bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gold/27972] New: gold leaves a broken output file behind when it's


From: johannes.abt at advantest dot com
Subject: [Bug gold/27972] New: gold leaves a broken output file behind when it's interrupted; should clean up
Date: Wed, 09 Jun 2021 13:58:41 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=27972

            Bug ID: 27972
           Summary: gold leaves a broken output file behind when it's
                    interrupted; should clean up
           Product: binutils
           Version: 2.37 (HEAD)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gold
          Assignee: ccoutant at gmail dot com
          Reporter: johannes.abt at advantest dot com
                CC: ian at airs dot com
  Target Milestone: ---

In output.cc, gold opens the file for writing, it fallocates the necessary
space and then it starts writing. Without using a temporary file. If you
interrupt gold with Ctrl-C, it does not clean up.

Some build system do not clean up output files after an interrupt. During the
next run, they just see updated timestamp and go on with the build using the
broken output file.

That's why many build tools either 
* use temporary files and use the atomic `rename()` call or 
* (try to) clean up in an atexit handler (see `ld_cleanup()` in file `ldmain.c`
of GNU ld)

I keep getting files with the proper output size, containing anything but nul
bytes. That's quite annoying.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]