Bug 154653 - emacs deletes the file which is being edited
emacs deletes the file which is being edited
Status: CLOSED UPSTREAM
Product: Fedora
Classification: Fedora
Component: emacs (Show other bugs)
4
i686 Linux
medium Severity high
: ---
: ---
Assigned To: Jens Petersen
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-04-13 07:23 EDT by John Smith
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-10-03 04:40:35 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description John Smith 2005-04-13 07:23:37 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; rv:1.7.6) Gecko/20050323 Fedora/1.7.6-1.3.2

Description of problem:
Under a certain very bizarre circumstance, emacs deletes
the file which is being edited when the user tries to
save it with C-x C-s.

Version-Release number of selected component (if applicable):
emacs-21.3-21.FC3

How reproducible:
Always

Steps to Reproduce:
1. Make sure you don't have a $HOME/emacsbug directory and type this in
a terminal:

mkdir $HOME/emacsbug
cd $HOME/emacsbug
cat >gen.c << EOF
#include <stdio.h>

main()
{
        putchar(0x1b);
        putchar(0x24);
        putchar(0x28);
        putchar(0x42);
        putchar(0x21);
        putchar(0x62);
        putchar(0x1b);
        putchar(0x28);
        putchar(0x42);
        putchar(0xf9);
        putchar(0x0a);
}
EOF
gcc gen.c -o gen
./gen >foo
emacs foo

2. So far we have created a file 'foo', and launched emacs to edit it.
Now in emacs hit exactly the following keys:

RET C-x C-s C-g C-x u C-x C-c

What happens is this: we type RET just to modify the file (so as to be
able to save it with C-x C-s), then we try to save it, then emacs complains
that it cannot be safely converted to any default coding system, then we
change our mind and decide to undo what we've just done, and we exit cleanly.

3. Now emacs has closed, we're back in the terminal. Just type 'ls'.


Actual Results:  The file 'foo' has disappeared: emacs has deleted it.


Expected Results:  The file 'foo' should still be here, unchanged.

Additional info:

It is very important to execute the above steps as indicated.
I have tried doing this in /tmp/emacsbug rather than $HOME/emacsbug,
and then the bug *doesn't* happen any more !
Comment 1 John Smith 2005-04-14 19:49:55 EDT
This bug has been fixed in emacs 22.  See

revision 1.597
date: 2002/07/23 19:23:08;  author: rms;  state: Exp;  lines: +27 -12
Comment 2 John Smith 2005-04-14 20:03:41 EDT
Sorry, here is the diff:

http://lists.gnu.org/archive/html/emacs-diffs/2002-07/msg00920.html
Comment 3 Jens Petersen 2005-10-03 04:40:35 EDT
Thanks.  However the above patch doesn't apply to emacs 21.

Note You need to log in before you can comment on or make changes to this bug.