From 14dc330c9c3afdec686bac6cdf528db4afc3e4aa Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 8 Jun 2025 10:04:45 +0900 Subject: [PATCH 1/8] libcrypt-util: include random-util.h Necessary for crypto_random_bytes(), which is used in the branch that HAVE_CRYPT_GENSALT_RA is false. Unfortunately, our CIs tested only the other branch. --- src/shared/libcrypt-util.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/shared/libcrypt-util.c b/src/shared/libcrypt-util.c index 7c48b5e0d3..aa41cd4458 100644 --- a/src/shared/libcrypt-util.c +++ b/src/shared/libcrypt-util.c @@ -21,6 +21,7 @@ #include "errno-util.h" #include "libcrypt-util.h" #include "log.h" +#include "random-util.h" #include "string-util.h" #include "strv.h" From a60495c44b5378c25f4e16962a72e064fdbd9345 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 8 Jun 2025 09:55:08 +0900 Subject: [PATCH 2/8] cryptsetup-util: move definition of crypt_token_max() As it uses streq(), but string-util.h is not included in the header. --- src/shared/cryptsetup-util.c | 6 ++++++ src/shared/cryptsetup-util.h | 6 +----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/shared/cryptsetup-util.c b/src/shared/cryptsetup-util.c index e45e8431bc..b8281679dc 100644 --- a/src/shared/cryptsetup-util.c +++ b/src/shared/cryptsetup-util.c @@ -54,6 +54,12 @@ DLSYM_PROTOTYPE(crypt_token_json_get) = NULL; DLSYM_PROTOTYPE(crypt_token_json_set) = NULL; #if HAVE_CRYPT_TOKEN_MAX DLSYM_PROTOTYPE(crypt_token_max) = NULL; +#else +int crypt_token_max(_unused_ const char *type) { + assert(streq(type, CRYPT_LUKS2)); + + return 32; +} #endif #if HAVE_CRYPT_TOKEN_SET_EXTERNAL_PATH DLSYM_PROTOTYPE(crypt_token_set_external_path) = NULL; diff --git a/src/shared/cryptsetup-util.h b/src/shared/cryptsetup-util.h index 6ecc8f601f..df897c208f 100644 --- a/src/shared/cryptsetup-util.h +++ b/src/shared/cryptsetup-util.h @@ -56,11 +56,7 @@ extern DLSYM_PROTOTYPE(crypt_token_json_set); extern DLSYM_PROTOTYPE(crypt_token_max); #else /* As a fallback, use the same hard-coded value libcryptsetup uses internally. */ -static inline int crypt_token_max(_unused_ const char *type) { - assert(streq(type, CRYPT_LUKS2)); - - return 32; -} +int crypt_token_max(_unused_ const char *type); #define sym_crypt_token_max(type) crypt_token_max(type) #endif #if HAVE_CRYPT_TOKEN_SET_EXTERNAL_PATH From afcb6d671bcc53fffb5f90b1fc843c1aef4d37ba Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 9 Jun 2025 08:33:36 +0900 Subject: [PATCH 3/8] forward: also include paths.h It provides several important constants, especially _PATH_BSHELL, which is used in PID1, executor, and run. The header has been included indirectly through e.g. libmount.h, mntent.h, utmpx.h, and so on. Let's explicitly include it in forward.h, as libmount.h and friends that includes paths.h are irrelevant to _PATH_BSHELL, and we may easily fail to build when code is touched. The header is not heavy, hence should not hurt anything. --- src/basic/forward.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/basic/forward.h b/src/basic/forward.h index df3bdee233..5ca540ae01 100644 --- a/src/basic/forward.h +++ b/src/basic/forward.h @@ -6,6 +6,7 @@ #include /* IWYU pragma: export */ #include /* IWYU pragma: export */ #include /* IWYU pragma: export */ +#include /* IWYU pragma: export */ #include /* IWYU pragma: export */ #include /* IWYU pragma: export */ #include /* IWYU pragma: export */ From e11f01b78a6cb9f826d5fa2aafe58d55eb3da511 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 9 Jun 2025 05:11:01 +0900 Subject: [PATCH 4/8] utmp-wtmp: replace _PATH_WTMPX -> WTMPX_FILE _PATH_WTMPX is a kind of internal definition in glibc, and WTMPX_FILE should be an exposed definition. Both are same, let's use WTMPX_FILE. Note, for utmp, we use UTMPX_FILE, rather than _PATH_UTMPX. Let's use consistent macros. --- src/shared/utmp-wtmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/utmp-wtmp.c b/src/shared/utmp-wtmp.c index b0581162ab..8a69e9692b 100644 --- a/src/shared/utmp-wtmp.c +++ b/src/shared/utmp-wtmp.c @@ -104,7 +104,7 @@ static int write_entry_wtmp(const struct utmpx *store) { * simply appended to the end; i.e. basically a log. */ errno = 0; - updwtmpx(_PATH_WTMPX, store); + updwtmpx(WTMPX_FILE, store); if (errno == ENOENT) { /* If utmp/wtmp have been disabled, that's a good thing, hence ignore the error. */ log_debug_errno(errno, "Not writing wtmp: %m"); From f37b4031f8d569b2c0f44874f2b10c6a776f5e7c Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 9 Jun 2025 05:52:17 +0900 Subject: [PATCH 5/8] tree-wide: drop unnecessary inclusion of sys/quota.h As it is included by quota-util.h anyway. --- src/home/homed-home.c | 1 - src/home/homed-manager.c | 1 - src/home/homework-quota.c | 1 - 3 files changed, 3 deletions(-) diff --git a/src/home/homed-home.c b/src/home/homed-home.c index 244e10166d..38da41332b 100644 --- a/src/home/homed-home.c +++ b/src/home/homed-home.c @@ -1,7 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #include -#include #include #include "sd-bus.h" diff --git a/src/home/homed-manager.c b/src/home/homed-manager.c index 511bc81707..5c0ad7625f 100644 --- a/src/home/homed-manager.c +++ b/src/home/homed-manager.c @@ -8,7 +8,6 @@ #include #include #include -#include #include #include "sd-bus.h" diff --git a/src/home/homework-quota.c b/src/home/homework-quota.c index 5d256c5dcd..f8affe58ed 100644 --- a/src/home/homework-quota.c +++ b/src/home/homework-quota.c @@ -1,5 +1,4 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include #include "btrfs-util.h" #include "errno-util.h" From b5aed602220da193d5443d40c5241a44d32c4efa Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 9 Jun 2025 05:42:22 +0900 Subject: [PATCH 6/8] selinux-setup.c: drop redundant inclusion of selinux/selinux.h The header is anyway included by selinux-util.h in below. --- src/core/selinux-setup.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/core/selinux-setup.c b/src/core/selinux-setup.c index a24af6d1c2..8e87b1be28 100644 --- a/src/core/selinux-setup.c +++ b/src/core/selinux-setup.c @@ -2,10 +2,6 @@ #include -#if HAVE_SELINUX -#include -#endif - #include "sd-messages.h" #include "errno-util.h" From 8139906eaaced08d7924abf012561a5e8e9fbf2a Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 9 Jun 2025 09:43:52 +0900 Subject: [PATCH 7/8] journal: use poll.h rather than sys/poll.h This does not change anything, as poll.h is a one-line wrapper of sys/poll.h. Note that man pages e.g. poll(2) indicate to include poll.h rather than sys/poll.h. So, let's use poll.h. --- src/journal/journald-sync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/journal/journald-sync.c b/src/journal/journald-sync.c index b22cb54b12..4722cfa9a3 100644 --- a/src/journal/journald-sync.c +++ b/src/journal/journald-sync.c @@ -1,8 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #include +#include #include -#include #include "sd-varlink.h" From afe1567297440cd9b40cfa156d6a8bf1afd954a8 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 9 Jun 2025 13:59:39 +0900 Subject: [PATCH 8/8] include: net/if.h requires features.h The header uses __THROW, which is defined in features.h, to make the header self-consistent. Note, src/basic/include/sys/mount.h also uses __THROW, and includes features.h. --- src/basic/include/net/if.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/basic/include/net/if.h b/src/basic/include/net/if.h index ba2948ae5c..1914b596e3 100644 --- a/src/basic/include/net/if.h +++ b/src/basic/include/net/if.h @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once +#include #include /* IWYU pragma: export */ #define IF_NAMESIZE 16