coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

lib.rs: restore default SIGPIPE signal handler

Open Ecordonnier opened this issue 2 weeks ago • 8 comments

Rust's start-up code sets the SIGPIPE signal handler to ignored. However the vast majority of the utilities should use the default signal handler for SIGPIPE rather than ignore SIGPIPE. (in reality those utilities should inherit the signal handler from their parent process, but this is not possible with current rust start-up code).

Instead of restoring the default signaler handler in individual utilities, do it in lib.rs and add some logic in the utilities which can't use the default SIGPIPE signal handler (cat, env, seq, split, tail, tee, tr, tty).

Ecordonnier avatar Dec 09 '25 22:12 Ecordonnier

GNU testsuite comparison:

GNU test failed: tests/sort/sort-compress-proc. tests/sort/sort-compress-proc is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)

github-actions[bot] avatar Dec 09 '25 23:12 github-actions[bot]

GNU testsuite comparison:

GNU test failed: tests/sort/sort-compress-proc. tests/sort/sort-compress-proc is passing on 'main'. Maybe you have to rebase?

github-actions[bot] avatar Dec 10 '25 10:12 github-actions[bot]

GNU testsuite comparison:

GNU test failed: tests/sort/sort-compress-proc. tests/sort/sort-compress-proc is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

github-actions[bot] avatar Dec 10 '25 12:12 github-actions[bot]

GNU testsuite comparison:

GNU test failed: tests/sort/sort-compress-proc. tests/sort/sort-compress-proc is passing on 'main'. Maybe you have to rebase?
Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)

github-actions[bot] avatar Dec 10 '25 13:12 github-actions[bot]

There's a PR here that does some advanced stuff to get both Default SIGPIPE and SIGPIPE ignored to match GNU behavior but it does it in a totally different way.

ChrisDryden avatar Dec 11 '25 03:12 ChrisDryden

@ChrisDryden are you talking about my PR #9620 or about some other PR? Did you really mean "both default SIGPIPE and SIGPIPE"? I don't understand what that means. Do you mean "both default signal SIGPIPE handler and custom SIGPIPE handler"?

Ecordonnier avatar Dec 11 '25 10:12 Ecordonnier

Whoops meant to add the link to this pr with that comment https://github.com/uutils/coreutils/pull/9184

I don't think this implementation covers: Default SIGPIPE and SIGPIPE ignored

ChrisDryden avatar Dec 11 '25 10:12 ChrisDryden

Whoops meant to add the link to this pr with that comment #9184

I don't think this implementation covers: Default SIGPIPE and SIGPIPE ignored

Thanks for the link. This is very interesting. I hope it can work that way.

Ecordonnier avatar Dec 11 '25 12:12 Ecordonnier