Subject: bug#20002: sed: tmp file left when there are errors and -i is used

From: David Jones <[email-masked]>
Date: Wed, 4 Mar 2015 17:32:37 +0000

sed -i sometimes leave its temporary files around:

Here's some terminal output:

drj$ ls
foo
drj$ sed -i 's//b/' foo
sed: -e expression #1, char 0: no previous regular expression
drj$ ls
foo  sedaelyL4

Note that the sedaelyL4 file is obviously a temp file left by sed. sed
had an error because of the bad sed program. But sed should clean up
after itself.

Cheers,
 drj

The output of sed --version is:

$ sed --version
sed (GNU sed) 4.2.2
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Jay Fenlason, Tom Lord, Ken Pizzini,
and Paolo Bonzini.
GNU sed home page: <http://www.gnu.org/software/sed/>.
General help using GNU software: <http://www.gnu.org/gethelp/>.
E-mail bug reports to: <[email-masked]>.
Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.