-
Notifications
You must be signed in to change notification settings - Fork 67
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
Fixing an error when the crate's name mismatches it will panic #170
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@yijunyu Thanks for the fix, did you find the root cause of the problem? Why is the get_package_name_from_cargo_metadata_package_id function failing to return the package name?
@jmcconnell26 Any ideas?
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'm not sure, @yijunyu, could you provide the package_id that fails / a link to a repository to scan that fails?
If so, I can try and write a few more test cases to catch behaviour like this.
I would like to go back at some point, and add some further error handling to this part of the code.
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've added a print statement before the line,
It turns out that the crate that caused the error is
wasm-bindgen
.This can be confirmed if you run cargo-geiger with this crate at https://github.com/rustwasm/wasm-bindgen.
I was trying to debug into this, the error is likely from
.cargo/registry/src/github.com-1ecc6299db9ec823/krates-0.5.0/src/lib.rs
, but I am not too sure about it.Indeed if I used the
unwrap_or_default
instead, it will skip thewasm-bindgen
crate, which is not what we wanted.What will be the better way to fix the error?
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 for the info @yijunyu! Taking a look at the issue, something seems strange with the dependencies being added to the graph, but only when running with
wasm-bindgen
as the root of the crate. Ifwasm-bindgen
is added as a dependency in a Cargo.toml, it looks to generate the report correctly.I'll take a deeper look at this, and try to figure out what is causing the root problem.
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 for looking into this: we will test it again later.
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.
@jmcconnell26 Any news? Just curious, no stress 😃
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.
@anderejd, apologies, I've been so busy lately I haven't had a chance to do half the things I've been meaning to! I may take a look at issue #175 first, and then come back to this one if you agree?
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.
No problem :) Take your time and thanks for #178!
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've been trying to replicate this behaviour in a new test project, and have been stumped. I can see it happening in the
wasm-bindgen
crate, but attempting to create a new crate with the same error fails.@anderejd, if its OK with you, I'd like to land a few PR's cleaning up the error handling, and hopefully that will lead me to the root of the problem.
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.
Sound great to me, go for it!