Bug 91096
Summary: | Add option so that tmpwatch can handle removing empty directories | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Craig Lawson <craig.lawson> |
Component: | tmpwatch | Assignee: | Miloslav Trmač <mitr> |
Status: | CLOSED RAWHIDE | QA Contact: | Ben Levenson <benl> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | rawhide | CC: | mattdm, mitr |
Target Milestone: | --- | Keywords: | FutureFeature |
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | 2.9.4-1 | Doc Type: | Enhancement |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2005-06-20 13:52:20 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Craig Lawson
2003-05-17 22:09:35 UTC
When running from a cron job (which is the expected usage model of tmpwatch), removing all empty directories can lead to race conditions between tmpwatch and other programs that create a temporary directory and then attempt to store files in it. Even "keeping the directory open" by chdir () to the directory doesn't remove the race condition in the time between mkdir () and chdir (). If that race condition would trigger, it would lead to mysterious program failures that would be virtually impossible to reproduce. Reopening as per discussion on fedora-devel-list. As it stands, tmpwatch basically never removes directories unless given --ctime or --mtime. However, it would often be desirable to use --mtime for directories and --atime for regular files (as suggested in bug #14930 by Aleksey Nogin), and there's currently not an option that allows that. Removing directories could still be a little dangerous -- they could be being used for simple inter-process communication, for example. However, there already is the -d/--nodirs option to not remove directories. Therefore, one approach would be to make --atime always use mtime for directories, and use -d in the standard cron scripts. That would introduce a change in behavior which might bite people, however. So, it's probably best to keep current behavior as-is and add a new option -- something like --mtime-dirs (no idea what a good short option would be, since -d is already taken). Or, we could totally change the ui, and add options like this: --check-files=[atime,mtime,ctime] --check-dirs=[atime,mtime,ctime] --check-others=[atime,mtime,ctime] but maybe that's getting silly. tmpwatch-2.9.4 has --dirmtime. The current state (--[acm]time --dirmtime) is as complicated as the options can get; I can see no good reason to discriminate between regular files and other non-directories; atime for directories is used if atime is used for other files, ctime doesn't make sense for directories because even removing a file from a directory updates the ctime. Thanks for proposing this alternative again. Cool. :) |