Skip to content

detach(package:base) kills R (PR#1271)

2 messages · david.heffernan@orcina.com, Peter Dalgaard

#
Full_Name: David Heffernan
Version: 1.3.1
OS: Windows & Linux
Submission from: (NULL) (158.152.160.7)


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.

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!!

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
david.heffernan@orcina.com writes:
Yes, it still does this in 1.4.0. And the fixup would be something
like that.
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.