From 5c26afce8be31fc7b0b118ac1623f8defd98015e Mon Sep 17 00:00:00 2001 From: Wolf Vollprecht Date: Fri, 4 Oct 2024 17:34:34 +0200 Subject: [PATCH] fix self-clobber when updating/downgrading packages --- crates/rattler/src/install/clobber_registry.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/rattler/src/install/clobber_registry.rs b/crates/rattler/src/install/clobber_registry.rs index 3c9a62570..b1196169b 100644 --- a/crates/rattler/src/install/clobber_registry.rs +++ b/crates/rattler/src/install/clobber_registry.rs @@ -148,11 +148,12 @@ impl ClobberRegistry { for (_, path) in computed_paths { // if we find an entry, we have a clobbering path! - if let Some(&primary_package_idx) = self.paths_registry.get(path) { + // let entry = self.paths_registry.get(path); + if let Some(&Some(primary_package_idx)) = self.paths_registry.get(path) { let new_path = clobber_name(path, &self.package_names[name_idx.0]); self.clobbers .entry(path.clone()) - .or_insert_with(|| primary_package_idx.map(|v| vec![v]).unwrap_or_default()) + .or_insert_with(|| vec![primary_package_idx]) .push(name_idx); // We insert the non-renamed path here @@ -282,7 +283,7 @@ impl ClobberRegistry { // Rename the winner let winner_path = clobber_name(path, &winner.1); - tracing::trace!("renaming {} to {}", winner_path.display(), path.display()); + tracing::debug!("renaming {} to {}", winner_path.display(), path.display()); fs::rename(target_prefix.join(&winner_path), target_prefix.join(path)).map_err( |e| { ClobberError::IoError(