From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#28875: 25.3.50; set-default-file-modes ignores execution bits Date: Tue, 17 Oct 2017 23:25:07 +0900 (JST) Message-ID: References: <87vajd2a1v.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Trace: blaine.gmane.org 1508250388 11277 195.159.176.226 (17 Oct 2017 14:26:28 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 17 Oct 2017 14:26:28 +0000 (UTC) User-Agent: Alpine 2.20 (DEB 67 2015-01-07) Cc: 28875@debbugs.gnu.org, Tino Calancha To: Andreas Schwab Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 17 16:26:23 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 1e4Sov-0000iY-Hg for geb-bug-gnu-emacs@m.gmane.org; Tue, 17 Oct 2017 16:26:13 +0200 Original-Received: from localhost ([::1]:39833 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4Soz-0003rh-Ou for geb-bug-gnu-emacs@m.gmane.org; Tue, 17 Oct 2017 10:26:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33997) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4Soo-0003qq-H2 for bug-gnu-emacs@gnu.org; Tue, 17 Oct 2017 10:26:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4Sok-00077v-Ip for bug-gnu-emacs@gnu.org; Tue, 17 Oct 2017 10:26:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37742) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e4Sok-00077k-Ej for bug-gnu-emacs@gnu.org; Tue, 17 Oct 2017 10:26:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e4Soj-0003gX-Pe for bug-gnu-emacs@gnu.org; Tue, 17 Oct 2017 10:26:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Oct 2017 14:26: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.150825031814111 (code B ref 28875); Tue, 17 Oct 2017 14:26:01 +0000 Original-Received: (at 28875) by debbugs.gnu.org; 17 Oct 2017 14:25:18 +0000 Original-Received: from localhost ([127.0.0.1]:46423 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e4So2-0003fX-LV for submit@debbugs.gnu.org; Tue, 17 Oct 2017 10:25:18 -0400 Original-Received: from mail-pf0-f196.google.com ([209.85.192.196]:50000) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e4So0-0003fF-3c for 28875@debbugs.gnu.org; Tue, 17 Oct 2017 10:25:16 -0400 Original-Received: by mail-pf0-f196.google.com with SMTP id i5so1463405pfe.6 for <28875@debbugs.gnu.org>; Tue, 17 Oct 2017 07:25:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=iGZ63rMncKGYGFX8ybRgj3q8bdDSilYmW6HGHdh5OUY=; b=PHFAzFPp8FmdFaDuKtZC/dqyN37pmJVlafB1peDgRlZVoz7zPctqHXXX3wUAbTkrvr +amKVUdV32OFNlUh0jByHPt91kxcrVKlR9ORhmoZJRnLj3/xW4iJOhbfO+zoV6bs8mp3 W6WnJQck9gzMbZwwV+yhWrK9IVwP750XHO+yX+RQ/tCnkbCmPRQqWEBBu9cYC/aM3XFT OIu3WEDdRm3Ggk/0v0T0TCkzAFarUkzuPG6QmyUkBuCNpg8pQR8Q3NakJtA0NnYreAKz 2MDFOH4ld+WtVbe8/cdfI/NZUNpuP9h6XYsbow6eYLDSIniF//uRViAtdMgZ2RF4vErn NdRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=iGZ63rMncKGYGFX8ybRgj3q8bdDSilYmW6HGHdh5OUY=; b=aLBHn1O9wbKob8X/eXf70xghwvcbxVx8QyuGwnv8urdNpJR6/2+c31kulYK5nxiebt GVZ206sobhobIc8z+Nb52eTP1FwKW+4owbcROhhUYbPsr6Xdmw5VFEFHpfNaMoH6mBWA GzkPoOQcZdbuZVI/aGRdovEcYTK4cp8mV6e6P6PMvF2VlVcKQ3cOWa8vjjZ0Cs51Aaxy 9W6dsqYZ9RPpO/aB+/tczG/roEyD21R/rWHrqL8T7nrsDYfllhTl4hZAMGykYEfbyEl5 ZJFrAXOPa65q81PqmDJqDuYMeAkNqQgUsEqlhuU0atdoCRC1NlL3K39KSFQoVfy5Hfgh TbQw== X-Gm-Message-State: AMCzsaUYq2q+gYrVpLaLf4FXcG9QVuwLyDgb+vVY2fojOHHk5ZQexDDx YwPyGcAbDFdrIkMrVBqHIe4= X-Google-Smtp-Source: AOwi7QBPyiUBTHtD5nK9/Hf8hmg4gghD2zvsfM9+4YzEngkTG02N0n0is2qZzlCbsEBudcP9lyI0fQ== X-Received: by 10.99.51.11 with SMTP id z11mr11349321pgz.223.1508250310312; Tue, 17 Oct 2017 07:25:10 -0700 (PDT) Original-Received: from calancha-pc (203.191.218.133.dy.bbexcite.jp. [133.218.191.203]) by smtp.gmail.com with ESMTPSA id h29sm11839695pfd.65.2017.10.17.07.25.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Oct 2017 07:25:09 -0700 (PDT) X-Google-Original-From: Tino Calancha X-X-Sender: calancha@calancha-pc In-Reply-To: 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:138619 Archived-At: On Tue, 17 Oct 2017, Andreas Schwab wrote: > On Okt 17 2017, Tino Calancha wrote: > >> emacs -Q: >> (let ((foo (make-temp-file "foo")) mode) >> (with-file-modes #o755 (write-region "" nil foo nil 0)) >> ;; (set-file-modes foo #o755) >> (setq mode (nth 8 (file-attributes foo))) >> (delete-file foo) mode) >> => "-rw-------" >> >> To set foo file permissions to "-rwxr-xr-x" I need uncomment >> (set-file-modes foo #o755) above. >> Why? Is for security reasons? > > 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. > Thank you for th enice explanation. I understand now. I think I was fooled by the docstring of `set-default-file-modes': "Set the file permission bits for newly created files..." I thought that setting will be used by the functions in my snippet.