[Rd] tempdir() may be deleted during long-running R session
Martin Maechler
maechler at stat.math.ethz.ch
Tue Apr 25 17:53:47 CEST 2017
>>>>> Jeroen Ooms <jeroenooms at gmail.com>
>>>>> on Tue, 25 Apr 2017 15:05:51 +0200 writes:
> On Tue, Apr 25, 2017 at 1:00 PM, Martin Maechler
> <maechler at stat.math.ethz.ch> wrote:
>> As I've found it is not at all hard to add an option
>> which checks the existence and if the directory is no
>> longer "valid", tries to recreate it (and if it fails
>> doing that it calls the famous R_Suicide(), as it does
>> when R starts up and tempdir() cannot be initialized
>> correctly).
> Perhaps this can also fix the problem with mcparallel
> deleting the tempdir() when one of its children dies:
> file.exists(tempdir()) #TRUE
> parallel::mcparallel(q('no'))
> file.exists(tempdir()) # FALSE
Thank you, Jeroen, for the extra example.
I now have comitted the new feature... (completely back
compatible: in R's code tempdir() is not yet called with an
argument and the default is check = FALSE ),
actually in a "suicide-free" way ... which needed only slightly
more code.
In the worst case, one could save the R session by
Sys.setenv(TEMPDIR = "<something writable>")
if for instance /tmp/ suddenly became unwritable for the user.
What we could consider is making the default of 'check' settable
by an option, and experiment with setting the option to TRUE, so
all such problems would be auto-solved (says the incurable optimist ...).
Martin
More information about the R-devel
mailing list