Bug 154653 - emacs deletes the file which is being edited
Summary: emacs deletes the file which is being edited
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: emacs
Version: 4
Hardware: i686
OS: Linux
medium
high
Target Milestone: ---
Assignee: Jens Petersen
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-04-13 11:23 UTC by John Smith
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-10-03 08:40:35 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description John Smith 2005-04-13 11:23:37 UTC
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 23:49:55 UTC
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-15 00:03:41 UTC
Sorry, here is the diff:

http://lists.gnu.org/archive/html/emacs-diffs/2002-07/msg00920.html

Comment 3 Jens Petersen 2005-10-03 08:40:35 UTC
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.