[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Auto-save bug -- has this been fixed in emacs21?

From: Rob Browning
Subject: Auto-save bug -- has this been fixed in emacs21?
Date: Fri, 07 Sep 2001 14:02:50 -0500
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/20.7

I can check the emacs21 source, but I figured you might just know off
the top of your head.  If not, just let me know, and I'll go poke


  Message-Id: <m0wQbRK-0004oPC@chiark.greenend.org.uk>
  From: Ian Jackson <ijackson@chiark.greenend.org.uk>
  Subject: Emacs save and auto-save not reliable

  Package: emacs
  Version: 19.34-2

  Emacs cannot safely be used to edit important data.

  When Emacs wishes to write a new version of an file or an auto-save
  file it does not do so safely.  For an auto-save file it truncates the
  existing file, and for the file itself it renames it to the ~-file and
  then creates it afresh; only then does it write the new data to it.
  It should write the new data to a temporary file, and then use
  rename(2) to install the new version (special considerations apply
  when the file has hard links, or permissions that the current user
  cannot duplicate in a new file).

  With the main file at the user can at least, if they know that a
  problem has occurred, restore the ~ file to regain their data.  This
  is unsatisfactory because not all users of the data in a file may be
  aware whether or not there was a problem last time it was saved.

  However, with an auto-save file even this workaround is not possible.
  This means that features like recover-file and recover-session cannot
  be used safely without checking by eye the contents of the file, to
  ensure that the version being recovered is complete.  Even worse, if
  the disk fills up the attempt to (auto-)save will often replace a good
  but slightly out-of-date file with a truncated one.

  This misdesign caused me to lose some mail, but it is a problem for
  any application where Emacs is used to edit important data.

  In order to determine Emacs's exact behaviour I ran
   strace -o t emacs -q v

  I typed one character into the new file, did M-x do-auto-save, typed
  another character, did M-x do-auto-save again, saved the file with C-x
  C-s, added a third character, saved the file again, and then exited

  The file t is below.


Rob Browning
rlb @defaultvalue.org, @linuxdevel.com, and @debian.org
Previously @cs.utexas.edu
GPG=1C58 8B2C FB5E 3F64 EA5C  64AE 78FE E5FE F0CB A0AD

reply via email to

[Prev in Thread] Current Thread [Next in Thread]