GNU bug report logs - #79252
Option 'file-precious-flag' creates unrelatable/untrackable temporary filenames

Previous Next

Package: emacs;

Reported by: "R. Diez" <rdiez-2006 <at> rd10.de>

Date: Sat, 16 Aug 2025 07:38:03 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Full log


View this message in rfc822 format

From: "R. Diez" <rdiez-2006 <at> rd10.de>
To: Eli Zaretskii <eliz <at> gnu.org>, Michael Albinus <michael.albinus <at> gmx.de>
Cc: 79252 <at> debbugs.gnu.org
Subject: bug#79252: Option 'file-precious-flag' creates unrelatable/untrackable temporary filenames
Date: Sun, 17 Aug 2025 20:58:38 +0200
> I think the patch below should do what you are asking for.

I don't really know much Emacs or Lisp, but the patch looks fine to me too.

At first, I thought that Tramp was the one creating the temporary file, so I suggested this change to Tramp:

> For a file like:
>
> myfile.txt
>
> I suggest a temporary filename like:
>
> myfile.txt.EmacsTrampTmp1eghjG

Michael Albinus' reply was:

> That wouldn't be possible. An extension, like ".txt", must be kept.

See the full text here: https://lists.gnu.org/archive/html/tramp-devel/2025-08/msg00008.html

Your patch does change the file extension, but I do not know whether that is actually a problem. The original temporary filename had no extension anyway.


> I don't see an issue. It is just the idea, that the temp file is more
> related to the canonical file instead of the link source.

While checking 'file-precious-flag' because of this issue, I saw related option 'file-preserve-symlinks-on-save'.

The documentation does not recommend enabling it, or leaving it disabled, but since enabling it seems to mirror the symlink behaviour when 'file-precious-flag' is disabled, I decided to enable 'file-preserve-symlinks-on-save' on my system. So far without trouble.

I am mentioning it mainly because I would imagine the Lisp code that queries 'file-preserve-symlinks-on-save' could offer some insight into the necessary symlink handling. However, if anything comes out of that, I would do it in a separate patch.




This bug report was last modified 20 days ago.

Previous Next


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