This commit cleans up the includes for all the small tools across
the tree.
A few cases of returning EXIT_SUCCESS are replaced with returning
0 to avoid including <stdlib.h>.
Split out of #37344.
Instead of recalculating the length of the string again after
reading it, let's make sd_netlink_message_read_string() return the
length of the string that we then use to check if the last character
is a dot or not.
This allows us to get rid of the string-util.h include in #37344.
On OBS the build VM is heavily locked down, with network
disabled in various ways in the custom kernel, to isolate the
build, including disabling CONFIG_UNIX_DIAG.
[ 456s] /* test_af_unix_get_qlen */
[ 456s] src/test/test-socket-netlink.c:393: Assertion failed: Expected "af_unix_get_qlen(unix_fd, &q)" to succeed, but got error: No such file or directory
[ 454s] /* test_sock_diag_unix */
[ 454s] src/libsystemd/sd-netlink/test-netlink.c:727: Assertion failed: Expected "sd_netlink_call(nl, message, 0, &reply)" to succeed, but got error: No such file or directory
Follow-up for 89e546e927
Follow-up for 4a3bf440f2
capability_quintet_mangle() can be called with capability sets
containing unknown capabilities. Let's not crash when this is the
case but instead ignore the unknown capabilities.
Fixes d5e12dc75e
Follow-up for 53628612b7.
With 'or', we ignore the empty string (but not '0'), and we only call
time.time() lazily. So this works the same as the code that is replaced,
but avoids the ugly repetition.
We recommend that users create overriddes. This creates the problem that there
is no syntax to unset a property. Thus, the user needs to just set the property
to "something else" in the override file. But then the blurb saying that
"VAR=1" (or "VAR=0" in some cases) is the only allowed value can be confusing.
Say that both 0 and 1 can be set, since this documentation is also intended
for end users.
In our files, we generally don't want the override values anywhere. But we
have a test which checks the rvalue, which should be enough.
We don't want to encourage people to copy the whole files. The
boilerplate text that recommends an override file rather than a
full copy appeared first in 0213a26f65,
but was added in other places in 57bb707d48.
Directly inspired by 951e8cb060, but
the wrong boilerplate was added in other places too.
Let's insist on a string literal in SYS_BLOCK_PATH_MAX() so that
we don't accidentally allocate VLAs and let's inline strempty() in
xsprintf_sys_block_path() so we don't need to include string-util.h
in blockdev-util.h
We'll remove the actual string-util.h include as part of #37344.
In preparation for adopting forward declarations to reduce unnecessary
transitive includes across the tree, let's introduce a forward.h header
with forward declarations for all libc, libsystemd, basic and shared
types.
Additionally, this header exports all basic integer types and errno
constants, as well as all macros including assertions macros. These
header files contain types often used in headers and are always included
in every source file one way or another anyway.
To avoid having to include memory-util.h and alloc-util.h in forward.h,
we split off the parts we need from both into cleanup-util.h and only
include cleanup-util.h in forward.h.
To keep this commit self-contained, we include cleanup-fundamental.h and
cleanup-util.h from the headers that originally contained the same
macros. We'll remove these again in a later commit that optimizes the
includes in src/basic and src/fundamental.
Split out of #37364
Previously, we'd only authenticate "one" of the subordinate devices of a
DM device, and which one was somewhat undefined, it would be what we
find in slaves/ first. This is in particular a problem with dm-verity
which generally has two subordinate devices: the data device and the
hash device.
Let's fix this properly. This means two things:
1. iterate through *all* subordinate devices of a DM device (i.e.
iterate through the sysfs slaves/ subdir), not just
one
2. permit configuring a list of gpt labels and gpt type uuids in the
xattrs of mount points, so that all valid combinations can be listed.
This only updates the validation like this. The generation of xattrs
that carry multiple type uuids/labels in systemd-repart will follow in a
later commit.
This extends the syntax of the two gpt-related xattrs, to allow lists of
things. This is a true extension, without breaking compat (but even if
it was, it wouldn't matter given that validatefs was added post v257,
i.e. is not included in a stable release.
Fixes: #37157