- Notifications
You must be signed in to change notification settings - Fork13.3k
elf2bin.py objcopy cleanup#7351
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
earlephilhower left a comment
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.
Good fix, but needs to have#7348 merged before it can go in. TheTemporaryDirectory method isn't available in Python2 (which is the only one installed on Macs until the very latest release AFAIK).
Using amkdtemp call and cleaning up afterward would allow it to go in even if#7348 isn't merged as that's available since Python2.
Uh oh!
There was an error while loading.Please reload this page.
Perhttps://docs.python.org/3/library/tempfile.html#tempfile.mkstemp
read_segment()'sdumpfilewas never deleted, producing 5 'segment' files each build.Instead, this patch creates a temporary directory which is later used for objcopy output.
TemporaryDirectory()context manager will handle the deletion.Plus, some minor refactoring to reduce line length and add some pythonisms (hopefully, not too much)
Noticed this issue accidentally by inspecting a specific Windows PC install using WSL circa January.
/tmpwas ~2.5GB and there was alot of files.