GNU bug report logs - #75306
31.0.50; Make `small-temporary-file-directory` variable obsolete

Previous Next

Package: emacs;

Reported by: Stefan Kangas <stefankangas <at> gmail.com>

Date: Fri, 3 Jan 2025 03:24:01 UTC

Severity: wishlist

Found in version 31.0.50

To reply to this bug, email your comments to 75306 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to michael.albinus <at> gmx.de, bug-gnu-emacs <at> gnu.org:
bug#75306; Package emacs. (Fri, 03 Jan 2025 03:24:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Kangas <stefankangas <at> gmail.com>:
New bug report received and forwarded. Copy sent to michael.albinus <at> gmx.de, bug-gnu-emacs <at> gnu.org. (Fri, 03 Jan 2025 03:24:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 31.0.50; Make `small-temporary-file-directory` variable obsolete
Date: Thu, 2 Jan 2025 21:23:12 -0600
[Message part 1 (text/plain, inline)]
Severity: wishlist

The variable `small-temporary-file-directory` was created in 2000 for
MS-DOS systems and systems with widely different specs than what we run
now.  Putting temporary files on a RAM disk should be done by the system
administrator (usually the user themselves), for example by simply using
tmpfs for _all_ temporary files (not just "small" ones, whatever that
means).

I think the variable doesn't make much sense these days, and should be
made obsolete.  Note that it is barely used in Emacs and third-party
packages.

However, Tramp recently started using the variable as a place to create
OpenSSH Unix domain sockets.  May I suggest that Tramp uses some other
variable for this purpose, perhaps a Tramp specific one?

I've attached a diff that makes the variable obsolete and removes all
uses, for reference.
[rmvar.diff (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75306; Package emacs. (Fri, 03 Jan 2025 05:57:01 GMT) Full text and rfc822 format available.

Message #8 received at 75306 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 75306 <at> debbugs.gnu.org
Subject: Re: bug#75306: 31.0.50; Make `small-temporary-file-directory`
 variable obsolete
Date: Fri, 03 Jan 2025 06:56:03 +0100
Stefan Kangas <stefankangas <at> gmail.com> writes:

Hi Stefan,

> I think the variable doesn't make much sense these days, and should be
> made obsolete.  Note that it is barely used in Emacs and third-party
> packages.
>
> However, Tramp recently started using the variable as a place to create
> OpenSSH Unix domain sockets.  May I suggest that Tramp uses some other
> variable for this purpose, perhaps a Tramp specific one?

Is there a reason that it must be changed? What are the advantages? Does
it hurt to keep the user option?

And in the Tramp case, you break an existing interface. Users have been
instructed to change the value of small-temporary-file-directory when
needed. See (info "(tramp) Frequently Asked Questions"), which documents
a user problem reported on the <tramp-devel <at> gnu.org> ML.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75306; Package emacs. (Fri, 03 Jan 2025 08:27:02 GMT) Full text and rfc822 format available.

Message #11 received at 75306 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 75306 <at> debbugs.gnu.org
Subject: Re: bug#75306: 31.0.50; Make `small-temporary-file-directory`
 variable obsolete
Date: Fri, 3 Jan 2025 02:26:29 -0600
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Stefan Kangas <stefankangas <at> gmail.com> writes:
>
> Hi Stefan,
>
>> I think the variable doesn't make much sense these days, and should be
>> made obsolete.  Note that it is barely used in Emacs and third-party
>> packages.
>>
>> However, Tramp recently started using the variable as a place to create
>> OpenSSH Unix domain sockets.  May I suggest that Tramp uses some other
>> variable for this purpose, perhaps a Tramp specific one?
>
> Is there a reason that it must be changed? What are the advantages? Does
> it hurt to keep the user option?

It doesn't hurt to keep it.  The advantage is that we get rid of a
redundant variable.

> And in the Tramp case, you break an existing interface. Users have been
> instructed to change the value of small-temporary-file-directory when
> needed. See (info "(tramp) Frequently Asked Questions"), which documents
> a user problem reported on the <tramp-devel <at> gnu.org> ML.

Thanks.  Would something like this work?

(define-obsolete-variable-alias 'small-temporary-file-directory
  'temporary-file-directory "31.1")




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75306; Package emacs. (Fri, 03 Jan 2025 08:40:01 GMT) Full text and rfc822 format available.

Message #14 received at 75306 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 75306 <at> debbugs.gnu.org, stefankangas <at> gmail.com
Subject: Re: bug#75306: 31.0.50;
 Make `small-temporary-file-directory` variable obsolete
Date: Fri, 03 Jan 2025 10:39:14 +0200
> Cc: 75306 <at> debbugs.gnu.org
> Date: Fri, 03 Jan 2025 06:56:03 +0100
> From:  Michael Albinus via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> Stefan Kangas <stefankangas <at> gmail.com> writes:
> 
> Hi Stefan,
> 
> > I think the variable doesn't make much sense these days, and should be
> > made obsolete.  Note that it is barely used in Emacs and third-party
> > packages.
> >
> > However, Tramp recently started using the variable as a place to create
> > OpenSSH Unix domain sockets.  May I suggest that Tramp uses some other
> > variable for this purpose, perhaps a Tramp specific one?
> 
> Is there a reason that it must be changed? What are the advantages? Does
> it hurt to keep the user option?

Exactly my questions.

The doc string says:

  If non-nil, this directory is used instead of ‘temporary-file-directory’
  by programs that create small temporary files.  This is for systems that
  have fast storage with limited space, such as a RAM disk.

This says nothing about MS-DOS, and makes perfect sense to me.  It
gives our users a capability to direct small enough temporary files to
a fast temporary filesystem.  If the OS sets this up, then users will
not need to customize this variable, whose default is nil.  But if
some user has a good reason to customize this, why take that
flexibility from them?  How do we justify removal of a feature which
could be useful to someone?  From my POV, this feature needs zero
maintenance.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75306; Package emacs. (Fri, 03 Jan 2025 08:50:02 GMT) Full text and rfc822 format available.

Message #17 received at 75306 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 75306 <at> debbugs.gnu.org, michael.albinus <at> gmx.de
Subject: Re: bug#75306: 31.0.50;
 Make `small-temporary-file-directory` variable obsolete
Date: Fri, 03 Jan 2025 10:49:30 +0200
> Cc: 75306 <at> debbugs.gnu.org
> From: Stefan Kangas <stefankangas <at> gmail.com>
> Date: Fri, 3 Jan 2025 02:26:29 -0600
> 
> Thanks.  Would something like this work?
> 
> (define-obsolete-variable-alias 'small-temporary-file-directory
>   'temporary-file-directory "31.1")

I don't see a need to annoy users of this variable with obsolescence
messages.  I don't think we should make this variable obsolete.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75306; Package emacs. (Fri, 03 Jan 2025 09:16:01 GMT) Full text and rfc822 format available.

Message #20 received at 75306 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Michael Albinus <michael.albinus <at> gmx.de>
Cc: 75306 <at> debbugs.gnu.org
Subject: Re: bug#75306: 31.0.50; Make `small-temporary-file-directory`
 variable obsolete
Date: Fri, 3 Jan 2025 03:15:49 -0600
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Cc: 75306 <at> debbugs.gnu.org
>> Date: Fri, 03 Jan 2025 06:56:03 +0100
>> From:  Michael Albinus via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>>
>> Stefan Kangas <stefankangas <at> gmail.com> writes:
>>
>> Hi Stefan,
>>
>> > I think the variable doesn't make much sense these days, and should be
>> > made obsolete.  Note that it is barely used in Emacs and third-party
>> > packages.
>> >
>> > However, Tramp recently started using the variable as a place to create
>> > OpenSSH Unix domain sockets.  May I suggest that Tramp uses some other
>> > variable for this purpose, perhaps a Tramp specific one?
>>
>> Is there a reason that it must be changed? What are the advantages? Does
>> it hurt to keep the user option?
>
> Exactly my questions.
>
> The doc string says:
>
>   If non-nil, this directory is used instead of ‘temporary-file-directory’
>   by programs that create small temporary files.  This is for systems that
>   have fast storage with limited space, such as a RAM disk.
>
> This says nothing about MS-DOS,

The docstring is one thing, but the variable _definition_ reads the same
today as when it was first introduced (in ffc0e1caf1a6):

(defvar small-temporary-file-directory
  (if (eq system-type 'ms-dos) (getenv "TMPDIR"))

This makes it clear that the intention was, at least in part, to support
MS-DOS specifically, and it has remained that over the years.

> and makes perfect sense to me.  It gives our users a capability to
> direct small enough temporary files to a fast temporary filesystem ...
> From my POV, this feature needs zero maintenance.

This feature would need maintenance just like any other, but it hasn't
seen too much of that.  If people had taken it seriously, we would have
seen it used it in many more places.

I doubt that this micro-optimization (or whatever we should call it) is
likely to give much bang for your buck, especially not in an age when
users are starting to routinely throw 500 MiB or even 1 GiB at their
tmpfs RAM disks.  Not everyone, of course, but this has been the general
direction; even low end systems have at minimum an order of magnitude
more resources now than when this variable was introduced 24 years ago.

> But if some user has a good reason to customize this, why take that
> flexibility from them?  How do we justify removal of a feature which
> could be useful to someone?

Besides the Tramp use case (which is valid and deserves its own
variable), it is used only in some very old modules: vc-rcs.el and
cmacexp.el, in shell-command-on-region, and literally nowhere else.
I suspect that it's removal wouldn't be noticed by anyone, even if we
were to assume that someone somewhere is getting slightly better
performance out of RCS/C macro expansions/Shell commands from using this.

I do agree that there's no compelling reason why we must remove _this
particular piece of cruft_ specifically, but I also don't see any good
reason to keep it.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75306; Package emacs. (Fri, 03 Jan 2025 11:48:01 GMT) Full text and rfc822 format available.

Message #23 received at 75306 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 75306 <at> debbugs.gnu.org, michael.albinus <at> gmx.de
Subject: Re: bug#75306: 31.0.50; Make `small-temporary-file-directory`
 variable obsolete
Date: Fri, 03 Jan 2025 13:46:52 +0200
> From: Stefan Kangas <stefankangas <at> gmail.com>
> Date: Fri, 3 Jan 2025 03:15:49 -0600
> Cc: 75306 <at> debbugs.gnu.org
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > This says nothing about MS-DOS,
> 
> The docstring is one thing, but the variable _definition_ reads the same
> today as when it was first introduced (in ffc0e1caf1a6):
> 
> (defvar small-temporary-file-directory
>   (if (eq system-type 'ms-dos) (getenv "TMPDIR"))
> 
> This makes it clear that the intention was, at least in part, to support
> MS-DOS specifically, and it has remained that over the years.

no, the _default_value_ caters to MS-DOS specifically.  But that
doesn't yet mean the variable itself is for that system.

> I doubt that this micro-optimization (or whatever we should call it) is
> likely to give much bang for your buck, especially not in an age when
> users are starting to routinely throw 500 MiB or even 1 GiB at their
> tmpfs RAM disks.

Maybe so, but we had this variable for eons, and I can easily imagine
valid use cases for it even today.  For example, some system whose
disks are of different speed (say, SSD and spinning disk).

> > But if some user has a good reason to customize this, why take that
> > flexibility from them?  How do we justify removal of a feature which
> > could be useful to someone?
> 
> Besides the Tramp use case (which is valid and deserves its own
> variable), it is used only in some very old modules: vc-rcs.el and
> cmacexp.el, in shell-command-on-region, and literally nowhere else.

Except by an unknown number of users.  Why break their setup?

> I do agree that there's no compelling reason why we must remove _this
> particular piece of cruft_ specifically, but I also don't see any good
> reason to keep it.

We should only remove or obsolete existing features if we have a good
reason for that.  A valid, and a very good, reason to keep a feature
is that we already have it.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75306; Package emacs. (Sat, 04 Jan 2025 09:55:02 GMT) Full text and rfc822 format available.

Message #26 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Björn Bidar <bjorn.bidar <at> thaodan.de>
To: Michael Albinus via "Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs <at> gnu.org>
Cc: 75306 <at> debbugs.gnu.org, Michael Albinus <michael.albinus <at> gmx.de>,
 Stefan Kangas <stefankangas <at> gmail.com>
Subject: Re: bug#75306: 31.0.50; Make `small-temporary-file-directory`
 variable obsolete
Date: Sat, 04 Jan 2025 11:54:06 +0200
Michael Albinus via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs <at> gnu.org> writes:

> Stefan Kangas <stefankangas <at> gmail.com> writes:
>
> Hi Stefan,
>
>> I think the variable doesn't make much sense these days, and should be
>> made obsolete.  Note that it is barely used in Emacs and third-party
>> packages.
>>
>> However, Tramp recently started using the variable as a place to create
>> OpenSSH Unix domain sockets.  May I suggest that Tramp uses some other
>> variable for this purpose, perhaps a Tramp specific one?
>
> Is there a reason that it must be changed? What are the advantages? Does
> it hurt to keep the user option?
>
> And in the Tramp case, you break an existing interface. Users have been
> instructed to change the value of small-temporary-file-directory when
> needed. See (info "(tramp) Frequently Asked Questions"), which documents
> a user problem reported on the <tramp-devel <at> gnu.org> ML.

If the intend of the variable is the same as listed in the Tramp FAQ why
not set it by default to /run/user/<uid>?

For such use cases using /run/user/<uid> is much better as it more
secure and on a ramdisk.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75306; Package emacs. (Sat, 04 Jan 2025 09:55:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75306; Package emacs. (Sat, 04 Jan 2025 11:27:02 GMT) Full text and rfc822 format available.

Message #32 received at 75306 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Björn Bidar <bjorn.bidar <at> thaodan.de>
Cc: "Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs <at> gnu.org>, 75306 <at> debbugs.gnu.org,
 Stefan Kangas <stefankangas <at> gmail.com>
Subject: Re: bug#75306: 31.0.50; Make `small-temporary-file-directory`
 variable obsolete
Date: Sat, 04 Jan 2025 12:26:36 +0100
Björn Bidar <bjorn.bidar <at> thaodan.de> writes:

Hi Björn,

>> And in the Tramp case, you break an existing interface. Users have been
>> instructed to change the value of small-temporary-file-directory when
>> needed. See (info "(tramp) Frequently Asked Questions"), which documents
>> a user problem reported on the <tramp-devel <at> gnu.org> ML.
>
> If the intend of the variable is the same as listed in the Tramp FAQ why
> not set it by default to /run/user/<uid>?
>
> For such use cases using /run/user/<uid> is much better as it more
> secure and on a ramdisk.

Because it isn't portable. The Tramp manual gives just an example.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75306; Package emacs. (Sat, 04 Jan 2025 11:28:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75306; Package emacs. (Sat, 04 Jan 2025 22:17:01 GMT) Full text and rfc822 format available.

Message #38 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Björn Bidar <bjorn.bidar <at> thaodan.de>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: "Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs <at> gnu.org>, 75306 <at> debbugs.gnu.org,
 Stefan Kangas <stefankangas <at> gmail.com>
Subject: Re: bug#75306: 31.0.50; Make `small-temporary-file-directory`
 variable obsolete
Date: Sun, 05 Jan 2025 00:16:43 +0200
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Björn Bidar <bjorn.bidar <at> thaodan.de> writes:
>
> Hi Björn,
>
>>> And in the Tramp case, you break an existing interface. Users have been
>>> instructed to change the value of small-temporary-file-directory when
>>> needed. See (info "(tramp) Frequently Asked Questions"), which documents
>>> a user problem reported on the <tramp-devel <at> gnu.org> ML.
>>
>> If the intend of the variable is the same as listed in the Tramp FAQ why
>> not set it by default to /run/user/<uid>?
>>
>> For such use cases using /run/user/<uid> is much better as it more
>> secure and on a ramdisk.
>
> Because it isn't portable. The Tramp manual gives just an example.

Portable across Unixes or Linux? For Linux /run/user is portable.
/var/run, which is symlinked to /run exists in BSD but not
/var/run/user.
However XDG_CACHE_HOME is already used in Tramp so using XDG_RUNTIME_DIR
should be a natural followup.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75306; Package emacs. (Sat, 04 Jan 2025 22:17:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75306; Package emacs. (Sun, 05 Jan 2025 05:31:02 GMT) Full text and rfc822 format available.

Message #44 received at 75306 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Björn Bidar <bjorn.bidar <at> thaodan.de>, 
 Michael Albinus <michael.albinus <at> gmx.de>
Cc: 75306 <at> debbugs.gnu.org
Subject: Re: bug#75306: 31.0.50; Make `small-temporary-file-directory`
 variable obsolete
Date: Sat, 4 Jan 2025 23:30:14 -0600
Björn Bidar via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs <at> gnu.org> writes:

> Michael Albinus <michael.albinus <at> gmx.de> writes:
>
>> Björn Bidar <bjorn.bidar <at> thaodan.de> writes:
>>
>> Hi Björn,
>>
>>>> And in the Tramp case, you break an existing interface. Users have been
>>>> instructed to change the value of small-temporary-file-directory when
>>>> needed. See (info "(tramp) Frequently Asked Questions"), which documents
>>>> a user problem reported on the <tramp-devel <at> gnu.org> ML.
>>>
>>> If the intend of the variable is the same as listed in the Tramp FAQ why
>>> not set it by default to /run/user/<uid>?
>>>
>>> For such use cases using /run/user/<uid> is much better as it more
>>> secure and on a ramdisk.
>>
>> Because it isn't portable. The Tramp manual gives just an example.
>
> Portable across Unixes or Linux?

Portable across all systems that we support, see etc/MACHINES.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75306; Package emacs. (Sun, 05 Jan 2025 08:19:02 GMT) Full text and rfc822 format available.

Message #47 received at 75306 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Björn Bidar <bjorn.bidar <at> thaodan.de>
Cc: "Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs <at> gnu.org>, 75306 <at> debbugs.gnu.org,
 Stefan Kangas <stefankangas <at> gmail.com>
Subject: Re: bug#75306: 31.0.50; Make `small-temporary-file-directory`
 variable obsolete
Date: Sun, 05 Jan 2025 09:18:36 +0100
Björn Bidar <bjorn.bidar <at> thaodan.de> writes:

Hi Björn,

> However XDG_CACHE_HOME is already used in Tramp so using XDG_RUNTIME_DIR
> should be a natural followup.

It is used only if it exists. And it isn't offered as user option, just
used internally.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75306; Package emacs. (Sun, 05 Jan 2025 08:19:02 GMT) Full text and rfc822 format available.

This bug report was last modified 162 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.