Subject: bug#44644: /tmp/emacs0/ not cleaned up upon exit

From: Eli Zaretskii <[email-masked]>
Date: Thu, 26 Nov 2020 15:41:31 +0200

> From: Lars Ingebrigtsen <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Wed, 25 Nov 2020 07:13:36 +0100
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> > I don't think it's kosher to delete $XDG_RUNTIME_DIR, even if it's
> > empty, since it is probably used by more than the server?  And if
> > XDG_RUNTIME_DIR is not defined, and we use a directory under /tmp,
> > then the system cleans that up from time to time, doesn't it?
> >
> > So bottom line, I don't think we should do this, at least not
> > unconditionally.
> 
> You raise some very good points.  Perhaps the only case where deleting
> the directory is the one described in the subject?  I.e., when the
> server directory has been created in `temporary-file-directory'?

At most, yes.  The problem is, it isn't easy to know when the
directory is under /tmp (we don't use temporary-file-directory, for
the reasons explained in the comment to server-socket-dir).  Maybe we
should put some special property on server-dir when that is the case?