unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Execute permission on Windows XP emacs 22.1
Date: Mon, 09 Jul 2007 15:19:52 +0300	[thread overview]
Message-ID: <u7ip9bwgn.fsf@gnu.org> (raw)
In-Reply-To: <20070709091427.GA14208@void.printf.net> (message from Pete Gillin on Mon, 9 Jul 2007 10:14:27 +0100)

> 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	other threads:[~2007-07-09 12:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-09  9:14 Execute permission on Windows XP emacs 22.1 Pete Gillin
2007-07-09 12:19 ` Eli Zaretskii [this message]
2007-07-09 13:46   ` Pete Gillin
2007-07-09 14:42     ` Eli Zaretskii
2007-07-09 15:03       ` Pete Gillin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=u7ip9bwgn.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).