Bug 1317849

Summary: systemd-tmpfiles cleanup old directories with content
Product: Red Hat Enterprise Linux 7 Reporter: W. de Heiden <wdh>
Component: systemdAssignee: systemd-maint
Status: CLOSED WONTFIX QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.2CC: carsten.grohmann, dtardon, systemd-maint-list
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-12-15 07:40:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description W. de Heiden 2016-03-15 11:06:23 UTC
Description of problem:
systemd-tmp can clean directory, however, it only seems capable of cleaning the content nnot the directories

Version-Release number of selected component (if applicable):
RHEL 7.x, Fedora

How reproducible:
The ipa-backup tool (for example) will create some "unpredictable" subdirectories. That is: the exact name of the directories is not known since the name contains a timestamp:

[root@ipa backup]# ls -lrt /var/lib/ipa/backup/
total 84
drwx------. 2 root root 16384 Feb 19 16:14 lost+found
drwx------. 2 root root  4096 Feb 19 16:16 ipa-data-2016-02-19-16-16-43
drwx------. 2 root root  4096 Feb 19 16:18 ipa-data-2016-02-19-16-18-38
drwx------. 2 root root  4096 Feb 20 03:20 ipa-data-2016-02-20-03-20-28
drwx------. 2 root root  4096 Feb 21 03:20 ipa-data-2016-02-21-03-20-28
drwx------. 2 root root  4096 Feb 22 03:44 ipa-data-2016-02-22-03-44-28
drwx------. 2 root root  4096 Feb 23 03:13 ipa-data-2016-02-23-03-13-29
drwx------. 2 root root  4096 Feb 24 03:51 ipa-data-2016-02-24-03-51-27
drwx------. 2 root root  4096 Feb 25 03:22 ipa-data-2016-02-25-03-22-27
drwx------. 2 root root  4096 Feb 26 03:20 ipa-data-2016-02-26-03-20-27
drwx------. 2 root root  4096 Feb 27 03:35 ipa-data-2016-02-27-03-35-30
drwx------. 2 root root  4096 Feb 28 03:39 ipa-data-2016-02-28-03-39-28
drwx------. 2 root root  4096 Feb 29 03:29 ipa-data-2016-02-29-03-29-27
drwxr-xr-x. 3 root root  4096 Mar  1 03:34 logs

Now, using this configuration file for cleanup old backups:

cat /etc/tmpfiles.d/ipa-backup.conf 
## man 5 tmpfiles.d
d /var/lib/ipa/backup/ipa-data-* 0700 root root 7d
d /var/lib/ipa/backup/logs/* 0700 root root 7d 

The directory /var/lig/ipa/backup/logs will get cleaned up properly, files are removed after 7 days.


Actual results:
Old backups  in /var/lib/ipa/backup/ipa-data-* removed after 7 days, including the directory itself. Dispite this config, old backups are not removed.

Expected results:
Removed old directories, including content


Additional info:

Changing d for r or R will not work since the Age is only accepted for s, D and x (man 5 tmpfiles.d)

R /var/lib/ipa/backup/ipa-data-* 0700 root root 7d
R /var/lib/ipa/backup/logs/* 0700 root root 7d

Comment 4 RHEL Program Management 2020-12-15 07:40:30 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.