From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: Execute permission on Windows XP emacs 22.1 Date: Mon, 09 Jul 2007 15:19:52 +0300 Message-ID: References: <20070709091427.GA14208@void.printf.net> NNTP-Posting-Host: lo.gmane.org X-Trace: sea.gmane.org 1183985118 6675 80.91.229.12 (9 Jul 2007 12:45:18 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 9 Jul 2007 12:45:18 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jul 09 14:45:14 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1I7sc4-0007Th-S4 for geh-help-gnu-emacs@m.gmane.org; Mon, 09 Jul 2007 14:45:13 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I7sc4-00066v-3t for geh-help-gnu-emacs@m.gmane.org; Mon, 09 Jul 2007 08:45:12 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I7sbo-00066j-AB for help-gnu-emacs@gnu.org; Mon, 09 Jul 2007 08:44:56 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I7sbj-00064x-Ba for help-gnu-emacs@gnu.org; Mon, 09 Jul 2007 08:44:55 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I7sbj-00064u-3P for help-gnu-emacs@gnu.org; Mon, 09 Jul 2007 08:44:51 -0400 Original-Received: from cemetery.inter.net.il ([213.8.233.29]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1I7sbi-0002lk-A0 for help-gnu-emacs@gnu.org; Mon, 09 Jul 2007 08:44:50 -0400 Original-Received: from heller.inter.net.il (heller.inter.net.il [213.8.233.23]) by cemetery.inter.net.il (Postfix) with ESMTP id 5227213452D for ; Mon, 9 Jul 2007 15:43:52 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 (IGLD-84-228-162-75.inter.net.il [84.228.162.75]) by heller.inter.net.il (MOS 3.7.3a-GA) with ESMTP id DAT05754 (AUTH halo1); Mon, 9 Jul 2007 15:19:51 +0300 (IDT) In-reply-to: <20070709091427.GA14208@void.printf.net> (message from Pete Gillin on Mon, 9 Jul 2007 10:14:27 +0100) X-detected-kernel: FreeBSD 6.x (1) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:45551 Archived-At: > Date: Mon, 9 Jul 2007 10:14:27 +0100 > From: Pete Gillin > > 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.