Files
finit/doc/tmpfiles-todo.md
T
Joachim Wiberg 9d49eaf4c7 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>
2026-11-20 18:03:33 +01:00

58 lines
2.1 KiB
Markdown

tmpfiles TODO
=============
What `tmpfiles` lacks compared to [tmpfiles.d(5)][], from a read of
`src/tmpfiles.c` in November 2026. Ranked: first what Finit's own
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. Specifiers
-------------
Missing are the ones for the OS release and the architecture: `%a`,
`%A`, `%B`, `%M`, `%o`, `%w`, and `%W`. An entry with one of them is
skipped. `%T` and `%V` are always `/tmp` and `/var/tmp`, they do not
look at `$TMPDIR`.
2. Remaining types and modifiers
--------------------------------
* `L?`, and `C+`, which is read as `C`
* `z` and `Z` only set the SELinux label when `restorecon` is installed
* `t`, `T` for extended attributes and `h`, `H` for file attributes
* Modifiers `-` (do not fail), `=` (remove what is of another type),
`~` (base64 argument), and `^` (credential as argument)
* Quoted paths, a path with a space in it cannot be written
3. Command line
---------------
Missing options: `--prefix`, `--root`, `--replace`, `--dry-run`,
`--purge`, `--graceful`, and `--cat-config`. Of these `--prefix`
is the useful one, for packages that run `tmpfiles --create` on only
their own paths.
4. Smaller things
------------------
* Files are processed one directory at a time. tmpfiles.d(5) sorts
all of them by name, whatever directory they are in, so `00-x.conf`
in `/etc` should run before `50-y.conf` in `/usr/lib`
* `a` and `A` handle an ACL of at most 32 entries, a path with more is
left as it is, with a warning
* A new `f` file without a mode gets what the umask leaves of 0666,
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 `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
* `mksubsys()` in `src/util.c` is unused