diff --git a/src/toolchain.rs b/src/toolchain.rs index bfe1563d..61e25316 100644 --- a/src/toolchain.rs +++ b/src/toolchain.rs @@ -385,16 +385,19 @@ impl Toolchain { let store = Store::from_env()?; for cfg in channel.build_download_configs() { if store.has_component(&cfg.name, &cfg.version) { - hard_or_symlink_file( - &store - .component_dir_path(&cfg.name, &cfg.version) - .join(&cfg.name), - &self.bin_path.join(&cfg.name), - )?; + self.add_component(cfg)?; } else { let downloaded = store.install_component(&cfg)?; for bin in downloaded { - hard_or_symlink_file(&bin, &self.bin_path.join(&cfg.name))?; + // Use the actual binary filename rather than the + // config name to prevent multiple binaries from + // being linked to the same target file. + match bin.file_name() { + None => bail!("Failed to read file '{bin:?}' from download"), + Some(executable) => { + hard_or_symlink_file(&bin, &self.bin_path.join(executable))? + } + } } } } diff --git a/tests/toolchain.rs b/tests/toolchain.rs index 4a514391..f69fca87 100644 --- a/tests/toolchain.rs +++ b/tests/toolchain.rs @@ -181,13 +181,11 @@ fn direct_proxy_install_toolchain_in_store_publishable() { } #[test] -#[should_panic] // TODO: #654 will fix this fn direct_proxy_install_toolchain_in_store_forc_plugin() { test_direct_proxy_install_toolchain_in_store(Some("forc-client")); } #[test] -#[should_panic] // TODO: #654 will fix this fn direct_proxy_install_toolchain_in_store_forc_plugin_external() { test_direct_proxy_install_toolchain_in_store(Some("forc-tx")); } @@ -208,13 +206,11 @@ fn direct_proxy_install_toolchain_not_in_store_publishable() { } #[test] -#[should_panic] // TODO: #654 will fix this fn direct_proxy_install_toolchain_not_in_store_forc_plugin() { test_direct_proxy_install_toolchain_not_in_store(Some("forc-client")); } #[test] -#[should_panic] // TODO: #654 will fix this fn direct_proxy_install_toolchain_not_in_store_forc_plugin_external() { test_direct_proxy_install_toolchain_not_in_store(Some("forc-tx")); }