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

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

Setting file-precious-flag fails to honour umask on new files


From: David Howells
Subject: Setting file-precious-flag fails to honour umask on new files
Date: Wed, 14 Jun 2006 17:14:21 +0100

Follow this process:

 (1) Create a directory with permissions 02775 and cd into it.

 (2) Do "umask 2"

 (3) Do "emacs -q" (turn off .emacs effects)

 (4) M-: (set-variable 'file-precious-flag t)

 (5) Create a new file (C-x C-f hello.c)

 (6) Type something in to the buffer (shouldn't matter what) and save it.

 (7) Exit emacs.

 (8) Do "echo `stat -c %a hello.c`" to view the file's permissions mask.

I see the result of step (8) as being 600 which is _not_ what I'd expect.  If
I then do this:

 (a) echo aaa >aaa.c

 (b) echo `stat -c %a aaa.c`

I see the result of step (b) as being 664 which _is_ what I'd expect.

Running through steps (1) - (8) but missing out step (4) gets emacs to produce
the result I'd expect - step (8) showing 664.

stracing emacs shows the umask being changed around the save (note write() and
various other irrelevant syscalls are here suppressed in strace's output):

...
umask(0)                                = 02
umask(02)                               = 0
umask(077)                              = 02
stat("/tmp/test/tmp27776wND", 0x7fffffba03b0) = -1 ENOENT (No such file or 
directory)
lstat("/tmp/test/.#hello.c", {st_mode=S_IFLNK|0777, st_size=54, ...}) = 0
symlink("address@hidden:1149507404", "/tmp/test/.#hello.c") = -1 EEXIST (File 
exists)
readlink("/tmp/test/.#hello.c", "address@hidden:1149507404", 100) = 54
open("/tmp/test/tmp27776wND", O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, 0666) = 3
fsync(3)                                = 0
close(3)                                = 0
stat("/tmp/test/tmp27776wND", {st_mode=S_IFREG|0600, st_size=5, ...}) = 0
lstat("/tmp/test/.#hello.c", {st_mode=S_IFLNK|0777, st_size=54, ...}) = 0
readlink("/tmp/test/.#hello.c", "address@hidden:1149507404", 100) = 54
unlink("/tmp/test/.#hello.c") = 0
--- SIGIO (I/O possible) @ 0 (0) ---
rt_sigreturn(0)                         = 73
umask(02)                               = 077
stat("/warthog/servicemgr/hello.c", 0x7fffffba0710) = -1 ENOENT (No such file 
or directory)
stat("/warthog/servicemgr/hello.c", 0x7fffffba06d0) = -1 ENOENT (No such file 
or directory)
rename("/warthog/servicemgr/tmp27776wND", "/warthog/servicemgr/hello.c") = 0
lstat("/warthog/servicemgr/hello.c", {st_mode=S_IFREG|0600, st_size=5, ...}) = 0
...

Looking in files.el, I can see various places that do:

        (set-default-file-modes ?\700)

And I presume this to be due to one of those, probably in basic-save-buffer-2.


In GNU Emacs 22.0.50.2 (x86_64-unknown-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2006-05-26 on warthog.cambridge.redhat.com
X server distributor `The X.Org Foundation', version 11.0.70000000
configured using `configure '--prefix=/warthog/emacs64''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  display-time-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: identity

Recent input:
C-x C-s <down-mouse-1> <mouse-1> C-x b . e <tab> <return> 
<down-mouse-1> <mouse-movement> <mouse-movement> <drag-mouse-1> 
<down-mouse-1> <mouse-movement> <mouse-movement> <drag-mouse-1> 
<down-mouse-1> <mouse-1> <down-mouse-1> <mouse-1> C-h 
f <return> <down-mouse-1> <mouse-1> C-h v <return> 
C-x 1 C-x b f i <tab> s <tab> . <tab> C-x C-g C-x b 
<return> C-x b <return> C-h v <return> <help-echo> 
<help-echo> <down-mouse-2> <mouse-2> C-x 1 <C-right> 
<C-right> <C-left> C-s C-w C-w C-w <C-home> C-s C-s 
C-s C-s C-s C-r C-r C-z C-a M-x b u g <tab> <M-backspace> 
e m a <tab> b <tab> <backspace> <backspace> <tab> <tab> 
C-g <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <menu-bar> <help-menu> <report-emacs-b
ug>

Recent messages:
Type C-x 1 to remove help window.  
Quit
Type C-x 1 to remove help window.  
uncompressing files.el.gz...done
Mark saved where search started
Mark set
Mark saved where search started
Making completion list...
Quit
Loading emacsbug...done




reply via email to

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