diff --git a/SOURCES/0045-include-c-add-cmp_timespec-and-cmp_stat_mtime.patch b/SOURCES/0045-include-c-add-cmp_timespec-and-cmp_stat_mtime.patch new file mode 100644 index 0000000..a356117 --- /dev/null +++ b/SOURCES/0045-include-c-add-cmp_timespec-and-cmp_stat_mtime.patch @@ -0,0 +1,47 @@ +From 5285f83b77df9e206f4904eba92c741eb42acc93 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=2180414 +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 354b59e29..01f0fa507 100644 +--- a/include/c.h ++++ b/include/c.h +@@ -167,6 +167,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/0046-mount-add-hint-about-systemctl-daemon-reload.patch b/SOURCES/0046-mount-add-hint-about-systemctl-daemon-reload.patch new file mode 100644 index 0000000..554b2ae --- /dev/null +++ b/SOURCES/0046-mount-add-hint-about-systemctl-daemon-reload.patch @@ -0,0 +1,86 @@ +From 5d150964f0b2fbcaa9f9d11809eede9255159a5d 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=2180414 +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 7e7d9053f..8c3c36477 100644 +--- a/include/pathnames.h ++++ b/include/pathnames.h +@@ -82,6 +82,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 ce1de16dc..90a0331c3 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" +@@ -336,6 +337,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. + */ +@@ -359,6 +379,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 e16e9ae..2ad0a25 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.37.4 -Release: 10%{?dist} +Release: 11%{?dist} License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain URL: http://en.wikipedia.org/wiki/Util-linux @@ -166,6 +166,11 @@ Patch43: 0043-agetty-resolve-tty-name-even-if-stdin-is-specified.patch # 2166653 - last(1) should be more robust with work with strings Patch44: 0044-last-use-snprintf-rather-than-sprintf.patch +### RHEL-9.2.Z (0day) +# +# 2180414 - Backport hint about systemd daemon-reload +Patch45: 0045-include-c-add-cmp_timespec-and-cmp_stat_mtime.patch +Patch46: 0046-mount-add-hint-about-systemctl-daemon-reload.patch %description The util-linux package contains a large variety of low-level system @@ -1000,6 +1005,9 @@ fi %{_libdir}/python*/site-packages/libmount/ %changelog +* Tue Mar 28 2023 Karel Zak 2.37.4-11 +- fix #2180414 - Backport hint about systemd daemon-reload + * Tue Feb 07 2023 Karel Zak 2.37.4-10 - fix #2165981 - fstrim -av fails to trim root filesystem on Red Hat Coreos - fix #2141970 - add --cont-clock feature for libuuid and uuidd