From 5a9ff8a62192dbbc068ad9a59368d3fc221b0dff Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Fri, 5 Apr 2019 10:48:23 -0700 Subject: [PATCH] install-upgrade: Add some more comments. --- src/cargo/ops/cargo_install.rs | 2 ++ src/cargo/ops/common_for_install_and_uninstall.rs | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/src/cargo/ops/cargo_install.rs b/src/cargo/ops/cargo_install.rs index 880c41f089e..7591b148a07 100644 --- a/src/cargo/ops/cargo_install.rs +++ b/src/cargo/ops/cargo_install.rs @@ -278,6 +278,8 @@ fn install_one( Ok(duplicates) }; + // WARNING: no_track does not perform locking, so there is no protection + // of concurrent installs. if no_track { // Check for conflicts. no_track_duplicates()?; diff --git a/src/cargo/ops/common_for_install_and_uninstall.rs b/src/cargo/ops/common_for_install_and_uninstall.rs index 84d67e9ed12..c581772d457 100644 --- a/src/cargo/ops/common_for_install_and_uninstall.rs +++ b/src/cargo/ops/common_for_install_and_uninstall.rs @@ -186,6 +186,13 @@ impl InstallTracker { // // There may be multiple matching duplicates if different versions of // the same package installed different binaries. + // + // This does not check the source_id in order to allow the user to + // switch between different sources. For example, installing from git, + // and then switching to the official crates.io release or vice-versa. + // If the source_id were included, then the user would get possibly + // confusing errors like "package `foo 1.0.0` is already installed" + // and the change of source may not be obvious why it fails. let matching_duplicates: Vec = duplicates .values() .filter_map(|v| match v {