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

cargo-semver-checks Crash Report (after using absolute path to dependency, panic: "we declared a dependency on a crate that doesn't exist in the metadata") #476

Closed
nmathewson opened this issue Jun 27, 2023 · 1 comment · Fixed by #477
Labels
C-bug Category: doesn't meet expectations

Comments

@nmathewson
Copy link
Contributor

Steps to reproduce the bug with the above code

Hi! The program told me to submit the attached file. This is running on arti, comparing it against a branch containing the previous version (with light hacking to work around a bug that causes the previous version not to compile correctly because of a pinned dependency which has been yanked.)

I suspect that this behavior is at issue. To work around the release bug here, I had to hack together a fake version of one of our upstream dependencies, and use dependencies.x.path in one of our crates to use the hacked-up version.

To work around the fact that cargo-semver-checks builds in a subdir, I had to use an absolute path to my hacked-up crate. I think this might be the problem.

I've tried to come up with a smaller reproducer, but it didn't seem to work.

Actual Behaviour

Here is my interaction with the program.

[1069]$ cargo semver-checks --features full --baseline-rev arti-v1.1.5-reconstructed
     Cloning arti-v1.1.5-reconstructed
     Parsing arti v1.1.5 (current)
     Parsing arti v1.1.5 (baseline)
    Checking arti v1.1.5 -> v1.1.5 (no change)
   Completed [   0.018s] 45 checks; 44 passed, 1 failed, 0 unnecessary

--- failure function_parameter_count_changed: pub fn parameter count changed ---

Description:
A publicly-visible function now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-check/tree/v0.22.0/src/lints/function_parameter_count_changed.ron

Failed in:
  arti::socks::run_socks_proxy now takes 4 parameters instead of 3, in /home/nickm/src/arti/crates/arti/src/socks.rs:598
       Final [   0.025s] semver requires new major version: 1 major and 0 minor checks failed
     Parsing arti-bench v0.8.5 (current)
Well, this is embarrassing.

cargo-semver-checks had a problem and crashed. To help us diagnose the problem you can send us a crash report.

We have generated a report file at "/tmp/report-ac6c5e48-479f-45f0-bbbd-876628d36d3d.toml". Submit an issue or email with the subject of "cargo-semver-checks Crash Report" and include the report as an attachment.

- Authors: Predrag Gruevski <[email protected]>

We take privacy seriously, and do not perform any automated error collection. In order to improve the software, we rely on people to submit reports.

Thank you kindly!

Here are the contents of the report-xxx.toml file; I'm pasting it here because github doesn't want me to upload toml.

name = "cargo-semver-checks"
operating_system = "Fedora 38.0.0 [64-bit]"
crate_version = "0.22.0"
explanation = """
Panic occurred in file '/home/nickm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-semver-checks-0.22.0/src/rustdoc_cmd.rs' at line 137
"""
cause = "we declared a dependency on a crate that doesn't exist in the metadata"
method = "Panic"
backtrace = """

   0: 0x55dde394ce73 - core::panicking::panic_display::h01701c1a3a28d8fa
                at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/panicking.rs:150
                 - core::panicking::panic_str::h7d8fffbb2324dc68
                at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/panicking.rs:134
                 - core::option::expect_failed::h18c286e2b6fe8852
                at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/option.rs:2025
   1: 0x55dde39bf8d7 - cargo_semver_checks::rustdoc_cmd::RustdocCommand::generate_rustdoc::h77c9cc3fff9fff7a
   2: 0x55dde3ae546b - cargo_semver_checks::rustdoc_gen::generate_rustdoc::hb89e63226cec69ff
   3: 0x55dde3ae73e6 - <cargo_semver_checks::rustdoc_gen::RustdocFromProjectRoot as cargo_semver_checks::rustdoc_gen::RustdocGenerator>::load_rustdoc::he7bebb273b064887
   4: 0x55dde39ff77d - cargo_semver_checks::generate_versioned_crates::h5157885ed6630105
   5: 0x55dde39c2442 - <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold::h3392cf6c53785f7e
   6: 0x55dde3b30198 - <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter::h3e7dac56a7b1f7b6
   7: 0x55dde39fec62 - cargo_semver_checks::Check::check_release::h5a54bcbac48502dc
   8: 0x55dde3960cda - cargo_semver_checks::main::h47a1a9836d63875a
   9: 0x55dde39705a3 - std::sys_common::backtrace::__rust_begin_short_backtrace::h3e87676ce6f51911
  10: 0x55dde39551dd - std::rt::lang_start::{{closure}}::h4a0957cb5a09d50c
  11: 0x55dde42e8cbe - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hb1327dc2ef3fecdf
                at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/ops/function.rs:287
                 - std::panicking::try::do_call::h4044173225fe83dd
                at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:485
                 - std::panicking::try::hd8a722c09d156a53
                at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:449
                 - std::panic::catch_unwind::hd2ca07971cf0119b
                at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panic.rs:140
                 - std::rt::lang_start_internal::{{closure}}::h26d89d595cf47b70
                at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/rt.rs:148
                 - std::panicking::try::do_call::hf47aa1aa005e5f1a
                at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:485
                 - std::panicking::try::h73d246b2423eaf4e
                at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:449
                 - std::panic::catch_unwind::hbaaeae8f1b2f9915
                at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panic.rs:140
                 - std::rt::lang_start_internal::h76f3e81e6b8f13f9
                at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/rt.rs:148
  12: 0x55dde3968ae5 - main
  13: 0x7feee689bb4a - __libc_start_call_main
  14: 0x7feee689bc0b - __libc_start_main@@GLIBC_2.34
  15: 0x55dde394d545 - _start
  16:        0x0 - <unresolved>"""

Expected Behaviour

.

Generated System Information

#### Software version

cargo-semver-checks 0.22.0

#### Operating system

Linux 6.3.8-200.fc38.x86_64

#### Command-line

```bash
/home/nickm/.cargo/bin/cargo-semver-checks semver-checks --bugreport 

cargo version

> cargo -V 
cargo 1.70.0 (ec8a8a0ca 2023-04-25)

Compile time information

  • Profile: release
  • Target triple: x86_64-unknown-linux-gnu
  • Family: unix
  • OS: linux
  • Architecture: x86_64
  • Pointer width: 64
  • Endian: little
  • CPU features: fxsr,sse,sse2
  • Host: x86_64-unknown-linux-gnu

### Build Configuration

_No response_

### Additional Context

_No response_
@nmathewson nmathewson added the C-bug Category: doesn't meet expectations label Jun 27, 2023
@obi1kenobi
Copy link
Owner

obi1kenobi commented Jun 28, 2023

I believe this is the same cause as #453 and a few other recent issues.

The failure is right after the line:

Parsing arti-bench v0.8.5 (current)

and that crate is a bin crate, with no lib target. By default, since semver-checking was started inside a workspace and not inside a particular crate's directory, cargo-semver-checks checks everything in the workspace. That binary crate should have been skipped automatically since there's no library API to check in it, but due to a bug it's being checked anyway and the check trips that assertion.

Sorry about that. I've been a bit swamped lately and haven't gotten a chance to work on this at all recently. If you happen to have the interest and cycles, I'd appreciate help and would be happy to point you in the right direction!

If not, no worries! You should be able to work around this for now in a few ways: by passing --exclude arti-bench, passing -p <crate-to-check> explicitly, or by doing a cd into a specific crate's directory and checking from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: doesn't meet expectations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants