Skip to content

Commit

Permalink
Fix incorrect binary link target (#654)
Browse files Browse the repository at this point in the history
When a proxy CLI'd command downloads a missing toolchain, multiple binary files within the downloaded distribution were being symlinked to the same one target file (thus overwriting each previous target).
  • Loading branch information
alfiedotwtf committed Oct 27, 2024
1 parent 51155e7 commit 570c4da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
14 changes: 7 additions & 7 deletions src/toolchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,16 +385,16 @@ 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))?;
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))?
}
}
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions tests/toolchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
Expand All @@ -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"));
}
Expand Down

0 comments on commit 570c4da

Please sign in to comment.