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 !
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
Sorry, here is the diff: http://lists.gnu.org/archive/html/emacs-diffs/2002-07/msg00920.html
Thanks. However the above patch doesn't apply to emacs 21.