From f9386d9c996093f209cf0637cbf1e3e93d87d048 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sat, 8 Apr 2023 10:54:43 -0700 Subject: [PATCH] Check for toolchains names with slashes and use the slow path in that case. --- src/cargo/util/config/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cargo/util/config/mod.rs b/src/cargo/util/config/mod.rs index c93699c33637..79b11e74e0b8 100644 --- a/src/cargo/util/config/mod.rs +++ b/src/cargo/util/config/mod.rs @@ -1664,6 +1664,11 @@ impl Config { // // First, we must be running under rustup in the first place. let toolchain = self.get_env_os("RUSTUP_TOOLCHAIN")?; + // This currently does not support toolchain paths. + // This also enforces UTF-8. + if toolchain.to_str()?.contains(&['/', '\\']) { + return None; + } // If the tool on PATH is the same as `rustup` on path, then // there is pretty good evidence that it will be a proxy. let tool_resolved = paths::resolve_executable(Path::new(tool)).ok()?;