Skip to content

Commit f4301a2

Browse files
Rollup merge of #79344 - JRF63:fix_install_script_win, r=Mark-Simulacrum
Convert UNC path to local path to satisfy install script on Windows `mkdir` with the `-p` flag attempts to create `//?` if passed a UNC path. This fails on both MSYS2 and Git Bash. The UNC paths come from [canonicalizing](https://github.com/rust-lang/rust/blob/32da90b431919eedb3e281a91caea063ba4edb77/src/bootstrap/install.rs#L79) the install prefix path. `mkdir -p` gets invoked on the [install script](https://github.com/rust-lang/rust-installer/blob/d66f476b4d5e7fdf1ec215c9ac16c923dc292324/install-template.sh#L149).
2 parents 93d830e + 6b47920 commit f4301a2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/bootstrap/dist.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1183,7 +1183,11 @@ impl Step for PlainSourceTarball {
11831183
// characters and on `C:\` paths, so normalize both of them away.
11841184
pub fn sanitize_sh(path: &Path) -> String {
11851185
let path = path.to_str().unwrap().replace("\\", "/");
1186-
return change_drive(&path).unwrap_or(path);
1186+
return change_drive(unc_to_lfs(&path)).unwrap_or(path);
1187+
1188+
fn unc_to_lfs(s: &str) -> &str {
1189+
if s.starts_with("//?/") { &s[4..] } else { s }
1190+
}
11871191

11881192
fn change_drive(s: &str) -> Option<String> {
11891193
let mut ch = s.chars();

0 commit comments

Comments
 (0)