coreutils
[Top][All Lists]
Advanced

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

Re: true,false: --version,--help exit code


From: Pádraig Brady
Subject: Re: true,false: --version,--help exit code
Date: Tue, 03 Jun 2014 13:16:06 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

On 06/03/2014 01:12 PM, Eric Blake wrote:
> On 06/03/2014 05:28 AM, Bernhard Voelker wrote:
> 
>> yes, sure, but ... wait, a test was failing; the following
>> fixes it:
>>
>> diff --git a/gnulib b/gnulib
>> index a10acfb..2f40bc5 160000
>> --- a/gnulib
>> +++ b/gnulib
>> @@ -1 +1 @@
>> -Subproject commit a10acfb1d2118f9a180181d3fed5399dbbe1df3c
>> +Subproject commit 2f40bc523412742dac387b37d70b5a7f5d8363cc
>> diff --git a/tests/misc/help-version.sh b/tests/misc/help-version.sh
>> index 4bc02d8..50c05a2 100755
>> --- a/tests/misc/help-version.sh
>> +++ b/tests/misc/help-version.sh
>> @@ -92,6 +92,13 @@ for lang in C fr da; do
>>
>>      # Make sure they fail upon 'disk full' error.
>>      if test -w /dev/full && test -c /dev/full; then
>> +      # true succeeds with --help or --version even if write fails.
>> +      if test $i = true; then
>> +        env $i --help >/dev/full || fail=1
>> +        env $i --version >/dev/full || fail=1
>> +        continue
>> +      fi
>> +
> 
> Oh, good point.  Maybe it's better to consistently have --help/--version
> return status 0 (we successfully printed output) or 1 (we encountered
> write failure) regardless of the program being executed (which means
> true is doing it right, and 'false --version' is the odd man out,
> opposite to what the most recent patch proposal does).  I'd wait for
> Paul and/or Jim to weigh in on this, since they made the decisions
> behind the current unpatched behavior.

My slight preference is to change true to be consistent,
as then it's consistent on all implementations, not
just within coreutils. I.E. the following would now hold everywhere:

  true --help > /dev/full && echo always ok

Pádraig.



reply via email to

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