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

Assertion error when clean is combined with -p flag. #8149

Closed
tkaitchuck opened this issue Apr 23, 2020 · 3 comments · Fixed by #8210
Closed

Assertion error when clean is combined with -p flag. #8149

tkaitchuck opened this issue Apr 23, 2020 · 3 comments · Fixed by #8210
Assignees
Labels
C-bug Category: bug Command-clean P-high Priority: High regression-from-stable-to-stable Regression in stable that worked in a previous stable release.

Comments

@tkaitchuck
Copy link

Problem
In cargo 1.43.0 (3532cf7 2020-03-17) but not in 1.42 the following assertion can be triggered when running cargo clean -p my-package:

thread 'main' panicked at 'assertion failed: self.host', src/tools/cargo/src/cargo/core/profiles.rs:920:13
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1063
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1426
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:204
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:224
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:470
  11: std::panicking::begin_panic
  12: cargo::core::compiler::unit_dependencies::compute_deps
  13: cargo::core::compiler::unit_dependencies::deps_of
  14: cargo::core::compiler::unit_dependencies::deps_of_roots
  15: cargo::core::compiler::unit_dependencies::build_unit_dependencies
  16: cargo::ops::cargo_clean::clean
  17: cargo::commands::clean::exec
  18: cargo::cli::main
  19: cargo::main
  20: std::rt::lang_start::{{closure}}
  21: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:52
  22: std::panicking::try::do_call
             at src/libstd/panicking.rs:303
  23: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:86
  24: std::panicking::try
             at src/libstd/panicking.rs:281
  25: std::panic::catch_unwind
             at src/libstd/panic.rs:394
  26: std::rt::lang_start_internal
             at src/libstd/rt.rs:51
  27: main
  28: __libc_start_main
  29: <unknown>

Steps

  1. Use Rustup to upgrade to cargo 1.43.0
  2. enter into a package directory
  3. run cargo clean -p package-name where "package-name" is a valid package name to be cleaned.

Notes
cargo clean without the -p flag works fine.

Output of cargo version:
cargo 1.43.0 (3532cf7 2020-03-17)
This is running on x86_64 GNU/Linux .

@tkaitchuck tkaitchuck added the C-bug Category: bug label Apr 23, 2020
@ehuss
Copy link
Contributor

ehuss commented Apr 23, 2020

Thanks for the report. I can't quite figure out a way to reproduce this. Is this in a public repo that I can look at? If not, do you think you could create a reproduction?

@tkaitchuck
Copy link
Author

tkaitchuck commented Apr 24, 2020

@ehuss I have invited you to the repository. You can see how the code is being invoked in the .github/workflows/cibuild.yml config file. You can see the output in the github actions. It also fails the same way when I run the same command locally.

@ehuss ehuss self-assigned this Apr 26, 2020
@ehuss
Copy link
Contributor

ehuss commented Apr 26, 2020

Thanks @tkaitchuck! I see the problem, it is embarrassingly easy to hit (cargo clean -p foo for any foo with a build dependency).

cargo clean -p has had a long history of not working very well. I'm taking a look to see if there is some slightly better approach for how it can work.

@ehuss ehuss added Command-clean regression-from-stable-to-stable Regression in stable that worked in a previous stable release. labels Apr 26, 2020
tkaitchuck pushed a commit to pravega/pravega-client-rust that referenced this issue Apr 27, 2020
Workaround for cargo clean bug rust-lang/cargo#8149

Signed-off-by: Sandeep <sandeep.shridhar@emc.com>
@ehuss ehuss added the P-high Priority: High label Apr 30, 2020
bors added a commit that referenced this issue May 6, 2020
[beta] Fix `clean -p` with a build dependency.

This is a temporary and simple fix for #8149 where `cargo clean -p foo` would fail if `foo` has a build dependency.  The full fix is in #8210, but I think that PR is way too risky to backport.
@bors bors closed this as completed in c719a05 May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug Command-clean P-high Priority: High regression-from-stable-to-stable Regression in stable that worked in a previous stable release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants