Subject: bug#18141: 24.4.50; saving .gz file breaks file coding

From: Vincent Lefevre <[email-masked]>
Date: Wed, 6 Aug 2014 18:43:16 +0200

On 2014-08-06 17:36:00 +0300, Eli Zaretskii wrote:
>  . Bug#13522, which these changes were trying to solve, happens when
>    Emacs is killed by an external signal during the time between
>    backing up the original file and writing the new one.  (This time
>    can be quite large if write-region asks the user to choose a
>    suitable encoding for the new content.)  That is a pretty rare
>    situation, and IMO it's perfectly OK for Emacs to leave just the
>    backup file if it was brutally killed during that time window.

No, this is not rare (Emacs seems to be confused on files that
have several encodings, such as mailboxes) and I sometimes hit
Ctrl-C in the terminal (from which Emacs was started) to discard
any change. And that's not OK to only leave the backup file,
since it can be removed or overwritten pretty quickly, before
I notice that the original file is gone. In such a case, I would
lose the entire file.

But why isn't the backup done just before the file is actually
written?

BTW, I notice that Bug#13522 doesn't occur when the file is in a
sshfs directory.

-- 
Vincent Lefèvre <[email-masked]> - 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)