On 02/17/2015 04:14 PM, 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'm not sure who would be relying on it, so I'm okay with treating it as
a bug fix to get into line with the POSIX wording.  Another option would
be to keep the existing behavior by default, and comply with POSIX if
POSIXLY_CORRECT is set in the environment, but I don't like using the
POSIXLY_CORRECT escape hatch without good reason.  I'm doubtful that the
POSIX folks would relax wording to allow coreutils' behavior; after all,
the possibility of interleaving duplicated output makes it less likely
to be useful, and therefore not worth standardizing.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to