When parsing workspace.members, the result of glob matching doesn't filter directories. It will gladly append Cargo.toml to file paths like README.md:
|
for member in &workspace.members { |
|
for manifest_dir in glob::glob(workspace_root.join(member).to_str().unwrap())? { |
|
let manifest_dir = manifest_dir?; |
|
let manifest_path = manifest_dir.join("Cargo.toml"); |
|
let manifest = Manifest::parse_from_toml(&manifest_path)?; |
Assumes a manifest being parsed contains:
[workspace]
members = [
"examples/*",
"tests/*",
]
... and these directories contain a README.md or other files as direct children. An example repo in the wild where this is done:
This kind of setup causes Subcommand::new() to return an error here:
|
utils::find_package_manifest_in_workspace( |
|
workspace_manifest, |
|
potential_manifest, |
|
package, |
|
)? |
The glob result needs to be filtered to match directories. Checking manifest_dir.is_dir() is a good start, but symlinks also need to be followed.
When parsing
workspace.members, the result of glob matching doesn't filter directories. It will gladly appendCargo.tomlto file paths likeREADME.md:cargo-subcommand/src/manifest.rs
Lines 38 to 42 in de0458c
Assumes a manifest being parsed contains:
... and these directories contain a
README.mdor other files as direct children. An example repo in the wild where this is done:egui:This kind of setup causes
Subcommand::new()to return an error here:cargo-subcommand/src/subcommand.rs
Lines 67 to 71 in de0458c
The
globresult needs to be filtered to match directories. Checkingmanifest_dir.is_dir()is a good start, but symlinks also need to be followed.