bug-coreutils
[Top][All Lists]
Advanced

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

bug#9089: pipe failure with cat and head of coreutils 6.12


From: Paul Eggert
Subject: bug#9089: pipe failure with cat and head of coreutils 6.12
Date: Sat, 19 Jan 2019 10:38:54 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1

Assaf Gordon wrote:
If the issue of cat(1) supporting socketpair/ECONNRESET instead of
pipes/EPIPE is still relevant, we can re-open the bug.

'cat' treats EPIPE on pipes the same way it treats ECONNRESET on socket pairs:

$ (trap '' PIPE; cat /usr/bin/emacs) | :
cat: write error: Broken pipe

The difference in observed behavior occurs only because most scripts (rightly) don't ignore SIGPIPE. If we change 'cat' to ignore ECONNRESET, for consistency we should also change it to ignore EPIPE.

The POSIX spec[1] allows 'write' to send a SIGPIPE and set errno to EPIPE for sockets that are no longer connected. I wonder why the Linux kernel doesn't do that? It would seem to be more consistent and useful.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html





reply via email to

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