From 39a110e7ff4f7695c9e3890e9ee0d2acd631890d Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 16 May 2023 09:16:53 +0000 Subject: [PATCH] import util-linux-2.32.1-42.el8_8 --- ...-add-cmp_timespec-and-cmp_stat_mtime.patch | 47 ++++++++++ ...d-hint-about-systemctl-daemon-reload.patch | 86 +++++++++++++++++++ SPECS/util-linux.spec | 11 ++- 3 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 SOURCES/0093-include-c-add-cmp_timespec-and-cmp_stat_mtime.patch create mode 100644 SOURCES/0094-mount-add-hint-about-systemctl-daemon-reload.patch diff --git a/SOURCES/0093-include-c-add-cmp_timespec-and-cmp_stat_mtime.patch b/SOURCES/0093-include-c-add-cmp_timespec-and-cmp_stat_mtime.patch new file mode 100644 index 0000000..3e90da0 --- /dev/null +++ b/SOURCES/0093-include-c-add-cmp_timespec-and-cmp_stat_mtime.patch @@ -0,0 +1,47 @@ +From 428791718a166ee5ce275b0bcf4a904a97e6af9d Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Mon, 13 Dec 2021 13:19:18 +0100 +Subject: include/c: add cmp_timespec() and cmp_stat_mtime() + +It's like timercmp() in libc, but for timespec and for stat.st_mtim +(or stat.st_mtime for old struct stat versions). + +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2180413 +Upstream: http://github.com/util-linux/util-linux/commit/0cfb8c5c3205a92ae81def278cdded63ea47094f +Signed-off-by: Karel Zak +--- + include/c.h | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/include/c.h b/include/c.h +index c8bcb375b..e48ac6d7d 100644 +--- a/include/c.h ++++ b/include/c.h +@@ -125,6 +125,24 @@ + _a == _b ? 0 : _a > _b ? 1 : -1; }) + #endif + ++ ++#ifndef cmp_timespec ++# define cmp_timespec(a, b, CMP) \ ++ (((a)->tv_sec == (b)->tv_sec) \ ++ ? ((a)->tv_nsec CMP (b)->tv_nsec) \ ++ : ((a)->tv_sec CMP (b)->tv_sec)) ++#endif ++ ++ ++#ifndef cmp_stat_mtime ++# ifdef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC ++# define cmp_stat_mtime(_a, _b, CMP) cmp_timespec(&(_a)->st_mtim, &(_b)->st_mtim, CMP) ++# else ++# define cmp_stat_mtime(_a, _b, CMP) ((_a)->st_mtime CMP (_b)->st_mtime) ++# endif ++#endif ++ ++ + #ifndef offsetof + #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) + #endif +-- +2.39.2 + diff --git a/SOURCES/0094-mount-add-hint-about-systemctl-daemon-reload.patch b/SOURCES/0094-mount-add-hint-about-systemctl-daemon-reload.patch new file mode 100644 index 0000000..f745f14 --- /dev/null +++ b/SOURCES/0094-mount-add-hint-about-systemctl-daemon-reload.patch @@ -0,0 +1,86 @@ +From 7cc9fe69d3f35038b7b3329fef0cccdbe38ffef6 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Mon, 13 Dec 2021 13:22:56 +0100 +Subject: mount: add hint about systemctl daemon-reload + +This commit implements an extra hint for systemd based distros to +inform users that units currently used by systemd are older than +fstab. This situation is usually unwanted, and 'systemctl +daemon-reload' is recommended. + +The message is printed only on terminal to avoid extra messages in +logs, etc. + +Addresses: https://github.com/systemd/systemd/pull/20476 +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2180413 +Upstream: http://github.com/util-linux/util-linux/commit/1db0715169954a8f3898f7ca9d3902cd6c27084d +Signed-off-by: Karel Zak +--- + include/pathnames.h | 2 ++ + sys-utils/mount.c | 23 +++++++++++++++++++++++ + 2 files changed, 25 insertions(+) + +diff --git a/include/pathnames.h b/include/pathnames.h +index 77f8b6e85..19b117cb9 100644 +--- a/include/pathnames.h ++++ b/include/pathnames.h +@@ -76,6 +76,8 @@ + #define _PATH_NUMLOCK_ON _PATH_RUNSTATEDIR "/numlock-on" + #define _PATH_LOGINDEFS "/etc/login.defs" + ++#define _PATH_SD_UNITSLOAD _PATH_RUNSTATEDIR "/systemd/systemd-units-load" ++ + /* misc paths */ + #define _PATH_WORDS "/usr/share/dict/words" + #define _PATH_WORDS_ALT "/usr/share/dict/web2" +diff --git a/sys-utils/mount.c b/sys-utils/mount.c +index 83cccf63e..108b55001 100644 +--- a/sys-utils/mount.c ++++ b/sys-utils/mount.c +@@ -38,6 +38,7 @@ + #include "strutils.h" + #include "closestream.h" + #include "canonicalize.h" ++#include "pathnames.h" + + #define XALLOC_EXIT_CODE MNT_EX_SYSERR + #include "xalloc.h" +@@ -287,6 +288,25 @@ static void selinux_warning(struct libmnt_context *cxt, const char *tgt) + # define selinux_warning(_x, _y) + #endif + ++static void systemd_hint(void) ++{ ++ static int fstab_check_done = 0; ++ ++ if (fstab_check_done == 0) { ++ struct stat a, b; ++ ++ if (isatty(STDERR_FILENO) && ++ stat(_PATH_SD_UNITSLOAD, &a) == 0 && ++ stat(_PATH_MNTTAB, &b) == 0 && ++ cmp_stat_mtime(&a, &b, <)) ++ printf(_( ++ "mount: (hint) your fstab has been modified, but systemd still uses\n" ++ " the old version; use 'systemctl daemon-reload' to reload.\n")); ++ ++ fstab_check_done = 1; ++ } ++} ++ + /* + * Returns exit status (MNT_EX_*) and/or prints error message. + */ +@@ -310,6 +330,9 @@ static int mk_exit_code(struct libmnt_context *cxt, int rc) + if (rc == MNT_EX_SUCCESS && mnt_context_get_status(cxt) == 1) { + selinux_warning(cxt, tgt); + } ++ ++ systemd_hint(); ++ + return rc; + } + +-- +2.39.2 + diff --git a/SPECS/util-linux.spec b/SPECS/util-linux.spec index b3bccbd..4a1296d 100644 --- a/SPECS/util-linux.spec +++ b/SPECS/util-linux.spec @@ -2,7 +2,7 @@ Summary: A collection of basic system utilities Name: util-linux Version: 2.32.1 -Release: 41%{?dist} +Release: 42%{?dist} License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain Group: System Environment/Base URL: http://en.wikipedia.org/wiki/Util-linux @@ -278,6 +278,12 @@ Patch90: 0090-lslogins-man-explain-password-statuses.patch Patch91: 0091-last-sync-utmp-strings-use-with-upstream-code.patch Patch92: 0092-last-use-full-size-of-the-username.patch +### RHEL-8.9 +### +# 2180413 - Backport hint about systemd daemon-reload +Patch93: 0093-include-c-add-cmp_timespec-and-cmp_stat_mtime.patch +Patch94: 0094-mount-add-hint-about-systemctl-daemon-reload.patch + %description The util-linux package contains a large variety of low-level system @@ -1126,6 +1132,9 @@ fi %{_libdir}/python*/site-packages/libmount/ %changelog +* Thu Mar 30 2023 Karel Zak 2.32.1-42 +- fix #2180413 - Backport hint about systemd daemon-reload + * Mon Feb 13 2023 Karel Zak 2.32.1-41 - improve #2160321 - [last] ut->ut_user is not null terminated