Elliott Mitchell
2021-Jan-04 06:13 UTC
[Pkg-xen-devel] [PATCH 11/16] debian/xendomains.init: Pipe xen-init-list instead of tmp file
Shell syntax is has some funky behavior in some areas/ways. For these sections /usr/lib/xen-common/bin/xen-init-list should be piped to the loop, rather than creating a temporary file. This is also pure-Bourne shell syntax, rather than requiring Bash. Signed-off-by: Elliott Mitchell <ehem+debian at m5p.com> --- debian/xen-utils-common.xendomains.init | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/debian/xen-utils-common.xendomains.init b/debian/xen-utils-common.xendomains.init index e01d41beb6..3704fde27c 100644 --- a/debian/xen-utils-common.xendomains.init +++ b/debian/xen-utils-common.xendomains.init @@ -158,10 +158,10 @@ do_stop_migrate() { [ -n "$XENDOMAINS_MIGRATE" ] || return - while read id name rest; do + /usr/lib/xen-common/bin/xen-init-list | while read id name discard; do log_action_begin_msg "Migrating Xen domain $name ($id)" (timeout_coproc "$XENDOMAINS_STOP_MAXWAIT" xen migrate $id $XENDOMAINS_MIGRATE) - done < <(/usr/lib/xen-common/bin/xen-init-list) + done } do_stop_save() @@ -169,24 +169,24 @@ do_stop_save() [ -n "$XENDOMAINS_SAVE" ] || return [ -d "$XENDOMAINS_SAVE" ] || mkdir -m 0700 -p "$XENDOMAINS_SAVE" - while read id name rest; do + /usr/lib/xen-common/bin/xen-init-list | while read id name discard; do log_action_begin_msg "Saving Xen domain $name ($id)" (timeout_coproc "$XENDOMAINS_STOP_MAXWAIT" xen save $id $XENDOMAINS_SAVE/$name) - done < <(/usr/lib/xen-common/bin/xen-init-list) + done } do_stop_shutdown() { - while read id name rest; do + /usr/lib/xen-common/bin/xen-init-list | while read id name discard; do log_action_begin_msg "Shutting down Xen domain $name ($id)" xen shutdown $id 2>&1 1>/dev/null log_action_end_msg $? - done < <(/usr/lib/xen-common/bin/xen-init-list) - while read id name rest; do + done + /usr/lib/xen-common/bin/xen-init-list | while read id name discard; do log_action_begin_msg "Waiting for Xen domain $name ($id) to shut down" timeout_domain "$name" "$XENDOMAINS_STOP_MAXWAIT" log_action_end_msg $? - done < <(/usr/lib/xen-common/bin/xen-init-list) + done } do_stop() -- -- (\___(\___(\______ --=> 8-) EHM <=-- ______/)___/)___/) \BS ( | ehem+sigmsg at m5p.com PGP 87145445 | ) / \_CS\ | _____ -O #include <stddisclaimer.h> O- _____ | / _/ 8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445
Hans van Kranenburg
2021-Jan-15 20:45 UTC
[Pkg-xen-devel] [PATCH 11/16] debian/xendomains.init: Pipe xen-init-list instead of tmp file
Hi, On 12/9/20 11:39 PM, Elliott Mitchell wrote:> Shell syntax is has> some funky behavior in some areas/ways.Being more vague about the reason why this change is necessary is almost not possible. Sure, I agree that the new code is preferable, but if you make such a statement, then at least tell in which case what funky behavior in what specific way does something that will do a certain thing wrong, instead of letting all future readers wonder whatever you have seen happening that you didn't tell about.> For these > sections /usr/lib/xen-common/bin/xen-init-list should be piped to the > loop, rather than creating a temporary file. This is also pure-Bourne > shell syntax, rather than requiring Bash. > > Signed-off-by: Elliott Mitchell <ehem+debian at m5p.com> > --- > debian/xen-utils-common.xendomains.init | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/debian/xen-utils-common.xendomains.init b/debian/xen-utils-common.xendomains.init > index e01d41beb6..3704fde27c 100644 > --- a/debian/xen-utils-common.xendomains.init > +++ b/debian/xen-utils-common.xendomains.init > @@ -158,10 +158,10 @@ do_stop_migrate() > { > [ -n "$XENDOMAINS_MIGRATE" ] || return > > - while read id name rest; do > + /usr/lib/xen-common/bin/xen-init-list | while read id name discard; do > log_action_begin_msg "Migrating Xen domain $name ($id)" > (timeout_coproc "$XENDOMAINS_STOP_MAXWAIT" xen migrate $id $XENDOMAINS_MIGRATE) > - done < <(/usr/lib/xen-common/bin/xen-init-list) > + done > } > > do_stop_save() > @@ -169,24 +169,24 @@ do_stop_save() > [ -n "$XENDOMAINS_SAVE" ] || return > [ -d "$XENDOMAINS_SAVE" ] || mkdir -m 0700 -p "$XENDOMAINS_SAVE" > > - while read id name rest; do > + /usr/lib/xen-common/bin/xen-init-list | while read id name discard; do > log_action_begin_msg "Saving Xen domain $name ($id)" > (timeout_coproc "$XENDOMAINS_STOP_MAXWAIT" xen save $id $XENDOMAINS_SAVE/$name) > - done < <(/usr/lib/xen-common/bin/xen-init-list) > + done > } > > do_stop_shutdown() > { > - while read id name rest; do > + /usr/lib/xen-common/bin/xen-init-list | while read id name discard; do > log_action_begin_msg "Shutting down Xen domain $name ($id)" > xen shutdown $id 2>&1 1>/dev/null > log_action_end_msg $? > - done < <(/usr/lib/xen-common/bin/xen-init-list) > - while read id name rest; do > + done > + /usr/lib/xen-common/bin/xen-init-list | while read id name discard; do > log_action_begin_msg "Waiting for Xen domain $name ($id) to shut down" > timeout_domain "$name" "$XENDOMAINS_STOP_MAXWAIT" > log_action_end_msg $? > - done < <(/usr/lib/xen-common/bin/xen-init-list) > + done > } > > do_stop() >