-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Prevent accidentally splitting file paths with spaces in RUSTFLAGS #10232
Conversation
r? @Eh2406 (rust-highfive has picked a reviewer for you, use r? to override) |
There are a few caveats:
In the worst case, the function does nothing, but in the usual case it merges broken paths in RUSTFLAGS like:
to:
I just wanted this in to get Xargo working on my machine without having to go through the hassle of creating a new user account without spaces. |
Thanks for the PR, but dealing with shell quoting and things like that is something that we specifically try to avoid in Cargo since shell quoting is system-specific and shell-specific. Are you able to set flags in |
Thanks for the PR! Unfortunately, I don't think this is a direction we would like to go with interpreting something like RUSTFLAGS. It introduces an ad-hoc quoting mechanism that can cause subtle issues with escaping, shell interpretation, and the like. There are several stable and unstable alternatives, and I was wondering if you would be willing to try them out and see if they are suitable for your use case? Some alternatives are:
|
Well the real issue is that none of these workarounds work with Xargo, which is what I'm trying to achieve in the first place: Running
I can't apply the workarounds, because xargo doesn't respect the input arguments and always runs
fails because This is a well known issue, but the xargo team doesn't want to fix it because "it has to be fixed in cargo", now the cargo team is telling me "noo, this has to be fixed in xargo or in external tools". So whos responsibility is it? Also, I'd have to edit the
xargo ALWAYS exports RUSTFLAGS manually, I cannot unset it via any other method. I suspect, the problem is here: let rustflags = cargo::rustflags(config.as_ref(), cmode.triple())?;
sysroot::update(
&cmode,
&home,
&root,
&rustflags,
&meta,
&src,
&sysroot,
verbose,
args.message_format(),
cargo_mode,
)?; @ehuss I'm not sure what "vulnerabilities" you mean, it's at most a call to @alexcrichton "shell quoting is system-specific and shell-specific" - Okay, but this is not about shell quoting, it's about spaces. At the point that the RUSTFLAGS are read, the shell / env should have already parsed the strings correctly. The shell already gives you the correct argument as a . But then cargo is doing a |
If the problem is xargo setting |
Ok I'm going to go ahead and close this because I don't think we want to merge this. If |
Yeah I am going to try changing it so that setting the RUSTFLAGS is done over |
FWIW, |
I filed #10555 to improve the documentation. |
Closes #6139