Received: (at 44627) by debbugs.gnu.org; 7 Jun 2022 10:44:42 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 07 06:44:42 2022 Received: from localhost ([127.0.0.1]:38327 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1nyWhW-0006gv-F2 for submit <at> debbugs.gnu.org; Tue, 07 Jun 2022 06:44:42 -0400 Received: from quimby.gnus.org ([95.216.78.240]:51518) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <larsi@HIDDEN>) id 1nyWhV-0006gh-1h for 44627 <at> debbugs.gnu.org; Tue, 07 Jun 2022 06:44:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=s0hnrMZTjyJ0RG9IYbPK14VY5AtI10JRsPet7tKZnlg=; b=YCsBlRjaRfFKsrhb4Eb3d42Qy1 S5/PTXqrk/Fg4zoc1C85580sjyG3j6sVEGnngwQ0tJpBQvUxswLwOPozqTl6gHVTeRTfGCJX9grry CaWw/f63pLK1IqgpEeYZZZUln1NlXBsIuft4AC7KuxF7GwHlUonf0cveRGIFy4phYJ2w=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <larsi@HIDDEN>) id 1nyWhK-0001T8-MA; Tue, 07 Jun 2022 12:44:33 +0200 From: Lars Ingebrigtsen <larsi@HIDDEN> To: Michael Young <mwy-hsyzfo@HIDDEN> Subject: Re: bug#44627: 25.2; tempsetmodes handling does not update extended attributes References: <f86a6d7e-87c1-4854-6715-a9d4e0c73325@HIDDEN> X-Now-Playing: Blaine L. Reininger's _Commissions 2 (1)_: "The Master and Margarita" Date: Tue, 07 Jun 2022 12:44:30 +0200 In-Reply-To: <f86a6d7e-87c1-4854-6715-a9d4e0c73325@HIDDEN> (Michael Young's message of "Fri, 13 Nov 2020 23:50:28 -0500") Message-ID: <87pmjklpm9.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Michael Young <mwy-hsyzfo@HIDDEN> writes: > Open a read-only file, toggle read-only mode, and modify the file. > Attempt to save the file. > Answer "yes" to the prompt > File <FILENAME> is write-protected; try to save anyway? (yes or no) > > [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 44627 Cc: 44627 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) Michael Young <mwy-hsyzfo@HIDDEN> writes: > Open a read-only file, toggle read-only mode, and modify the file. > Attempt to save the file. > Answer "yes" to the prompt > File <FILENAME> is write-protected; try to save anyway? (yes or no) > > If the filesystem housing <FILENAME> supports extended attributes, > the attempt to temporarily change the file mode doesn't do anything, > and the subsequent attempt to write fails in basic-save-buffer-2: > Opening output file: Permission denied, <FILENAME> > > This section of files.el appears to be the problem: > https://github.com/emacs-mirror/emacs/blob/d408866ff2a0de7af5d8bb40d9c1c310573f1800/lisp/files.el#L5444 > > It retrieves the extended attributes, but then does not make any changes > to them before setting them. If the attempt to set the extended > attributes fails, it falls back on set-file-modes to set the > POSIX user write permission (128) -- that appears to work as intended. (I'm going through old bug reports that unfortunately weren't resolved at the time.) This bug report is about Emacs 25.2, but the code is still essentially the same today: ;; If file not writable, see if we can make it writable ;; temporarily while we write it. ;; But no need to do so if we have just backed it up ;; (setmodes is set) because that says we're superseding. (cond ((and tempsetmodes (not setmodes)) ;; Change the mode back, after writing. (setq setmodes (list (file-modes buffer-file-name) (file-extended-attributes buffer-file-name) buffer-file-name)) ;; If set-file-extended-attributes fails, fall back on ;; set-file-modes. (unless (with-demoted-errors "Error setting attributes: %s" (set-file-extended-attributes buffer-file-name (nth 1 setmodes))) (set-file-modes buffer-file-name (logior (car setmodes) 128))))) I.e., it's reading the extended attributes -- and then setting the extended attributes to exactly what they were, which seems nonsensical. Is this anything but a NOOP on any system? For this to work, Emacs would have to (as Michael points out) actually modify the extended attributes to allow writing, but does Emacs have any functions to do that? A brief poke around doesn't seem to reveal anything -- anybody know? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no
bug-gnu-emacs@HIDDEN
:bug#44627
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 14 Nov 2020 08:38:11 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 14 03:38:11 2020 Received: from localhost ([127.0.0.1]:49689 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1kdr4U-0001ZL-6t for submit <at> debbugs.gnu.org; Sat, 14 Nov 2020 03:38:11 -0500 Received: from lists.gnu.org ([209.51.188.17]:59352) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <mwy-hsyzfo@HIDDEN>) id 1kdnX0-0004Yc-VF for submit <at> debbugs.gnu.org; Fri, 13 Nov 2020 23:51:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41542) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <mwy-hsyzfo@HIDDEN>) id 1kdnX0-0006DA-MI for bug-gnu-emacs@HIDDEN; Fri, 13 Nov 2020 23:51:22 -0500 Received: from resqmta-ch2-09v.sys.comcast.net ([2001:558:fe21:29:69:252:207:41]:58790) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <mwy-hsyzfo@HIDDEN>) id 1kdnWy-0006Fe-5Q for bug-gnu-emacs@HIDDEN; Fri, 13 Nov 2020 23:51:22 -0500 Received: from resomta-ch2-11v.sys.comcast.net ([69.252.207.107]) by resqmta-ch2-09v.sys.comcast.net with ESMTP id dnSjkPZ91fRqGdnWskvBSu; Sat, 14 Nov 2020 04:51:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcastmailservice.net; s=20180828_2048; t=1605329474; bh=jiXl33LoOf4BFowZvBWyB+mv3wFD6AIEgMvWJGFeRwQ=; h=Received:Received:From:Subject:To:Message-ID:Date:MIME-Version: Content-Type; b=hVL9/bY/rnsv/D+qfgaIKgi3v/6EWW5eFiK9eUOL2wuu52nEY0HjRJDVb5h+1yDWh jhQ3Crds7YkGtCc68tqLnVH8ON1uRRvHWrP7YqB44QHB3dwTAmFc7+SpyVVYgOf+c0 Ox82QAd0WxHhBVxgaZXHYydF1pmI//BMI078J6bCsoEOppcVUx3v8Jv864MvKG8sNy q8CFGiOGi8Jzx1//mqHIWY1D8qgNqVyod3FojUBeJ4QOImZEWo9J2hTmd65behcV7O o/MjvkOfRVthEBiUqU9O2wpBUFR2Jfg+drrMbmLrE0fzqnR79FkMq5BZIN38iaJm4r gCHGeYYseRMhw== Received: from [172.17.22.37] ([24.131.31.129]) by resomta-ch2-11v.sys.comcast.net with ESMTPA id dnW9k2qZXDCzhdnWpkcieQ; Sat, 14 Nov 2020 04:51:11 +0000 X-Xfinity-VAAS: gggruggvucftvghtrhhoucdtuddrgedujedruddviedgjeehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuvehomhgtrghsthdqtfgvshhipdfqfgfvpdfpqffurfetoffkrfenuceurghilhhouhhtmecufedtudenucenucfjughrpefhuffvkffffgggtgfgsehtkeertddtfeejnecuhfhrohhmpefoihgthhgrvghlucgjohhunhhguceomhifhidqhhhshiiifhhosehthhgvqdihohhunhhgshdrohhrgheqnecuggftrfgrthhtvghrnhepgeekhfehiefghfekteetgedvgeetudekhfehfefggeevgeefjeeuuefgvefgheehnecuffhomhgrihhnpehgnhhurdhorhhgpdhgihhthhhusgdrtghomhenucfkphepvdegrddufedurdefuddruddvleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhephhgvlhhopegludejvddrudejrddvvddrfeejngdpihhnvghtpedvgedrudefuddrfedurdduvdelpdhmrghilhhfrhhomhepmhifhidqhhhshiiifhhosehthhgvqdihohhunhhgshdrohhrghdprhgtphhtthhopegsuhhgqdhgnhhuqdgvmhgrtghssehgnhhurdhorhhg X-Xfinity-VMeta: sc=0.00;st=legit From: Michael Young <mwy-hsyzfo@HIDDEN> Subject: 25.2; tempsetmodes handling does not update extended attributes To: bug-gnu-emacs@HIDDEN Message-ID: <f86a6d7e-87c1-4854-6715-a9d4e0c73325@HIDDEN> Date: Fri, 13 Nov 2020 23:50:28 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Received-SPF: none client-ip=2001:558:fe21:29:69:252:207:41; envelope-from=mwy-hsyzfo@HIDDEN; helo=resqmta-ch2-09v.sys.comcast.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/13 23:51:14 X-ACL-Warn: Detected OS = ??? X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sat, 14 Nov 2020 03:38:07 -0500 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) This bug report will be sent to the Bug-GNU-Emacs mailing list and the GNU bug tracker at debbugs.gnu.org. Please check that the From: line contains a valid email address. After a delay of up to one day, you should receive an acknowledgment at that address. Please write in English if possible, as the Emacs maintainers usually do not have translators for other languages. Please describe exactly what actions triggered the bug, and the precise symptoms of the bug. If you can, give a recipe starting from 'emacs -Q': Open a read-only file, toggle read-only mode, and modify the file. Attempt to save the file. Answer "yes" to the prompt File <FILENAME> is write-protected; try to save anyway? (yes or no) If the filesystem housing <FILENAME> supports extended attributes, the attempt to temporarily change the file mode doesn't do anything, and the subsequent attempt to write fails in basic-save-buffer-2: Opening output file: Permission denied, <FILENAME> This section of files.el appears to be the problem: https://github.com/emacs-mirror/emacs/blob/d408866ff2a0de7af5d8bb40d9c1c310573f1800/lisp/files.el#L5444 It retrieves the extended attributes, but then does not make any changes to them before setting them. If the attempt to set the extended attributes fails, it falls back on set-file-modes to set the POSIX user write permission (128) -- that appears to work as intended. I'm not sure whether the right fix is to add the write bit in the extended-attributes ACL entry somehow, or to execute the set-file-modes (with the 128 bit) even when there are extended attirbutes. The description of file-extended-attributes at the top of files.el says that they are platform-specific metadata, so it's not clear to me how to modify the ACL in a portable way, or if there is library support for doing that. I have encountered this behavior in several different versions of emacs, including 25.2.2 and 27.1. Let me know if you need any more information. Thanks for your support! If Emacs crashed, and you have the Emacs process in the gdb debugger, please include the output from the following gdb commands: 'bt full' and 'xbacktrace'. For information about debugging Emacs, please read the file /usr/share/emacs/25.2/etc/DEBUG. In GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.21) of 2017-09-22, modified by Debian built on lgw01-amd64-050 System Description: Ubuntu 18.04.4 LTS Configured using: 'configure --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes --enable-locallisppath=/etc/emacs25:/etc/emacs:/usr/local/share/emacs/25.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/25.2/site-lisp:/usr/share/emacs/site-lisp --with-sound=alsa --without-gconf --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes --enable-locallisppath=/etc/emacs25:/etc/emacs:/usr/local/share/emacs/25.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/25.2/site-lisp:/usr/share/emacs/site-lisp --with-sound=alsa --without-gconf --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2 -fdebug-prefix-map=/build/emacs25-jYekUr/emacs25-25.2+1=. -fstack-protector-strong -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro'' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Fundamental Minor modes in effect: tooltip-mode: t global-eldoc-mode: t mouse-wheel-mode: t tool-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent messages: Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done Loading /etc/emacs/site-start.d/50lilypond-data.el (source)...done Loading /home/mwyoung/lib/emacs/mwyoung.el (source)...done For information about GNU Emacs and the GNU system, type <f1> C-a. Mark set Note: file is write protected Read-Only mode disabled in current buffer ‘toggle-read-only’ is an obsolete command (as of 24.3); use ‘read-only-mode’ instead. Saving file /tmp/hi... basic-save-buffer-2: Opening output file: Permission denied, /tmp/hi Load-path shadows: /usr/share/emacs/25.2/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup /home/mwyoung/lib/emacs/vi hides /usr/share/emacs/25.2/lisp/obsolete/vi Features: (shadow sort mail-extr emacsbug message format-spec rfc822 mml mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util help-fns help-mode easymenu cl-loaddefs pcase cl-lib mail-prsvr mail-utils dired time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote dbusbind inotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 104135 6434) (symbols 48 19842 0) (miscs 40 48 135) (strings 32 14416 4804) (string-bytes 1 411539) (vectors 16 9391) (vector-slots 8 385376 17862) (floats 8 162 258) (intervals 56 8579 0) (buffers 976 20))
Michael Young <mwy-hsyzfo@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#44627
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.