From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#28875: 25.3.50; set-default-file-modes ignores execution bits Date: Fri, 20 Oct 2017 10:15:34 +0300 Message-ID: <83vajacmsp.fsf@gnu.org> References: <87vajd2a1v.fsf@gmail.com> <878tg6ecpx.fsf@gmail.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1508483790 5721 195.159.176.226 (20 Oct 2017 07:16:30 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 20 Oct 2017 07:16:30 +0000 (UTC) Cc: 28875@debbugs.gnu.org, schwab@suse.de To: Tino Calancha Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Oct 20 09:16:20 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e5RXH-0006jq-1P for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Oct 2017 09:16:03 +0200 Original-Received: from localhost ([::1]:52473 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5RXM-0008Pb-Sr for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Oct 2017 03:16:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60032) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5RXH-0008PW-7O for bug-gnu-emacs@gnu.org; Fri, 20 Oct 2017 03:16:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e5RXG-0004Uh-39 for bug-gnu-emacs@gnu.org; Fri, 20 Oct 2017 03:16:03 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:42348) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e5RXG-0004UM-0A for bug-gnu-emacs@gnu.org; Fri, 20 Oct 2017 03:16:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e5RXF-0000jD-OQ for bug-gnu-emacs@gnu.org; Fri, 20 Oct 2017 03:16:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 20 Oct 2017 07:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28875 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 28875-submit@debbugs.gnu.org id=B28875.15084837602791 (code B ref 28875); Fri, 20 Oct 2017 07:16:01 +0000 Original-Received: (at 28875) by debbugs.gnu.org; 20 Oct 2017 07:16:00 +0000 Original-Received: from localhost ([127.0.0.1]:51028 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e5RXD-0000iv-PT for submit@debbugs.gnu.org; Fri, 20 Oct 2017 03:15:59 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:40754) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e5RXB-0000ig-Pe for 28875@debbugs.gnu.org; Fri, 20 Oct 2017 03:15:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e5RX5-0004Me-DV for 28875@debbugs.gnu.org; Fri, 20 Oct 2017 03:15:52 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:47964) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5RWx-0004GL-Pa; Fri, 20 Oct 2017 03:15:43 -0400 Original-Received: from [176.228.60.248] (port=1858 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1e5RWx-0001MZ-72; Fri, 20 Oct 2017 03:15:43 -0400 In-reply-to: <878tg6ecpx.fsf@gmail.com> (message from Tino Calancha on Fri, 20 Oct 2017 12:10:18 +0900) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:138744 Archived-At: > From: Tino Calancha > Cc: Eli Zaretskii , Andreas Schwab > Date: Fri, 20 Oct 2017 12:10:18 +0900 > > >> make-temp-file already creates the file (with restrictive modes), so > >> with-file-modes has no effect (write-region does not change the mode of > >> existing files). But write-region also never sets the x bits in the > >> first place, it uses #o666 as the base mode. > >> > > I think I was fooled by the docstring of `set-default-file-modes': > > "Set the file permission bits for newly created files..." > Besides the behavior is mentioned in the manual, that is relevant > for the correct use of the function, so IMO it's worth to include it > the docstring as well. > > --8<-----------------------------cut here---------------start------------->8--- > commit d749ad1ca0375a938c0283155b56e737cc120640 > Author: Tino Calancha > Date: Fri Oct 20 11:58:17 2017 +0900 > > * src/fileio.c (set-default-file-modes): Doc fix > > diff --git a/src/fileio.c b/src/fileio.c > index b7df38c857..d707bfc1c6 100644 > --- a/src/fileio.c > +++ b/src/fileio.c > @@ -3125,7 +3125,11 @@ symbolic notation, like the `chmod' command from GNU Coreutils. */) > DEFUN ("set-default-file-modes", Fset_default_file_modes, Sset_default_file_modes, 1, 1, 0, > doc: /* Set the file permission bits for newly created files. > The argument MODE should be an integer; only the low 9 bits are used. > -This setting is inherited by subprocesses. */) > +This setting is inherited by subprocesses. > + > +Note that some functions (e.g., `write-region') ignore the execution > +bits in MODE. In that case you need first to create the file, > +and then set the permisions with `set-file-modes'. */) Why would someone assume that write-region could/should change the mode bits of an already existing file? It's entirely unreasonable for write-region to do so, as the mode bits are determined when the file is created, in this case by make-temp-file. So I'm not sure why should we make this correction to the doc string. What am I missing? Thanks.