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

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

Re: Execute permission on Windows XP emacs 22.1


From: Eli Zaretskii
Subject: Re: Execute permission on Windows XP emacs 22.1
Date: Mon, 09 Jul 2007 15:19:52 +0300

> Date: Mon, 9 Jul 2007 10:14:27 +0100
> From: Pete Gillin <pete@void.printf.net>
> 
> OS: Windows XP Pro / SP2
> Emacs: This is GNU Emacs 22.1.1 (i386-mingw-nt5.1.2600) of 2007-06-02
> on RELEASE
> 
> Can anyone explain to me why emacs refuses to create files without
> "Read and Execute" permission set (for the creating user)?

I don't see this, or maybe I don't understand how exactly did you try
this.  Would you please show a step-by-step recipe, starting with
"emacs -Q", to reproduce this problem?

On my machine (also an XP SP2), Emacs by default creates files that
have only Read and Write permissions set; no Execute permission.  I
look at the permission bits by running Dired on the parent directory.
How did you look at the permission bits in your case?

> I tried
> things like the following in my startup file, to set the value and
> allow me to inspect it immediately after setting (by looking at the
> variable) and at runtime (by running the insert function).
> 
> (set-default-file-modes ?\644)
> 
> (setq my-default-file-modes (number-to-string (default-file-modes)))
> 
> (defun insert-default-file-modes ()
>   "inserts current value of default-file-modes"
>   (interactive)
>   (insert (number-to-string (default-file-modes))))
> 
> Both ways of checking the value agree, and suggest that the value I
> have tried to set has been immediately ORed with 177 (octal). In the
> above case, when I've tried to set 644, the value actually set is 777.

Is the problem only with default-file-modes and set-default-file-modes? 
Or do you really see files created with wrong permissions?

If the problem is with default-file-modes and set-default-file-modes,
then it could be a bug with just these two functions, or it could be a
problem with your usage of them (or both).  In particular, you need to
be aware that the Windows implementation of the `umask' library
function, which is what these two Lisp functions call, does not
support the Execute bit (it masks it off, as if you never set it in
the argument to `umask'), and it also zeroes out the lower 6 bits of
the mask, i.e. it uses only the owner's bits, because the Windows
filesystem has only one set of permissions, not 3 sets as on Unix.
(Well, actually, the last part is not 100% true: NTFS volumes do
support much more elaborate access permissions on Windows NT and its
descendants, but Emacs does not call the APIs necessary to make use of
these features.)

> And looking at the file properties confirms that "Read and Execute" is
> set for the creating user whatever modes I've asked for.

Please describe how did you look at them, exactly.

> P.S. I know that the normal behaviour on Windows is to make everything
> executable by default

No, it isn't.  The default is to make files with read and write
permissions.  The executable permission isn't maintained as part of
the bits returned by `stat' and similar functions.

> P.P.S. The behaviour seemed to be even odder on emacs 21.3

I see the same behavior there, but again, I might be using a wrong
sequence of commands, not the one you used.




reply via email to

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