🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #829

emacs can lose RMAIL file if system crashes

#829
From: Joe Ramey
Date: Wed, 07 Oct 1992 00:11
32 lines
1973 bytes
We're running Emacs version 18.58 on Sun 4s running SunOS 4.1.2.

A few times over the past couple of years I've had users report that
their RMAIL files were truncated when the system on which they were
reading their mail crashed.  They happened to be saving their RMAIL
files at the time that the system crashed.

I read through some of the Emacs lisp code and here's what I think is
happening:

RMAIL mode sets the file-precious-flag for the RMAIL buffer, so when
Emacs saves the RMAIL buffer it first renames it to #RMAIL, then
writes the new version of the buffer to RMAIL.  Suppose the system
crashes during that save.  Then the RMAIL file that exists is a
partial one.  When the system comes back up and the user runs RMAIL
again, Emacs brings in the partial version of the RMAIL file, reads in
the new mail, and saves out this new version of the truncated RMAIL
file.  The #RMAIL is now gone, because the file-precious-flag has
caused it to be overwritten and then deleted, and the RMAIL~ file
contains the original truncated version of the RMAIL file.

I haven't tried to fix the problem yet, but it seems that one fix
would be to write the new version of the RMAIL file under a different
name, say #RMAIL, and only if that write completes should you rename
#RMAIL to RMAIL.  Then if the system should crash in the middle of the
save, the RMAIL file will contain the last complete save of the file.

Is a fix for this problem already available (or am I overlooking
something)?

Joe Ramey
<ramey@csc.ti.com>
Technical Details
Message-ID: <9210070011.AA04715@ra.csc.ti.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ra.CSc.ti.COM!ramey

Show Full Headers
Complete Article Headers
Newsgroups: gnu.emacs.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ra.CSc.ti.COM!ramey
From: ramey@ra.CSc.ti.COM (Joe Ramey)
Subject: emacs can lose RMAIL file if system crashes
Message-ID: <9210070011.AA04715@ra.csc.ti.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 7 Oct 1992 00:11:42 GMT
Approved: bug-gnu-emacs@prep.ai.mit.edu
Lines: 35