GNU bug report logs - #3328
set-default-file-modes on Windows Emacs broken

Previous Next

Package: emacs;

Reported by: Matthew Carter <r_q_einstein-emacsbugreport <at> yahoo.com>

Date: Mon, 18 May 2009 20:45:03 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #10 received at 3328-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Matthew Carter <r_q_einstein-emacsbugreport <at> yahoo.com>,
        3328-done <at> debbugs.gnu.org
Subject: Re: bug#3328: set-default-file-modes on Windows Emacs broken
Date: Tue, 19 May 2009 22:38:46 +0300
> Date: Mon, 18 May 2009 16:39:31 -0400
> From: Matthew Carter <r_q_einstein-emacsbugreport <at> yahoo.com>
> Cc: 
> 
> Run this lisp expression:
>   (set-default-file-modes ?\644)
> e.g., by putting it in your ~/.emacs or by using M-:
> 
> Then, create a new file, "foo.txt".
> Then, in a cygwin bash shell, run "ls -l foo.txt".
> The file SHOULD have these permissions:
>   -rw-r--r--
> But instead, it has these permissions:
>   -rwxrwxrwx

This is not a bug.  Maybe a missing feature (which is not easy to
implement).  Details follow.

First, the way native Windows programs (such as Emacs) implement
Unix-style permission mode bits, and the way Cygwin implements them,
are very different.  Native Windows applications only look at the
first (most significant) 3 mode bits, and ignore the rest.  Thus,
0644, 0664, and 0666 will all give the same effect: create a file that
is readable and writable by the owner.  If you use 0444, you will get
a read-only file.  And that is about all you can meaningfully get in
the native Windows build of Emacs: the MS emulation of `umask' does
not allow to create files that are not readable by the owner, and it
can not set the executable (x) bit.

This all is a consequence of a simple fact that the MS emulation of
`umask' and related features use a single bit in the file's
attributes: the readonly bit.

Cygwin, OTOH, uses Windows NT security features to emulate the Posix
permissions much closer.  It almost completely ignores the readonly
bit, and instead manipulates the Windows ACLs to emulate Posix
permissions, including owner, group, and world permissions.

So you are (a) expecting from NTEmacs more than it currently supports,
and (b) use incompatible tools to assess the effect of operations on
the file permission bits.

Therefore, I'm closing this bug report.

Thanks anyway for your detailed report.




This bug report was last modified 16 years and 3 days ago.

Previous Next


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