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#71074: 29.3; When doing a backup, the file is missing during interactive questions Date: Wed, 22 May 2024 16:25:24 +0300 Message-ID: <86ed9u6ksb.fsf@gnu.org> References: <20240520010748.GB323381@qaa.vinc17.org> <86pltgaff3.fsf@gnu.org> <20240521084416.GH2665@qaa.vinc17.org> <86msoj8iui.fsf@gnu.org> <20240522110818.GU2665@qaa.vinc17.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37516"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 71074@debbugs.gnu.org To: Vincent Lefevre Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed May 22 15:26:25 2024 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 1s9lz6-0009QC-FW for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 22 May 2024 15:26:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9lyh-0002sU-EI; Wed, 22 May 2024 09:25:59 -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 1s9lyf-0002q8-M9 for bug-gnu-emacs@gnu.org; Wed, 22 May 2024 09:25:57 -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 1s9lyf-0008Kq-D0 for bug-gnu-emacs@gnu.org; Wed, 22 May 2024 09:25:57 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s9lyk-0002rv-9B for bug-gnu-emacs@gnu.org; Wed, 22 May 2024 09:26: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: Wed, 22 May 2024 13:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71074 X-GNU-PR-Package: emacs Original-Received: via spool by 71074-submit@debbugs.gnu.org id=B71074.171638434911021 (code B ref 71074); Wed, 22 May 2024 13:26:02 +0000 Original-Received: (at 71074) by debbugs.gnu.org; 22 May 2024 13:25:49 +0000 Original-Received: from localhost ([127.0.0.1]:55947 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s9lyX-0002rh-5V for submit@debbugs.gnu.org; Wed, 22 May 2024 09:25:49 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:33180) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s9lyU-0002rb-Qw for 71074@debbugs.gnu.org; Wed, 22 May 2024 09:25:47 -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 1s9lyJ-0008JR-Do; Wed, 22 May 2024 09:25:35 -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=yFNGt59zYnRlP3AD1RNWMvnnJ7t1a99+H9d2XTLG6JA=; b=Rwiq/ulvEcAA UcPNQm+swcRvG0iTwBqoJaURh4EVASD7ixVFjxCpPSehbM3HxBN2TiNcWeOq74iIM/7lq9dvwhF/C N5Ymy4lhu/UhhJEQvcaG3g5kOSBACLJnZBme80tTMRUKdq1PRfyF5P2xy37HP8Rmd0H6mC5OKiRuQ hyo+vubDtHoRhJlxKo6T4Bw7cvP7rXZ3pgZ9ignS7BjaH6HMBdo1wNa+vdTudeGzLNNW0QwGIPzLh 6vStNGc5ZfsSlLBGp+J+jAptQHxDhx2jO9aYU2hnTEv0imcASlclstD8VqQIMrjvCYUaTWqB356iI Pwv/SqhNqJWC2a96R/Ji1w==; In-Reply-To: <20240522110818.GU2665@qaa.vinc17.org> (message from Vincent Lefevre on Wed, 22 May 2024 13:08:18 +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:285614 Archived-At: > Date: Wed, 22 May 2024 13:08:18 +0200 > From: Vincent Lefevre > Cc: 71074@debbugs.gnu.org > > > > 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. I don't see how this could be done in Emacs, sorry. But if you or someone has practical ideas, let's hear them. > 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. This is how backups in Emacs work. Catastrophes do happen, but at least Emacs attempts to auto-save everything when it is about to crash. It doesn't always work, depending on the reason for the crash. > > 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? AFAICT, it does work. Its purpose is to avoid overwriting the original file until the new stuff was successfully written to disk. > > 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. I don't see how. E.g., if we let users and packages customize how files are backed up, it's anyone's guess what will happen inside the backup-buffer call and how much time will that take. What would be a "proper implementation" that still allows such customizations? But again, practical ideas are welcome.