This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: checksum files not ^C safe
On Sep 15, 2005, Geoffrey Keating <geoffk@apple.com> wrote:
> On 14/09/2005, at 5:32 PM, Mike Stump wrote:
>> If you output to a temp file, and then mv them to the final file,
>> they will be (I think) safe.
> From the 'make' documentation, node 'Interrupts':
>> If `make' gets a fatal signal while a command is executing, it may
>> delete the target file that the command was supposed to update.
>> This is
>> done if the target file's last-modification time has changed since
>> `make' first checked it.
> So, I think this is safe. The file will be deleted and then re-built
> next time you run 'make'.
That unfortunately doesn't cover power failures and so, which may
leave an incomplete file behind. The use of a temp file has been the
right approach, recommended forever, and used all over the place in
the GCC build machinery.
--
Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}