X-Loop: help-debbugs@HIDDEN Subject: bug#71074: 29.3; When doing a backup, the file is missing during interactive questions Resent-From: Vincent Lefevre <vincent@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Mon, 20 May 2024 01:11:01 +0000 Resent-Message-ID: <handler.71074.B.17161674274023 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 71074 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 71074 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.17161674274023 (code B ref -1); Mon, 20 May 2024 01:11:01 +0000 Received: (at submit) by debbugs.gnu.org; 20 May 2024 01:10:27 +0000 Received: from localhost ([127.0.0.1]:39007 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1s8rXg-00012j-O1 for submit <at> debbugs.gnu.org; Sun, 19 May 2024 21:10:26 -0400 Received: from lists.gnu.org ([209.51.188.17]:51546) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <vincent@HIDDEN>) id 1s8rXe-00012d-HM for submit <at> debbugs.gnu.org; Sun, 19 May 2024 21:10:19 -0400 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 <vincent@HIDDEN>) id 1s8rVS-0007im-Lb for bug-gnu-emacs@HIDDEN; Sun, 19 May 2024 21:08:02 -0400 Received: from joooj.vinc17.net ([2001:4b99:1:3:216:3eff:fe20:ac98]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <vincent@HIDDEN>) id 1s8rVR-0007ij-2e for bug-gnu-emacs@HIDDEN; Sun, 19 May 2024 21:08:02 -0400 Received: from smtp-qaa.vinc17.net (135.197.67.86.rev.sfr.net [86.67.197.135]) by joooj.vinc17.net (Postfix) with ESMTPSA id BFDF7323; Mon, 20 May 2024 03:07:48 +0200 (CEST) Received: by qaa.vinc17.org (Postfix, from userid 1000) id 9243DCA00B5; Mon, 20 May 2024 03:07:48 +0200 (CEST) Date: Mon, 20 May 2024 03:07:48 +0200 From: Vincent Lefevre <vincent@HIDDEN> Message-ID: <20240520010748.GB323381@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Mailer-Info: https://www.vinc17.net/mutt/ User-Agent: Mutt/2.2.13+76 (1f3da810) vl-167818 (2024-04-20) Received-SPF: pass client-ip=2001:4b99:1:3:216:3eff:fe20:ac98; envelope-from=vincent@HIDDEN; helo=joooj.vinc17.net 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) 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 (---) When doing a backup, GNU Emacs renames the file (according to strace). Under some conditions, the file can be lost. I noticed that due to a bug in the combination between Emacs and gpg, where the "save" operation cannot be completed. To reproduce with "emacs -Q", do for a file that is not under version control (otherwise --eval="(setq vc-make-backup-files t)" is needed): 1. emacs -Q file.gpg 2. Modify the file. 3. Save with C-x C-s At this point, gpg gets interactive, with a question Untrusted key [...]. Use anyway? (y or n) and one can see that the file "file.gpg" has been renamed to "file.gpg~". And it may happen that the save operation will never be completed, e.g. because of a bug like https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1071372 (where gpg never terminates) or because Emacs may be killed before the user could complete the save operation. In short, the file may have silently disappeared. There is a backup, but the backups may be cleaned up before the user realizes the issue. Note: I put the backups in a specific directory with (defun find-backup-file-name (fn) (list (concat "~/.poub/" (file-name-nondirectory fn) "~"))) but I look at it only when I know I've done something wrong or if I get an error message about the save operation. Having a missing file during interactive questions is bad. Note: I'm using Debian's package emacs-gtk 1:29.3+1-3. -- Vincent Lefèvre <vincent@HIDDEN> - Web: <https://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Vincent Lefevre <vincent@HIDDEN> Subject: bug#71074: Acknowledgement (29.3; When doing a backup, the file is missing during interactive questions) Message-ID: <handler.71074.B.17161674274023.ack <at> debbugs.gnu.org> References: <20240520010748.GB323381@HIDDEN> X-Gnu-PR-Message: ack 71074 X-Gnu-PR-Package: emacs Reply-To: 71074 <at> debbugs.gnu.org Date: Mon, 20 May 2024 01:11:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-gnu-emacs@HIDDEN If you wish to submit further information on this problem, please send it to 71074 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 71074: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D71074 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN Subject: bug#71074: 29.3; When doing a backup, the file is missing during interactive questions Resent-From: Eli Zaretskii <eliz@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Mon, 20 May 2024 11:32:01 +0000 Resent-Message-ID: <handler.71074.B71074.171620468813493 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 71074 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Vincent Lefevre <vincent@HIDDEN> Cc: 71074 <at> debbugs.gnu.org Received: via spool by 71074-submit <at> debbugs.gnu.org id=B71074.171620468813493 (code B ref 71074); Mon, 20 May 2024 11:32:01 +0000 Received: (at 71074) by debbugs.gnu.org; 20 May 2024 11:31:28 +0000 Received: from localhost ([127.0.0.1]:42161 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1s91El-0003VZ-0O for submit <at> debbugs.gnu.org; Mon, 20 May 2024 07:31:28 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57974) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1s91EU-0003P4-HO for 71074 <at> debbugs.gnu.org; Mon, 20 May 2024 07:31:25 -0400 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 <eliz@HIDDEN>) id 1s91EK-0003vE-3p; Mon, 20 May 2024 07:31:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=pF3K1dVqbr8SnoETDw64MZCn2HclUQyiSfXcRJm6wz4=; b=SzRKO4rJRplM kUfb6UJhndhoSyqev3dyq9hP9wHd7NeN75582duvF5o+p9k2aSV6OTiYgETRzxE/jM80HU5G4khrF B1veQyK4uUpQiuDAmv3HmTM8A/YcP1bBdMSlfCz/d5QaW3lItL0UjykyfXu/Nn80q+qtg46q8LzxR 66LlvEX7f0aSktVJoDcQcmaFXC32SslJfqX3HnyeD5Dpv/V275UJ6wDFRO3M6BMiT6FbxHxI1ZqC6 zla9fPcqvh8M5XV9GfxxVI1BrWaG8XdSbNBLO/CF6Ta+0c0t6qA8jl/mO9pXeiKRrUaFjiBHiGuX/ cbVdzPpmUaX/hA0EN8eiHw==; Date: Mon, 20 May 2024 14:30:56 +0300 Message-Id: <86pltgaff3.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> In-Reply-To: <20240520010748.GB323381@HIDDEN> (message from Vincent Lefevre on Mon, 20 May 2024 03:07:48 +0200) References: <20240520010748.GB323381@HIDDEN> X-Spam-Score: -0.0 (/) 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 (---) > Date: Mon, 20 May 2024 03:07:48 +0200 > From: Vincent Lefevre <vincent@HIDDEN> > > When doing a backup, GNU Emacs renames the file (according to strace). > Under some conditions, the file can be lost. > > I noticed that due to a bug in the combination between Emacs and gpg, > where the "save" operation cannot be completed. > > To reproduce with "emacs -Q", do for a file that is not under version > control (otherwise --eval="(setq vc-make-backup-files t)" is needed): > > 1. emacs -Q file.gpg > 2. Modify the file. > 3. Save with C-x C-s > > At this point, gpg gets interactive, with a question > > Untrusted key [...]. Use anyway? (y or n) > > and one can see that the file "file.gpg" has been renamed to > "file.gpg~". > > And it may happen that the save operation will never be completed, > e.g. because of a bug like > > https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1071372 > > (where gpg never terminates) or because Emacs may be killed before > the user could complete the save operation. Does it help to customize the variable backup-by-copying to a non-nil value?
X-Loop: help-debbugs@HIDDEN Subject: bug#71074: 29.3; When doing a backup, the file is missing during interactive questions Resent-From: Vincent Lefevre <vincent@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Tue, 21 May 2024 08:45:02 +0000 Resent-Message-ID: <handler.71074.B71074.171628109721262 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 71074 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii <eliz@HIDDEN> Cc: 71074 <at> debbugs.gnu.org Received: via spool by 71074-submit <at> debbugs.gnu.org id=B71074.171628109721262 (code B ref 71074); Tue, 21 May 2024 08:45:02 +0000 Received: (at 71074) by debbugs.gnu.org; 21 May 2024 08:44:57 +0000 Received: from localhost ([127.0.0.1]:47925 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1s9L7A-0005Ws-Uy for submit <at> debbugs.gnu.org; Tue, 21 May 2024 04:44:57 -0400 Received: from joooj.vinc17.net ([155.133.131.76]:46674) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <vincent@HIDDEN>) id 1s9L77-0005Wm-TZ for 71074 <at> debbugs.gnu.org; Tue, 21 May 2024 04:44:55 -0400 Received: from smtp-qaa.vinc17.net (2a02-8428-1b1d-4d01-96a9-491d-7b48-ba31.rev.sfr.net [IPv6:2a02:8428:1b1d:4d01:96a9:491d:7b48:ba31]) by joooj.vinc17.net (Postfix) with ESMTPSA id 8AF7E4AF; Tue, 21 May 2024 10:44:17 +0200 (CEST) Received: by qaa.vinc17.org (Postfix, from userid 1000) id 9F01DCA011C; Tue, 21 May 2024 10:44:16 +0200 (CEST) Date: Tue, 21 May 2024 10:44:16 +0200 From: Vincent Lefevre <vincent@HIDDEN> Message-ID: <20240521084416.GH2665@HIDDEN> References: <20240520010748.GB323381@HIDDEN> <86pltgaff3.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <86pltgaff3.fsf@HIDDEN> X-Mailer-Info: https://www.vinc17.net/mutt/ User-Agent: Mutt/2.2.13+76 (1f3da810) vl-167818 (2024-04-20) X-Spam-Score: 0.0 (/) 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: -1.0 (-) On 2024-05-20 14:30:56 +0300, Eli Zaretskii wrote: > Does it help to customize the variable backup-by-copying to a non-nil > value? Yes, but note that a useless backup is done because the file will not necessarily be saved (if the save operation is canceled via an interactive question or due to Debian bug 1071372). Whether renaming or copying, the backup should be done just before actually saving. -- Vincent Lefèvre <vincent@HIDDEN> - Web: <https://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
X-Loop: help-debbugs@HIDDEN Subject: bug#71074: 29.3; When doing a backup, the file is missing during interactive questions Resent-From: Eli Zaretskii <eliz@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Tue, 21 May 2024 12:13:02 +0000 Resent-Message-ID: <handler.71074.B71074.171629354819466 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 71074 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Vincent Lefevre <vincent@HIDDEN> Cc: 71074 <at> debbugs.gnu.org Received: via spool by 71074-submit <at> debbugs.gnu.org id=B71074.171629354819466 (code B ref 71074); Tue, 21 May 2024 12:13:02 +0000 Received: (at 71074) by debbugs.gnu.org; 21 May 2024 12:12:28 +0000 Received: from localhost ([127.0.0.1]:48838 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1s9OLx-00053u-Fw for submit <at> debbugs.gnu.org; Tue, 21 May 2024 08:12:27 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58652) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1s9OLs-00053o-9h for 71074 <at> debbugs.gnu.org; Tue, 21 May 2024 08:12:24 -0400 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 <eliz@HIDDEN>) id 1s9OLh-0006mR-2o; Tue, 21 May 2024 08:12:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=FxDGTJsS2amh6cLDVrgx3F4xeO4hS32g2M84hgE9AHI=; b=r9WLPkHBzyit cgUbTyCMkKHKF5eKyomwRnu3xYBWEjNKfIZAuyYsQQ9KsqA16P+pU+LQ+FXilmn2sg80aBGO/iX5k E1uHpOleKPNHLvqHrrMyPsqXloIh7NZ6SQinSn53gFrQxkHaQvmYaaV5LlUxJh5GoBceIu2eafR/0 8362Kxhzi+POhE3OvCwkfFSQTFYVzFm02Z4dDDCb2QNt/BGMdjc9Ze7mcojJzBhqQrxcsgZsTky2K ww/ZLVyPeMZgSrAeixCTTH+BgksjZt/QYipT6I1DQeZnwwsX2r5WuvUR2rQ909NivKVnVcQauD2rg 8Rj/ryxQ9sUc1PYjQ556Ng==; Date: Tue, 21 May 2024 15:12:05 +0300 Message-Id: <86msoj8iui.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> In-Reply-To: <20240521084416.GH2665@HIDDEN> (message from Vincent Lefevre on Tue, 21 May 2024 10:44:16 +0200) References: <20240520010748.GB323381@HIDDEN> <86pltgaff3.fsf@HIDDEN> <20240521084416.GH2665@HIDDEN> X-Spam-Score: -0.0 (/) 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 (---) > Date: Tue, 21 May 2024 10:44:16 +0200 > From: Vincent Lefevre <vincent@HIDDEN> > Cc: 71074 <at> debbugs.gnu.org > > On 2024-05-20 14:30:56 +0300, Eli Zaretskii wrote: > > Does it help to customize the variable backup-by-copying to a non-nil > > value? > > Yes, but note that a useless backup is done because the file will > not necessarily be saved (if the save operation is canceled via > an interactive question or due to Debian bug 1071372). Sure, but if the danger is to lose the file due to some calamity, a useless backup is a very minor disadvantage, don't you agree? > Whether renaming or copying, the backup should be done just before > actually saving. We already do that. However, backup+save is not an atomic operation, and as long as it is not atomic, there's always a window of opportunity for some catastrophe, like a system crash or Emacs being killed, to happen in-between. Moreover, Emacs being Emacs, with its high degree of customization, some feature can customize either backup or save (or both) in a way that makes the above-mentioned window very wide. That's what happened in the case you reported: epa-file overrides write-contents, the Emacs primitive that actually writes the buffer to a file, with its own version, and that's why you get that prompt about untrusted key. We cannot avoid such situations, because if we disallow customizations like that, Emacs will no longer be Emacs. In fact, you yourself use a similar feature, when you define find-backup-file-name to force all the backup files to go to a specific directory. Such a function could in theory do anything it wants, including prompting you and whatnot, thus prolonging the window between the backup and the save. So I don't see how we could significantly change this situation without losing very useful features, and therefore I think backup-by-copying is the best solution we can provide in such cases.
X-Loop: help-debbugs@HIDDEN Subject: bug#71074: 29.3; When doing a backup, the file is missing during interactive questions Resent-From: Eli Zaretskii <eliz@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Tue, 21 May 2024 12:43:01 +0000 Resent-Message-ID: <handler.71074.B71074.171629536120603 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 71074 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: vincent@HIDDEN Cc: 71074 <at> debbugs.gnu.org Received: via spool by 71074-submit <at> debbugs.gnu.org id=B71074.171629536120603 (code B ref 71074); Tue, 21 May 2024 12:43:01 +0000 Received: (at 71074) by debbugs.gnu.org; 21 May 2024 12:42:41 +0000 Received: from localhost ([127.0.0.1]:48969 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1s9OpF-0005MF-JF for submit <at> debbugs.gnu.org; Tue, 21 May 2024 08:42:41 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45140) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1s9OpE-0005M5-1V for 71074 <at> debbugs.gnu.org; Tue, 21 May 2024 08:42:41 -0400 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 <eliz@HIDDEN>) id 1s9Op3-0003gI-Bm; Tue, 21 May 2024 08:42:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=J+04GhE+uHMe91AJY5hElz65oV4URKWVMq8g3t9nt4U=; b=P4w91AQciVTd tDSOPDXnOf3NaataJwAYMRCvRm5iDj3+Ebq8VKsUjjPdER+Vi1pYQ4BPVNeV+aHQiRPik6Q3nO7PD u6C5cSzeKXicwneyiY8qzF/DVQl7/tZ8UzqtZQUTs5pUdu6MxFbBt7esQElSzi+rvFF/SD2DRei0w WEZPrt4qyTEJE2o/ObZgtpG010WwJaWAJVGOILNk/7Di8VgiOO22JcFPz67fHUNTdNbbsOb6aC5iP lxPg0iDutQT6XuorUCaZiRY66lAAlUqNNDrX11dMjgHqU2t0kxbaGFl4jQHEzIjEfFN6fmdcG0+Tw 8ybqyCmNe0vG0f3PNCSpXw==; Date: Tue, 21 May 2024 15:42:26 +0300 Message-Id: <86ikz78hfx.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> In-Reply-To: <86msoj8iui.fsf@HIDDEN> (message from Eli Zaretskii on Tue, 21 May 2024 15:12:05 +0300) References: <20240520010748.GB323381@HIDDEN> <86pltgaff3.fsf@HIDDEN> <20240521084416.GH2665@HIDDEN> <86msoj8iui.fsf@HIDDEN> X-Spam-Score: -2.3 (--) 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 (---) > Cc: 71074 <at> debbugs.gnu.org > Date: Tue, 21 May 2024 15:12:05 +0300 > From: Eli Zaretskii <eliz@HIDDEN> > > So I don't see how we could significantly change this situation > without losing very useful features, and therefore I think > backup-by-copying is the best solution we can provide in such cases. Actually, an alternative is to customize file-precious-flag to a non-nil value.
X-Loop: help-debbugs@HIDDEN Subject: bug#71074: 29.3; When doing a backup, the file is missing during interactive questions Resent-From: Vincent Lefevre <vincent@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Wed, 22 May 2024 11:09:02 +0000 Resent-Message-ID: <handler.71074.B71074.171637613916048 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 71074 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii <eliz@HIDDEN> Cc: 71074 <at> debbugs.gnu.org Received: via spool by 71074-submit <at> debbugs.gnu.org id=B71074.171637613916048 (code B ref 71074); Wed, 22 May 2024 11:09:02 +0000 Received: (at 71074) by debbugs.gnu.org; 22 May 2024 11:08:59 +0000 Received: from localhost ([127.0.0.1]:55230 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1s9jq6-0004Am-Tw for submit <at> debbugs.gnu.org; Wed, 22 May 2024 07:08:59 -0400 Received: from joooj.vinc17.net ([155.133.131.76]:55904) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <vincent@HIDDEN>) id 1s9jq3-0004Ac-9v for 71074 <at> debbugs.gnu.org; Wed, 22 May 2024 07:08:57 -0400 Received: from smtp-qaa.vinc17.net (2a02-8428-1b1d-4d01-96a9-491d-7b48-ba31.rev.sfr.net [IPv6:2a02:8428:1b1d:4d01:96a9:491d:7b48:ba31]) by joooj.vinc17.net (Postfix) with ESMTPSA id 59D8C602; Wed, 22 May 2024 13:08:18 +0200 (CEST) Received: by qaa.vinc17.org (Postfix, from userid 1000) id 1A403CA00B3; Wed, 22 May 2024 13:08:18 +0200 (CEST) Date: Wed, 22 May 2024 13:08:18 +0200 From: Vincent Lefevre <vincent@HIDDEN> Message-ID: <20240522110818.GU2665@HIDDEN> References: <20240520010748.GB323381@HIDDEN> <86pltgaff3.fsf@HIDDEN> <20240521084416.GH2665@HIDDEN> <86msoj8iui.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <86msoj8iui.fsf@HIDDEN> X-Mailer-Info: https://www.vinc17.net/mutt/ User-Agent: Mutt/2.2.13+76 (1f3da810) vl-167818 (2024-04-20) X-Spam-Score: 0.0 (/) 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: -1.0 (-) On 2024-05-21 15:12:05 +0300, Eli Zaretskii wrote: > > Date: Tue, 21 May 2024 10:44:16 +0200 > > From: Vincent Lefevre <vincent@HIDDEN> > > Cc: 71074 <at> debbugs.gnu.org > > > > On 2024-05-20 14:30:56 +0300, Eli Zaretskii wrote: > > > Does it help to customize the variable backup-by-copying to a non-nil > > > value? > > > > Yes, but note that a useless backup is done because the file will > > not necessarily be saved (if the save operation is canceled via > > an interactive question or due to Debian bug 1071372). > > Sure, but if the danger is to lose the file due to some calamity, a > useless backup is a very minor disadvantage, don't you agree? Yes, but this could be a future improvement. > > Whether renaming or copying, the backup should be done just before > > actually saving. > > We already do that. By "just before", I mean that there should not be any system call between a backup and the write of the file. BTW, there is actually an issue with the backup system: the backup is done only before the *first* save-buffer, while an issue might appear only for a subsequent save-buffer. > However, backup+save is not an atomic operation, and as long as it > is not atomic, there's always a window of opportunity for some > catastrophe, like a system crash or Emacs being killed, to happen > in-between. Yes, but if the window is restricted to the minimum, the probability of a system crash / killed Emacs is significantly reduced. I suppose that file-precious-flag as you suggested later may be the ultimate solution. > Moreover, Emacs being Emacs, with its high degree of customization, > some feature can customize either backup or save (or both) in a way > that makes the above-mentioned window very wide. That's what happened > in the case you reported: epa-file overrides write-contents, the Emacs > primitive that actually writes the buffer to a file, with its own > version, and that's why you get that prompt about untrusted key. So, does this mean that file-precious-flag doesn't work here? But perhaps that's a bug in epa-file, which should ensure that by default, the pathname isn't removed (due to the backup by rename) until the new file can be written. This means that it currently does the backup too early. > We cannot avoid such situations, because if we disallow customizations > like that, Emacs will no longer be Emacs. In fact, you yourself use a > similar feature, when you define find-backup-file-name to force all > the backup files to go to a specific directory. Such a function could > in theory do anything it wants, including prompting you and whatnot, > thus prolonging the window between the backup and the save. But customizations should be implemented properly to avoid issues. -- Vincent Lefèvre <vincent@HIDDEN> - Web: <https://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.