GNU bug report logs - #34488
Add sort --limit, or document workarounds for sort|head error messages

Previous Next

Package: coreutils;

Reported by: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>

Date: Fri, 15 Feb 2019 14:53:01 UTC

Severity: normal

Tags: fixed

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #20 received at 34488 <at> debbugs.gnu.org (full text, mbox):

From: Assaf Gordon <assafgordon <at> gmail.com>
To: Eric Blake <eblake <at> redhat.com>, 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>, 34488 <at> debbugs.gnu.org
Subject: Re: bug#34488: Add sort --limit, or document workarounds for
 sort|head error messages
Date: Fri, 15 Feb 2019 14:40:07 -0700
[Message part 1 (text/plain, inline)]
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

[0001-env-new-option-D-default-signal-SIG-FIXME.patch (text/x-patch, attachment)]

This bug report was last modified 6 years and 51 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.