From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#66546: 30.0.50; save-buffer to write-protected file without backup fails Date: Thu, 19 Oct 2023 07:40:21 +0300 Message-ID: <83y1fzmdhm.fsf@gnu.org> References: <83h6mtq9t7.fsf@gnu.org> <8734ydx7x3.fsf@sappc2.fritz.box> <83cyxgqwjm.fsf@gnu.org> <87lec4cjqe.fsf@sappc2.fritz.box> <83ttqsp5x1.fsf@gnu.org> <87il78cdyf.fsf@sappc2.fritz.box> <83pm1gozi6.fsf@gnu.org> <87edhvd84h.fsf@sappc2.fritz.box> <838r82q0gi.fsf@gnu.org> <87wmvmfi68.fsf@sappc2.fritz.box> <83o7gxo771.fsf@gnu.org> <87ttqpgg8l.fsf@sappc2.fritz.box> <83cyxcnp2f.fsf@gnu.org> <87sf671xe3.fsf@sappc2.fritz.box> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15180"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 66546@debbugs.gnu.org To: Jens Schmidt Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 19 06:42:00 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qtKr8-0003gW-TN for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 19 Oct 2023 06:41:58 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtKqp-00015z-PL; Thu, 19 Oct 2023 00:41:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtKqn-00015g-HY for bug-gnu-emacs@gnu.org; Thu, 19 Oct 2023 00:41:38 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtKql-0006mL-NX for bug-gnu-emacs@gnu.org; Thu, 19 Oct 2023 00:41:36 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qtKrC-0006MP-1d for bug-gnu-emacs@gnu.org; Thu, 19 Oct 2023 00:42:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 19 Oct 2023 04:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66546 X-GNU-PR-Package: emacs Original-Received: via spool by 66546-submit@debbugs.gnu.org id=B66546.169769047124369 (code B ref 66546); Thu, 19 Oct 2023 04:42:01 +0000 Original-Received: (at 66546) by debbugs.gnu.org; 19 Oct 2023 04:41:11 +0000 Original-Received: from localhost ([127.0.0.1]:35406 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qtKqM-0006Kz-Gd for submit@debbugs.gnu.org; Thu, 19 Oct 2023 00:41:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38870) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qtKqJ-0006Kg-GZ for 66546@debbugs.gnu.org; Thu, 19 Oct 2023 00:41:08 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtKpi-0006gI-2c; Thu, 19 Oct 2023 00:40:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=Y2BcMLiHfDt5aKziqLcASVq5/hVh1zEqWvA1ZS+P0+k=; b=In1UHINNtC6LPEbRi1r7 AVQ5k7GMzHjiUPBMF7l9/i0zbFcf/PSefagwu8j6FIJSEsYApz20xSFz+VjKPSA6KzULIpIlduZ9X Ig/liADE5LjRaPU7p5Woi1BdseK7qUnhE5DZuxVeUiw+H9f+zqwRPfzXIgkGFLDoSo5aMTr6Tss0u kotH4zjvc83d+iMIt/6E4CSaPKQtIfB5qWcvZ7H3TTbXMATWv/20JANULmagoEUhxy9vvKcl2i0HF 9VsY+jMZWYGKEG4rcVB6zVlJAco9uSysSjunprxXmlYS/ImuL+BoNo0m5FFWvq5QbldUnF4fCkjc9 GHsdMRLA3QBpOw==; In-Reply-To: <87sf671xe3.fsf@sappc2.fritz.box> (message from Jens Schmidt on Wed, 18 Oct 2023 22:36:04 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:272695 Archived-At: > From: Jens Schmidt > Cc: 66546@debbugs.gnu.org > Date: Wed, 18 Oct 2023 22:36:04 +0200 > > Why exactly do we need that > > (set-file-extended-attributes > buffer-file-name > (file-extended-attributes buffer-file-name)) > > incantation or the equivalent one > > (setq setmodes > (list (file-modes buffer-file-name) > (with-demoted-errors > "Error getting extended attributes: %s" > (file-extended-attributes buffer-file-name)) > buffer-file-name)) > (with-demoted-errors "Error setting attributes: %s" > (set-file-extended-attributes buffer-file-name > (nth 1 setmodes))) > > in function `basic-save-buffer-2'? Because it was added there long ago, and because we have no reason to believe it does any harm. > In addition, I tried to trace back (this time hopefully correctly) the > origin of this call to `set-file-extended-attributes' and reached this > commit: > > 574c05e21947 Karel Klíc - Add SELinux support. > > Karel added as comment on this function: > > (basic-save-buffer-2): Set SELinux context of the newly created file, > and return it. > > But we do not have a "newly created file" here, and, in my opinion, do > not need to set an SELinux context/extended attributes on it. When working with Emacs, we usually respect old code unless we have a clear-cut case where it is wrong. Here, we don't. Me, I don't even know enough about SELinux to discuss this intelligently. So let's leave the code as it is, until we have a good reason to change it. (And if and when we do decide to change it, we will need a good understanding of what this will do to the several ACL frameworks we currently support, before we know how to change it without introducing subtle issues.)