Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[oxlog] add sigpipe::reset #5357

Conversation

sunshowers
Copy link
Contributor

We have a number of CLI tools that panic when piped to things like head
instead of quietly exiting. There's a long history about this within the Rust
community (see rust-lang/rust#62569), but the long
and short of it is that SIGPIPE really should be set to its default handler
(SIG_DFL, terminate the process) for CLI tools.

Because oxlog doesn't make any network requests, reset the SIGPIPE handler to
SIG_DFL.

I looked at also potentially doing this for some of our other CLI tools that
wait on network services. This should be fine to do if and only if whenever we
send data over a socket, the MSG_NOSIGNAL flag is set. (This causes an
EPIPE error to be returned, but no SIGPIPE signal to be generated.)

Rust does set this flag here 1. However, as of Rust 1.77 this flag is not
set on illumos.
That's a bug and I'll fix it in Rust upstream.

Created using spr 1.3.6-beta.1
@sunshowers sunshowers closed this Mar 30, 2024
@sunshowers sunshowers deleted the sunshowers/spr/oxlog-add-sigpipereset branch March 30, 2024 02:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant