Symbolic links are never removed from /tmp with TMPTIME>0
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
sysvinit (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
With TMPTIME set to anything other than 0 in /etc/default/rcS the init script has to find files to remove rather than simply wiping /tmp. This fails to remove symbolic links.
lrwxrwxrwx 1 1001 1001 12 Mar 20 02:01 test2.jpg -> download.jpg
lrwxrwxrwx 1 1001 1001 3 Mar 20 02:04 beh -> meh
$ file beh
beh: broken symbolic link to `meh'
$ file test2.jpg
test2.jpg: broken symbolic link to `download.jpg'
My TMPTIME is set to 3 but these two files are well over a month old.
The script uses find but this seems to find the files no problem:
$ find . ! -type d 2>&- | egrep "beh|test2"
./beh
./test2.jpg
Tests using "find . ! -type d -delete" show "find" removing symbolic links both working and broken.
My syslog does show this during boot:
kernel: [ 723.500519] type=1302 audit(142902471
This seems to be updating the atime, and the atime is used in the expression:
TEXPR="-mtime +${TMPTIME} -ctime +${TMPTIME} -atime +${TMPTIME}"
The result being that symbolic links will, apparently, never be removed.
I have no idea what is updating the atime for these symbolic links or why it is being audited. It's nothing I have intentionally set up on this system. It may be that the script is not at fault here but whatever package is updating the atime on these files.
A temporary solution would be to have a separate expression just for symbolic links ignoring the atime, but this may not be what a user wants. However: I can think of no good reason why anyone would need a symbolic link hanging around /tmp for longer than the TMPTIME.
ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: initscripts 2.88dsf-
ProcVersionSign
Uname: Linux 3.11.0-26-generic i686
NonfreeKernelMo
ApportVersion: 2.0.1-0ubuntu17.8
Architecture: i386
Date: Tue Apr 14 16:46:52 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 (128 days ago)