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

Eli Schwartz eschwartz at archlinux.org
Mon Jan 15 20:34:48 UTC 2018


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.

The manpage unclear on the intended behavior, so I'm not even sure if
this is a bug. "Create a file if it does not exist yet. If the argument
parameter is given, it will be written to the file." I wouldn't describe
the current behavior as "written", but rather "appended". And there
appears to be no way to do what I want.

OTOH, it also updates the file owner/mode for existing files, which
seems to be in theme for this appending behavior, but which is also
undocumented behavior. Contrast this with the "d" type, which explicitly
states "The mode and ownership will be adjusted if specified and the
directory already exists."

So either the behavior or the documentation seems to be flawed here. I
guess since "f" consistently behaves like "F" except without the initial
truncation, it is probably the documentation that is flawed, in which
case I think "write" should be replaced with "append", or the
description for "F" should thematically match "D" by stating "Similar to
f, but in addition if the file exists it will be truncated before
checking for and writing any argument parameter".

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.

-- 
Eli Schwartz
Bug Wrangler and Trusted User

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180115/0e2329d6/attachment.sig>


More information about the systemd-devel mailing list