diff mbox

[3/4] block: qemu-iotests - fix image cleanup when using spaced pathnames

Message ID 048598424eaf37233be9b0b091fd9ea0d41fa285.1395105370.git.jcody@redhat.com
State New
Headers show

Commit Message

Jeff Cody March 18, 2014, 1:24 a.m. UTC
The _rm_test_img() function in common.rc did not quote the image
file, which left droppings in the scratch directory (and performed
a potentially unsafe rm -f).

This adds the necessary quotes.

Signed-off-by: Jeff Cody <jcody@redhat.com>
---
 tests/qemu-iotests/common.rc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Benoît Canet March 19, 2014, 1:46 p.m. UTC | #1
The Monday 17 Mar 2014 à 21:24:39 (-0400), Jeff Cody wrote :
> The _rm_test_img() function in common.rc did not quote the image
> file, which left droppings in the scratch directory (and performed
> a potentially unsafe rm -f).
> 
> This adds the necessary quotes.
> 
> Signed-off-by: Jeff Cody <jcody@redhat.com>
> ---
>  tests/qemu-iotests/common.rc | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
> index 881079b..6b13a45 100644
> --- a/tests/qemu-iotests/common.rc
> +++ b/tests/qemu-iotests/common.rc
> @@ -178,10 +178,10 @@ _rm_test_img()
>      local img=$1
>      if [ "$IMGFMT" = "vmdk" ]; then
>          # Remove all the extents for vmdk
> -        $QEMU_IMG info $img 2>/dev/null | grep 'filename:' | cut -f 2 -d: \
> +        "$QEMU_IMG" info "$img" 2>/dev/null | grep 'filename:' | cut -f 2 -d: \
>              | xargs -I {} rm -f "{}"
>      fi
> -    rm -f $img
> +    rm -f "$img"
>  }
>  
>  _cleanup_test_img()
> -- 
> 1.8.3.1
> 
> 
Reviewed-by: Benoit Canet <benoit@irqsave.net>
diff mbox

Patch

diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index 881079b..6b13a45 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -178,10 +178,10 @@  _rm_test_img()
     local img=$1
     if [ "$IMGFMT" = "vmdk" ]; then
         # Remove all the extents for vmdk
-        $QEMU_IMG info $img 2>/dev/null | grep 'filename:' | cut -f 2 -d: \
+        "$QEMU_IMG" info "$img" 2>/dev/null | grep 'filename:' | cut -f 2 -d: \
             | xargs -I {} rm -f "{}"
     fi
-    rm -f $img
+    rm -f "$img"
 }
 
 _cleanup_test_img()