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


Message #44 received at 62260 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: manuel <at> ledu-giraud.fr, 62260 <at> debbugs.gnu.org
Subject: Re: 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 <at> gmx.de>
> Cc: Manuel Giraud <manuel <at> ledu-giraud.fr>,  62260 <at> 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.




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.