public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Rearrange detection of temporary directory for NetBSD
@ 2020-03-18 19:29 Kamil Rytarowski
  2020-03-25 22:36 ` Jeff Law
  0 siblings, 1 reply; 6+ messages in thread
From: Kamil Rytarowski @ 2020-03-18 19:29 UTC (permalink / raw)
  To: gcc-patches

Set /tmp first, then /var/tmp. /tmp is volatile on NetBSD and
/var/tmp not. This improves performance in the common use.
The downstream copy of GCC was patched for this preference
since 2015.

Remove occurence of /usr/tmp as it was never valid for NetBSD.
It was already activey disabled in the GCC manual page in 1996 and
in the GCC source code at least in 1998.

This change is not a matter of user-preference but Operating
System defaults that disagree with the libiberty detection plan.

No functional change for other Operataing Systems/environments.

libiberty/ChangeLog:

	* make-temp-file.c (choose_tmpdir): Honor NetBSD specific paths.
---
 libiberty/ChangeLog        | 4 ++++
 libiberty/make-temp-file.c | 8 +++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 106c107e91a..18b9357aaed 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,7 @@
+2020-03-18  Kamil Rytarowski  <n54@gmx.com>
+
+	* make-temp-file.c (choose_tmpdir): Honor NetBSD specific paths.
+
 2020-03-05  Egeyar Bagcioglu  <egeyar.bagcioglu@oracle.com>

 	* simple-object.c (handle_lto_debug_sections): Name
diff --git a/libiberty/make-temp-file.c b/libiberty/make-temp-file.c
index cb08c27af6f..674333f042b 100644
--- a/libiberty/make-temp-file.c
+++ b/libiberty/make-temp-file.c
@@ -129,10 +129,16 @@ choose_tmpdir (void)
 	base = try_dir (P_tmpdir, base);
 #endif

-      /* Try /var/tmp, /usr/tmp, then /tmp.  */
+#if defined(__NetBSD__)
+      /* Try /tmp (volatile), then /var/tmp (non-volatile) on NetBSD.  */
+      base = try_dir (tmp, base);
+      base = try_dir (vartmp, base);
+#else
+      /* For others try /var/tmp, /usr/tmp, then /tmp.  */
       base = try_dir (vartmp, base);
       base = try_dir (usrtmp, base);
       base = try_dir (tmp, base);
+#endif

       /* If all else fails, use the current directory!  */
       if (base == 0)
--
2.25.0


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

* Re: [PATCH] Rearrange detection of temporary directory for NetBSD
  2020-03-18 19:29 [PATCH] Rearrange detection of temporary directory for NetBSD Kamil Rytarowski
@ 2020-03-25 22:36 ` Jeff Law
  2020-03-26  0:39   ` Kamil Rytarowski
  0 siblings, 1 reply; 6+ messages in thread
From: Jeff Law @ 2020-03-25 22:36 UTC (permalink / raw)
  To: Kamil Rytarowski, gcc-patches

On Wed, 2020-03-18 at 20:29 +0100, Kamil Rytarowski wrote:
> Set /tmp first, then /var/tmp. /tmp is volatile on NetBSD and
> /var/tmp not. This improves performance in the common use.
> The downstream copy of GCC was patched for this preference
> since 2015.
> 
> Remove occurence of /usr/tmp as it was never valid for NetBSD.
> It was already activey disabled in the GCC manual page in 1996 and
> in the GCC source code at least in 1998.
> 
> This change is not a matter of user-preference but Operating
> System defaults that disagree with the libiberty detection plan.
> 
> No functional change for other Operataing Systems/environments.
> 
> libiberty/ChangeLog:
> 
> 	* make-temp-file.c (choose_tmpdir): Honor NetBSD specific paths.
> ---
>  libiberty/ChangeLog        | 4 ++++
>  libiberty/make-temp-file.c | 8 +++++++-
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
> index 106c107e91a..18b9357aaed 100644
> --- a/libiberty/ChangeLog
> +++ b/libiberty/ChangeLog
> @@ -1,3 +1,7 @@
> +2020-03-18  Kamil Rytarowski  <n54@gmx.com>
> +
> +	* make-temp-file.c (choose_tmpdir): Honor NetBSD specific paths.
I'd strongly recommend against this as-is.

The whole reason we prefer /var/tmp is because it's often dramatically larger
than a ram-backed /tmp.

I wouldn't mind dropping /usr/tmp.  That so antiquated that it'd be non-
controversial.  Can you send that as a separate patch.

Jeff
> 


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

* Re: [PATCH] Rearrange detection of temporary directory for NetBSD
  2020-03-25 22:36 ` Jeff Law
@ 2020-03-26  0:39   ` Kamil Rytarowski
  2021-06-28 22:45     ` Gerald Pfeifer
  0 siblings, 1 reply; 6+ messages in thread
From: Kamil Rytarowski @ 2020-03-26  0:39 UTC (permalink / raw)
  To: law, gcc-patches

On 25.03.2020 23:36, Jeff Law wrote:
> On Wed, 2020-03-18 at 20:29 +0100, Kamil Rytarowski wrote:
>> Set /tmp first, then /var/tmp. /tmp is volatile on NetBSD and
>> /var/tmp not. This improves performance in the common use.
>> The downstream copy of GCC was patched for this preference
>> since 2015.
>>
>> Remove occurence of /usr/tmp as it was never valid for NetBSD.
>> It was already activey disabled in the GCC manual page in 1996 and
>> in the GCC source code at least in 1998.
>>
>> This change is not a matter of user-preference but Operating
>> System defaults that disagree with the libiberty detection plan.
>>
>> No functional change for other Operataing Systems/environments.
>>
>> libiberty/ChangeLog:
>>
>> 	* make-temp-file.c (choose_tmpdir): Honor NetBSD specific paths.
>> ---
>>  libiberty/ChangeLog        | 4 ++++
>>  libiberty/make-temp-file.c | 8 +++++++-
>>  2 files changed, 11 insertions(+), 1 deletion(-)
>>
>> diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
>> index 106c107e91a..18b9357aaed 100644
>> --- a/libiberty/ChangeLog
>> +++ b/libiberty/ChangeLog
>> @@ -1,3 +1,7 @@
>> +2020-03-18  Kamil Rytarowski  <n54@gmx.com>
>> +
>> +	* make-temp-file.c (choose_tmpdir): Honor NetBSD specific paths.
> I'd strongly recommend against this as-is.
>
> The whole reason we prefer /var/tmp is because it's often dramatically larger
> than a ram-backed /tmp.
>

NetBSD supports swap whenever /tmp is too small. Whenever tmpfs+ram are
too small, users use /tmp that is a regular directory (if I am not
wrong, this is still the default setup from an installer).

In NetBSD we want to use a non-persistent storage for performance
reasons. /var/tmp also affects negatively modern SSD devices with
needless writes.

It would be enough to get these try_dir paths tuned at least from
preprocessor during libiberty build for gdb/gcc/etc.

> 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.

> Jeff
>>
>


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

* Re: [PATCH] Rearrange detection of temporary directory for NetBSD
  2020-03-26  0:39   ` Kamil Rytarowski
@ 2021-06-28 22:45     ` Gerald Pfeifer
  2021-06-29 15:15       ` Jeff Law
  0 siblings, 1 reply; 6+ messages in thread
From: Gerald Pfeifer @ 2021-06-28 22:45 UTC (permalink / raw)
  To: Kamil Rytarowski, Jeff Law; +Cc: gcc-patches

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!  */

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

* Re: [PATCH] Rearrange detection of temporary directory for NetBSD
  2021-06-28 22:45     ` Gerald Pfeifer
@ 2021-06-29 15:15       ` Jeff Law
  2021-06-30 22:03         ` Gerald Pfeifer
  0 siblings, 1 reply; 6+ messages in thread
From: Jeff Law @ 2021-06-29 15:15 UTC (permalink / raw)
  To: Gerald Pfeifer, Kamil Rytarowski, Jeff Law; +Cc: gcc-patches



On 6/28/2021 4:45 PM, Gerald Pfeifer wrote:
> 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.
Yup.  This is fine.  You might consider updating the comment which 
references /usr/tmp in choose_tmpdir along the way.
jeff


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

* Re: [PATCH] Rearrange detection of temporary directory for NetBSD
  2021-06-29 15:15       ` Jeff Law
@ 2021-06-30 22:03         ` Gerald Pfeifer
  0 siblings, 0 replies; 6+ messages in thread
From: Gerald Pfeifer @ 2021-06-30 22:03 UTC (permalink / raw)
  To: Jeff Law; +Cc: Kamil Rytarowski, gcc-patches

On Tue, 29 Jun 2021, Jeff Law wrote:
>>      2021-06-29  Gerald Pfeifer  <gerald@pfeifer.com>
>>      
>>              * make-temp-file.c (usrtmp): Remove.
>>              (choose_tmpdir): Remove use of usrtmp.
> Yup.  This is fine.  You might consider updating the comment which 
> references /usr/tmp in choose_tmpdir along the way.

You've got sharp eyes - and gave me the opportunity to practice
`git rebase -i`. ;-)

Pushed, thank you.

Gerald

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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-18 19:29 [PATCH] Rearrange detection of temporary directory for NetBSD Kamil Rytarowski
2020-03-25 22:36 ` Jeff Law
2020-03-26  0:39   ` Kamil Rytarowski
2021-06-28 22:45     ` Gerald Pfeifer
2021-06-29 15:15       ` Jeff Law
2021-06-30 22:03         ` Gerald Pfeifer

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).