GNU bug report logs - #62260
30.0.50; [PATCH] Restrict auto-save file mode

Previous Next

Package: emacs;

Reported by: Manuel Giraud <manuel <at> ledu-giraud.fr>

Date: Sat, 18 Mar 2023 15:19:01 UTC

Severity: normal

Tags: patch

Merged with 57395

Found in versions 28.1, 30.0.50

Full log


View this message in rfc822 format

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Manuel Giraud <manuel <at> ledu-giraud.fr>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 62260 <at> debbugs.gnu.org
Subject: bug#62260: 30.0.50; [PATCH] Restrict auto-save file mode
Date: Thu, 23 Mar 2023 17:26:25 +0100
Manuel Giraud <manuel <at> ledu-giraud.fr> writes:

> Hi Michael,

Hi Manuel,

> What do you think of the attached patch?

Honestly, I haven't had enough time to review it in detail. My gut
feeling tells me that it looks to complicate and too much hard-coded,
but I will need to review. I hope I could do it next days.

> I think it fixes point 2 and 4 of bug#57395.  IMO point 3 (unsafe
> non-root-owned file) is not really solvable in a remote setup: local and
> remote uid can be any numbers.
>
> What I'd like to do then is to work on point 1.  For this, my idea is to
> make 'tramp-allow-unsafe-temporary-files' a three states variable with
> the following possible values:
>
>           - 'ask (default value): Prompt the user "Autosave file on
>             local temporary directory, do you want to continue?"
>
>           - nil: auto-save-mode should be disable on this file (same
>             behaviour when answering "no" to the prompt)
>             
>           - t: auto-save-mode is on as usual (same behaviour when
>             answering "yes" to the prompt)

Please take into account, that tramp-allow-unsafe-temporary-files is not
only for auto-save files. It is used also for backup and file locks. See
functions tramp-handle-find-backup-file-name, tramp-handle-lock-file and
tramp-handle-make-auto-save-file-name.

For the time being, I have added the possibility to suppress auto-save
for remote files. The Tramp manual says now:

--8<---------------cut here---------------start------------->8---
        − Keep auto-save files local.  This is already the default
          configuration in Emacs, don’t change it.  If you want to
          disable auto-saving for remote files at all, set
          ‘remote-file-name-inhibit-auto-save’ to ‘t’, but think about
          the consequences!

          If you want to disable auto-saving just for selected
          connections, for example due to security considerations, use
          connection-local variables in order to set
          ‘buffer-auto-save-file-name’.  If you, for example, want to
          disable auto-saving for all ‘sudo’ connections, apply the
          following code.  *Note (emacs)Connection Variables::.

               (connection-local-set-profile-variables
                 'my-auto-save-profile
                 '((buffer-auto-save-file-name . nil)))

               (connection-local-set-profiles
                '(:application tramp :protocol "sudo")
                'my-auto-save-profile)
--8<---------------cut here---------------end--------------->8---

Pushed to master.

Best regards, Michael.




This bug report was last modified 2 years and 84 days ago.

Previous Next


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