From MEC at stowers.org  Tue Apr 25 16:41:58 2017
From: MEC at stowers.org (Cook, Malcolm)
Date: Tue, 25 Apr 2017 14:41:58 +0000
Subject: [Rd] tempdir() may be deleted during long-running R session
In-Reply-To: <22783.11355.51121.660887@stat.math.ethz.ch>
References: <c78e9022-04c2-3cda-5898-dceec8bc5e94@helsinki.fi>
 <15e3b0a3-e0a8-2da8-27c4-9268a5751986@stats.ox.ac.uk>
 <4f0797c5-a078-67ae-3992-cd66a82b454a@helsinki.fi>
 <22777.65060.465733.160015@max.eddelbuettel.com>
 <20170421173446.GB20737@ofb.net>
 <22780.46838.39255.710673@max.eddelbuettel.com>
 <22783.11355.51121.660887@stat.math.ethz.ch>
Message-ID: <ea6a1fb2067a4c98b113c878789faf9f@exchsrv2.sgc.loc>

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
 



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