Cleaning a directory in /tmp during boot updates the directory's modification time

Bug #1415974 reported by Ken Sharp
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mountall (Ubuntu)
New
Undecided
Unassigned

Bug Description

When TMPTIME is set to anything other than 0 (clean all of /tmp) in /etc/default/rcS, /tmp is cleaned of "old" files, but in doing so it updates the modification times of all the directories, so that they remain until they themselves become "old".

I hope this makes sense, an example:

During boot files in /tmp older than three days will be cleaned.
Files in /tmp/olddir will be cleaned.
/tmp/olddir will have its modification time updated, it is no longer an old directory.
/tmp/olddir is left behind because it is not recognised as an old directory.

It's minor and may be impossible to fix, but is there any magic that can be done to remove the old directories at boot rather than waiting for the directory to "expire" again? Is it possible to avoid the modification time being updated?

Simply removing the whole directory based on its creation or modification times, without first checking its contents for newer files, would probably not be preferable.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: initscripts 2.88dsf-13.10ubuntu11.1
ProcVersionSignature: Ubuntu 3.11.0-26.45~precise1-generic 3.11.10.12
Uname: Linux 3.11.0-26-generic i686
NonfreeKernelModules: nvidia
ApportVersion: 2.0.1-0ubuntu17.8
Architecture: i386
Date: Thu Jan 29 15:13:27 2015
MarkForUpload: True
ProcEnviron:
 LANGUAGE=en_GB:en
 TERM=xterm
 PATH=(custom, no user)
 LANG=en_GB.UTF-8
 SHELL=/bin/bash
SourcePackage: sysvinit
UpgradeStatus: Upgraded to precise on 2014-12-07 (53 days ago)

Revision history for this message
Ken Sharp (kennybobs) wrote :
Ken Sharp (kennybobs)
summary: - Cleaning a directory in /tmp during boot updates the folder's
+ Cleaning a directory in /tmp during boot updates the directory's
modification time
Revision history for this message
Ken Sharp (kennybobs) wrote :

If a directory in /tmp has multiple subdirectories it means that the director[y|ies] can hang around for months, or even permanently. This shouldn't use a lot of disk space but will leave /tmp a bit of a mess.

tags: added: amd64 trusty
Ken Sharp (kennybobs)
description: updated
Revision history for this message
Ken Sharp (kennybobs) wrote :

Indeed the script shows that the directory's mtime is checked after the files have been removed:

DEXPR="-mtime +${TMPTIME} -ctime +${TMPTIME}"

find . -depth -xdev $DEXPR $EXCEPT -type d -empty -delete

affects: sysvinit (Ubuntu) → mountall (Ubuntu)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.