From: lzwind Date: Tue, 28 Jul 2026 12:33:00 +0000 (+0200) Subject: agetty: show default issue file when built without issue.d support X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d380eae906be7e2904360101baaeb2569f354728;p=thirdparty%2Futil-linux.git agetty: show default issue file when built without issue.d support Commit d1cf7ef refactored the issue file handling to read the default issue file (/etc/issue) together with the issue.d drop-in directory through ul_configs_file_list(). That call was placed inside an "#ifdef ISSUEDIR_SUPPORT" block, so on builds without issue.d support (e.g. systems where scandirat()/openat() are unavailable, such as musl libc) the default issue file was no longer read at all. As a result `agetty --show-issue` and the login prompt printed nothing on such builds unless --issue-file was given, regressing the long-standing behaviour of displaying /etc/issue. ul_configs_file_list() returns the main issue file even when drop-in directory support is unavailable (it skips the drop-in scan but still locates the main configuration file), so move the call out from under ISSUEDIR_SUPPORT and include configs.h unconditionally. The drop-in directory scanning itself still requires ISSUEDIR_SUPPORT, which is unchanged. [kzak: removed github issue URL from in-code comment] Fixes: https://github.com/util-linux/util-linux/issues/4505 Suggested-by: Naomi Rennie-Waldock Signed-off-by: lzwind Signed-off-by: Karel Zak --- diff --git a/agetty-cmd/issuefile.c b/agetty-cmd/issuefile.c index 104ccef81..46b69fb10 100644 --- a/agetty-cmd/issuefile.c +++ b/agetty-cmd/issuefile.c @@ -19,16 +19,22 @@ #include "agetty.h" #include "c.h" #include "color-names.h" +#include "configs.h" #include "nls.h" #include "fileutils.h" #include "pathnames.h" #include "widechar.h" +/* The default issue file (e.g. /etc/issue) is read via ul_configs_file_list() + * whenever ISSUE_SUPPORT is enabled. The drop-in directory (issue.d) scanning + * performed by that function additionally requires ISSUEDIR_SUPPORT + * (i.e. scandirat()/openat()); when it is unavailable ul_configs_file_list() + * still returns the main issue file. */ +#define ISSUEDIR_EXT "issue" +#define ISSUEDIR_EXTSIZ sizeof(ISSUEDIR_EXT) + #ifdef ISSUEDIR_SUPPORT -# include "configs.h" # include -# define ISSUEDIR_EXT "issue" -# define ISSUEDIR_EXTSIZ sizeof(ISSUEDIR_EXT) #endif #ifdef USE_SYSTEMD @@ -393,7 +399,6 @@ skip: goto done; } -#ifdef ISSUEDIR_SUPPORT struct list_head file_list; struct list_head *current = NULL; char *name = NULL; @@ -403,6 +408,11 @@ skip: * https://github.com/uapi-group/specifications/blob/main/specs/configuration_files_specification.md * * Note that _PATH_RUNSTATEDIR (/run) is always read by ul_configs_file_list(). + * + * ul_configs_file_list() returns the main issue file (e.g. /etc/issue) + * even when drop-in directory support (ISSUEDIR_SUPPORT) is unavailable, + * so the default issue file is still shown on builds without issue.d + * support. */ ul_configs_file_list(&file_list, NULL, @@ -417,7 +427,6 @@ skip: } ul_configs_free_list(&file_list); -#endif done: if (ie->output) {