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

fix(symsorter): Don't emit files with empty debug identifiers #469

Merged
merged 2 commits into from
Jun 17, 2021

Conversation

relaxolotl
Copy link
Contributor

Files that symsorter was unable to generate a valid, nonempty debug identifier (i.e. 000...000) for were being written to disk as if they were successfully parsed and sorted. Chances are if the debug identifier is empty, then the debug info is unusable. Not emitting these saves some manual cleanup work on the user's end since they don't have to prune these directories.

Related: #465

Files that symsorter was unable to generate a valid, nonempty debug
identifier (i.e. 000...000) for were being written to disk as if
they were successfully parsed and sorted. Chances are if the debug
identifier is empty, then the debug info is unusable.
@relaxolotl relaxolotl requested review from Swatinem and a team June 16, 2021 21:38
Copy link
Member

@jan-auer jan-auer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

} else {
obj.code_id().as_ref().unwrap().as_str().to_string()
Ok(obj.code_id().as_ref().unwrap().as_str().to_string())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you check that this identifier is non-empty, too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, this also tripped me up as well when I was working on this: L30 checks this (|| obj.code_id().is_none()) and enters the debug ID block if .code_id() is empty.

I was thinking of ways to make it more obvious that this else block runs with a non-empty code_id, but anything that came to mind felt like an overcomplication. For example, a match block was one of my ideas:

match (obj.file_format(), obj.code_id()) {
    (Pe, _) 
    | (_, None) => use debug_id,
    (_, _) => use code
}

Thoughts, opinions?

Copy link
Member

@jan-auer jan-auer Jun 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, you know our code better than we do. And in fact, code_id can also never be empty since it always returns None instead. This is good to go then 👍

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

Successfully merging this pull request may close these issues.

3 participants