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

Warnings for breaking changes to the configuration discovery of cargo install and cargo uninstall proposed in #11775 #11786

Closed
wants to merge 1 commit into from

Conversation

jofas
Copy link
Contributor

@jofas jofas commented Mar 1, 2023

#11775 tries to streamline the configuration discovery of cargo uninstall with cargo install and make both more intuitive and in sync with how crate-local configuration discovery works. Unfortunately, these are breaking changes. So this PR adds warning messages to cargo install and cargo uninstall, informing the user that the configuration discovery will change in a future version of cargo.

@rustbot
Copy link
Collaborator

rustbot commented Mar 1, 2023

r? @epage

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

@rustbot rustbot added A-cli Area: Command-line interface, option parsing, etc. Command-install Command-uninstall S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 1, 2023
@jofas jofas marked this pull request as draft March 1, 2023 16:16
@jofas
Copy link
Contributor Author

jofas commented Mar 1, 2023

Shoot, forgot to run the test suite locally and check if my changes broke any tests

@jofas
Copy link
Contributor Author

jofas commented Mar 1, 2023

Seemingly I broke all tests (>50) that run cargo install/cargo uninstall and check stderr output with .with_stderr, instead of .with_stderr_contains. Anyone any idea how I should proceed (CC @weihanglo)? Should I add the warning to each call of .with_stderr or maybe reduce all the panicking .with_stderr calls to .with_stderr_contains?

This test broke, for example:

#[cargo_test]
fn simple() {
pkg("foo", "0.0.1");
cargo_process("install foo")
.with_stderr(
"\
[UPDATING] `[..]` index
[DOWNLOADING] crates ...
[DOWNLOADED] foo v0.0.1 (registry [..])
[INSTALLING] foo v0.0.1
[COMPILING] foo v0.0.1
[FINISHED] release [optimized] target(s) in [..]
[INSTALLING] [CWD]/home/.cargo/bin/foo[EXE]
[INSTALLED] package `foo v0.0.1` (executable `foo[EXE]`)
[WARNING] be sure to add `[..]` to your PATH to be able to run the installed binaries
",
)
.run();
assert_has_installed_exe(cargo_home(), "foo");
cargo_process("uninstall foo")
.with_stderr("[REMOVING] [CWD]/home/.cargo/bin/foo[EXE]")
.run();
assert_has_not_installed_exe(cargo_home(), "foo");
}

because now we have an additional, unexpected [WARNING] ... in stderr of cargo install and cargo uninstall.

Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

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

First of all, I am not sure if everyone in the Cargo team buys in this change. It may or may not change based on the consensus 😞.

Seemingly I broke all tests (>50) that run cargo install/cargo uninstall and check stderr output with .with_stderr, instead of .with_stderr_contains

I wish we could have turned trivial tests into UI tests style. So that we don't need to update each test manually.

Specifically to this fix, Cargo should strive to be as less verbose as it could (although it is already too verbose), so flushing messages to every user running cargo install is definitely no-go. I would probably limit the message to users that load configurations from locations other than ~/.cargo/config.toml. However, I feel even we have shipped this warning, it won't be landed in any near future, as it would highly possibly break a lot of automation processes, especially Docker builds which I've seen they were putting config on /.cargo/config.toml.

@jofas
Copy link
Contributor Author

jofas commented Mar 1, 2023

However, I feel even we have shipped this warning, it won't be landed in any near future, as it would highly possibly break a lot of automation processes, especially Docker builds which I've seen they were putting config on /.cargo/config.toml.

Very interesting. Well, I'll close this PR then, as the changes I've made aren't thought through well enough and I underestimated the complexity of what I was trying to implement. Maybe some other day 🤷‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cli Area: Command-line interface, option parsing, etc. Command-install Command-uninstall S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants