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
signature.asc
Description: OpenPGP digital signature