File util-linux-agetty-configs.patch of Package util-linux
From d1cf7efb17869d0fdf132bb3581d9b74a459bb87 Mon Sep 17 00:00:00 2001
From: Stefan Schubert <schubi@suse.de>
Date: Wed, 17 Sep 2025 13:43:55 +0200
Subject: [PATCH] agetty: using configs lib for parsing issue files
---
term-utils/agetty.c | 39 +++++++++++++++++++++++----------------
1 file changed, 23 insertions(+), 16 deletions(-)
Index: util-linux-2.41.2/term-utils/agetty.c
===================================================================
--- util-linux-2.41.2.orig/term-utils/agetty.c
+++ util-linux-2.41.2/term-utils/agetty.c
@@ -122,10 +122,11 @@
#ifdef SYSV_STYLE
# define ISSUE_SUPPORT
# if defined(HAVE_SCANDIRAT) && defined(HAVE_OPENAT)
+# include "configs.h"
# include <dirent.h>
# define ISSUEDIR_SUPPORT
-# define ISSUEDIR_EXT ".issue"
-# define ISSUEDIR_EXTSIZ (sizeof(ISSUEDIR_EXT) - 1)
+# define ISSUEDIR_EXT "issue"
+# define ISSUEDIR_EXTSIZ sizeof(ISSUEDIR_EXT)
# endif
#endif
@@ -1683,7 +1684,7 @@ static int issuedir_filter(const struct
namesz = strlen(d->d_name);
if (!namesz || namesz < ISSUEDIR_EXTSIZ + 1 ||
- strcmp(d->d_name + (namesz - ISSUEDIR_EXTSIZ), ISSUEDIR_EXT) != 0)
+ strcmp(d->d_name + (namesz - ISSUEDIR_EXTSIZ), "." ISSUEDIR_EXT) != 0)
return 0;
/* Accept this */
@@ -1930,22 +1931,28 @@ skip:
goto done;
}
- /* The default /etc/issue and optional /etc/issue.d directory as
- * extension to the file. The /etc/issue.d directory is ignored if
- * there is no /etc/issue file. The file may be empty or symlink.
+#ifdef ISSUEDIR_SUPPORT
+ struct list_head file_list;
+ struct list_head *current = NULL;
+ char *name = NULL;
+
+ /* Reading all issue files and concatinating all contents to one content.
+ * The ordering rules are defineded in:
+ * https://github.com/uapi-group/specifications/blob/main/specs/configuration_files_specification.md
*/
- if (access(_PATH_ISSUE, F_OK|R_OK) == 0) {
- issuefile_read(ie, _PATH_ISSUE, op, tp);
- issuedir_read(ie, _PATH_ISSUEDIR, op, tp);
+ ul_configs_file_list(&file_list,
+ NULL,
+ _PATH_ETC_ISSUEDIR,
+ _PATH_USR_ISSUEDIR,
+ _PATH_ISSUE_FILENAME,
+ ISSUEDIR_EXT);
+
+ while (ul_configs_next_filename(&file_list, ¤t, &name) == 0) {
+ issuefile_read(ie, name, op, tp);
}
- /* Fallback @runstatedir (usually /run) */
- issuefile_read(ie, _PATH_RUNSTATEDIR "/" _PATH_ISSUE_FILENAME, op, tp);
- issuedir_read(ie, _PATH_RUNSTATEDIR "/" _PATH_ISSUE_DIRNAME, op, tp);
-
- /* Fallback @sysconfstaticdir (usually /usr/lib)*/
- issuefile_read(ie, _PATH_SYSCONFSTATICDIR "/" _PATH_ISSUE_FILENAME, op, tp);
- issuedir_read(ie, _PATH_SYSCONFSTATICDIR "/" _PATH_ISSUE_DIRNAME, op, tp);
+ ul_configs_free_list(&file_list);
+#endif
done:
if (ie->output) {