Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make "cargo uninstall" uninstall the cwd bins #5927

Merged
merged 2 commits into from
Aug 23, 2018

Conversation

dwijnand
Copy link
Member

Fixes #5916

Tested with a local build of cargo, using coreutils:

17:33:57 $ dcargo uninstall
Removing /Users/dnw/.cargo/bin/uutils

@rust-highfive
Copy link

r? @matklad

(rust_highfive has picked a reviewer for you, use r? to override)

Entry::Occupied(e) => e,
Entry::Vacant(..) => panic!("entry not found: {}", result),
Entry::Vacant(..) => panic!("entry not found: {}", pkgid),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This panic happens if you attempt to cargo uninstall something that is not installed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the status quo despite this change. What change are you requesting?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think previously this code path should have been unreachable. The call to query_str ensured that a match was found. Since it no longer uses a query, I think it probably should just return a normal cargo error. Call bail! with a message indicating that the package is not installed ("package `blah` is not installed" or something along those lines).

let crate_metadata = metadata(config, root)?;
let metadata = read_crate_list(&crate_metadata)?;
let source_id = SourceId::for_path(config.cwd())?;
let (pkg, _source) = select_path_pkg(None, &source_id, None, config, true)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This includes an error message that mentions --path and --git which don't exist in uninstall.

@dwijnand
Copy link
Member Author

Thanks for the review, @ehuss! I've address one of your comments, but I'm unsure about the other. 😕

@dwijnand
Copy link
Member Author

@ehuss I spent some time reproducing the test case you predicted so now we can iterate on how to handle it better.

@dwijnand
Copy link
Member Author

All done from me, ready for re-review.

@dwijnand
Copy link
Member Author

This is failing on Travis CI for:

---- path::deep_dependencies_trigger_rebuild stdout ----
running `/Users/travis/build/rust-lang/cargo/target/debug/cargo build`
running `/Users/travis/build/rust-lang/cargo/target/debug/cargo build`
running `/Users/travis/build/rust-lang/cargo/target/debug/cargo build`
running `/Users/travis/build/rust-lang/cargo/target/debug/cargo build`
thread 'path::deep_dependencies_trigger_rebuild' panicked at '
Expected: execs
    but: differences:
  0 - |[COMPILING] bar v0.5.0 (file:///Users/travis/build/rust-lang/cargo/target/cit/t871/foo/bar)|
    + |   Compiling baz v0.5.0 (file:///Users/travis/build/rust-lang/cargo/target/cit/t871/foo/baz)|
  1 - |[COMPILING] foo v0.5.0 (file:///Users/travis/build/rust-lang/cargo/target/cit/t871/foo)|
    + |   Compiling bar v0.5.0 (file:///Users/travis/build/rust-lang/cargo/target/cit/t871/foo/bar)|
  2 - |[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]|
    + |   Compiling foo v0.5.0 (file:///Users/travis/build/rust-lang/cargo/target/cit/t871/foo)|
  3 -
    + |    Finished dev [unoptimized + debuginfo] target(s) in 1.71s|
other output:
``', tests/testsuite/support/hamcrest.rs:13:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.
failures:
    path::deep_dependencies_trigger_rebuild

which I'd say is unrelated to this PR. 😕

@ehuss
Copy link
Contributor

ehuss commented Aug 23, 2018

LGTM, r+ unless anyone else has input.

@alexcrichton
Copy link
Member

@bors: r=ehuss

@bors
Copy link
Collaborator

bors commented Aug 23, 2018

📌 Commit d87951a has been approved by ehuss

@bors
Copy link
Collaborator

bors commented Aug 23, 2018

⌛ Testing commit d87951a with merge 8537ab9...

bors added a commit that referenced this pull request Aug 23, 2018
Make "cargo uninstall" uninstall the cwd bins

Fixes #5916

Tested with a local build of cargo, using coreutils:

    17:33:57 $ dcargo uninstall
    Removing /Users/dnw/.cargo/bin/uutils
@bors
Copy link
Collaborator

bors commented Aug 23, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: ehuss
Pushing 8537ab9 to master...

@bors bors merged commit d87951a into rust-lang:master Aug 23, 2018
@dwijnand dwijnand deleted the uninstall-cwd branch August 23, 2018 17:31
@ehuss ehuss added this to the 1.30.0 milestone Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cargo uninstall doesn't uninstall
6 participants