When strip(1) is run on any file, a temporary file is created and usually just left in /tmp (although with ticket 597 applied it is left in the current directory).
Please would you consider merging this (pull request)? I'm happy to make it coexist with tickets/597-- it needed a bit of hand-merging that I'm happy to do.
You might prefer that the temporary file could be left on failure-- this could be a flag I guess, and I'm also happy to put that in.
I think it should definitely clean up when strip(1) is run on a file that is not a binary file;
crees@pegasus~ % ls /tmp/ecp
ls: No match.
crees@pegasus~ % touch nonbinary; strip nonbinary
strip: elf_begin() failed: Invalid argument
crees@pegasus~ % ls /tmp/ecp
/tmp/ecp.1dkHpANz
crees@pegasus~ %
(ticket 597) https://sourceforge.net/p/elftoolchain/tickets/597/
(pull request) https://github.com/elftoolchain/elftoolchain/pull/3
Thanks for the bug report and the patch.
There are test failures with the patch applied (please see the attachment). Do you think you would be able to take a look at these test failures and adapt the patch accordingly?
OK, thanks, I've updated the pull request. The imprecisely named copy_from_tempfile actually moves the tempfile, so there's no need to try to delete it. Of course, tempfile isn't freed there as it can't modify it. One solution is to modify
copy_from_tempfileto takechar **src, but it's much less disruptive to just leave out the cleanup_tempfile out for that invocation and leave a comment to say so.Thank you for revising the patch. It has been committed in [r3918].
Related
Commit: [r3918]