GNU bug report logs - #13522
24.2; save-buffer removes edited file under some conditions

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Vincent Lefevre <vincent@HIDDEN>; Keywords: confirmed; dated Tue, 22 Jan 2013 01:49:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 13522 <at> debbugs.gnu.org:


Received: (at 13522) by debbugs.gnu.org; 14 Mar 2022 17:32:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 14 13:32:45 2022
Received: from localhost ([127.0.0.1]:46211 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nToYn-0001vz-5k
	for submit <at> debbugs.gnu.org; Mon, 14 Mar 2022 13:32:45 -0400
Received: from cventin.lip.ens-lyon.fr ([140.77.13.17]:35018)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <vincent@HIDDEN>) id 1nToYk-0001vq-WD
 for 13522 <at> debbugs.gnu.org; Mon, 14 Mar 2022 13:32:43 -0400
Received: from vlefevre by cventin.lip.ens-lyon.fr with local (Exim 4.95)
 (envelope-from <vincent@HIDDEN>) id 1nToYf-0005dE-RX;
 Mon, 14 Mar 2022 18:32:37 +0100
Date: Mon, 14 Mar 2022 18:32:37 +0100
From: Vincent Lefevre <vincent@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some
 conditions
Message-ID: <20220314173237.GD2381@HIDDEN>
References: <87622qaszq.fsf@HIDDEN> <8735jkye2q.fsf@HIDDEN>
 <83mthsk63c.fsf@HIDDEN> <87sfrkwsy5.fsf@HIDDEN>
 <83fsnkk4so.fsf@HIDDEN>
 <20220314152053.GB2381@HIDDEN>
 <83bky8jwmh.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <83bky8jwmh.fsf@HIDDEN>
X-Mailer-Info: https://www.vinc17.net/mutt/
User-Agent: Mutt/2.2.1+12 (1ba319cf) vl-138565 (2022-03-05)
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 13522
Cc: larsi@HIDDEN, 13522 <at> debbugs.gnu.org
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 2022-03-14 19:02:14 +0200, Eli Zaretskii wrote:
> > Note that in any case, C-x C-c in Emacs does not replace Ctrl-C in the
> > terminal, as with C-x C-c, Emacs quits with a zero exit status, which
> > may not be what one wants. Example: in a "svn ci", one may want to
> > abort the commit without losing the text written in Emacs. Ctrl-C in
> > the terminal (where "svn ci" has been run) allows one to do that.
> 
> Emacs is not SVN, and doesn't work in transactions.

You missed my point. "svn ci" runs an editor, e.g. Emacs. If I want
to interrupt (i.e. abort) the "svn ci", I need to do Ctrl-C in the
terminal. The same is true with shell scripts that run Emacs.

> > SIGINT could be equivalent to something like C-g in Emacs + quit
> > without saving (a backup of the current buffer can be kept),
> > exiting with a non-zero exit status. Note that you do not need to
> > do everything in the signal handler. In general, what is done is
> > just to set some variable saying that SIGINT has been received.
> > The abort of the operations is done in the main code.
> 
> When the program is delivered a fatal signal, the only way to get back
> to "main code" is longjmp from the signal handler, which is already
> "not recommended", to say the least.

No, SIGINT is *not* a fatal signal. What is done with it is what the
application decides. You don't need a longjmp. Setting a variable in
the signal handler and handle it in the general code should be
sufficient.

BTW, there's the same issue when requesting to close the X11 window.
I get a "Question" dialogue, asking me whether I want to save the
file. I answer "No". I get another question saying

  Modified buffers exist; exit anyway?

I answer "Yes". Emacs quits, but the file is no longer there; there's
just the backup.

Handling SIGINT could be similar to this case (which should be fixed),
where the answers "No" and "Yes" are assumed.

-- 
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)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#13522; Package emacs. Full text available.

Message received at 13522 <at> debbugs.gnu.org:


Received: (at 13522) by debbugs.gnu.org; 14 Mar 2022 17:02:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 14 13:02:35 2022
Received: from localhost ([127.0.0.1]:46171 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nTo5a-00014M-WA
	for submit <at> debbugs.gnu.org; Mon, 14 Mar 2022 13:02:35 -0400
Received: from eggs.gnu.org ([209.51.188.92]:55122)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1nTo5Z-000145-BT
 for 13522 <at> debbugs.gnu.org; Mon, 14 Mar 2022 13:02:34 -0400
Received: from [2001:470:142:3::e] (port=46860 helo=fencepost.gnu.org)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1nTo5T-0002gw-Rp; Mon, 14 Mar 2022 13:02:27 -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=iPN504dxWKdd01E+bjPpYyTbkc6bUQzthV6ecMevsYA=; b=ZLp75BqM9r3n
 nwdXc5l1q/I1ljMFgl19Ufw7MVzbmrt+Ax32cTXvpUjyJOc4Q1So9bjHAUySIPB/3tGvdTDtnh34L
 NyW1WlOiZI+CspCXYF8yannyQqswfbU2m/wRKXmfuCAcVtuov/T6s/tXUnCkmZ40sAverLllikz2j
 BUUMY0CgLMIZNTZu7/isE9tygtqk+oX0Vya7FaKLxZcP48oiNIR8HO2nlIJdTefIVn2zLak7Mdw5j
 3H+xRQoF+OnrjcgEY783ZItuWoWEkEX0EMtiFmoNlx8upyjGd1IwBsP9eZSvrs0qN/cY/g7guym7+
 gYScRQ1DaaYWLei4rk2KSg==;
Received: from [87.69.77.57] (port=3830 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1nTo5T-0001ki-BN; Mon, 14 Mar 2022 13:02:27 -0400
Date: Mon, 14 Mar 2022 19:02:14 +0200
Message-Id: <83bky8jwmh.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Vincent Lefevre <vincent@HIDDEN>
In-Reply-To: <20220314152053.GB2381@HIDDEN> (message from
 Vincent Lefevre on Mon, 14 Mar 2022 16:20:53 +0100)
Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some
 conditions
References: <87622qaszq.fsf@HIDDEN> <8735jkye2q.fsf@HIDDEN>
 <83mthsk63c.fsf@HIDDEN> <87sfrkwsy5.fsf@HIDDEN>
 <83fsnkk4so.fsf@HIDDEN> <20220314152053.GB2381@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 13522
Cc: larsi@HIDDEN, 13522 <at> debbugs.gnu.org
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, 14 Mar 2022 16:20:53 +0100
> From: Vincent Lefevre <vincent@HIDDEN>
> Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 13522 <at> debbugs.gnu.org
> 
> This is silly. Ctrl-C is *standard* to interrupt commands. When there
> is a risk to lose data or to get in an inconsistent state, commands
> should trap SIGINT (either to ignore it or to do some cleanup before
> exiting).

That's what Emacs does.  Except that not every processing interrupted
in its middle can be restarted and run to its "normal" completion.

> Note that in any case, C-x C-c in Emacs does not replace Ctrl-C in the
> terminal, as with C-x C-c, Emacs quits with a zero exit status, which
> may not be what one wants. Example: in a "svn ci", one may want to
> abort the commit without losing the text written in Emacs. Ctrl-C in
> the terminal (where "svn ci" has been run) allows one to do that.

Emacs is not SVN, and doesn't work in transactions.

> In this bug, the issue is actually more important: When one does
> C-x C-s, the file has been renamed, which is bad, because the user
> may not choose what to do immediately, and many things can happen
> in the period, such as a power outage, a network outage, a crash of
> the machine, etc. The user may not notice the issue with the file
> immediately, so that he may lose the contents (or the changes, e.g.
> if the file is handled by a VCS). The file may also be needed by
> other software while the user is editing it (for instance, as backup
> software, or some application if this is a configuration file).

There should be an auto-save file to recover your edits.

> > 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.
> 
> SIGINT could be equivalent to something like C-g in Emacs + quit
> without saving (a backup of the current buffer can be kept),
> exiting with a non-zero exit status. Note that you do not need to
> do everything in the signal handler. In general, what is done is
> just to set some variable saying that SIGINT has been received.
> The abort of the operations is done in the main code.

When the program is delivered a fatal signal, the only way to get back
to "main code" is longjmp from the signal handler, which is already
"not recommended", to say the least.

Anyway, what you describe is not what actually happens, AFAIK.
Handling a fatal signal and handling C-g are very different in Emacs.
But maybe I'm missing something, so I will let others speak up.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#13522; Package emacs. Full text available.

Message received at 13522 <at> debbugs.gnu.org:


Received: (at 13522) by debbugs.gnu.org; 14 Mar 2022 15:21:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 14 11:21:00 2022
Received: from localhost ([127.0.0.1]:46004 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nTmVI-0006aO-AK
	for submit <at> debbugs.gnu.org; Mon, 14 Mar 2022 11:21:00 -0400
Received: from cventin.lip.ens-lyon.fr ([140.77.13.17]:35004)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <vincent@HIDDEN>) id 1nTmVG-0006aG-AI
 for 13522 <at> debbugs.gnu.org; Mon, 14 Mar 2022 11:20:58 -0400
Received: from vlefevre by cventin.lip.ens-lyon.fr with local (Exim 4.95)
 (envelope-from <vincent@HIDDEN>) id 1nTmVB-0004Pc-7z;
 Mon, 14 Mar 2022 16:20:53 +0100
Date: Mon, 14 Mar 2022 16:20:53 +0100
From: Vincent Lefevre <vincent@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some
 conditions
Message-ID: <20220314152053.GB2381@HIDDEN>
References: <87622qaszq.fsf@HIDDEN> <8735jkye2q.fsf@HIDDEN>
 <83mthsk63c.fsf@HIDDEN> <87sfrkwsy5.fsf@HIDDEN>
 <83fsnkk4so.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <83fsnkk4so.fsf@HIDDEN>
X-Mailer-Info: https://www.vinc17.net/mutt/
User-Agent: Mutt/2.2.1+12 (1ba319cf) vl-138565 (2022-03-05)
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 13522
Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 13522 <at> debbugs.gnu.org
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 2022-03-14 16:05:43 +0200, Eli Zaretskii wrote:
> > From: Lars Ingebrigtsen <larsi@HIDDEN>
> > Cc: vincent@HIDDEN,  13522 <at> debbugs.gnu.org
> > Date: Mon, 14 Mar 2022 14:43:14 +0100
> > 
> > Eli Zaretskii <eliz@HIDDEN> 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.

This is silly. Ctrl-C is *standard* to interrupt commands. When there
is a risk to lose data or to get in an inconsistent state, commands
should trap SIGINT (either to ignore it or to do some cleanup before
exiting).

Note that in any case, C-x C-c in Emacs does not replace Ctrl-C in the
terminal, as with C-x C-c, Emacs quits with a zero exit status, which
may not be what one wants. Example: in a "svn ci", one may want to
abort the commit without losing the text written in Emacs. Ctrl-C in
the terminal (where "svn ci" has been run) allows one to do that.

In this bug, the issue is actually more important: When one does
C-x C-s, the file has been renamed, which is bad, because the user
may not choose what to do immediately, and many things can happen
in the period, such as a power outage, a network outage, a crash of
the machine, etc. The user may not notice the issue with the file
immediately, so that he may lose the contents (or the changes, e.g.
if the file is handled by a VCS). The file may also be needed by
other software while the user is editing it (for instance, as backup
software, or some application if this is a configuration file).

> 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.

SIGINT could be equivalent to something like C-g in Emacs + quit
without saving (a backup of the current buffer can be kept),
exiting with a non-zero exit status. Note that you do not need to
do everything in the signal handler. In general, what is done is
just to set some variable saying that SIGINT has been received.
The abort of the operations is done in the main code.

-- 
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)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#13522; Package emacs. Full text available.

Message received at 13522 <at> debbugs.gnu.org:


Received: (at 13522) by debbugs.gnu.org; 14 Mar 2022 14:06:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 14 10:06:02 2022
Received: from localhost ([127.0.0.1]:45902 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nTlKk-0004Um-Jg
	for submit <at> debbugs.gnu.org; Mon, 14 Mar 2022 10:06:02 -0400
Received: from eggs.gnu.org ([209.51.188.92]:44602)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1nTlKj-0004UG-8B
 for 13522 <at> debbugs.gnu.org; Mon, 14 Mar 2022 10:06:01 -0400
Received: from [2001:470:142:3::e] (port=48922 helo=fencepost.gnu.org)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1nTlKd-00072I-Nm; Mon, 14 Mar 2022 10:05:55 -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=11jHEJ8hpFdZy3mq1/AMclhznm9UwV93d3M6BioZ+aY=; b=h3YoGOHJMbz8
 r6uHHY9auihBlsCEaZAkcVg5uxUd3S0gvmtOJ1ocUjhUBIb1XvjMuT5WhKF1WYmzLZGJt0lyHFlxG
 QYN5bdpxaus2d3hiNDHlANKT65G6Ljl2THuCfT+SHKHu6pHg+QnblkcQsMbUL2e4cc0IjLLRR+UuL
 nX4QSlFZlzEuSfjMtx/ZYuyeaO9EVKIV/y+2JtQelJv16DXsjnMv80sdUzYoo7tQopYDUjNVaC4SC
 MOFx+wlXcjYas186K8fJ6NUIyePet3gaB4V5XMaFcfJcUUvFrim1FTGy0v4vqL5VTcUZ2NkSaWpaY
 75xHcqCt57A9WgoLu0ZJdA==;
Received: from [87.69.77.57] (port=4841 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1nTlKd-0003Uk-5w; Mon, 14 Mar 2022 10:05:55 -0400
Date: Mon, 14 Mar 2022 16:05:43 +0200
Message-Id: <83fsnkk4so.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
In-Reply-To: <87sfrkwsy5.fsf@HIDDEN> (message from Lars Ingebrigtsen on Mon, 
 14 Mar 2022 14:43:14 +0100)
Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some
 conditions
References: <87622qaszq.fsf@HIDDEN> <8735jkye2q.fsf@HIDDEN>
 <83mthsk63c.fsf@HIDDEN> <87sfrkwsy5.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 13522
Cc: 13522 <at> debbugs.gnu.org, vincent@HIDDEN
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 (---)

> From: Lars Ingebrigtsen <larsi@HIDDEN>
> Cc: vincent@HIDDEN,  13522 <at> debbugs.gnu.org
> Date: Mon, 14 Mar 2022 14:43:14 +0100
> 
> Eli Zaretskii <eliz@HIDDEN> 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.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#13522; Package emacs. Full text available.

Message received at 13522 <at> debbugs.gnu.org:


Received: (at 13522) by debbugs.gnu.org; 14 Mar 2022 13:43:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 14 09:43:27 2022
Received: from localhost ([127.0.0.1]:44410 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nTkyt-0001I6-NY
	for submit <at> debbugs.gnu.org; Mon, 14 Mar 2022 09:43:27 -0400
Received: from quimby.gnus.org ([95.216.78.240]:42772)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1nTkys-0001Hp-8b
 for 13522 <at> debbugs.gnu.org; Mon, 14 Mar 2022 09:43:26 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=6p5HC5S2B+9RXBRSQmLwcRLJrnrb3RVTsBmSHiXWUx4=; b=O9HN7B/rDZDDACEFehw2FEldV/
 CWA413smPxyiwFPji1+9Vad9geyu8LUjEiu4PMEiJ7PZFbsx2pV90WDoeCJx0b1KRc3+8iu8qq+G2
 frSlIW3sPBfqZ/mJ5z4qvpfMBFgn7c5+cs6ljSWNOSfJAQGP82KecdBJkrgf6hE2XUw8=;
Received: from [84.212.220.105] (helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1nTkyi-0007C9-Gt; Mon, 14 Mar 2022 14:43:19 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some
 conditions
References: <87622qaszq.fsf@HIDDEN> <8735jkye2q.fsf@HIDDEN>
 <83mthsk63c.fsf@HIDDEN>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAABGdBTUEAALGPC/xhBQAAACBj
 SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEVCMDimTFitl4L/
 ///CA72vAAAAAWJLR0QDEQxM8gAAAAd0SU1FB+YDDg0mKrsLhn0AAAG5SURBVCjPPZBBa9tAEIWf
 hFfYe3KCFVIdA4XUv2JS7B5yWhmNIbq11CHVr9gcDMUny0TB9kkpspD2V3bWLh1YmI95896wwNIW
 J3euAripI5u30rp3IHIWm01b5R7CGj02p+QCznbq8bReuhzQAqtvpYADph0+mAbm6OHRYs1kkHvr
 O4u4zeih6GUidfNeZYFEw6LG8+Lpc+QqJ60NDhTzRu5BJ0mHSca5BxcMo1+x4aUch87V0csPksmq
 gmuKUfN9xsueGXCdbj6yUdWThEzrpD5xxYVPVDYp32Ju3VAgRFKWKTs38isCTR8UThOOWyRNH504
 1w4Di6QruGhi/QeOwmSvuLll3cJZmxzG6tlU+g7XX7W2yrS7Uk9lMtQ2aOojhaG3Fs+fixb6WlK1
 VmZldoXVIAxVYFa7Q2FD+YN7BCbd7fGvlDHlfmX/w+73kC69wPbcyddPAg8vZxnPAhK4R4wApAKk
 F1kNmgALrxnLiwXSV9/44RwgS2yuMBAHKHpAlY2h8i1jYEpak8BMzZGZV6q2sYDsUJZi9pZCPRGL
 +wIwIqOrTCBi+mQEYpENIsJEduYkoEKmL/QX+SqirXh/okEAAAAldEVYdGRhdGU6Y3JlYXRlADIw
 MjItMDMtMTRUMTM6Mzg6NDIrMDA6MDBrKBqBAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIyLTAzLTE0
 VDEzOjM4OjQyKzAwOjAwGnWiPQAAAABJRU5ErkJggg==
X-Now-Playing: Little Annie's _Soul Possession_: "Waiting For The Fun"
Date: Mon, 14 Mar 2022 14:43:14 +0100
In-Reply-To: <83mthsk63c.fsf@HIDDEN> (Eli Zaretskii's message of "Mon, 14 Mar
 2022 15:37:43 +0200")
Message-ID: <87sfrkwsy5.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Eli Zaretskii <eliz@HIDDEN> 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 [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 13522
Cc: 13522 <at> debbugs.gnu.org, vincent@HIDDEN
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 (---)

Eli Zaretskii <eliz@HIDDEN> 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.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#13522; Package emacs. Full text available.

Message received at 13522 <at> debbugs.gnu.org:


Received: (at 13522) by debbugs.gnu.org; 14 Mar 2022 13:38:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 14 09:38:04 2022
Received: from localhost ([127.0.0.1]:44396 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nTktg-000190-Fr
	for submit <at> debbugs.gnu.org; Mon, 14 Mar 2022 09:38:04 -0400
Received: from eggs.gnu.org ([209.51.188.92]:37598)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1nTkte-00018U-5e
 for 13522 <at> debbugs.gnu.org; Mon, 14 Mar 2022 09:38:03 -0400
Received: from [2001:470:142:3::e] (port=48258 helo=fencepost.gnu.org)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1nTktY-0001kg-KD; Mon, 14 Mar 2022 09:37:56 -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=spHN371Y9lTZXdEYn9FC5Ze8UrgPUMX5vlyfyZIdQdY=; b=myHohBIj9t8M
 7tgUiF3znAZzOHPG6xK5aAj/SgLtKwx8YsDRVaeuvpDZp3AjLn9fMl8Nf70yZrwwFWIVQ6WKRUGsG
 EBc5kdG+wMmJ/bn6WnA6iNo5nUN3cGjx/cfSMdG90jMB2DO2HcG6IT+1YQBoPDypGdNSuuguSK/CH
 22btokcrCnyzoea9VrYukO/dKK6OH4pnQxuwr/oHPUnpaxhPjDlFfykH310017fOUQ09IlW290GrK
 VuPMzb4NsRbA+3hEGGMHla/lE9WpCTDrrrAiKRB7/X8uNkX/L7Fd2q6qbzn+bcffDCdY/TnCoxFl7
 3sm/fX0iuMc/GrEKtWskaQ==;
Received: from [87.69.77.57] (port=3099 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1nTktY-0004k9-31; Mon, 14 Mar 2022 09:37:56 -0400
Date: Mon, 14 Mar 2022 15:37:43 +0200
Message-Id: <83mthsk63c.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
In-Reply-To: <8735jkye2q.fsf@HIDDEN> (message from Lars Ingebrigtsen on Mon, 
 14 Mar 2022 12:21:33 +0100)
Subject: Re: bug#13522: 24.2;
 save-buffer removes edited file under some conditions
References: <87622qaszq.fsf@HIDDEN> <8735jkye2q.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 13522
Cc: 13522 <at> debbugs.gnu.org, vincent@HIDDEN
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 (---)

> From: Lars Ingebrigtsen <larsi@HIDDEN>
> Date: Mon, 14 Mar 2022 12:21:33 +0100
> Cc: 13522 <at> debbugs.gnu.org
> 
> Vincent Lefevre <vincent@HIDDEN> writes:
> 
> > 1. Create a file with: printf "\x80" > file
> > 2. Open the file under X Window with: emacs -Q file
> > 3. Modify the file e.g. by adding a space.
> > 4. Type C-x C-s
> >    At this point, Emacs asks the user to select a coding system.
> > 5. Type C-c in the terminal to kill Emacs.
> >
> > The result is that the file "file" is no longer there!
> 
> (I'm going through old bug reports that unfortunately weren't resolved
> at the time.)
> 
> This problem is still present in Emacs 29 -- the file is moved to the
> backup file before doing the prompt.

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.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#13522; Package emacs. Full text available.

Message received at 13522 <at> debbugs.gnu.org:


Received: (at 13522) by debbugs.gnu.org; 14 Mar 2022 11:21:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 14 07:21:46 2022
Received: from localhost ([127.0.0.1]:44245 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nTilm-0003hv-A7
	for submit <at> debbugs.gnu.org; Mon, 14 Mar 2022 07:21:46 -0400
Received: from quimby.gnus.org ([95.216.78.240]:41836)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1nTilk-0003hd-0f
 for 13522 <at> debbugs.gnu.org; Mon, 14 Mar 2022 07:21:44 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=9dnjG3mXpgo0l9iwRwxSz4lU5tFNUGZfqYgmJnZIUFE=; b=TunGcZzIavSqxcG9bD9gajrTup
 nt6X5gI5K6aCMZ3rwmqzW5rBTdkRRCS5mzddylFeBesAtiNjOftZEXt795PGutbvb/9hrxWw0s0U9
 uEVe5OWT66IKn2bJ/GD4BY+EXUIKbxflewr5ydupK4MBu9jDSaU3BxESQrqm5/5i/43k=;
Received: from [84.212.220.105] (helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1nTila-0005rd-Ow; Mon, 14 Mar 2022 12:21:37 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Vincent Lefevre <vincent@HIDDEN>
Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some
 conditions
References: <87622qaszq.fsf@HIDDEN>
X-Now-Playing: 23 Skidoo's _The Culling Is Coming_: "Healing (For The Strong)"
Date: Mon, 14 Mar 2022 12:21:33 +0100
In-Reply-To: <87622qaszq.fsf@HIDDEN> (Vincent Lefevre's message of
 "Tue, 22 Jan 2013 02:47:37 +0100")
Message-ID: <8735jkye2q.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Vincent Lefevre <vincent@HIDDEN> writes: > 1. Create a
 file with: printf "\x80" > file > 2. Open the file under X Window with: emacs
 -Q file > 3. Modify the file e.g. by adding a space. > 4. Type C-x C-s >
 At this point, Emacs asks the user [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 13522
Cc: 13522 <at> debbugs.gnu.org
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 (---)

Vincent Lefevre <vincent@HIDDEN> writes:

> 1. Create a file with: printf "\x80" > file
> 2. Open the file under X Window with: emacs -Q file
> 3. Modify the file e.g. by adding a space.
> 4. Type C-x C-s
>    At this point, Emacs asks the user to select a coding system.
> 5. Type C-c in the terminal to kill Emacs.
>
> The result is that the file "file" is no longer there!

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

This problem is still present in Emacs 29 -- the file is moved to the
backup file before doing the prompt.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#13522; Package emacs. Full text available.
bug Marked as found in versions 25.1. Request was from npostavs@HIDDEN to control <at> debbugs.gnu.org. Full text available.
Severity set to 'normal' from 'important' Request was from npostavs@HIDDEN to control <at> debbugs.gnu.org. Full text available.

Message received at 13522 <at> debbugs.gnu.org:


Received: (at 13522) by debbugs.gnu.org; 11 Aug 2014 01:06:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 10 21:06:51 2014
Received: from localhost ([127.0.0.1]:38148 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XGe4Y-0006r4-Jd
	for submit <at> debbugs.gnu.org; Sun, 10 Aug 2014 21:06:50 -0400
Received: from fencepost.gnu.org ([208.118.235.10]:33447 ident=Debian-exim)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <rgm@HIDDEN>) id 1XGe4V-0006qv-Le
 for 13522 <at> debbugs.gnu.org; Sun, 10 Aug 2014 21:06:48 -0400
Received: from rgm by fencepost.gnu.org with local (Exim 4.71)
 (envelope-from <rgm@HIDDEN>)
 id 1XGe4V-0002fz-2v; Sun, 10 Aug 2014 21:06:47 -0400
From: Glenn Morris <rgm@HIDDEN>
To: 13522 <at> debbugs.gnu.org
Subject: Re: bug#13522: 24.2;
 save-buffer removes edited file under some conditions
References: <87622qaszq.fsf@HIDDEN> <aqtxq6e36c.fsf@HIDDEN>
 <20130125000256.GC3397@HIDDEN>
 <s14ni6axzc.fsf@HIDDEN> <83libhlnpz.fsf@HIDDEN>
 <y5txq5n0rm.fsf@HIDDEN> <3b8v7byrki.fsf@HIDDEN>
 <jwv4nhybh3s.fsf-monnier+emacs@HIDDEN>
 <c6halxg8py.fsf@HIDDEN>
X-Spook: Uzbekistan Indigo Aldergrove subversive CDC Attorney
X-Ran: aFlt%E+?O)@$$H@g,)3\o5<f<P5%LGKm>Psh.^Q56K8c|Q;!7+\oq5t2/U.,CS}7%A5M_J
X-Hue: blue
X-Attribution: GM
Date: Sun, 10 Aug 2014 21:06:47 -0400
In-Reply-To: <c6halxg8py.fsf@HIDDEN> (Glenn Morris's message of
 "Thu, 31 Jan 2013 01:36:09 -0500")
Message-ID: <3v8umvdec8.fsf@HIDDEN>
User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 13522
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://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: <http://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: -5.0 (-----)


Had to revert this fix - see discussion in http://debbugs.gnu.org/18141 .




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#13522; Package emacs. Full text available.
bug Marked as found in versions 24.4; no longer marked as fixed in versions 24.4 and reopened. Request was from Glenn Morris <rgm@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
bug unarchived. Request was from Glenn Morris <rgm@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
bug archived. Request was from Debbugs Internal Request <help-debbugs@HIDDEN> to internal_control <at> debbugs.gnu.org. Full text available.
bug marked as fixed in version 24.4, send any further explanations to 13522 <at> debbugs.gnu.org and Vincent Lefevre <vincent@HIDDEN> Request was from Glenn Morris <rgm@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 13522 <at> debbugs.gnu.org:


Received: (at 13522) by debbugs.gnu.org; 31 Jan 2013 06:36:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 31 01:36:57 2013
Received: from localhost ([127.0.0.1]:56674 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1U0nlY-00040K-NE
	for submit <at> debbugs.gnu.org; Thu, 31 Jan 2013 01:36:56 -0500
Received: from fencepost.gnu.org ([208.118.235.10]:52211)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <rgm@HIDDEN>) id 1U0nlV-00040B-5m
	for 13522 <at> debbugs.gnu.org; Thu, 31 Jan 2013 01:36:54 -0500
Received: from rgm by fencepost.gnu.org with local (Exim 4.71)
	(envelope-from <rgm@HIDDEN>)
	id 1U0nkn-0006Sw-N6; Thu, 31 Jan 2013 01:36:09 -0500
From: Glenn Morris <rgm@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#13522: 24.2;
	save-buffer removes edited file under some conditions
References: <87622qaszq.fsf@HIDDEN> <aqtxq6e36c.fsf@HIDDEN>
	<20130125000256.GC3397@HIDDEN>
	<s14ni6axzc.fsf@HIDDEN> <83libhlnpz.fsf@HIDDEN>
	<y5txq5n0rm.fsf@HIDDEN> <3b8v7byrki.fsf@HIDDEN>
	<jwv4nhybh3s.fsf-monnier+emacs@HIDDEN>
X-Spook: Bosnia blackjack condor PET analyzer red noise Commecen
X-Ran: fe4w8dnluO4;D~Z:VU8LQKlwc+xg6CZ2\z7CY*'+JaY_3`_}Z0BZCBf4aSA,7A^3:+uWIc
X-Hue: cyan
X-Debbugs-No-Ack: yes
X-Attribution: GM
Date: Thu, 31 Jan 2013 01:36:09 -0500
In-Reply-To: <jwv4nhybh3s.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
	of "Wed, 30 Jan 2013 14:34:57 -0500")
Message-ID: <c6halxg8py.fsf@HIDDEN>
User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -4.7 (----)
X-Debbugs-Envelope-To: 13522
Cc: Eli Zaretskii <eliz@HIDDEN>, vincent@HIDDEN, 13522 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://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: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -7.4 (-------)

Stefan Monnier wrote:

> Rather than introduce a new var, we could let bind
> coding-system-for-write (and coding-system-require-warning).

Sold.

Done in trunk.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#13522; Package emacs. Full text available.

Message received at 13522 <at> debbugs.gnu.org:


Received: (at 13522) by debbugs.gnu.org; 30 Jan 2013 19:35:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 30 14:35:52 2013
Received: from localhost ([127.0.0.1]:56195 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1U0dRo-0000xs-Nn
	for submit <at> debbugs.gnu.org; Wed, 30 Jan 2013 14:35:52 -0500
Received: from ironport2-out.teksavvy.com ([206.248.154.182]:57583)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <monnier@HIDDEN>) id 1U0dRn-0000xk-6G
	for 13522 <at> debbugs.gnu.org; Wed, 30 Jan 2013 14:35:51 -0500
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: Av4EABK/CFG4rw3e/2dsb2JhbABEvw4Xc4IfAQVWIxALDiYSFBgNJIgkwS2RCgOIYZwZgV6DFQ
X-IPAS-Result: Av4EABK/CFG4rw3e/2dsb2JhbABEvw4Xc4IfAQVWIxALDiYSFBgNJIgkwS2RCgOIYZwZgV6DFQ
X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; 
   d="scan'208";a="48456"
Received: from 184-175-13-222.dsl.teksavvy.com (HELO ceviche.home)
	([184.175.13.222])
	by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA;
	30 Jan 2013 14:35:06 -0500
Received: by ceviche.home (Postfix, from userid 20848)
	id 8201166130; Wed, 30 Jan 2013 14:34:57 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Glenn Morris <rgm@HIDDEN>
Subject: Re: bug#13522: 24.2;
	save-buffer removes edited file under some conditions
Message-ID: <jwv4nhybh3s.fsf-monnier+emacs@HIDDEN>
References: <87622qaszq.fsf@HIDDEN> <aqtxq6e36c.fsf@HIDDEN>
	<20130125000256.GC3397@HIDDEN>
	<s14ni6axzc.fsf@HIDDEN> <83libhlnpz.fsf@HIDDEN>
	<y5txq5n0rm.fsf@HIDDEN> <3b8v7byrki.fsf@HIDDEN>
Date: Wed, 30 Jan 2013 14:34:57 -0500
In-Reply-To: <3b8v7byrki.fsf@HIDDEN> (Glenn Morris's message of
	"Wed, 30 Jan 2013 03:59:25 -0500")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 13522
Cc: Eli Zaretskii <eliz@HIDDEN>, vincent@HIDDEN, 13522 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://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: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

> + 	      (let ((write-region-coding-system writecoding))
>   		(write-region nil nil
>   			      buffer-file-name nil t buffer-file-truename)

Rather than introduce a new var, we could let bind
coding-system-for-write (and coding-system-require-warning).


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#13522; Package emacs. Full text available.

Message received at 13522 <at> debbugs.gnu.org:


Received: (at 13522) by debbugs.gnu.org; 30 Jan 2013 09:00:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 30 04:00:05 2013
Received: from localhost ([127.0.0.1]:55213 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1U0TWX-0006L0-0Q
	for submit <at> debbugs.gnu.org; Wed, 30 Jan 2013 04:00:05 -0500
Received: from fencepost.gnu.org ([208.118.235.10]:37160)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <rgm@HIDDEN>) id 1U0TWU-0006KN-KR
	for 13522 <at> debbugs.gnu.org; Wed, 30 Jan 2013 04:00:04 -0500
Received: from rgm by fencepost.gnu.org with local (Exim 4.71)
	(envelope-from <rgm@HIDDEN>)
	id 1U0TVu-0003CS-40; Wed, 30 Jan 2013 03:59:26 -0500
From: Glenn Morris <rgm@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#13522: 24.2;
	save-buffer removes edited file under some conditions
References: <87622qaszq.fsf@HIDDEN> <aqtxq6e36c.fsf@HIDDEN>
	<20130125000256.GC3397@HIDDEN>
	<s14ni6axzc.fsf@HIDDEN> <83libhlnpz.fsf@HIDDEN>
	<y5txq5n0rm.fsf@HIDDEN>
X-Spook: Downing Street World Trade Center Blowpipe Plame class
X-Ran: /-Hg7m,\{zoejgS-m`{Jzz0=R9F7GOq\uud'XfZt=O-teO"8HjNmsoY[rZqSs0/mUdK+)m
X-Hue: black
X-Debbugs-No-Ack: yes
X-Attribution: GM
Date: Wed, 30 Jan 2013 03:59:25 -0500
In-Reply-To: <y5txq5n0rm.fsf@HIDDEN> (Glenn Morris's message of
	"Fri, 25 Jan 2013 03:07:57 -0500")
Message-ID: <3b8v7byrki.fsf@HIDDEN>
User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -7.4 (-------)
X-Debbugs-Envelope-To: 13522
Cc: 13522 <at> debbugs.gnu.org, vincent@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://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: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -7.4 (-------)

Glenn Morris wrote:

> Maybe the right solution is to have the select-safe-coding-system check
> in basic-save-buffer-2 before backup-buffer, then pass the resulting
> coding system to write-region somehow so it does not need to query
> again.

Very lightly tested patch:

*** lisp/files.el	2013-01-10 15:50:04 +0000
--- lisp/files.el	2013-01-30 08:53:30 +0000
***************
*** 4656,4662 ****
  ;; This returns a value (MODES EXTENDED-ATTRIBUTES BACKUPNAME), like
  ;; backup-buffer.
  (defun basic-save-buffer-2 ()
!   (let (tempsetmodes setmodes)
      (if (not (file-writable-p buffer-file-name))
  	(let ((dir (file-name-directory buffer-file-name)))
  	  (if (not (file-directory-p dir))
--- 4656,4662 ----
  ;; This returns a value (MODES EXTENDED-ATTRIBUTES BACKUPNAME), like
  ;; backup-buffer.
  (defun basic-save-buffer-2 ()
!   (let (tempsetmodes setmodes writecoding)
      (if (not (file-writable-p buffer-file-name))
  	(let ((dir (file-name-directory buffer-file-name)))
  	  (if (not (file-directory-p dir))
***************
*** 4672,4677 ****
--- 4672,4680 ----
  		     buffer-file-name)))
  		  (setq tempsetmodes t)
  		(error "Attempt to save to a file which you aren't allowed to write"))))))
+     (setq writecoding
+ 	  (choose-write-coding-system nil nil buffer-file-name nil t
+ 				      buffer-file-truename))
      (or buffer-backed-up
  	(setq setmodes (backup-buffer)))
      (let* ((dir (file-name-directory buffer-file-name))
***************
*** 4753,4762 ****
  				 (logior (car setmodes) 128))))))
  	(let (success)
  	  (unwind-protect
- 	      (progn
                  ;; Pass in nil&nil rather than point-min&max to indicate
                  ;; we're saving the buffer rather than just a region.
                  ;; write-region-annotate-functions may make us of it.
  		(write-region nil nil
  			      buffer-file-name nil t buffer-file-truename)
  		(setq success t))
--- 4756,4765 ----
  				 (logior (car setmodes) 128))))))
  	(let (success)
  	  (unwind-protect
  	      ;; Pass in nil&nil rather than point-min&max to indicate
  	      ;; we're saving the buffer rather than just a region.
  	      ;; write-region-annotate-functions may make us of it.
+ 	      (let ((write-region-coding-system writecoding))
  		(write-region nil nil
  			      buffer-file-name nil t buffer-file-truename)
  		(setq success t))

=== modified file 'src/fileio.c'
*** src/fileio.c	2013-01-23 20:07:28 +0000
--- src/fileio.c	2013-01-30 08:55:45 +0000
***************
*** 249,254 ****
--- 249,255 ----
  static Lisp_Object Qset_file_acl;
  static Lisp_Object Qfile_newer_than_file_p;
  Lisp_Object Qinsert_file_contents;
+ Lisp_Object Qchoose_write_coding_system;
  Lisp_Object Qwrite_region;
  static Lisp_Object Qverify_visited_file_modtime;
  static Lisp_Object Qset_visited_file_modtime;
***************
*** 4615,4628 ****
  
  /* Decide the coding-system to encode the data with.  */
  
! static Lisp_Object
! choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
! 			    Lisp_Object append, Lisp_Object visit, Lisp_Object lockname,
! 			    struct coding_system *coding)
  {
    Lisp_Object val;
    Lisp_Object eol_parent = Qnil;
  
    if (auto_saving
        && NILP (Fstring_equal (BVAR (current_buffer, filename),
  			      BVAR (current_buffer, auto_save_file_name))))
--- 4616,4637 ----
  
  /* Decide the coding-system to encode the data with.  */
  
! DEFUN ("choose-write-coding-system", Fchoose_write_coding_system,
!        Schoose_write_coding_system, 3, 6, 0,
!        doc: /* Choose coding system for write.
! Arguments as for `write-region'.  */ )
!   (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
!    Lisp_Object append, Lisp_Object visit, Lisp_Object lockname)
  {
    Lisp_Object val;
    Lisp_Object eol_parent = Qnil;
  
+   if (NILP (start))
+     {
+       XSETFASTINT (start, BEGV);
+       XSETFASTINT (end, ZV);
+     }
+ 
    if (auto_saving
        && NILP (Fstring_equal (BVAR (current_buffer, filename),
  			      BVAR (current_buffer, auto_save_file_name))))
***************
*** 4715,4724 ****
      }
  
    val = coding_inherit_eol_type (val, eol_parent);
-   setup_coding_system (val, coding);
- 
-   if (!STRINGP (start) && !NILP (BVAR (current_buffer, selective_display)))
-     coding->mode |= CODING_MODE_SELECTIVE_DISPLAY;
    return val;
  }
  
--- 4724,4729 ----
***************
*** 4874,4882 ****
       We used to make this choice before calling build_annotations, but that
       leads to problems when a write-annotate-function takes care of
       unsavable chars (as was the case with X-Symbol).  */
!   Vlast_coding_system_used
!     = choose_write_coding_system (start, end, filename,
! 				  append, visit, lockname, &coding);
  
  #ifdef CLASH_DETECTION
    if (!auto_saving)
--- 4879,4893 ----
       We used to make this choice before calling build_annotations, but that
       leads to problems when a write-annotate-function takes care of
       unsavable chars (as was the case with X-Symbol).  */
!   Vlast_coding_system_used = NILP (Vwrite_region_coding_system) ?
!     Fchoose_write_coding_system (start, end, filename,
!                                 append, visit, lockname) :
!     Vwrite_region_coding_system;
! 
!   setup_coding_system (Vlast_coding_system_used, &coding);
! 
!   if (!STRINGP (start) && !NILP (BVAR (current_buffer, selective_display)))
!     coding.mode |= CODING_MODE_SELECTIVE_DISPLAY;
  
  #ifdef CLASH_DETECTION
    if (!auto_saving)
***************
*** 5861,5866 ****
--- 5872,5878 ----
    DEFSYM (Qset_file_acl, "set-file-acl");
    DEFSYM (Qfile_newer_than_file_p, "file-newer-than-file-p");
    DEFSYM (Qinsert_file_contents, "insert-file-contents");
+   DEFSYM (Qchoose_write_coding_system, "choose-write-coding-system");
    DEFSYM (Qwrite_region, "write-region");
    DEFSYM (Qverify_visited_file_modtime, "verify-visited-file-modtime");
    DEFSYM (Qset_visited_file_modtime, "set-visited-file-modtime");
***************
*** 5890,5895 ****
--- 5902,5912 ----
  of file names regardless of the current language environment.  */);
    Vdefault_file_name_coding_system = Qnil;
  
+   DEFVAR_LISP ("write-region-coding-system", Vwrite_region_coding_system,
+ 	       doc: /* If non-nil, coding system for `write-region'.
+ You should only ever `let'-bind this around a `write-region' call.  */);
+   Vwrite_region_coding_system = Qnil;
+ 
    DEFSYM (Qformat_decode, "format-decode");
    DEFSYM (Qformat_annotate_function, "format-annotate-function");
    DEFSYM (Qafter_insert_file_set_coding, "after-insert-file-set-coding");
***************
*** 6085,6090 ****
--- 6102,6108 ----
    defsubr (&Sdefault_file_modes);
    defsubr (&Sfile_newer_than_file_p);
    defsubr (&Sinsert_file_contents);
+   defsubr (&Schoose_write_coding_system);
    defsubr (&Swrite_region);
    defsubr (&Scar_less_than_car);
    defsubr (&Sverify_visited_file_modtime);





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#13522; Package emacs. Full text available.

Message received at 13522 <at> debbugs.gnu.org:


Received: (at 13522) by debbugs.gnu.org; 25 Jan 2013 08:08:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 25 03:08:09 2013
Received: from localhost ([127.0.0.1]:48522 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1TyeKX-00083l-2a
	for submit <at> debbugs.gnu.org; Fri, 25 Jan 2013 03:08:09 -0500
Received: from fencepost.gnu.org ([208.118.235.10]:44084)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <rgm@HIDDEN>) id 1TyeKV-00083e-A3
	for 13522 <at> debbugs.gnu.org; Fri, 25 Jan 2013 03:08:08 -0500
Received: from rgm by fencepost.gnu.org with local (Exim 4.71)
	(envelope-from <rgm@HIDDEN>)
	id 1TyeKL-0000Pl-TS; Fri, 25 Jan 2013 03:07:57 -0500
From: Glenn Morris <rgm@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#13522: 24.2;
	save-buffer removes edited file under some conditions
References: <87622qaszq.fsf@HIDDEN> <aqtxq6e36c.fsf@HIDDEN>
	<20130125000256.GC3397@HIDDEN>
	<s14ni6axzc.fsf@HIDDEN> <83libhlnpz.fsf@HIDDEN>
X-Spook: RSA Bellcore afsatcom security CIA Downing Street kibo
X-Ran: vG\h/{o2]QyCu7k2'ED.rzAV?8JP_S'0>pb6*;=Hxt<d/H|C.~3HEeT?nq[(n~)*V(=%2E
X-Hue: black
X-Debbugs-No-Ack: yes
X-Attribution: GM
Date: Fri, 25 Jan 2013 03:07:57 -0500
In-Reply-To: <83libhlnpz.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 25 Jan
	2013 09:35:04 +0200")
Message-ID: <y5txq5n0rm.fsf@HIDDEN>
User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -4.2 (----)
X-Debbugs-Envelope-To: 13522
Cc: 13522 <at> debbugs.gnu.org, vincent@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://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: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -5.5 (-----)

Eli Zaretskii wrote:

> I can't.  Moreover, the recipe says "Type C-c in the terminal to kill
> Emacs", but C-c does not kill Emacs, only C-x C-c does. 

C-c *in the shell* from which Emacs was started in the foreground, not
from in Emacs; ie interrupt it from outside.

Or even: do C-x C-s, and leave the coding prompt unanswered. You will
find the original file missing until you answer, or quit, the coding
question!

Looks like it has been this way since the unicode merge.
basic-save-buffer-2 calls backup-buffer, which may rename the original
file. It then calls write-region. This may call
select-safe-coding-system, so there can be an arbitrarily long interval
between the original file being renamed to the backup, and the new file
being written.

If you interrupt the coding prompt with C-g, the unwind-protect in
basic-save-buffer-2 puts back the original file. I suppose the problem
could maybe be papered over by adding something equivalent to
kill-emacs-hook, but it's still very far from ideal.

Maybe the right solution is to have the select-safe-coding-system check
in basic-save-buffer-2 before backup-buffer, then pass the resulting
coding system to write-region somehow so it does not need to query
again.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#13522; Package emacs. Full text available.

Message received at 13522 <at> debbugs.gnu.org:


Received: (at 13522) by debbugs.gnu.org; 25 Jan 2013 07:35:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 25 02:35:11 2013
Received: from localhost ([127.0.0.1]:48464 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Tydoc-0007FJ-N2
	for submit <at> debbugs.gnu.org; Fri, 25 Jan 2013 02:35:11 -0500
Received: from mtaout21.012.net.il ([80.179.55.169]:34336)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <eliz@HIDDEN>) id 1TydoY-0007F7-JH
	for 13522 <at> debbugs.gnu.org; Fri, 25 Jan 2013 02:35:08 -0500
Received: from conversion-daemon.a-mtaout21.012.net.il by
	a-mtaout21.012.net.il (HyperSendmail v2007.08) id
	<0MH600L007OGFW00@HIDDEN> for
	13522 <at> debbugs.gnu.org; Fri, 25 Jan 2013 09:34:57 +0200 (IST)
Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il
	(HyperSendmail v2007.08) with ESMTPA id
	<0MH600LLV7Q9AF70@HIDDEN>;
	Fri, 25 Jan 2013 09:34:57 +0200 (IST)
Date: Fri, 25 Jan 2013 09:35:04 +0200
From: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#13522: 24.2;
	save-buffer removes edited file under some conditions
In-reply-to: <s14ni6axzc.fsf@HIDDEN>
X-012-Sender: halo1@HIDDEN
To: Glenn Morris <rgm@HIDDEN>
Message-id: <83libhlnpz.fsf@HIDDEN>
References: <87622qaszq.fsf@HIDDEN> <aqtxq6e36c.fsf@HIDDEN>
	<20130125000256.GC3397@HIDDEN>
	<s14ni6axzc.fsf@HIDDEN>
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 13522
Cc: 13522 <at> debbugs.gnu.org, vincent@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: Eli Zaretskii <eliz@HIDDEN>
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://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: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.2 (-)

> From: Glenn Morris <rgm@HIDDEN>
> Date: Thu, 24 Jan 2013 19:48:55 -0500
> Cc: 13522 <at> debbugs.gnu.org
> 
> Vincent Lefevre wrote:
> 
> >> I can't reproduce this with 24.2.
> 
> I was using a file in /tmp

I wasn't.

> Using a file in $HOME I can reproduce it.

I can't.  Moreover, the recipe says "Type C-c in the terminal to kill
Emacs", but C-c does not kill Emacs, only C-x C-c does.  And if I type
C-x C-c, I am asked whether to exit without saving etc.  This doesn't
seem to be the described scenario at all.  What am I missing?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#13522; Package emacs. Full text available.
bug Marked as found in versions 24.1. Request was from Glenn Morris <rgm@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
bug Marked as found in versions 23.4. Request was from Glenn Morris <rgm@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
bug Marked as found in versions 23.3. Request was from Glenn Morris <rgm@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
bug Marked as found in versions 23.2. Request was from Glenn Morris <rgm@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
bug Marked as found in versions 23.1. Request was from Glenn Morris <rgm@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 13522 <at> debbugs.gnu.org:


Received: (at 13522) by debbugs.gnu.org; 25 Jan 2013 00:49:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 24 19:49:04 2013
Received: from localhost ([127.0.0.1]:48296 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1TyXTc-0004Sx-1T
	for submit <at> debbugs.gnu.org; Thu, 24 Jan 2013 19:49:04 -0500
Received: from fencepost.gnu.org ([208.118.235.10]:32896)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <rgm@HIDDEN>) id 1TyXTa-0004Sq-2c
	for 13522 <at> debbugs.gnu.org; Thu, 24 Jan 2013 19:49:02 -0500
Received: from rgm by fencepost.gnu.org with local (Exim 4.71)
	(envelope-from <rgm@HIDDEN>)
	id 1TyXTT-00016E-NU; Thu, 24 Jan 2013 19:48:55 -0500
From: Glenn Morris <rgm@HIDDEN>
To: Vincent Lefevre <vincent@HIDDEN>
Subject: Re: bug#13522: 24.2;
	save-buffer removes edited file under some conditions
References: <87622qaszq.fsf@HIDDEN> <aqtxq6e36c.fsf@HIDDEN>
	<20130125000256.GC3397@HIDDEN>
X-Spook: weapons of mass destruction Putin Aladdin South Africa
X-Ran: zUE^-y55/ZS8P1|mdxis.wDiF9m6irN^%=1d!biwp*b|e4QFKDs{f9,`CZ*RI$XO.a{v=4
X-Hue: white
X-Debbugs-No-Ack: yes
X-Attribution: GM
Date: Thu, 24 Jan 2013 19:48:55 -0500
In-Reply-To: <20130125000256.GC3397@HIDDEN> (Vincent Lefevre's
	message of "Fri, 25 Jan 2013 01:02:56 +0100")
Message-ID: <s14ni6axzc.fsf@HIDDEN>
User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -4.2 (----)
X-Debbugs-Envelope-To: 13522
Cc: 13522 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://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: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -5.0 (-----)

Vincent Lefevre wrote:

>> I can't reproduce this with 24.2.

I was using a file in /tmp, and apparently Emacs does not make backups
of files in /tmp (normal-backup-enable-predicate; not sure that seems
useful behaviour to me). Using a file in $HOME I can reproduce it.

>> Here I have both "file" and "#file", no "file~".
>
> I have "file~" and "#file#" (with 2 # characters).

(The "#" was just a typo on my part.)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#13522; Package emacs. Full text available.

Message received at 13522 <at> debbugs.gnu.org:


Received: (at 13522) by debbugs.gnu.org; 25 Jan 2013 00:03:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 24 19:03:06 2013
Received: from localhost ([127.0.0.1]:48286 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1TyWl8-0003Ph-E3
	for submit <at> debbugs.gnu.org; Thu, 24 Jan 2013 19:03:06 -0500
Received: from vinc17.pck.nerim.net ([213.41.242.187]:56091
	helo=smtp-xvii.vinc17.net) by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <vincent@HIDDEN>) id 1TyWl5-0003PY-3u
	for 13522 <at> debbugs.gnu.org; Thu, 24 Jan 2013 19:03:04 -0500
Received: by xvii.vinc17.org (Postfix, from userid 1000)
	id 66445314021; Fri, 25 Jan 2013 01:02:56 +0100 (CET)
Date: Fri, 25 Jan 2013 01:02:56 +0100
From: Vincent Lefevre <vincent@HIDDEN>
To: Glenn Morris <rgm@HIDDEN>
Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some
	conditions
Message-ID: <20130125000256.GC3397@HIDDEN>
References: <87622qaszq.fsf@HIDDEN> <aqtxq6e36c.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
In-Reply-To: <aqtxq6e36c.fsf@HIDDEN>
X-Mailer-Info: http://www.vinc17.net/mutt/
User-Agent: Mutt/1.5.21-6294-vl-r57845 (2013-01-23)
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.8 (/)
X-Debbugs-Envelope-To: 13522
Cc: 13522 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://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: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -0.0 (/)

On 2013-01-24 15:28:27 -0500, Glenn Morris wrote:
> Vincent Lefevre wrote:
> > 1. Create a file with: printf "\x80" > file
> > 2. Open the file under X Window with: emacs -Q file
> > 3. Modify the file e.g. by adding a space.
> > 4. Type C-x C-s
> >    At this point, Emacs asks the user to select a coding system.
> > 5. Type C-c in the terminal to kill Emacs.
> >
> > The result is that the file "file" is no longer there!

Same problem with the official GNU Emacs 24.2.1 (not Debian's).

> I can't reproduce this with 24.2.
> Here I have both "file" and "#file", no "file~".

I have "file~" and "#file#" (with 2 # characters).

--=20
Vincent Lef=E8vre <vincent@HIDDEN> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#13522; Package emacs. Full text available.

Message received at 13522 <at> debbugs.gnu.org:


Received: (at 13522) by debbugs.gnu.org; 24 Jan 2013 20:28:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 24 15:28:44 2013
Received: from localhost ([127.0.0.1]:48181 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1TyTPb-0004zn-Pz
	for submit <at> debbugs.gnu.org; Thu, 24 Jan 2013 15:28:44 -0500
Received: from fencepost.gnu.org ([208.118.235.10]:57321)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <rgm@HIDDEN>) id 1TyTPV-0004zZ-4i
	for 13522 <at> debbugs.gnu.org; Thu, 24 Jan 2013 15:28:38 -0500
Received: from rgm by fencepost.gnu.org with local (Exim 4.71)
	(envelope-from <rgm@HIDDEN>)
	id 1TyTPP-0006VX-8E; Thu, 24 Jan 2013 15:28:27 -0500
From: Glenn Morris <rgm@HIDDEN>
To: Vincent Lefevre <vincent@HIDDEN>
Subject: Re: bug#13522: 24.2;
	save-buffer removes edited file under some conditions
References: <87622qaszq.fsf@HIDDEN>
X-Spook: investigation analyzer cybercash asset mindwar Europol
X-Ran: sdX?s_wKZ]@'^pgWoP)m&umipi-Laqa&ezGj8K%O\'*Tp7p&rEjgq)HkpmEfhh:1pHf^DP
X-Hue: blue
X-Attribution: GM
Date: Thu, 24 Jan 2013 15:28:27 -0500
In-Reply-To: <87622qaszq.fsf@HIDDEN> (Vincent Lefevre's message of
	"Tue, 22 Jan 2013 02:47:37 +0100")
Message-ID: <aqtxq6e36c.fsf@HIDDEN>
User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -4.2 (----)
X-Debbugs-Envelope-To: 13522
Cc: 13522 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://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: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.9 (------)

Vincent Lefevre wrote:

> 1. Create a file with: printf "\x80" > file
> 2. Open the file under X Window with: emacs -Q file
> 3. Modify the file e.g. by adding a space.
> 4. Type C-x C-s
>    At this point, Emacs asks the user to select a coding system.
> 5. Type C-c in the terminal to kill Emacs.
>
> The result is that the file "file" is no longer there!

I can't reproduce this with 24.2.
Here I have both "file" and "#file", no "file~".

> Actually there is a backup. Here it is easy to see (file~), but




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#13522; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 22 Jan 2013 01:48:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 21 20:48:57 2013
Received: from localhost ([127.0.0.1]:43798 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1TxSyu-0005q5-Qq
	for submit <at> debbugs.gnu.org; Mon, 21 Jan 2013 20:48:57 -0500
Received: from eggs.gnu.org ([208.118.235.92]:59390)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <vincent@HIDDEN>) id 1TxSys-0005px-Cu
	for submit <at> debbugs.gnu.org; Mon, 21 Jan 2013 20:48:55 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <vincent@HIDDEN>) id 1TxSxm-0000bV-A4
	for submit <at> debbugs.gnu.org; Mon, 21 Jan 2013 20:47:47 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-101.9 required=5.0 tests=BAYES_00, USER_IN_WHITELIST
	autolearn=unavailable version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:36604)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vincent@HIDDEN>) id 1TxSxm-0000bP-6l
	for submit <at> debbugs.gnu.org; Mon, 21 Jan 2013 20:47:46 -0500
Received: from eggs.gnu.org ([208.118.235.92]:42513)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vincent@HIDDEN>) id 1TxSxk-0001oM-JR
	for bug-gnu-emacs@HIDDEN; Mon, 21 Jan 2013 20:47:46 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <vincent@HIDDEN>) id 1TxSxi-0000a6-O5
	for bug-gnu-emacs@HIDDEN; Mon, 21 Jan 2013 20:47:44 -0500
Received: from vinc17.pck.nerim.net ([213.41.242.187]:56968
	helo=smtp-xvii.vinc17.net) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <vincent@HIDDEN>) id 1TxSxi-0000Zj-5h
	for bug-gnu-emacs@HIDDEN; Mon, 21 Jan 2013 20:47:42 -0500
Received: by xvii.vinc17.org (Postfix, from userid 1000)
	id B41F231001E; Tue, 22 Jan 2013 02:47:37 +0100 (CET)
From: Vincent Lefevre <vincent@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 24.2; save-buffer removes edited file under some conditions
Date: Tue, 22 Jan 2013 02:47:37 +0100
Message-ID: <87622qaszq.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.17
X-Spam-Score: -6.9 (------)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://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: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.9 (------)

1. Create a file with: printf "\x80" > file
2. Open the file under X Window with: emacs -Q file
3. Modify the file e.g. by adding a space.
4. Type C-x C-s
   At this point, Emacs asks the user to select a coding system.
5. Type C-c in the terminal to kill Emacs.

The result is that the file "file" is no longer there!

Actually there is a backup. Here it is easy to see (file~), but
if the user has defined find-backup-file-name, he may not be
aware that there is a backup (as this is not the normal use of
backups since the file hasn't been saved) and may think that the
file has been lost (it took me some time to find out...).

I think that Emacs makes the backup too soon. It should do it only
just before saving.

This might be a variant of the old bug:

  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=194171


In GNU Emacs 24.2.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.10)
 of 2012-09-11 on xvii, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11204000
Configured using:
 `configure '--build' 'x86_64-linux-gnu' '--build' 'x86_64-linux-gnu'
 '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
 '--localstatedir=/var/lib' '--infodir=/usr/share/info'
 '--mandir=/usr/share/man' '--with-pop=yes'
 '--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.2/site-lisp:/usr/share/emacs/site-lisp'
 '--with-crt-dir=/usr/lib/x86_64-linux-gnu' '--with-x=yes'
 '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars'
 'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector
 --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall'
 'CPPFLAGS=-D_FORTIFY_SOURCE=2''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: POSIX
  value of $LC_CTYPE: en_US.UTF-8
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: en_DK
  value of $LANG: POSIX
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<help-echo> <escape> x r e p o r t - b u <tab> <re
turn>

Recent messages:
Loading /etc/emacs/site-start.d/50html-helper-mode.el (source)...done
Loading /etc/emacs/site-start.d/50latex-cjk-common.el (source)...
Loading cjk-enc...done
Loading /etc/emacs/site-start.d/50latex-cjk-common.el (source)...done
Loading /etc/emacs/site-start.d/50latex-cjk-thai.el (source)...done
Loading /etc/emacs/site-start.d/50psvn.el (source)...done
Loading /etc/emacs/site-start.d/50rnc-mode.el (source)...done
Loading /etc/emacs/site-start.d/50thailatex.el (source)...done
Loading /etc/emacs/site-start.d/50w3m-el.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
/usr/share/emacs24/site-lisp/css-mode/css-mode hides /usr/share/emacs/site-lisp/css-mode/css-mode
/usr/share/emacs/24.2/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs/site-lisp/autoconf/autotest-mode hides /usr/share/emacs/site-lisp/autotest-mode
/usr/share/emacs/24.2/site-lisp/cmake-data/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode
/usr/share/emacs24/site-lisp/html-helper-mode/tempo hides /usr/share/emacs/24.2/lisp/tempo
/usr/share/emacs24/site-lisp/flim/hex-util hides /usr/share/emacs/24.2/lisp/hex-util
/usr/share/emacs24/site-lisp/flim/md4 hides /usr/share/emacs/24.2/lisp/md4
/usr/share/emacs24/site-lisp/dictionaries-common/flyspell hides /usr/share/emacs/24.2/lisp/textmodes/flyspell
/usr/share/emacs24/site-lisp/dictionaries-common/ispell hides /usr/share/emacs/24.2/lisp/textmodes/ispell
/usr/share/emacs24/site-lisp/css-mode/css-mode hides /usr/share/emacs/24.2/lisp/textmodes/css-mode
/usr/share/emacs24/site-lisp/flim/hmac-md5 hides /usr/share/emacs/24.2/lisp/net/hmac-md5
/usr/share/emacs24/site-lisp/flim/sasl-ntlm hides /usr/share/emacs/24.2/lisp/net/sasl-ntlm
/usr/share/emacs24/site-lisp/flim/sasl-cram hides /usr/share/emacs/24.2/lisp/net/sasl-cram
/usr/share/emacs24/site-lisp/flim/ntlm hides /usr/share/emacs/24.2/lisp/net/ntlm
/usr/share/emacs24/site-lisp/flim/sasl hides /usr/share/emacs/24.2/lisp/net/sasl
/usr/share/emacs24/site-lisp/flim/hmac-def hides /usr/share/emacs/24.2/lisp/net/hmac-def
/usr/share/emacs24/site-lisp/flim/sasl-digest hides /usr/share/emacs/24.2/lisp/net/sasl-digest
/usr/share/emacs24/site-lisp/latex-cjk-thai/thai-word hides /usr/share/emacs/24.2/lisp/language/thai-word
/usr/share/emacs24/site-lisp/html-helper-mode/html-helper-mode hides /usr/share/emacs/site-lisp/html-helper-mode/html-helper-mode
/usr/share/emacs24/site-lisp/html-helper-mode/hhm-config hides /usr/share/emacs/site-lisp/html-helper-mode/hhm-config
/usr/share/emacs24/site-lisp/html-helper-mode/tempo hides /usr/share/emacs/site-lisp/html-helper-mode/tempo
/usr/share/emacs24/site-lisp/html-helper-mode/visual-basic-mode hides /usr/share/emacs/site-lisp/html-helper-mode/visual-basic-mode

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail regexp-opt rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils w3m-load jabber-autoloads
time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd
tool-bar dnd fontset image fringe lisp-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)




Acknowledgement sent to Vincent Lefevre <vincent@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#13522; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 14 Mar 2022 17:45:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.