public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug driver/57652] New: [4.7/4.8/4.9 Regression] collect2 does not clean up temporary files
@ 2013-06-19 13:47 dje at gcc dot gnu.org
  2013-06-19 13:50 ` [Bug driver/57652] " dje at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: dje at gcc dot gnu.org @ 2013-06-19 13:47 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57652

            Bug ID: 57652
           Summary: [4.7/4.8/4.9 Regression] collect2 does not clean up
                    temporary files
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: driver
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dje at gcc dot gnu.org

The 2011-05-19 change to convert collect2 to use the common diagnostics
infrastructure broke collect2's handling of temporary files.  The original
error reporting routines reported the error message and, IMPORTANTLY, called
collect_exit(). collect_exit() removes temporary files through multiple
invocations of maybe_unlink().

The change to invoke fatal_error() in GCC's diagnostics.c directly terminates
without cleaning up the temporary files. This leaves at least 5 temporary files
in /tmp for each link step that results in an error message.  When using GNU
configure to probe system features, this creates numerous temporary files.

For example,

$ cat foo.c
int main () {}
$ gcc foo.c -lnonexistent
collect2: fatal error: library libnonexistent not found
compilation terminated.
$ ls /tmp/cc*
/tmp/cc0IcxVL.c   /tmp/ccKwuh03.x   /tmp/ccqMJsFn.le
/tmp/cc2taIMJ.ld  /tmp/cceKTq5n.o


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug driver/57652] [4.7/4.8/4.9 Regression] collect2 does not clean up temporary files
  2013-06-19 13:47 [Bug driver/57652] New: [4.7/4.8/4.9 Regression] collect2 does not clean up temporary files dje at gcc dot gnu.org
@ 2013-06-19 13:50 ` dje at gcc dot gnu.org
  2013-06-19 17:37 ` dje at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: dje at gcc dot gnu.org @ 2013-06-19 13:50 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57652

David Edelsohn <dje at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
      Known to work|                            |4.6.3
           Keywords|                            |error-recovery
   Last reconfirmed|                            |2013-06-19
                 CC|                            |jsm28 at gcc dot gnu.org
     Ever confirmed|0                           |1
   Target Milestone|---                         |4.9.0
      Known to fail|                            |4.7.0, 4.7.1, 4.7.2, 4.7.3,
                   |                            |4.8.0, 4.8.1

--- Comment #1 from David Edelsohn <dje at gcc dot gnu.org> ---
Confirmed.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug driver/57652] [4.7/4.8/4.9 Regression] collect2 does not clean up temporary files
  2013-06-19 13:47 [Bug driver/57652] New: [4.7/4.8/4.9 Regression] collect2 does not clean up temporary files dje at gcc dot gnu.org
  2013-06-19 13:50 ` [Bug driver/57652] " dje at gcc dot gnu.org
@ 2013-06-19 17:37 ` dje at gcc dot gnu.org
  2013-06-22 18:47 ` dje at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: dje at gcc dot gnu.org @ 2013-06-19 17:37 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57652

--- Comment #2 from David Edelsohn <dje at gcc dot gnu.org> ---
Prototype patch to use atexit.

        PR driver/57652
        * collect2.c (collect_atexit): New.
        (collect_exit): Directly call exit.
        (main): Register collect_atexit with atexit.

Index: collect2.c
===================================================================
--- collect2.c  (revision 200203)
+++ collect2.c  (working copy)
@@ -367,7 +367,7 @@
 /* Delete tempfiles and exit function.  */

 void
-collect_exit (int status)
+collect_atexit (void)
 {
   if (c_file != 0 && c_file[0])
     maybe_unlink (c_file);
@@ -395,12 +395,13 @@
       maybe_unlink (lderrout);
     }

-  if (status != 0 && output_file != 0 && output_file[0])
-    maybe_unlink (output_file);
-
   if (response_file)
     maybe_unlink (response_file);
+}

+void
+collect_exit (int status)
+{
   exit (status);
 }

@@ -970,6 +971,9 @@
   signal (SIGCHLD, SIG_DFL);
 #endif

+  if (atexit (collect_atexit) != 0)
+    fatal_error ("atexit failed");
+
   /* Unlock the stdio streams.  */
   unlock_std_streams ();


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug driver/57652] [4.7/4.8/4.9 Regression] collect2 does not clean up temporary files
  2013-06-19 13:47 [Bug driver/57652] New: [4.7/4.8/4.9 Regression] collect2 does not clean up temporary files dje at gcc dot gnu.org
  2013-06-19 13:50 ` [Bug driver/57652] " dje at gcc dot gnu.org
  2013-06-19 17:37 ` dje at gcc dot gnu.org
@ 2013-06-22 18:47 ` dje at gcc dot gnu.org
  2021-08-30 22:20 ` pinskia at gcc dot gnu.org
  2021-08-30 22:20 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: dje at gcc dot gnu.org @ 2013-06-22 18:47 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57652

David Edelsohn <dje at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to work|                            |4.7.4, 4.8.2
         Resolution|---                         |FIXED

--- Comment #3 from David Edelsohn <dje at gcc dot gnu.org> ---
Patch committed and backported.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug driver/57652] [4.7/4.8/4.9 Regression] collect2 does not clean up temporary files
  2013-06-19 13:47 [Bug driver/57652] New: [4.7/4.8/4.9 Regression] collect2 does not clean up temporary files dje at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2013-06-22 18:47 ` dje at gcc dot gnu.org
@ 2021-08-30 22:20 ` pinskia at gcc dot gnu.org
  2021-08-30 22:20 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-30 22:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57652

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dilyan.palauzov at aegee dot org

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 79181 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug driver/57652] [4.7/4.8/4.9 Regression] collect2 does not clean up temporary files
  2013-06-19 13:47 [Bug driver/57652] New: [4.7/4.8/4.9 Regression] collect2 does not clean up temporary files dje at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-08-30 22:20 ` pinskia at gcc dot gnu.org
@ 2021-08-30 22:20 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-30 22:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57652

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andi-gcc at firstfloor dot org

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 50786 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-08-30 22:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-19 13:47 [Bug driver/57652] New: [4.7/4.8/4.9 Regression] collect2 does not clean up temporary files dje at gcc dot gnu.org
2013-06-19 13:50 ` [Bug driver/57652] " dje at gcc dot gnu.org
2013-06-19 17:37 ` dje at gcc dot gnu.org
2013-06-22 18:47 ` dje at gcc dot gnu.org
2021-08-30 22:20 ` pinskia at gcc dot gnu.org
2021-08-30 22:20 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).