coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH 1/2] tee: exit early if no more writable outputs


From: Bernhard Voelker
Subject: Re: [PATCH 1/2] tee: exit early if no more writable outputs
Date: Tue, 17 Feb 2015 09:26:45 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

On 02/17/2015 08:36 AM, Bernhard Voelker wrote:
> On 02/17/2015 03:44 AM, Pádraig Brady wrote:
>> +  yes | returns_ 1 timeout 10 tee /dev/full 2>err >/dev/full || fail=1
> 
> This test case combines 2 test cases, i.e., when writing to the output
> file *and* to stdout is returning an error:
> 
>   $ yes |  timeout 10 src/tee /dev/full > /dev/full ; echo $?
>   src/tee: standard output: No space left on device
>   src/tee: /dev/full: No space left on device
>   1
> 
> But if run separately, then we run into timeouts again:
> 
>   $ yes |  timeout 10 src/tee /dev/null > /dev/full; echo $?
>   src/tee: standard output: No space left on device
>   124
> 
>   $ yes |  timeout 10 src/tee /dev/full > /dev/null; echo $?
>   src/tee: /dev/full: No space left on device
>   124
> 
> Isn't exiting early in both cases what you wanted to achieve?

Oho, read this [0]:

  CONSEQUENCES OF ERRORS

  If a write to any successfully opened file operand fails, writes
  to other successfully opened file operands and standard output
  shall continue, but the exit status shall be non-zero. [...]

Therefore your patch is right; only the test case doesn't cover the
case where tee has to continue if any of the output files or stdout
can still be written.

[0]
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/tee.html

Have a nice day,
Berny



reply via email to

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