kornelski / cargo-deb

Make Debian packages directly from Rust/Cargo projects
https://lib.rs/cargo-deb
MIT License
423 stars 50 forks source link

Fix workspace inheritance bug #53

Closed dyerti closed 2 years ago

dyerti commented 2 years ago

Need to call complete_from_path after inherit_workspace otherwise inherited fields are accessed before they have been defined.

Bug is reproducible by inheriting edition or readme from the workspace. For edition you need either a lib.rs or main.rs (or both) in the package (empty files are sufficient).

I have a minimal test for cargo_toml, but it seems to be expected behavior based on the function descriptions.

Triggered by edition with lib.rs: https://gitlab.com/crates.rs/cargo_toml/-/blob/3c9c20e07638dba7f7ba462f6d5f9247146cd93b/src/cargo_toml.rs#L366 Triggered by edition with main.rs: https://gitlab.com/crates.rs/cargo_toml/-/blob/3c9c20e07638dba7f7ba462f6d5f9247146cd93b/src/cargo_toml.rs#L388 Triggered by readme: https://gitlab.com/crates.rs/cargo_toml/-/blob/3c9c20e07638dba7f7ba462f6d5f9247146cd93b/src/cargo_toml.rs#L428 Potentially problematic, but I didn't get around to triggering them: https://gitlab.com/crates.rs/cargo_toml/-/blob/3c9c20e07638dba7f7ba462f6d5f9247146cd93b/src/cargo_toml.rs#L482 https://gitlab.com/crates.rs/cargo_toml/-/blob/3c9c20e07638dba7f7ba462f6d5f9247146cd93b/src/cargo_toml.rs#L499

kornelski commented 2 years ago

Thanks