Skip to content

Commit 4ffbb5d

Browse files
committed
rustbuild: Ensure PATH does not contain invalid character "
1 parent fd1d360 commit 4ffbb5d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/bootstrap/sanity.rs

+9
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ use Build;
3131
pub fn check(build: &mut Build) {
3232
let mut checked = HashSet::new();
3333
let path = env::var_os("PATH").unwrap_or(OsString::new());
34+
// On Windows, quotes are invalid characters for filename paths, and if
35+
// one is present as part of the PATH then that can lead to the system
36+
// being unable to identify the files properly. See
37+
// https://github.com/rust-lang/rust/issues/34959 for more details.
38+
if cfg!(windows) {
39+
if path.to_string_lossy().contains("\"") {
40+
panic!("PATH contains invalid character '\"'");
41+
}
42+
}
3443
let mut need_cmd = |cmd: &OsStr| {
3544
if !checked.insert(cmd.to_owned()) {
3645
return

0 commit comments

Comments
 (0)