sed(1) q command with -i option don't writeback temporary file

Issue #257 resolved
Takehiko NOZAKI repo owner created an issue

from FreeBSD’s bugzilla

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230507

expected:

$ jot 5 >a
$ sed -i.bak '2q' a
$ cat a.bak
1
2
3
4
5
$ cat a
1
2

but actually:

$ jot 5 >a
$ sed -i.bak '2q' a
$ cat a.bak
cat: a.bak: No such file or directory
$ cat a
1
2
3
4
5
$ ls
a             sed00021986aa

analysis:

  • backup file is not created
  • original file is not edited
  • temporary file(sedXXXXXXXXXX) is here