coreutils
[Top][All Lists]
Advanced

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

Re: "tee -" treating "-" as stdout violating POSIX?


From: Bernhard Voelker
Subject: Re: "tee -" treating "-" as stdout violating POSIX?
Date: Thu, 19 Feb 2015 01:53:43 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

On 02/19/2015 01:34 AM, Eric Blake wrote:
> But I'm still 60:40 in favor of fixing it as
> a bug fix, for consistency with other POSIX implementations.

Furthermore, what would be the alternative?

It is clear now that GNU tee violates an explicitly mentioned
aspect in the POSIX specification ... without proper documenting
it.  To summarize, these are our options:
a) leave as is.
b) guard deviating behavior by POSIXLY_CORRECT.
c) revert the special-casing of "-" as meaning stdout.
d) improve documentation and state why GNU tee consciously
   violates an explicit POSIX rule.

a) is lame, b) was already considered suboptimal, and for d)
I don't see much other argument than "it's like it is - although
it's probably not useful".
Therefore, I'd personally also vote for c).

If there are some odd scripts out there relying on this,
then it might not be hard to fix, e.g. (for text files):

  - ... | tee - | ...
  + ... | sed p | ...
or
  - ... | tee out1 - out2 > out3
  + ... | tee out1 >(sed p > out3) > out2

Attached is a patch to talk about.

BTW: tee(1) seems to be the only coreutils utility which
accepts "-" as stdout, isn't it?

Have a nice day,
Berny

Attachment: 0001-tee-treat-operand-as-file-name-as-mandated-by-POSIX.patch
Description: Text Data


reply via email to

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