On Sat 15 Mar 2025, Andras Korn wrote: > On Sat, Mar 15, 2025 at 02:28:00PM +0100, Paul Slootman wrote: > > > > > > I suggest that the default configuration be changed thusly: > > > > > > > > > > TMPREAPER_PROTECT_EXTRA='/tmp/user/[0-9]*' > > > > > TMPREAPER_DIRS='/tmp/. /tmp/user/*/.' > > > > > > > > TMPREAPER_DIRS is the list of directories to search for old files, so > > > > only the TMPREAPER_PROTECT_EXTRA list is what you want. > > > > > > Even if /tmp/user (or a particular subdir under /tmp/user) is a > > > mountpoint? > > > > tmpreaper stays on the filesystem(s) the TMPREAPER_DIRS are on. > > So if /tmp/user is a separate filesystem, you don't need to protect it > > anyway as tmpreaper won't go there, unless you do specify /tmp/user/*/* > > but I thought the point of this bug report was _not_ to delete stuff > > under /tmp/user/* . If you do also want to remove files under /tmp/user/ > > that don't start with a digit, then sure, then it also needs to be added > > to TMPREAPER_DIRS. Please let me know what the exact intention is. > > The intention is to have tmpreaper descend /tmp/user/^[0-9]+$/ and delete old > files in there in the same way files under /tmp itself are deleted, BUT not > to delete the /tmp/user/^[0-9]*$ directories themselves even if they are > "old"; whether /tmp/user or any particular /tmp/user/^[0-9]+$/ is a > mountpoint or not.
OK, thanks for clarifying. > The problem this solves is that if a long-running process is started with > TMP=/tmp/user/4242 and it tries to create its first tempfile months after it > was started, its individual tmp directory will have been reaped by tmpreaper, > causing the tempfile creation to fail. > > (Yes, I used regexes instead of proper glob patterns.) Hmm the problem is that tmpreaper only does glob. The additional problem with supplying /tmp/user/*/. per default with TMPREAPER_DIRS is that if those files don't exist, tmpreaper will give an error as it can't chdir to that. I think that I will leave this as a local configuration change when needed. In light of this, does adding /tmp/user/[0-9]* to TMPREAPER_PROTECT_EXTRA anyway make sense? Paul