-
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
rustbuild --verbose
switch is missing env var info
#38686
Comments
(I suspect the naive fix for this, to print key="value" each time |
Yeah I've often wondered if we should update the |
Dupe of #38221 |
This is a simple way to workaround the debugging issues caused by the rustc wrapper used in the bootstrap process. Namely, it uses some obscure environment variables and you can’t just copy the failed command and run it in the shell or debugger to examine the failure more closely. With `--on-fail` its possible to run an arbitrary command within exactly the same environment under which rustc failed. Theres’s multiple ways to use this new flag: $ python x.py build --stage=1 --on-fail=env would print a list of environment variables and the failed command, so a few copy-pastes and you now can run the same rust in your shell outside the bootstrap system. $ python x.py build --stage=1 --on-fail=bash Is a more useful variation of the command above in that it launches a whole shell with environment already in place! All that’s left to do is copy-paste the command just above the shell prompt! Fixes rust-lang#38686 Fixes rust-lang#38221
…chton [rustbuild] add a way to run command after failure This is a simple way to workaround the debugging issues caused by the rustc wrapper used in the bootstrap process. Namely, it uses some obscure environment variables and you can’t just copy the failed command and run it in the shell or debugger to examine the failure more closely. With `--on-fail` its possible to run an arbitrary command within exactly the same environment under which rustc failed. Theres’s multiple ways to use this new flag: $ python x.py build --stage=1 --on-fail=env would print a list of environment variables and the failed command, so a few copy-pastes and you now can run the same rust in your shell outside the bootstrap system. $ python x.py build --stage=1 --on-fail=bash Is a more useful variation of the command above in that it launches a whole shell with environment already in place! All that’s left to do is copy-paste the command just above the shell prompt! Fixes rust-lang#38686 Fixes rust-lang#38221
…chton [rustbuild] add a way to run command after failure This is a simple way to workaround the debugging issues caused by the rustc wrapper used in the bootstrap process. Namely, it uses some obscure environment variables and you can’t just copy the failed command and run it in the shell or debugger to examine the failure more closely. With `--on-fail` its possible to run an arbitrary command within exactly the same environment under which rustc failed. Theres’s multiple ways to use this new flag: $ python x.py build --stage=1 --on-fail=env would print a list of environment variables and the failed command, so a few copy-pastes and you now can run the same rust in your shell outside the bootstrap system. $ python x.py build --stage=1 --on-fail=bash Is a more useful variation of the command above in that it launches a whole shell with environment already in place! All that’s left to do is copy-paste the command just above the shell prompt! Fixes rust-lang#38686 Fixes rust-lang#38221
…chton [rustbuild] add a way to run command after failure This is a simple way to workaround the debugging issues caused by the rustc wrapper used in the bootstrap process. Namely, it uses some obscure environment variables and you can't just copy the failed command and run it in the shell or debugger to examine the failure more closely. With `--on-fail` its possible to run an arbitrary command within exactly the same environment under which rustc failed. Theres's multiple ways to use this new flag: $ python x.py build --stage=1 --on-fail=env would print a list of environment variables and the failed command, so a few copy-pastes and you now can run the same rust in your shell outside the bootstrap system. $ python x.py build --stage=1 --on-fail=bash Is a more useful variation of the command above in that it launches a whole shell with environment already in place! All that's left to do is copy-paste the command just above the shell prompt! Fixes rust-lang#38686 Fixes rust-lang#38221
…chton [rustbuild] add a way to run command after failure This is a simple way to workaround the debugging issues caused by the rustc wrapper used in the bootstrap process. Namely, it uses some obscure environment variables and you can't just copy the failed command and run it in the shell or debugger to examine the failure more closely. With `--on-fail` its possible to run an arbitrary command within exactly the same environment under which rustc failed. Theres's multiple ways to use this new flag: $ python x.py build --stage=1 --on-fail=env would print a list of environment variables and the failed command, so a few copy-pastes and you now can run the same rust in your shell outside the bootstrap system. $ python x.py build --stage=1 --on-fail=bash Is a more useful variation of the command above in that it launches a whole shell with environment already in place! All that's left to do is copy-paste the command just above the shell prompt! Fixes rust-lang#38686 Fixes rust-lang#38221
…chton [rustbuild] add a way to run command after failure This is a simple way to workaround the debugging issues caused by the rustc wrapper used in the bootstrap process. Namely, it uses some obscure environment variables and you can't just copy the failed command and run it in the shell or debugger to examine the failure more closely. With `--on-fail` its possible to run an arbitrary command within exactly the same environment under which rustc failed. Theres's multiple ways to use this new flag: $ python x.py build --stage=1 --on-fail=env would print a list of environment variables and the failed command, so a few copy-pastes and you now can run the same rust in your shell outside the bootstrap system. $ python x.py build --stage=1 --on-fail=bash Is a more useful variation of the command above in that it launches a whole shell with environment already in place! All that's left to do is copy-paste the command just above the shell prompt! Fixes rust-lang#38686 Fixes rust-lang#38221
I might claim that #39888 did not fix this in full generality. Yes, the particular case where I filed this bug was one where the However, today I wanted to extract the |
Here's a simple diff that solves my problem completely, and I suspect is sufficiently low impact (since I think it would only affect people using diff --git HEAD:/src/bootstrap/bin/rustc.rs INDEX:/src/bootstrap/bin/rustc.rs
index 37336a56d7..182fc0862c 100644
--- HEAD:/src/bootstrap/bin/rustc.rs
+++ INDEX:/src/bootstrap/bin/rustc.rs
@@ -279,6 +279,10 @@ fn main() {
}
if verbose > 1 {
+ for (i, (k, v)) in env::vars().enumerate() {
+ eprintln!("rustc env[{}]: {} = {}", i, k, v);
+ }
+ eprintln!("rustc directory: {}", env::current_dir().unwrap().display());
eprintln!("rustc command: {:?}", cmd);
} |
I would be happy to review (and likely accept) such a PR. |
Reopening based on reasoning given in my earlier comment |
@pnkfelix I'm attempting to use your patch above, but I'm not sure I understand where/when those outputs would occur. I am running |
@mark-i-m I would have expected the patch to cause a change to the output you saw from |
When I run
time python /Users/fklock/Dev/Mozilla/rust.git/x.py build --stage 1
, in an error condition likeerror: Could not compile `core`
, I see the subsequent suggestion:To learn more, run the command again with --verbose.
When I run with
--verbose
, I do see helpful output with the build commands it executes. In particular, I seerustc
invocations that I would like to run myself, withRUST_BACKTRACE=1
turned on.Unfortunately:
i.e., the environment variable
RUSTC_STAGE
needs to be set. After I set that, I get:and I start to wonder: "How many of these environment variables are there? Am I going to have to deduce the values for all of them? Why doesn't the
--verbose
flag either include them in the command invocation output (to make it trivial to cut-and-paste the desired command), or at least include them somewhere in the output so that I can grep for them?"The text was updated successfully, but these errors were encountered: