[libvirt] [PATCH 2/2] virt-aa-helper-test: avoid non-portable echo -n

Eric Blake eblake at redhat.com
Wed Apr 14 17:17:55 UTC 2010


On 04/14/2010 10:14 AM, Jim Meyering wrote:
> Eric Blake wrote:
>> * tests/virt-aa-helper-test (testme): Use printf instead.
>> ---
>>
>> -    echo -n "  $outstr: " >$output
>> -    echo -n " '$extra_args $args" >$output
>> +    printf "  $outstr: " >$output
>> +    printf " '$extra_args $args" >$output
> 
> These are fine if you know that the printf arguments
> never (and will never) contain the likes of "%" and "\".
> If you add a "%s" argument, then we don't even have to think about it:
> 
>        printf %s "  $outstr: " >$output
>        printf %s " '$extra_args $args" >$output

Okay, I modified 2/2 to use %s as you suggested, and pushed (I've
already ditched 1/2, as discussed elsewhere in the thread).

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 323 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100414/a8d5ab58/attachment-0001.sig>


More information about the libvir-list mailing list