about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJonas Schievink <jonasschievink@gmail.com>2020-11-28 15:58:19 +0100
committerGitHub <noreply@github.com>2020-11-28 15:58:19 +0100
commitf4301a26beb78596b3a877fc36ca76fbd427e33c (patch)
tree235b8e512246edb3b531131a7128af11fd60ea36 /src
parent93d830ed50ada43ce3c7561d6f98dd3630a11cf9 (diff)
parent6b47920c69fa048331aeb46612b158ded7c6e12e (diff)
downloadrust-f4301a26beb78596b3a877fc36ca76fbd427e33c.tar.gz
rust-f4301a26beb78596b3a877fc36ca76fbd427e33c.zip
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).
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/dist.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs
index 9b77e38a847..354be109cf2 100644
--- a/src/bootstrap/dist.rs
+++ b/src/bootstrap/dist.rs
@@ -1183,7 +1183,11 @@ impl Step for PlainSourceTarball {
 // characters and on `C:\` paths, so normalize both of them away.
 pub fn sanitize_sh(path: &Path) -> String {
     let path = path.to_str().unwrap().replace("\\", "/");
-    return change_drive(&path).unwrap_or(path);
+    return change_drive(unc_to_lfs(&path)).unwrap_or(path);
+
+    fn unc_to_lfs(s: &str) -> &str {
+        if s.starts_with("//?/") { &s[4..] } else { s }
+    }
 
     fn change_drive(s: &str) -> Option<String> {
         let mut ch = s.chars();