[PATCH] Rearrange detection of temporary directory for NetBSD

Gerald Pfeifer gerald@pfeifer.com
Mon Jun 28 22:45:30 GMT 2021


On Thu, 26 Mar 2020, Kamil Rytarowski wrote:
> On 25.03.2020 23:36, Jeff Law wrote:
>> I wouldn't mind dropping /usr/tmp.  That so antiquated that it'd be 
>> non- controversial.  Can you send that as a separate patch.
> Behavior for !__NetBSD__ is out of interest.

This is not a very useful approach in a collaborative project like GCC.

Incremental changes (including cleanups) help and are a good way to get 
engaged, improve the overall code base, and gain support from others 
(who may not have any interest in the __NetBSD__ case, but be willing 
to collaborate).

@Jeff, is the following what you had in mind?  

It passed testing on i686-unknown-freebsd12; okay to push?

Gerald


commit 8365565396cee65aeb6c2e4bfad74e095a3c388c
Author: Gerald Pfeifer <gerald@pfeifer.com>
Date:   Tue Jun 29 00:39:15 2021 +0200

    libiberty: No longer use /usr/tmp
    
    /usr/tmp is antiquated and not present on decently modern systems.
    Remove it from consideration when choosing a directory for temporary
    files.
    
    libiberty:
    
    2021-06-29  Gerald Pfeifer  <gerald@pfeifer.com>
    
            * make-temp-file.c (usrtmp): Remove.
            (choose_tmpdir): Remove use of usrtmp.

diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 1c9138861bd..2f8390cc63a 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,8 @@
+2021-06-13  Gerald Pfeifer  <gerald@pfeifer.com>
+
+	* make-temp-file.c (usrtmp): Remove.
+	(choose_tmpdir): Remove use of usrtmp.
+
 2021-06-05  John David Anglin  <danglin@gcc.gnu.org>
 
 	PR target/100734
diff --git a/libiberty/make-temp-file.c b/libiberty/make-temp-file.c
index 7465cec5ea6..cad0645619e 100644
--- a/libiberty/make-temp-file.c
+++ b/libiberty/make-temp-file.c
@@ -81,8 +81,6 @@ try_dir (const char *dir, const char *base)
 }
 
 static const char tmp[] = { DIR_SEPARATOR, 't', 'm', 'p', 0 };
-static const char usrtmp[] =
-{ DIR_SEPARATOR, 'u', 's', 'r', DIR_SEPARATOR, 't', 'm', 'p', 0 };
 static const char vartmp[] =
 { DIR_SEPARATOR, 'v', 'a', 'r', DIR_SEPARATOR, 't', 'm', 'p', 0 };
 
@@ -131,7 +129,6 @@ choose_tmpdir (void)
 
       /* Try /var/tmp, /usr/tmp, then /tmp.  */
       base = try_dir (vartmp, base);
-      base = try_dir (usrtmp, base);
       base = try_dir (tmp, base);
       
       /* If all else fails, use the current directory!  */


More information about the Gcc-patches mailing list