[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sed --in-place bug (updates mtime of file even if no changes are mad
From: |
Eric Blake |
Subject: |
Re: sed --in-place bug (updates mtime of file even if no changes are made) |
Date: |
Fri, 11 Nov 2011 17:35:44 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110930 Thunderbird/7.0.1 |
On 11/08/2011 02:32 PM, John Vanderpool wrote:
> --in-place shouldn't update the mtime of the file if the pattern doesn't
> match
> (i.e. no changes were made to file)
Why not? Conceptually, 'sed --in-place' is short-hand for 'sed > temp,
mv temp original', since it is not possible to known a priori whether
the sed script will modify the input when generating the temporary file.
You're welcome to submit a patch if you think you can fix it, but right
now, I don't think sed should have to recognize whether the output is
identical to the input. If you need mtime unchanged, then use sed to a
temporary file yourself, and compare the two files before deciding
whether to move the temporary file or keep the original.
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature