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: Eli Zaretskii
Subject: bug#62260: 30.0.50; [PATCH] Restrict auto-save file mode
Date: Sun, 19 Mar 2023 16:11:02 +0200

> From: Michael Albinus <michael.albinus@gmx.de>
> Cc: Manuel Giraud <manuel@ledu-giraud.fr>,  62260@debbugs.gnu.org
> Date: Sun, 19 Mar 2023 13:40:29 +0100
> 
> Tramp has no influence on the permissions of the auto-saved file.

My reading of the code in auto_save_1 is that the permission modes of
the auto-saved files for remote files are determined from their
original files, by calling file-modes (which I believe Tramp
implements?).  See the 'else' branch of this part of auto_save_1:

  /* Get visited file's mode to become the auto save file's mode.  */
  if (! NILP (BVAR (current_buffer, filename)))
    {
      if (emacs_fstatat (AT_FDCWD, SSDATA (BVAR (current_buffer, filename)),
                         &st, 0)
          == 0)
        /* But make sure we can overwrite it later!  */
        auto_save_mode_bits = (st.st_mode | 0600) & 0777;
      else if (modes = Ffile_modes (BVAR (current_buffer, filename), Qnil),
               FIXNUMP (modes))
        /* Remote files don't cooperate with fstatat.  */
        auto_save_mode_bits = (XFIXNUM (modes) | 0600) & 0777;
    }

If by "Tramp has no influence on the permissions of the auto-saved
file" you mean the permissions are determined by the file, not by
Tramp, then I agree.  This simply follows what we do with local files,
just by calling an Emacs primitive instead of fstatat.





reply via email to

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