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: Pádraig Brady
Subject: Re: "tee -" treating "-" as stdout violating POSIX?
Date: Tue, 17 Feb 2015 23:53:47 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

On 17/02/15 23:14, Bernhard Voelker wrote:
> "tee -" duplicates stdin to stdout (maybe in interleaved order)
> since v5.2.1-1247-g8dafbe5; this behavior is documented as such.
> 
> But POSIX explicitly mandates different behavior:
> 
>   http://pubs.opengroup.org/onlinepubs/9699919799/utilities/tee.html
> 
>   If a file operand is '-', it shall refer to a file named -;
>   implementations shall not treat it as meaning standard output.
> 
> I assume it's too late to revert the behavior to adhere to POSIX
> rules as it may break existing use cases.
> Shall we either document that the GNU tee implementation violates
> POSIX, or should we go for a change to POSIX to allow this (or is
> there already such a discussion)?

I noticed that but didn't really want to start a discussion about it :)

The conformance issue was introduced with:
  http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commit;h=v5.2.1-1244-g4eafd1b
  http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commit;h=v5.2.1-1247-g8dafbe5

The reason I inferred from documentation is that the change was made for 
consistency,
but the point was also made that it wasn't that useful.
Are there any use cases for interleaved multiplied data?
One can always refer to a '-' file like ./- anyway,
so having '-' referring to stdout doesn't reduce functionality in any way.

I suppose we could change the behavior depending on $POSIXLY_CORRECT,
which is done in the attached.  I'd be 60:40 _against_ applying it.

cheers,
Pádraig.

Attachment: tee-posix-dash.patch
Description: Text Data


reply via email to

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