On 04/14/2010 05:28 AM, Jim Meyering wrote:
echo -e is not portable.
This is the sole remaining use in all of libvirt.
ACK.
How'd you find it? I know we've talked about adding a maint.mk check to
help automate some of this (was it over on the bug-grep list?), but I
still haven't thought of a good regexp that doesn't suffer from too many
false positives (in particular, distinguishing between \ as arguments to
echo vs. \ as line continuation can be hard) while still catching the
worst offenders. Right now, about the best regex I can think of is:
'echo .?[$-]'
which will filter out:
echo -n oops
echo -e oops
echo "$oops"
where the first two are blatantly wrong, and the third might be a false
positive if you can audit $oops for safety. It would also have a FP on:
echo a-b
although that is less likely, and it totally misses echo 'a\\b', but you
can only do so much.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org