bug-coreutils
[Top][All Lists]
Advanced

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

bug#34488: Add sort --limit, or document workarounds for sort|head error


From: Assaf Gordon
Subject: bug#34488: Add sort --limit, or document workarounds for sort|head error messages
Date: Fri, 15 Feb 2019 14:40:07 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

Helo,

On 2019-02-15 8:20 a.m., Eric Blake wrote:
On 2/15/19 8:43 AM, 積丹尼 Dan Jacobson wrote:
sort: write failed: 'standard output': Broken pipe
sort: write error
[...]
Perhaps coreutils should teach 'env' a command-line option to forcefully
reset SIGPIPE back to default behavior [...]   If we
did that, then even if your sh is started with SIGPIPE ignored (so that
the shell itself can't restore default behavior), you could do this
theoretical invocation:

$ seq 9999 | env --default-signal PIPE sort -n | sed 5q | wc -l
5

That is a nice idea, I could've used it myself couple of times.

Attached a suggested patch.
If this seems like a good direction, I'll complete it with NEWS/docs/etc.

Usage is:
    env --default-signal=PIPE
    env -P     ##shortcut to reset SIGPIPE
    env --default-signal=PIPE,INT,FOO


This also works nicely with the recent 'env -S' option,
so a script like so can always start with default SIGPIPE handler:

    #!/usr/bin/env -S -P sh
    seq inf | head -n1



comments welcomed,
 - assaf

Attachment: 0001-env-new-option-D-default-signal-SIG-FIXME.patch
Description: Text Data


reply via email to

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