]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
agetty: show default issue file when built without issue.d support
authorlzwind <liuzheng@uniontech.com>
Tue, 28 Jul 2026 12:33:00 +0000 (14:33 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 28 Jul 2026 12:33:00 +0000 (14:33 +0200)
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 <naomi.renniewaldock@gmail.com>
Signed-off-by: lzwind <liuzheng@uniontech.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
agetty-cmd/issuefile.c

index 104ccef81428aa6b9de8ca59ee93843b1566e000..46b69fb10ead9090ddd4504d09a3ad6e92633e76 100644 (file)
 #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 <dirent.h>
-# 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) {