R-alpha: .RData zapped by system shutdown

Peter Dalgaard BSA p.dalgaard@kubism.ku.dk
03 Aug 1997 00:40:44 +0200


R : Copyright 1997, Robert Gentleman and Ross Ihaka
Version 0.50 Alpha-1 (July 22, 1997)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type "license()" for details.

[Previously saved workspace restored]

Error: restore file corrupted -- no data loaded


-rw-r--r--   1 pd       users      0 Aug  1 12:46 /home/pd/R-sandbox/.RData


Aug  1 12:46:27 blackbird init: Switching to runlevel: 6
Aug  1 12:46:28 blackbird getty[197]: exiting on TERM signal


"Houston, we have a problem here".... As I remember, R was just
sitting in an xterm window doing nothing when the system was taken
down. This is weird, because as far as I can tell from the source, R
shouldn't try to save the workspace in an interactive session without
user confirmation. 

One possible scenario to explain it is that when the xterm got killed,
R's standard input was closed *and detached from the pty*, so that the
evaluation loop terminates, isatty(0) returns 0, forcing a save of the
GlobalEnv, during which the R process itself got terminated.

Fix? First of all, I suggest that the original .RData be rename()'d
before it is opened for writing (the backup may or may not be removed
afterwards). Secondly, do we really want this behaviour where isatty()
is called at a very late stage, or would we rather have the logic
depend on R_interactive? The cases to consider is when an interactive
session gets backgrounded, or loses its controlling terminal. And
shouldn't there be a signal handler for the TERM signal, to ensure
that things get wrapped up?

[Fortunately, the important bits of that workspace had been dumped out
previously, so I didn't lose much]

   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch