Closed
Description
When running x install
, I was getting the following error:
Installing stage2 docs (x86_64-pc-windows-msvc)
sh: /C/Users/anton/Documents/rust_compilers/unchained/build/tmp/tarball/rust-docs/x86_64-pc-windows-msvc/rust-docs-nightly-x86_64-pc-windows-msvc/install.sh: No such file or directory
I found that the source of the issue was inside the function sanitize_sh
, located in: "src/bootstrap/src/core/build_steps/install.rs":
fn sanitize_sh(path: &Path) -> String {
let path = path.to_str().unwrap().replace('\\', "/");
return change_drive(unc_to_lfs(&path)).unwrap_or(path);
fn unc_to_lfs(s: &str) -> &str {
s.strip_prefix("//?/").unwrap_or(s)
}
fn change_drive(s: &str) -> Option<String> {
let mut ch = s.chars();
let drive = ch.next().unwrap_or('C');
if ch.next() != Some(':') {
return None;
}
if ch.next() != Some('/') {
return None;
}
Some(format!("/{}/{}", drive, &s[drive.len_utf8() + 2..]))
}
}
change_drive
turns paths such as "C:/user/foo" into "/C/user/foo", which makes those paths invalid, resulting in "No such file or directory" errors.
In my fork, I commented the call to change_drive
and returned path
directly:
let path = path.to_str().unwrap().replace('\\', "/");
return path;
Which fixed the issue, x install
then ran without any problems, everything was installed correctly.
Meta
OS: Windows 10 x64
rust-lang commit: ef972a3