Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 234596 - --test does not resemble reality
Summary: --test does not resemble reality
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: tmpwatch
Version: 6
Hardware: All
OS: Linux
medium
low
Target Milestone: ---
Assignee: Miloslav Trmač
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-03-30 13:54 UTC by Konstantin Ryabitsev
Modified: 2007-11-30 22:12 UTC (History)
0 users

Fixed In Version: 2.9.11-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-03-31 12:37:25 UTC


Attachments (Terms of Use)

Description Konstantin Ryabitsev 2007-03-30 13:54:42 UTC
Check this out:

---
root@gdb:[/home/test7]# ls -al muhc/files
total 8
drwxr-xr-x  2 wcg  wcg  4096 Mar 14 20:49 ./
drwxr-xr-x  3 wcg  wcg  4096 Mar 14 20:49 ../
lrwxrwxrwx  1 root root   18 Mar 14 20:49 global -> /home/files-global/

root@gdb:[/home/test7]# tmpwatch --test --nosymlinks -m 168 muhc
removing directory muhc/files
root@gdb:[/home/test7]# tmpwatch --nosymlinks -m 168 muhc
root@gdb:[/home/test7]# tmpwatch --test --nosymlinks -m 168 muhc
removing directory muhc/files
---

Hence, even though "--test" will claim that muhc/files will be removed, it
actually won't since it's contains a symlink.

Comment 1 Miloslav Trmač 2007-03-30 18:40:22 UTC
Thanks for your report.

tmpwatch always uses rmdir() and ignores its failure if the directory is
non-empty, thus the message should probably be "attempting to remove directory %
if not empty".

tmpwatch could keep track of the directory contents and skip the rmdir () if the
directory were known to be non-empty, but this is racy - the only way to
atomically remove a directory if it is non-empty is to actually use rmdir ().

Would keeping track of the directory contents be useful to you (are you e. g.
somehow processing the --test output), or is fixing the incorrect message
sufficient?

Comment 2 Konstantin Ryabitsev 2007-03-31 01:43:47 UTC
I think that changing the message to say "removing if not empty" is sufficient.
The purpose of --test is to see what precisely is going to get removed, and my
concern upon seeing the message was that the files directory would get deleted
(very bad for me). I think I would have been a lot less worried if I knew that
it wouldn't actually delete the directory if it wasn't empty.

Comment 3 Miloslav Trmač 2007-03-31 12:37:25 UTC
Thanks, message changed in rawhide tmpwatch-2.9.11-1.


Note You need to log in before you can comment on or make changes to this bug.