mirror of
https://github.com/troglobit/finit.git
synced 2026-11-23 20:11:44 +00:00
tmpfiles: read all of the age formats in tmpfiles.d(5)
Only one number with one unit was read from the age of an entry. An
age like this one was taken as two days:
d /var/tmp 1777 root root 2d12h
What came after the first unit was not looked at. ms and us were not
known, so 500ms gave no cleaning at all.
Read any number of values with units, us, ms, s, m or min, h, d, and
w, and refuse an age that cannot be read or that overflows. Add the ~
prefix, which keeps what is right in the directory, and the prefix
that says which timestamps to go by, e.g. "aAmM:" for access and
modification time of files and directories.
Without that prefix the birth time of a file now counts too, as in
tmpfiles.d(5). It is read with statx(), where the C library has it,
and left out on a file system that has none.
A prefix that names timestamps for files only, or directories only,
leaves the default set for the other. The age is capped at what a 32
bit time_t holds, and nothing is cleaned when it reaches back past
the epoch.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
6 files changed
+189
-88
No files matched your search
+6
-18
@@ -8,20 +8,7 @@ files or common packages already rely on, last what few will miss.
|
||||
[tmpfiles.d(5)]: https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html
|
||||
|
||||
|
||||
1. Ages
|
||||
-------
|
||||
|
||||
Finit never runs `tmpfiles --clean` itself, `doc/plugins.md` tells the
|
||||
user to call it from cron.
|
||||
|
||||
* Only one number with `s`, `m`, `h`, `d`, or `w` is read. Missing
|
||||
are `1d12h`, `ms`, `us`, the `~` prefix, and the `a`, `b`, `c`, `m`
|
||||
selectors for which timestamps to compare
|
||||
* The age is only used for `d`, `D`, and `e`, and an `e` entry with a
|
||||
glob in the path is not cleaned
|
||||
|
||||
|
||||
2. Specifiers
|
||||
1. Specifiers
|
||||
-------------
|
||||
|
||||
Missing are the ones for the OS release and the architecture: `%a`,
|
||||
@@ -30,7 +17,7 @@ skipped. `%T` and `%V` are always `/tmp` and `/var/tmp`, they do not
|
||||
look at `$TMPDIR`.
|
||||
|
||||
|
||||
3. Remaining types and modifiers
|
||||
2. Remaining types and modifiers
|
||||
--------------------------------
|
||||
|
||||
* `L?`, and `C+`, which is read as `C`
|
||||
@@ -41,7 +28,7 @@ look at `$TMPDIR`.
|
||||
* Quoted paths, a path with a space in it cannot be written
|
||||
|
||||
|
||||
4. Command line
|
||||
3. Command line
|
||||
---------------
|
||||
|
||||
Missing options: `--prefix`, `--root`, `--replace`, `--dry-run`,
|
||||
@@ -50,7 +37,7 @@ is the useful one, for packages that run `tmpfiles --create` on only
|
||||
their own paths.
|
||||
|
||||
|
||||
5. Smaller things
|
||||
4. Smaller things
|
||||
------------------
|
||||
|
||||
* Files are processed one directory at a time. tmpfiles.d(5) sorts
|
||||
@@ -62,7 +49,8 @@ their own paths.
|
||||
it should be 0644
|
||||
* A `d` or `e` entry for a path that is a link to a directory warns
|
||||
that mode and owner could not be set
|
||||
* An age so large that it overflows is not caught
|
||||
* An `x` or `X` entry with an age should have what it names cleaned
|
||||
by that age, the age is not read
|
||||
* A `w` entry with a glob that matches several paths writes its
|
||||
argument only up to the first backslash for all but the first,
|
||||
`write_arg()` cuts the argument up as it goes
|
||||
|
||||
Reference in new issue
Block a user