Warn on invalid jobserver file descriptors#16843
Merged
weihanglo merged 2 commits intorust-lang:masterfrom Apr 7, 2026
Merged
Conversation
weihanglo
reviewed
Apr 6, 2026
Member
There was a problem hiding this comment.
On Windows jobserver crate uses named semaphore so the error message is a bit different:
[99](https://github.com/rust-lang/cargo/actions/runs/24051846505/job/70149149235?pr=16843#step:15:5100)
---- expected: tests\testsuite\jobserver.rs:424:27
++++ actual: stderr
Warning: [0m - [WARNING] failed to connect to jobserver from environment variable `MAKEFLAGS="--jobserver-auth=200001,200002"`: cannot open file descriptor 200001 from the jobserver environment variable value: [..]
1 + [WARNING] failed to connect to jobserver from environment variable `MAKEFLAGS="--jobserver-auth=200001,200002"`: cannot open path or name 200001,200002 from the jobserver environment variable value: [NOT_FOUND]
2 2 | [COMPILING] foo v0.0.1 ([ROOT]/foo)
3 3 | [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
weihanglo
approved these changes
Apr 6, 2026
rust-bors bot
pushed a commit
to rust-lang/rust
that referenced
this pull request
Apr 8, 2026
Cargo submodule update 11 commits in a357df4c26fc14514e66aae2a269456b5545c7db..101549dddbd2b08e806f50154e3aa4cb3374cc21 2026-04-03 16:47:15 +0000 to 2026-04-08 12:51:20 +0000 - Never include use extra-filename in build scripts (rust-lang/cargo#16855) - fix(toml): Force script edition warnings on quiet (rust-lang/cargo#16848) - GitHub fast path uses `http_async` (rust-lang/cargo#16847) - feat(manifest): allow git dependency alongside alternate registry (rust-lang/cargo#16810) - fix(auth): add auth scheme hint to token rejected error for alt registries (rust-lang/cargo#16794) - Warn on invalid jobserver file descriptors (rust-lang/cargo#16843) - docs(unstable): List the minimum required MSRV for 'public' field (rust-lang/cargo#16841) - feat(lints): Emit unused_dependencies lint (rust-lang/cargo#16600) - fix(tree): clarify error message when `-i` is used without a package name (rust-lang/cargo#16818) - fix: Typo in target.<cfg>.linker (rust-lang/cargo#16839) - Send Content-Type header with cargo publish requests (rust-lang/cargo#16832) r? ghost
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR try to resolve?
Cargo will currently load a jobserver from file descriptors if
MAKEFLAGS,MFLAGS,RUST_MAKEFLAGSenvironment variables contain--jobserver-auth=N,N.The jobserver crate provides a method to attempt to validate whether these descriptors are actually pipes, which cargo was not using. This change enables the validation, and emits a warning if the file descriptors appear to be incorrect.
This helps avoid hard-to-debug problems where cargo interprets FDs as jobserver FDs, when they are actually not. This can occur when a process in between
makeandcargoforwards the environment variables, but not the FDs.How to test and review this PR?
This change is based on what rustc does.
First commit shows issue,
Second commit contains fix with warning showing.
r? @weihanglo