FS#53848 - [r] tmpfiles.d to prevent deletion of files in /tmp

Attached to Project: Arch Linux
Opened by Frederick Eaton (Herodotus) - Thursday, 27 April 2017, 04:45 GMT
Last edited by Antonio Rojas (arojas) - Monday, 31 January 2022, 22:44 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Ronald van Haren (pressh)
Antonio Rojas (arojas)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

Since Arch uses Systemd, the "r" package should install a file in /usr/lib/tmpfiles.d/ which prevents Systemd from deleting directories matching "/tmp/Rtmp*". R puts all of its per-session temporary files in such directories and cleans them itself upon exit.

The file should probably be named /usr/lib/tmpfiles.d/R.conf and it should probably contain a single line "x /tmp/Rtmp*".

Here's a link to the R-devel discussion:

https://stat.ethz.ch/pipermail/r-devel/2017-April/074142.html

Steps to reproduce:

$ mkdir /tmp/Rtmpaoeu
$ touch -d "12 days ago" /tmp/Rtmpaoeu
$ sudo systemd-tmpfiles --clean
$ ls /tmp/Rtmpaoeu
ls: cannot access '/tmp/Rtmpaoeu': No such file or directory

$ sudo sh -c "echo 'x /tmp/Rtmp*' > /etc/tmpfiles.d/Rtmp.conf"
$ mkdir /tmp/Rtmpaoeu
$ touch -d "12 days ago" /tmp/Rtmpaoeu
$ sudo systemd-tmpfiles --clean
$ ls /tmp/Rtmpaoeu
(still there)

Additional info:
* R version 3.3.3-1

This task depends upon

Closed by  Antonio Rojas (arojas)
Monday, 31 January 2022, 22:44 GMT
Reason for closing:  Won't implement
Additional comments about closing:  See comments
Comment by Antonio Rojas (arojas) - Saturday, 20 May 2017, 10:09 GMT
IMO this is something that needs to be properly handled upstream instead of worked around downstream
Comment by Frederick Eaton (Herodotus) - Saturday, 20 May 2017, 19:08 GMT
"Upstream" meaning the R source distribution? That has no dependence on Systemd. They are certainly willing to include an example tmpfiles.d/R.conf but looking at other packages like 'screen', it seems that the contents of such files are just specified in the package itself. If you have a reason to think that doing this is unconventional, then please explain why, and let us know what we should do on our end to make things more standard. Or if you want me to provide an example PKGBUILD script, I can do that. But I was thinking this bug should be pretty straightforward...
Comment by Eli Schwartz (eschwartz) - Friday, 04 August 2017, 02:55 GMT
Is there a particular reason why R might still be using files that are older than ten days? AIUI the reason /usr/lib/tmpfiles.d/tmp.conf is configured to remove temporary files that are older than ten days is due to the assumption that any such files are essentially guaranteed to have been orphaned. Systemd is not the only thing used by operating systems to clean up old temporary files.

tmpfiles.d snippets are only provided in Arch packages when upstreams fail to provide their own, BTW. :) Which is probably a lot more common than we'd like. And the screen one only (re)creates a directory with given ownership/permissions, it doesn't do or unset any age-based cleanup at all, so that's not really a fair comparison.

I think what arojas means is that perhaps R should be responsible for periodically (once every couple days at least) updating the timestamp on temporary files it is still using during very long-running processes.

Loading...