-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Cargo build ICE when run with closed STDIN #60447
Comments
triage: P-medium due to niche nature of bug. Leaving nominated to try to increase its visibility in short term in case T-compiler members want to attack it. |
discussed briefly at T-compiler meeting. un-nominating. |
I inadvertently ran into this bug today when trying to do |
I am unable to reproduce this anymore
and WSL:
|
The problem is still present for me on macOS even on nightly:
|
I wonder if this is related to #57728? By the way, for that reason, don't run Rust things with |
Reopen standard file descriptors when they are missing on Unix The syscalls returning a new file descriptors generally return lowest-numbered file descriptor not currently opened, without any exceptions for those corresponding to stdin, sdout, or stderr. Previously when any of standard file descriptors has been closed before starting the application, operations on std::io::{stderr,stdin,stdout} were likely to either succeed while being performed on unrelated file descriptor, or fail with EBADF which is silently ignored. Avoid the issue by using /dev/null as a replacement when the standard file descriptors are missing. The implementation is based on the one found in musl. It was selected among a few others on the basis of the lowest overhead in the case when all descriptors are already present (measured on GNU/Linux). Closes rust-lang#57728. Closes rust-lang#46981. Closes rust-lang#60447. Benefits: * Makes applications robust in the absence of standard file descriptors. * Upholds IntoRawFd / FromRawFd safety contract (which was broken previously). Drawbacks: * Additional syscall during startup. * The standard descriptors might have been closed intentionally. * Requires /dev/null. Alternatives: * Check if stdin, stdout, stderr are opened and provide no-op substitutes in std::io::{stdin,stdout,stderr} without reopening them directly. * Leave the status quo, expect robust applications to reopen them manually.
How to reproduce
Actual Result
Actual Result with full backtrace
rustc --version --verbose
Expected result
Additional details
Please note that the issue will go away once you succeed in building the project (probably thanks due to some compiler caching, sorry, not sure here).
A
touch
is enough to get the error back :)Thank you.
The text was updated successfully, but these errors were encountered: