import CS util-linux-2.32.1-43.el8

This commit is contained in:
eabdullin 2023-09-27 14:17:45 +00:00
parent d5ce9dbb01
commit 450ffe8d7b
7 changed files with 353 additions and 1 deletions

View File

@ -0,0 +1,47 @@
From 428791718a166ee5ce275b0bcf4a904a97e6af9d Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
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 <kzak@redhat.com>
---
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

View File

@ -0,0 +1,86 @@
From 7cc9fe69d3f35038b7b3329fef0cccdbe38ffef6 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
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 <kzak@redhat.com>
---
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

View File

@ -0,0 +1,35 @@
From e85fb0785608ce9f9b7d1e4b61813eb2693501f8 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Thu, 10 Aug 2023 12:34:49 +0200
Subject: fstab: add hint about systemd reload
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2117355
Upstream: http://github.com/util-linux/util-linux/commit/9105d3cdd819a499f5029d1009952acf6f51b7d9
Signed-off-by: Karel Zak <kzak@redhat.com>
---
sys-utils/fstab.5 | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/sys-utils/fstab.5 b/sys-utils/fstab.5
index a9e9f8c54..c1af2b347 100644
--- a/sys-utils/fstab.5
+++ b/sys-utils/fstab.5
@@ -53,6 +53,15 @@ sequentially iterate through
.B fstab
doing their thing.
+The file is not read by
+.BR mount (8)
+only but often is used by many other tools
+and daemons, and proper functionality may require additional steps. For
+example, on systemd-based systems, it's recommended to use 'systemctl
+daemon-reload' after
+.B fstab
+modification.
+
Each filesystem is described on a separate line.
Fields on each line are separated by tabs or spaces.
Lines starting with '#' are comments. Blank lines are ignored.
--
2.40.1

View File

@ -0,0 +1,84 @@
From 494ee71afa6bf732f73484c9e2f4a9f4595371ef Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Wed, 9 Aug 2023 13:30:49 +0200
Subject: libuuid: backport cache handling from upstream
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2184728
Upstream: http://github.com/util-linux/util-linux/commit/104dc2e092058489a4be17d5b15902e58ca56804
Upstream: http://github.com/util-linux/util-linux/commit/2fa4168c8bc9d5438bc1dfadda293c7c21b6fa59
Signed-off-by: Karel Zak <kzak@redhat.com>
---
libuuid/src/gen_uuid.c | 33 ++++++++++++++++++++++++++++-----
1 file changed, 28 insertions(+), 5 deletions(-)
diff --git a/libuuid/src/gen_uuid.c b/libuuid/src/gen_uuid.c
index 8dc38559f..a06ddfd11 100644
--- a/libuuid/src/gen_uuid.c
+++ b/libuuid/src/gen_uuid.c
@@ -528,18 +528,37 @@ int __uuid_generate_time_cont(uuid_t out, int *num, uint32_t cont_offset)
*/
static int uuid_generate_time_generic(uuid_t out) {
#ifdef HAVE_TLS
+ /* thread local cache for uuidd based requests */
+ const int cs_min = (1<<6);
+ const int cs_max = (1<<18);
+ const int cs_factor = 2;
THREAD_LOCAL int num = 0;
+ THREAD_LOCAL int cache_size = cs_min;
+ THREAD_LOCAL int last_used = 0;
THREAD_LOCAL struct uuid uu;
THREAD_LOCAL time_t last_time = 0;
time_t now;
- if (num > 0) {
+ if (num > 0) { /* expire cache */
now = time(NULL);
- if (now > last_time+1)
+ if (now > last_time+1) {
+ last_used = cache_size - num;
num = 0;
+ }
}
- if (num <= 0) {
- num = 1000;
+ if (num <= 0) { /* fill cache */
+ /*
+ * num + OP_BULK provides a local cache in each application.
+ * Start with a small cache size to cover short running applications
+ * and adjust the cache size over the runntime.
+ */
+ if ((last_used == cache_size) && (cache_size < cs_max))
+ cache_size *= cs_factor;
+ else if ((last_used < (cache_size / cs_factor)) && (cache_size > cs_min))
+ cache_size /= cs_factor;
+
+ num = cache_size;
+
if (get_uuid_via_daemon(UUIDD_OP_BULK_TIME_UUID,
out, &num) == 0) {
last_time = time(NULL);
@@ -547,9 +566,11 @@ static int uuid_generate_time_generic(uuid_t out) {
num--;
return 0;
}
+ /* request to daemon failed, reset cache */
num = 0;
+ cache_size = cs_min;
}
- if (num > 0) {
+ if (num > 0) { /* serve uuid from cache */
uu.time_low++;
if (uu.time_low == 0) {
uu.time_mid++;
@@ -558,6 +579,8 @@ static int uuid_generate_time_generic(uuid_t out) {
}
num--;
uuid_pack(&uu, out);
+ if (num == 0)
+ last_used = cache_size;
return 0;
}
#else
--
2.40.1

View File

@ -0,0 +1,43 @@
From 0035da01a9acdb547c3162e3a98a2d265bcc11e7 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Thu, 10 Aug 2023 13:13:04 +0200
Subject: swapon: (man) fix --priority description
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2188894
Upstream: http://github.com/util-linux/util-linux/commit/85d15200e840d4fd150801e635ee5c1b7da84737
Signed-off-by: Karel Zak <kzak@redhat.com>
---
sys-utils/swapon.8 | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/sys-utils/swapon.8 b/sys-utils/swapon.8
index 3c66c8188..301a232fc 100644
--- a/sys-utils/swapon.8
+++ b/sys-utils/swapon.8
@@ -137,18 +137,18 @@ command line options.
.RE
.TP
.BR \-p , " \-\-priority " \fIpriority\fP
-Specify the priority of the swap device.
+Specify the priority of the swap device.
.I priority
-is a value between \-1 and 32767. Higher numbers indicate
-higher priority. See
+is a value between 0 and 32767. Higher numbers indicate higher priority. See
.BR swapon (2)
-for a full description of swap priorities. Add
+for a full description of swap priorities. Add
.BI pri= value
to the option field of
.I /etc/fstab
for use with
.BR "swapon -a" .
-When no priority is defined, it defaults to \-1.
+When no priority is defined, Linux kernel defaults to negative numbers.
+
.TP
.BR \-s , " \-\-summary"
Display swap usage summary by device. Equivalent to "cat /proc/swaps".
--
2.40.1

View File

@ -0,0 +1,34 @@
From 9ab804e580e767640eae3d9189f8c6de2e673143 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Sat, 29 Jul 2023 17:32:57 -0400
Subject: wall: do not error for ttys that do not exist
Some wayland display managers (GDM) put strings like "seat0" in the
ut_line field of utmp entries. These are not valid tty devices.
Avoid writing a confusing error message for ttys that do not exist.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2227097
Bug: https://bugs.gentoo.org/911336
Upstream: http://github.com/util-linux/util-linux/commit/7d3713a6d541be0bac0bb78cc8fea1620583fd08
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
---
term-utils/ttymsg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/term-utils/ttymsg.c b/term-utils/ttymsg.c
index 2aab69f10..e53506520 100644
--- a/term-utils/ttymsg.c
+++ b/term-utils/ttymsg.c
@@ -100,7 +100,7 @@ ttymsg(struct iovec *iov, size_t iovcnt, char *line, int tmout) {
* if not running as root; not an error.
*/
if ((fd = open(device, O_WRONLY|O_NONBLOCK, 0)) < 0) {
- if (errno == EBUSY || errno == EACCES)
+ if (errno == EBUSY || errno == EACCES || errno == ENOENT)
return NULL;
len = snprintf(errbuf, sizeof(errbuf), "%s: %m", device);
--
2.40.1

View File

@ -2,7 +2,7 @@
Summary: A collection of basic system utilities
Name: util-linux
Version: 2.32.1
Release: 41%{?dist}
Release: 43%{?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,20 @@ 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
# 2117355 - Add additional documentation for fstab.
Patch95: 0095-fstab-add-hint-about-systemd-reload.patch
# 2184728 - libuuid - downport cache related patch
Patch96: 0096-libuuid-backport-cache-handling-from-upstream.patch
# 2188894 - The swapon man page of -p(priority) option shows incorrect.
Patch97: 0097-swapon-man-fix-priority-description.patch
# 2227097 - wall(1) fails when trying to use seat0
Patch98: 0098-wall-do-not-error-for-ttys-that-do-not-exist.patch
%description
The util-linux package contains a large variety of low-level system
@ -1126,6 +1140,15 @@ fi
%{_libdir}/python*/site-packages/libmount/
%changelog
* Thu Aug 10 2023 Karel Zak <kzak@redhat.com> 2.32.1-43
- fix #2117355 - Add additional documentation for fstab
- fix #2184728 - libuuid - downport cache related patch
- fix #2188894 - The swapon man page of -p(priority) option shows incorrect.
- fix #2227097 - wall(1) fail when trying to use seat0
* Thu Mar 30 2023 Karel Zak <kzak@redhat.com> 2.32.1-42
- fix #2180413 - Backport hint about systemd daemon-reload
* Mon Feb 13 2023 Karel Zak <kzak@redhat.com> 2.32.1-41
- improve #2160321 - [last] ut->ut_user is not null terminated