-
Notifications
You must be signed in to change notification settings - Fork 110
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
Do not list dependency packages by MetadataCommand #356
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really follow what is going on here -- to calm my nerves, would you mind adding a regression test that fails without this change and passes after it is introduced?
@fitzgen, just pushed a commit with a failing test case that is fixed by my change. |
assert!(project.fuzz_cargo_toml().is_file()); | ||
let cargo_toml = fs::read_to_string(project.fuzz_cargo_toml()).unwrap(); | ||
let expected_dependency_attrs = | ||
&format!("[dependencies.{name}]\npath = \"..\"", name = project_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on my tests, CargoMetadata
crate calls cargo metadata
with or without --no-deps
.
When called without --no-deps
, the result contains all packages including dependency packages which are sorted alphabetically. In order to create a failing example, I had to create a sample cargo project which has the name alphabetically greater than one of its dependencies (project_with_some_dep > matches
).
When following `cargo-fuzz` tutorial at https://rust-fuzz.github.io/book/cargo-fuzz/tutorial.html, after executing `cargo fuzz init`, `fuzz/Cargo.toml` contains entry `[dependencies.matches]` instead of `[dependencies.url]`. This is caused by `MetadataCommand` listing dependency packages in addition to main packages which is not desired. This does work as expected if result of `MetadataCommand` contains the first package as the non-dep package but that does not seem to work all the time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
When following
cargo-fuzz
tutorial athttps://rust-fuzz.github.io/book/cargo-fuzz/tutorial.html, after executing
cargo fuzz init
,fuzz/Cargo.toml
contains entry[dependencies.matches]
instead of[dependencies.url]
. This is caused byMetadataCommand
listing dependency packages in addition to main packages which is not desired.Current implementation does work as expected if result of
MetadataCommand
contains the first package as the non-dep package but that does not seem to work all the time.