EmbarkStudios / krates

📦 Creates graphs of crates from cargo metadata 🦀
Apache License 2.0
58 stars 18 forks source link

Running `cargo deny check` with krates 0.16.5 panics #76

Closed upbqdn closed 9 months ago

upbqdn commented 9 months ago

Describe the bug

Running

RUST_BACKTRACE=1 cargo deny check

for this project https://github.com/ZcashFoundation/zebra fails with:

thread '<unnamed>' panicked at /.../.cargo/registry/src/index.crates.io-6f17d22bba15001f/krates-0.16.5/src/builder.rs:1183:48:
cargo metadata resolved a dependency for a dependency not specified by the crate: NodeDep { name: "zebra_chain", pkg: Kid { name: "zebra-chain", version: "1.0.0-beta.34", source: "path+file:///.../zebra/zebra-chain" }, dep_kinds: [DepKindInfo { kind: Normal, cfg: None }, DepKindInfo { kind: Dev, cfg: None }] }
stack backtrace:
   0: rust_begin_unwind
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panicking.rs:72:14
   2: <core::slice::iter::Iter<T> as core::iter::traits::iterator::Iterator>::find_map
   3: krates::builder::Builder::build_with_metadata
   4: cargo_deny::common::KrateContext::gather_krates
   5: std::panicking::try
   6: <rayon_core::job::HeapJob<BODY> as rayon_core::job::Job>::execute
   7: rayon_core::registry::WorkerThread::wait_until_cold
   8: rayon_core::registry::ThreadBuilder::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

You can also see the error in the CI of the project: https://github.com/ZcashFoundation/zebra/actions/runs/7639791083/job/20814504342?pr=8185#step:5:14.

To Reproduce Steps to reproduce the behavior:

  1. Clone https://github.com/ZcashFoundation/zebra
  2. Run cargo deny check

Device:

upbqdn commented 9 months ago

I didn't investigate the panic in the code, but cargo deny version 0.14.8 works, so the bug was likely introduced in #75.