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 12:13:36 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

On 02/17/2015 11:52 AM, Pádraig Brady wrote:
On 17/02/15 10:42, Bernhard Voelker wrote:
On 02/17/2015 11:27 AM, Pádraig Brady wrote:
The following patch wrt --write-error, tests the continue
with working outputs functionality.  Though that's with pipes
and only with the new option.  I've amended the test in this patch
to check continuation with standard files and no options, like:

Thanks. I didn't have a look at the other patch yet.

+  # Ensure we continue with outputs that are OK
+  seq 10000 > multi_read || framework_failure_
+
+  returns_ 1 tee /dev/full 2>err >multi_write <multi_read || fail=1
+  cmp multi_read multi_write || fail=1

Specifying 2 or more output files for tee(1) is probably such an
unusual case - yet mandated by POSIX - that it's likely that we forget
this when making changes in future.
Therefore, I recommend adding this to the test case:

+  returns_ 1 tee out1 /dev/full out2 2>err >multi_write <multi_read || fail=1
+  cmp multi_read out1 || fail=1
+  cmp multi_read out2 || fail=1
+  cmp multi_read multi_write || fail=1

WDYT?

I can't see how the implementation would vary when going from 2 to 3 outputs,
hence the above is probably overkill.

It is going from 1 output file (plus the implicit stdout) to more output
files ... where all but the failing output file (and the implicit stdout)
should have the same content.  The simpler test doesn't check this.

That is exactly the point in the POSIX spec: writing to all other output
files should continue.  Therefore, I think we should check this.

Have a nice day,
Berny



reply via email to

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