bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#62260: 30.0.50; [PATCH] Restrict auto-save file mode


From: Michael Albinus
Subject: bug#62260: 30.0.50; [PATCH] Restrict auto-save file mode
Date: Thu, 23 Mar 2023 17:26:25 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Manuel Giraud <manuel@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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]