-
Notifications
You must be signed in to change notification settings - Fork 42
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
unix: Check that file descriptors obtained from --jobserver-auth=R,W
actually refer to a pipe
#27
Comments
Currently there's a check that the fd is at leaset least a valid file descriptor, and adding another check there that it's a pipe makes sense to me! |
Sigh, the |
I'm totally OK with reverting that change, as I have found that a socket wouldn't be any useful for jobservers. It does make me wonder that make has the same checking logic but doesn't get affected. Not sure what's going on, but maybe submake gets some special treatment? |
@ishitatsuyuki |
Ok, I think it's better to be consistent with However, what needs to be done is a better diagnostic in the erroneous cases.
To do this the |
cargo
andrustc
(and other tools usingjobserver
) will fail with a "failed to acquire jobserver token: early EOF on jobserver pipe" error in the next scenario reported in rust-lang/rust#46981 (comment) as ICE inrustc
:make
executes a subprocess (e.g. shell) with the jobserver pipe closed (marked withFD_CLOEXEC
), but theMAKEFLAGS
env var will still contain--jobserver-auth=3,4
(or some other pair of integers) in the subprocess.This is where
make
is wrong, if it closes the descriptors for a subprocess, then it should probably clean upMAKEFLAGS
for it as well, but it doesn't, so we have to live withmake
possibly providing garbage descriptors.3
and4
are taken again now, but refer to entirely unrelated files.cargo
, which sees that3
and4
are open, concludes that they refer to a jobserver, and fails when trying to read from them.jobserver
could be more resilient in the face of garbage descriptors if it checked not only that the descriptors are valid, but also that they actually refer to a pipe rather than random unrelated files.The text was updated successfully, but these errors were encountered: