qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 4/5] block: qemu-iotests - fix image cleanup


From: Jeff Cody
Subject: Re: [Qemu-devel] [PATCH v2 4/5] block: qemu-iotests - fix image cleanup when using spaced pathnames
Date: Thu, 10 Apr 2014 08:53:56 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Apr 10, 2014 at 03:53:57PM +0800, Fam Zheng wrote:
> On Wed, 04/09 22:41, 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 <address@hidden>
> > ---
> >  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 7f00883..195c564 100644
> > --- a/tests/qemu-iotests/common.rc
> > +++ b/tests/qemu-iotests/common.rc
> > @@ -178,10 +178,10 @@ _rm_test_img()
> >      local img=$1
> 
> Since we are quoting $img, should we quote $1 as well?
>

I believe not, because variable assignment won't undergo all the shell
expansions.  Notably, in variable assignment word splitting is not
performed on the parameter expansion on the argument immediately to the
right of the '='.  Quote removal, however, will still be performed.  So
img=$1 and img="$1" are identical once processed.

> 
> >      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
> > 
> > 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]