[PATCH] libvirt-guests: avoid globbing when splitting $URIS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* tools/libvirt-guests.init.sh (start, stop, gueststatus): Avoid
shell globbing, since valid URIs can contain '?'.
---

> Meanwhile, we already know that a valid URI does not contain whitespace
> (a valid URI can represent whitespace via encoding, where needed), so
> it's already acceptable to use IFS splitting on $URIS to break it into
> individual URIs, it's just that we need to suppress globbing in the
> process.  'set -f' can be used for this, if needed.

Does this patch look sane?  If you like it, then I will push your
patch and mine at the same time.

 tools/libvirt-guests.init.sh |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/tools/libvirt-guests.init.sh b/tools/libvirt-guests.init.sh
index 0b64cf6..f247e5e 100644
--- a/tools/libvirt-guests.init.sh
+++ b/tools/libvirt-guests.init.sh
@@ -143,12 +143,15 @@ start() {

     while read uri list; do
         configured=false
+        set -f
         for confuri in $URIS; do
+            set +f
             if [ "x$confuri" = "x$uri" ]; then
                 configured=true
                 break
             fi
         done
+        set +f
         if ! "$configured"; then
             eval_gettext "Ignoring guests on \$uri URI"; echo
             continue
@@ -241,7 +244,9 @@ stop() {
     fi

     : >"$LISTFILE"
+    set -f
     for uri in $URIS; do
+        set +f
         eval_gettext "Running guests on \$uri URI: "

         if [ "x$uri" = xdefault ] && [ ! -x "$libvirtd" ]; then
@@ -265,6 +270,7 @@ stop() {
             fi
         fi
     done
+    set +f

     while read uri list; do
         if "$suspending"; then
@@ -286,10 +292,13 @@ stop() {
 }

 gueststatus() {
+    set -f
     for uri in $URIS; do
+        set +f
         echo "* $uri URI:"
         retval run_virsh "$uri" list || echo
     done
+    set +f
 }

 # rh_status
-- 
1.7.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]