Skip to content
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

caller_crate_root() is wrong in some very specific edge case #5

Closed
sam0x17 opened this issue Jul 31, 2023 · 1 comment
Closed

caller_crate_root() is wrong in some very specific edge case #5

sam0x17 opened this issue Jul 31, 2023 · 1 comment
Assignees

Comments

@sam0x17
Copy link
Owner

sam0x17 commented Jul 31, 2023

Originally reported here: paritytech/substrate#14672 (comment)

What's telling is this:

  1. macro invocation site: frame/paged-list/src/lib.rs
  2. caller_crate_root() at that site: frame/paged-list/fuzzer
  3. CARGO_MANIFEST_DIR at that site: frame/paged-list
  4. CARGO_CRATE_NAME at that site: pallet_paged_list
  5. CARGO_PKG_NAME at that site: pallet-paged-list

So somehow caller_crate_root() is failing to explore the parent directory in this very specific situation that we can only reproduce in CI

@sam0x17 sam0x17 self-assigned this Jul 31, 2023
@sam0x17
Copy link
Owner Author

sam0x17 commented Aug 4, 2023

So the reason for this is actually quite simple.

The code that looks for the crate_root looks for Cargo.toml files where name = "{{crate_name}}" is in the file. Normally this is an OK assumption but the fuzzer has this line in the bin section:

[[bin]]
name = "pallet-paged-list"

So my assumption is bad and what I should be doing is real TOML parsing here. So will add that.

@sam0x17 sam0x17 closed this as completed in e3c4b4f Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant