-
Notifications
You must be signed in to change notification settings - Fork 564
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
more mypy v1.1.1 fixes #1423
more mypy v1.1.1 fixes #1423
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
SHT_SYMTAB = 0x2 | ||
SHT_STRTAB = 0x3 | ||
strtab_buf = symtab_buf = None | ||
|
||
for shdr in elf.section_headers: | ||
if shdr.type == SHT_STRTAB: | ||
strtab_buf, strtab_sz= shdr.buf, shdr.size | ||
|
||
elif shdr.type == SHT_SYMTAB: | ||
symtab_buf, symtab_entsize, symtab_sz = shdr.buf, shdr.entsize, shdr.size | ||
|
||
if None in (strtab_buf, symtab_buf): |
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.
@yelhamer FYI, ELF files may have mutiple strtabs, so we need to read the correct one using the sh_link
field of the symtab section header field, rather than just taking the last one found. i learned this from here: https://stackoverflow.com/a/69888949/87207
i noticed the bug because the ELF sample bf7a9c8bdfa6d47e01ad2b056264acc3fd90cf43fe0ed8deec93ab46b47d76cb has extra string tables that didn't line up with what the symtab entries expected.
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.
note i've also done a little refactoring to make use of existing code to parse section headers and their associated data. no major changes to your logic.
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.
Oh, I missed using sh_link to get strtab's index, that's pretty nifty!
I also really like the refactoring you did, specifically, adding symtab() to the ELF section, I think that's much better than my original solution (having it inside the guess_os_from_symtab() function).
Thank you!
let's ensure tests pass, and if they do, @mr-tz should consider this for code review and merge, so we can get master green again. |
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.
LGTM, thanks!!
PyInstaller fail appears unrelated (GitHub issue?). |
the ubuntu-18.04 image has been deprecated |
i think we were using the oldest ubuntu possible so that the resulting builds would work with the widest range of commonly installed dependencies. by updating to ubuntu 20.04, we may fail to run on other older linuxes (ubuntu 18.04, 18.10, etc.). lets try this out, and if we face pushback, we can find another old linux image. |
fixes:
Checklist