Subject: Re: bug#71074: 29.3; When doing a backup, the file is missing during interactive questions

From: Eli Zaretskii <[email-masked]>
Date: Mon, 20 May 2024 14:30:56 +0300

> Date: Mon, 20 May 2024 03:07:48 +0200
> From: Vincent Lefevre <[email-masked]>
> 
> 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?