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

Dirk Eddelbuettel edd at debian.org
Fri Apr 21 14:42:12 CEST 2017


On 21 April 2017 at 15:13, Mikko Korpela wrote:
| Despite my obvious failure to read the manual and report this properly, 
| I will try to make a case. I understand that data stored in a temporary 
| file may disappear, and for that reason using an alternative TMPDIR 
| might be advisable. However, I think that creating a new temporary file 
| is a different case, and it would be nice if `?` and `help` continued to 
| work, for example. I understand if this will not be put on the R core 
| list of things to do.

It's complicated as it is clearly an interaction between the hosting OS and
the R application running.  "R cannot know" what policy the host OS may be
having.

You could also talk to your sys.admins and have the service configured. Eg on
my system the description for the tmpreaper package reads

 This package provides a program that can be used to clean out temporary-file
 directories.  It recursively searches the directory, refusing to chdir()
 across symlinks, and removes files that haven't been accessed in a
 user-specified amount of time.  You can specify a set of files to protect
 from deletion with a shell pattern.  It will not remove files owned by the
 process EUID that have the `w' bit clear, unless you ask it to, much like
 `rm -f'.  `tmpreaper' will not remove symlinks, sockets, fifos, or special
 files unless given a command line option enabling it to.
 .
 WARNING:  Please do not run `tmpreaper' on `/'.  There are no protections
 against this written into the program, as that would prevent it from
 functioning the way you'd expect it to in a `chroot(8)' environment.
 .
 The daily tmpreaper run can be configured through /etc/tmpreaper.conf .

which makes it clear that you can configure local behaviour.

Lastly, as the manual referenced in the initial reply says, you are in fact
in full control of this as you can set the environment variables for your R
sessions.

Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org



More information about the R-devel mailing list