1
Fork 0

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](32da90b431/src/bootstrap/install.rs (L79)) the install prefix path. `mkdir -p` gets invoked on the [install script](d66f476b4d/install-template.sh (L149)).
This commit is contained in:
Jonas Schievink 2020-11-28 15:58:19 +01:00 committed by GitHub
commit f4301a26be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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();