-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Apply modulo 256 to BSD WEXITSTATUS #4213
base: main
Are you sure you want to change the base?
Conversation
wait(2p)[^1] says > WEXITSTATUS(status) > If WIFEXITED(status) is true, evaluates to the low-order 8 bits > of the argument passed to _exit(2) or exit(3) by the child. meaning WEXITSTATUS(status) is an 8-bit value. We accidentally return too many bits. For example WEXITSTATUS(-1) returns -1 instead of 255. Fix it, matching the C library and our other WEXITSTATUS implementations. [^1] https://manpage.me/index.cgi?apropos=0&q=wait&sektion=2&manpath=FreeBSD+12-CURRENT+and+Ports&arch=default&format=html Originally reported at fish-shell/fish-shell#10919
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @tgross35 (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
The libc crate has a bug on BSD where WEXITSTATUS is not an 8-bit value, causing assertion failures. Any libc higher than our 0.2.155 would increase our MSRV, see libc commit 5ddbdc29f (Bump MSRV to 1.71, 2024-01-07), so we want to woraround this anyway. It's probably not worth using a patched version of libc since it's just one line. While at it, tighten some types I guess. Upstream fix: rust-lang/libc#4213 Closes #10919
The libc crate has a bug on BSD where WEXITSTATUS is not an 8-bit value, causing assertion failures. Any libc higher than our 0.2.155 would increase our MSRV, see libc commit 5ddbdc29f (Bump MSRV to 1.71, 2024-01-07), so we want to woraround this anyway. It's probably not worth using a patched version of libc since it's just one line. While at it, tighten some types I guess. Upstream fix: rust-lang/libc#4213 Closes #10919 Cherry-picked from c1b4605
The libc crate has a bug on BSD where WEXITSTATUS is not an 8-bit value, causing assertion failures. Any libc higher than our 0.2.155 would increase our MSRV, see libc commit 5ddbdc29f (Bump MSRV to 1.71, 2024-01-07), so we want to woraround this anyway. It's probably not worth using a patched version of libc since it's just one line. While at it, tighten some types I guess. Upstream fix: rust-lang/libc#4213 Closes fish-shell#10919
wait(2p)1 says
meaning WEXITSTATUS(status) is an 8-bit value. We accidentally return
too many bits. For example WEXITSTATUS(-1) returns -1 instead of 255.
Fix it, matching the C library and our other WEXITSTATUS implementations.
Originally reported at fish-shell/fish-shell#10919
Footnotes
https://manpage.me/index.cgi?apropos=0&q=wait&sektion=2&manpath=FreeBSD+12-CURRENT+and+Ports&arch=default&format=html ↩