rust-fuzz / cargo-fuzz

Command line helpers for fuzzing
https://rust-fuzz.github.io/book/cargo-fuzz.html
Apache License 2.0
1.48k stars 108 forks source link

`cargo fuzz init` fails with `edition.workspace = true` #333

Closed mauricelam closed 7 months ago

mauricelam commented 1 year ago

When running cargo fuzz init on a workspace, where the member crate's Cargo.toml has edition.workspace = true, the command fails.

Cargo.toml:

[worksapce]
members = [
  "member",
]

[workspace.package]
edition = "2021"

member/Cargo.toml:

[package]
name = "member"
version = "0.1.0"
edition.workspace = true
$ cd member
$ cargo fuzz init
Error: /path/to/project/member/Cargo.toml (package.edition) is malformed

edition.workspace is supported by cargo itself per https://doc.rust-lang.org/cargo/reference/workspaces.html#the-package-table. If I change edition.workspace = true back to edition = "2021", the init command runs successfully.

exdx commented 1 year ago

Running into the same issue -- my first time trying to use the project. The workspace Cargo.toml looks like this:

[workspace]
members = [
  "a",
  "b",
  "c",
  "d",
  "e",
]

[profile.release]
debug = true

I think based on https://github.com/rust-fuzz/cargo-fuzz/issues/226#issuecomment-629822514 if you run cargo fuzz init inside a particular workspace member it works. Worked fine for me. Maybe the docs should be updated to make that clear in the case of workspaces.

mauricelam commented 1 year ago

@exdx That sounds like a different problem? I was running cargo fuzz init from inside the member directory but it still fails if the member has edition.workspace = true.