[Rd] detach(package:base) kills R (PR#1271)

Peter Dalgaard BSA p.dalgaard@biostat.ku.dk
17 Jan 2002 11:53:37 +0100


david.heffernan@orcina.com writes:

> The command detach(package:base) kills R with segmentation fault on Linux and an
> access violation on Windows.  I guess the same will happen on any platform. 
> Obviously this is a not a sensible command to execute but you could easily do it
> by accident particularly if using the pos parameter to detach and getting it
> wrong.
> 
> It seems to me that an obvious fix is to report an error in do_detach in envir.c
> if the base package is the one which the caller is attempting to detach.

Yes, it still does this in 1.4.0. And the fixup would be something
like that.

> As a related issue it seems bad that when R crashes it doesn't give you a chance
> to save your workspace.  In fact, why does an access violation have to cause
> termination?  At the least the user should get a chance to save their workspace
> before termination.  At best R would report the error an carry running.
> 
> By the way, it's a great piece of software!!

These types of error are handled by the OS. It is difficult, if not
impossible, to get the program back in control. Even if you do,
there's a rather large risk that the workspace has been corrupted.

-- 
   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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._