]> git.ipfire.org Git - thirdparty/systemd.git/commit
tmpfiles: make handling of existing-but-different targets more consistent
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 7 Apr 2021 22:48:35 +0000 (00:48 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 8 Apr 2021 18:16:37 +0000 (20:16 +0200)
commitb88ba6c76116b6e03e202b1bdffd37933f748f03
tree28b28517f14008f3e8303a7c8da181d0d1e876a5
parentb065dfc8ed7b0465be113a0d739f153ca0230ee6
tmpfiles: make handling of existing-but-different targets more consistent

create_fifo() was added in a2fc2f8dd30c17ad1e23a31fc6ff2aeba4c6fa27, and
would always ignore failure. The test was trying to fail in this case, but
we actually don't fail, which seems to be correct. We didn't notice before
because the test was ineffective.

To make things consistent, generally log at warning level, but don't propagate
the error. For symlinks, log at debug level, as before.

For 'e', failure is not propagated now. The test is adjusted to match.

I think warning is appropriate in most cases: we do not expect a device node to
be replaced by a different device node or even a non-device file. This would
most likely be an error somewhere. An exception is made for symlinks, which are
mismatched on purpose, for example /etc/resolv.conf. With this patch, we don't
get any warnings with the any of the 74 tmpfiles.d files, which suggests that
increasing the warning levels will not cause too many unexpected warnings. If
it turns out that there are valid cases where people have expected mismatches
for non-symlink types, we can always decrease the log levels again.
man/systemd-tmpfiles.xml
src/tmpfiles/tmpfiles.c
test/units/testsuite-22.02.sh
test/units/testsuite-22.04.sh