-
Notifications
You must be signed in to change notification settings - Fork 17
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 metadata
incorrectly adds weak dependencies
#41
Comments
This actually appears to be a cargo bug with weak dependencies (related rust-lang/cargo#10801). cargo-deny relies on the output of # Cargo.toml
[package]
name = "test"
[dependencies]
git2 = { version = "0.14", default-features = false, features = [
"zlib-ng-compat",
] } {
"id": "libgit2-sys 0.13.4+1.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"dependencies": [
"cc 1.0.73 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.126 (registry+https://github.com/rust-lang/crates.io-index)",
"libssh2-sys 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
"libz-sys 1.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)"
],
"deps": [
{
"name": "cc",
"pkg": "cc 1.0.73 (registry+https://github.com/rust-lang/crates.io-index)",
"dep_kinds": [
{
"kind": "build",
"target": null
}
]
},
{
"name": "libc",
"pkg": "libc 0.2.126 (registry+https://github.com/rust-lang/crates.io-index)",
"dep_kinds": [
{
"kind": null,
"target": null
}
]
},
{
"name": "libssh2_sys",
"pkg": "libssh2-sys 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
"dep_kinds": [
{
"kind": null,
"target": null
}
]
},
{
"name": "libz_sys",
"pkg": "libz-sys 1.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"dep_kinds": [
{
"kind": null,
"target": null
}
]
},
{
"name": "pkg_config",
"pkg": "pkg-config 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)",
"dep_kinds": [
{
"kind": "build",
"target": null
}
]
}
],
"features": [
"zlib-ng-compat"
]
}, Here we can see that even though the correct feature is enabled, the Luckily, this bug can be worked around, but is not specific to cargo-deny itself, but rather the crate it uses to build the crate graph itself, so I'm transferring the issue there. |
cargo deny check bans
does not understand weak dependency featurescargo metadata
incorrectly adds weak dependencies
Resolved by #42 |
Describe the bug
cargo deny check bans
errors out saying a banned package appears in dependencies, even if that package only appears in a weak dependency feature that isn't activated.To Reproduce
Steps to reproduce the behavior:
git2
version0.14.4
, withdefault-features = false
, andfeatures = ["zlib-ng-compat"]
.cargo tree
and observe nolibssh2-sys
oropenssl-sys
dependency.deny.toml
that bansopenssl-sys
.cargo deny check bans
, and get this output:Expected behavior
cargo deny check bans
should understand that there's no dependency onopenssl-sys
(orlibssh2-sys
) here.The text was updated successfully, but these errors were encountered: