-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix: reset $CARGO if the running program is real cargo[.exe]
#15208
Conversation
I'll fix the errors shortly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch!
Please allow me time to test against the dynamic linker use case.
cargo[.exe]
9c65e60
to
2c7e098
Compare
Just because I am curious, is the reason for the recent CI failures known? |
They were fixed in #15211
|
Oh, interesting! Thank you for explaining! |
0a8a248
to
0ce3f9e
Compare
Overwrite `$CARGO` when the current exe is detected to be a cargo binary. See: rust-lang#15099 (comment)
If I'm interpreting the results right, path normalization is applied to stderr but not stdout?
Anyway, the PR should be ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did manual tests for ld wrapper from what Joo's has described in #10113. This seems working!
One thing I am not sure is this characteristic:
- We don't fix this issue for when users have an alternative name for the Cargo binary (or on some platforms, an alternative symlink name)
Should we document our heuristic rule in the CARGO env doc? I feel like it might be excessive and don't want to wait for a perfect doc to merge this fix.
@@ -391,10 +391,13 @@ fn cargo_subcommand_env() { | |||
.canonicalize() | |||
.unwrap(); | |||
let envtest_bin = envtest_bin.to_str().unwrap(); | |||
// Previously, `$CARGO` would be left at `envtest_bin`. However, with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seeing this test change and I wonder if using $CARGO
as a Cargo wrapper is a supported use case, and we don't want to reset it.
Maybe we can detect iff the current $CARGO
is cargo[.exe]
and then we reset?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @epage as you proposed the current solution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no problem with implementing this if @epage agrees.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CARGO
was originally not intended for purposes of being a wrapper. That people could do it was a byproduct of the implementation that was done but it wasn't intentional. I wouldn't worry too much about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is fair. Thanks Ed.
I would just point out that the current description of each variable is light on details: https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-crates I think there some benefit to this, as it makes the list easy to scan. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working with us for this fix!
Overwrite
$CARGO
when the current exe is detected to be a cargo binary.From #15099 (comment):
r? @epage