On Tue, Jan 29, 2019 at 3:17 PM Segher Boessenkool <seg...@kernel.crashing.org> wrote: > > On Sun, Jan 27, 2019 at 01:53:18PM -0800, Ian Lance Taylor wrote: > > You need to use a temporary file, such as $@.tmp, for the final sed > > command, followed by a mv to $@. Otherwise a failure in the sed will > > leave what appears to be an up to date file. > > Or you just set .DELETE_ON_ERROR, we require GNU make after all so might > as well use it!
It's useful, but it doesn't help if the file is partially written on disk and then the computer crashes. It also doesn't help if the program is not careful to check for errors on writing to standard output--many programs aren't--and the disk fills up after writing out part of the file. Yes, both cases have happened to me when I was a release engineer aeons ago, so I try to be careful. Ian