qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] qemu-iotests: Fix _filter_qemu


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] qemu-iotests: Fix _filter_qemu
Date: Tue, 16 Apr 2013 08:08:19 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130402 Thunderbird/17.0.5

On 04/16/2013 07:16 AM, Stefan Hajnoczi wrote:
>>> +    sed -e "s#^$(basename $QEMU_PROG):#QEMU_PROG:#g"
>>
>> Why spawn a basename process, when you can use shell to do the same?

> The problem with the POSIX shell string replacement is that the syntax
> is horrible.  I can never remember what ${%}, ${%%}, ${#} and
> %{##} do.  $(basename $QEMU_PROG) is clear (although it doesn't handle
> spaces in the filename!).

As written, it also doesn't handle a leading '-' in the name.  To be
robust, it should be $(basename -- "$QEMU_PROG") - and even then, it
still fails if $QEMU_PROG has a trailing newline (but no one is that
perverse in how they name their program, right?).  The shell variant
never goofs on any of those corner cases.  But I can totally understand
your aversion to line noise, and as I'm doubtful that anyone will run
the testsuite while trying to stress extreme corner-case $QEMU_PROG
naming conventions, I can certainly live with keeping $(basename
$QEMU_PROG) form for legibility.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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