coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] tests: fix false failure due to xargs usage


From: Pádraig Brady
Subject: Re: [PATCH] tests: fix false failure due to xargs usage
Date: Tue, 10 Dec 2013 09:02:56 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

On 12/10/2013 12:54 AM, Eric Blake wrote:
> On 12/09/2013 12:18 PM, Pádraig Brady wrote:
>> On 12/09/2013 06:43 PM, Andreas Schwab wrote:
>>> Pádraig Brady <address@hidden> writes:
>>>
>>>> diff --git a/tests/readlink/multi.sh b/tests/readlink/multi.sh
>>>> index 3b91544..dc4ba87 100755
>>>> --- a/tests/readlink/multi.sh
>>>> +++ b/tests/readlink/multi.sh
>>>> @@ -40,7 +40,7 @@ compare exp out || fail=1
>>>>  # Note the edge case that the last xargs run may not have a delimiter
>>>>  rm out || framework_failure_
>>>>  printf '/1\0/1\0/1' > exp || framework_failure_
>>>> -printf '/1 /1 /1' | xargs -n2 readlink -n -m --zero >> out || fail=1
>>>> +printf '/1 /1 /1 ' | xargs -n2 readlink -n -m --zero >> out || fail=1
>>>
>>> Still wrong.
>>>
>>> <http://pubs.opengroup.org/onlinepubs/9699919799/utilities/xargs.html>:
>>>
>>>     The standard input shall be a text file.
>>
>> A "text file" doesn't have to have a new line AFAIK,
>> so the above should be fine.
> 
> A text file must either end in newline or be empty; your approach does
> neither.

This is beside the point for xargs as space is a delimiter, but POSIX says:

Text file = "A file that contains characters organized into zero or more 
lines..."

That suggests to me a newline is not required. If it is required I'd suggest
changing that description.

> Why not just:
> 
> readlink -n -m --zero /1 /1 >> out || fail=1
> readlink -n -m --zero /1 >> out || fail=1
> 
> and just avoid the printf and xargs altogether?

The point was to demonstrate an edge case possible with xargs,
so a comment would suffice I suppose.

thanks,
Pádraig.




reply via email to

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