Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some conditions

From: Eli Zaretskii <[email-masked]>
Date: Mon, 14 Mar 2022 16:05:43 +0200

> From: Lars Ingebrigtsen <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Mon, 14 Mar 2022 14:43:14 +0100
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> > Is it "C-c to kill Emacs" as in "terminate Emacs with a fatal signal",
> > or is it "C-x C-c" as in "exit Emacs in an orderly fashion"?
> >
> > If the former, then in general killing a program when it is in the
> > middle of writing files isn't guaranteed to preserve those files.
> 
> It's the former (sort of).
> 
> And, yes, we make no guarantees, but the present situation doesn't seem
> optimal.  The user may well hit `C-z' at the prompt and wonder where the
> file disappeared to.

That's in the "if it hurts, don't do that" department, IMO.  SIGINT is
a fatal signal, and our response to fatal signals cannot be too
fancy.  We just auto-save what we can and commit suicide.  Even that
is disliked by some, who say we cannot safely do anything non-trivial
from a fatal signal handler -- and they are absolutely right, we do
stuff that invokes undefined behavior.