sed --in-place bug (updates mtime of file even if no changes are made)

John Vanderpool <[email protected]>
Newsgroups gmane.comp.gnu.utils.bugs
Message-ID <[email protected]>
--in-place shouldn't update the mtime of the file if the pattern doesn't match
(i.e. no changes were made to file) - sed is great - thanx for your support!

$ sed --version    # on ubuntu (same problem with sed version 4.1.5 on redhat 5.7)
GNU sed version 4.2.1

$ date
Tue Nov  8 16:12:59 EST 2011

$ touch a b
$ ls -l
-rw-r--r-- 1 fish fish    0 Nov  8 16:12 a
-rw-r--r-- 1 fish fish    0 Nov  8 16:12 b

$ date
Tue Nov  8 16:13:14 EST 2011

$ sed --in-place 's%foo%bar%g'  a b

$ ls -l
-rw-r--r-- 1 fish fish    0 Nov  8 16:13 a
-rw-r--r-- 1 fish fish    0 Nov  8 16:13 b
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.