[systemd-devel] Unclear behavior of tmpfiles.d "f" type

Lennart Poettering lennart at poettering.net
Wed Jan 24 10:16:46 UTC 2018


On Mo, 15.01.18 15:34, Eli Schwartz (eschwartz at archlinux.org) wrote:

> Over in Arch Linux, I am trying to move some packages over from using
> post-install scripts to using tpmfiles.d/sysusers.d for any applicable
> behavior. Occasionally, default files need to be created with the
> contents of some specifier, for example %H.
> 
> I don't think /usr/share/factory is appropriate for this, but it
> shouldn't be overwritten with "F" type either. So "f" seems most
> appropriate.
> 
> But re-running systemd-tmpfiles repeatedly appends the argument to the
> file, which doesn't seem right. I cannot offhand think of a situation
> where I would want that utility, anyways.

Yes, I agree. I think the current O_APPEND behaviour indeed does not
make much sense, and O_EXIST would make more sense and actually be
in line with what the documentation suggests.

I have thus prepared a PR that fixes this and makes it work like you
want:

https://github.com/systemd/systemd/pull/7983

It's a change of behaviour, but i think one we can get away with as
the old behaviour really didn#t make much sense and didnt match what
the documentation suggested.

> Also, how do I use a specifier in an argument here? Should I use "F"
> mode to write a file to /usr/share/factory and then on the next line use
> "C" to copy it over? That's not very simple IMHO.

let's fix tmpfiles with the aforementioned PR first. And then my
answer is: use "f", as you originally wanted to.

Thanks for pointing this out,

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list