From edd at debian.org  Fri Apr 21 14:42:12 2017
From: edd at debian.org (Dirk Eddelbuettel)
Date: Fri, 21 Apr 2017 07:42:12 -0500
Subject: [Rd] tempdir() may be deleted during long-running R session
In-Reply-To: <4f0797c5-a078-67ae-3992-cd66a82b454a@helsinki.fi>
References: <c78e9022-04c2-3cda-5898-dceec8bc5e94@helsinki.fi>
 <15e3b0a3-e0a8-2da8-27c4-9268a5751986@stats.ox.ac.uk>
 <4f0797c5-a078-67ae-3992-cd66a82b454a@helsinki.fi>
Message-ID: <22777.65060.465733.160015@max.eddelbuettel.com>


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



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