[Rd] tempdir() may be deleted during long-running R session

Cook, Malcolm MEC at stowers.org
Tue Apr 25 16:41:58 CEST 2017

Chiming in late on this thread...

>     > | Are there any packages which
 >     > | would break if a call to 'tempdir' automatically recreated this
 >     > | directory? (Or would it be too much of a performance hit to have
 >     > | 'tempdir' check and even just issue a warning when the directory is
 >     > | found not to exist?)
 >     > | Should we have a timer which periodically updates
 >     > | the modification time of tempdir()? What do other long-running
 >     > | programs do (e.g. screen, emacs)?
 > Valid questions, in my view.  Before answering, let's try to see
 > how hard it would be to make the tempdir() function in R more versatile.

Might this combination serve the purpose: 
	* R session keeps an open handle on the tempdir it creates, 
	* whatever tempdir harvesting cron job the user has be made sensitive enough not to delete open files (including open directories)

 > 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).
 > The proposed entry in NEWS is
 >    • tempdir(check=TRUE) recreates the tmpdir() if it is no longer valid.
 > and of course the default would be status quo, i.e.,  check = FALSE,
 > and once this is in R-devel, we (those who install R-devel) can
 > experiment with it.
 > Martin

More information about the R-devel mailing list