On Sun, May 10, 2015 at 6:45 AM, Jim Meyering wrote: > [David Jones reported this in http://bugs.gnu.org/20002] > Thank you for the report. > That was indeed a bug. > I have attached the patch I expect to push: > > [PATCH] sed -i: don't leave behind a temporary sedXXXXXX file > > For example, running a command like "sed -i s//b/ F" would fail > to remove a temporary file named sedXXXXXX (for random XXXXXX) > in the directory alongside F. > * sed/sed.c (G_file_to_unlink): New global. > (register_cleanup_file, cancel_cleanup, cleanup): New functions. > (main): Call atexit. > * sed/execute.c (open_next_file): Register for unlink. > (closedown): Call cancel_cleanup right after the rename. > * sed/sed.h: Declare two of the new functions. > * NEWS (Bug fixes): Mention it. > * testsuite/temp-file-cleanup.sh: New file. Test for this. > * testsuite/Makefile.am (T): Add it. > Reported by David Jones in http://bugs.gnu.org/20002. This required the following fix-up patch: