Skip to content
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

Command.env not working since nightly-2021-07-05 #87859

Closed
seven1oe opened this issue Aug 8, 2021 · 1 comment · Fixed by #87863
Closed

Command.env not working since nightly-2021-07-05 #87859

seven1oe opened this issue Aug 8, 2021 · 1 comment · Fixed by #87863
Labels
C-bug Category: This is a bug. regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Comments

@seven1oe
Copy link

seven1oe commented Aug 8, 2021

Command.env not work after nightly-2021-07-05 or commit 8345538(maybe).

Here is my test main.rs:

use std::process::Command;
fn main() {
    Command::new("gcc").env("PATH", "C:\\msys64\\mingw64\\bin").spawn().expect("gcc not found");
}
> rustup default stable-x86_64-pc-windows-gnu
info: using existing install for 'stable-x86_64-pc-windows-gnu'
info: default toolchain set to 'stable-x86_64-pc-windows-gnu'
  stable-x86_64-pc-windows-gnu unchanged - rustc 1.54.0 (a178d0322 2021-07-26)

> rustc main.rs -o stable.exe

> stable.exe      # gcc found !!
gcc.exe: fatal error: no input files
compilation terminated.
> rustup default nightly-2021-07-05-x86_64-pc-windows-gnu
info: using existing install for 'nightly-2021-07-05-x86_64-pc-windows-gnu'
info: default toolchain set to 'nightly-2021-07-05-x86_64-pc-windows-gnu'
  nightly-2021-07-05-x86_64-pc-windows-gnu unchanged - rustc 1.55.0-nightly (b3d11f95c 2021-07-04)

> rustc main.rs -o nightly.exe

> nightly.exe      # gcc not found !!
thread 'main' panicked at 'gcc not found: Os { code: 2, kind: NotFound, message: "The system cannot find the file specified." }', main.rs:4:73
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This also affects rustc search for linker after nightly-2021-07-05 (with link-self-contained=yes or without mingw installed)

Run the rustc in cargo's bin works fine, but run the rustc in toolchain's bin show this:

error: linker `x86_64-w64-mingw32-gcc` not found

cmd.env("PATH", env::join_paths(new_path).unwrap());

@seven1oe seven1oe added the C-bug Category: This is a bug. label Aug 8, 2021
@seven1oe seven1oe changed the title Command.env not work Command.env not working since nightly-2021-07-05 Aug 8, 2021
@ChrisDenton
Copy link
Member

Thanks for the report! I see the problem. I'll submit a fix as soon as I can.

@dtolnay dtolnay added the regression-from-stable-to-beta Performance or correctness regression from stable to beta. label Aug 8, 2021
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Aug 8, 2021
@m-ou-se m-ou-se added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Aug 11, 2021
@bors bors closed this as completed in cc54fda Aug 12, 2021
@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Apr 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants