import UBI util-linux-2.32.1-44.el8_9.1

This commit is contained in:
eabdullin 2024-04-02 17:21:57 +00:00
parent 1199f1e74c
commit ecfec454d2
2 changed files with 117 additions and 1 deletions

View File

@ -0,0 +1,108 @@
From e561e4740d8dd5419e5fb23ab186ae43fd572736 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Wed, 10 Jan 2024 12:08:17 +0100
Subject: lscpu: avoid EBUSY on cpuinfo_max_freq
Addresses: https://issues.redhat.com/browse/RHEL-13741
---
include/path.h | 4 ++++
lib/path.c | 20 ++++++++++++++++++++
sys-utils/lscpu.c | 18 ++++++++++++------
3 files changed, 36 insertions(+), 6 deletions(-)
diff --git a/include/path.h b/include/path.h
index 4be01095c..965bdd047 100644
--- a/include/path.h
+++ b/include/path.h
@@ -19,8 +19,12 @@ extern void path_read_str(char *result, size_t len, const char *path, ...)
__attribute__ ((__format__ (__printf__, 3, 4)));
extern int path_write_str(const char *str, const char *path, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
+
+extern int __path_read_s32(int *result, const char *path, ...)
+ __attribute__ ((__format__ (__printf__, 2, 3)));
extern int path_read_s32(const char *path, ...)
__attribute__ ((__format__ (__printf__, 1, 2)));
+
extern uint64_t path_read_u64(const char *path, ...)
__attribute__ ((__format__ (__printf__, 1, 2)));
diff --git a/lib/path.c b/lib/path.c
index e8cfa557a..7217c9089 100644
--- a/lib/path.c
+++ b/lib/path.c
@@ -145,6 +145,26 @@ path_read_str(char *result, size_t len, const char *path, ...)
result[len - 1] = '\0';
}
+/* like path_read_s32() but do not print any error message */
+int __path_read_s32(int *result, const char *path, ...)
+{
+ FILE *f;
+ va_list ap;
+ int rc;
+
+ va_start(ap, path);
+ f = path_vfopen("r" UL_CLOEXECSTR, 0, path, ap);
+ va_end(ap);
+
+ if (!f)
+ return -1;
+
+ rc = fscanf(f, "%d", result);
+ fclose(f);
+
+ return rc == 1 ? 0 : -1;
+}
+
int
path_read_s32(const char *path, ...)
{
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index 01f8fba35..ed5543901 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -1176,28 +1176,34 @@ static void
read_max_mhz(struct lscpu_desc *desc, int idx)
{
int num = real_cpu_num(desc, idx);
+ int mhz = 0;
if (!path_exist(_PATH_SYS_CPU "/cpu%d/cpufreq/cpuinfo_max_freq", num))
return;
+ if (__path_read_s32(&mhz, _PATH_SYS_CPU
+ "/cpu%d/cpufreq/cpuinfo_max_freq", num) != 0)
+ return;
+
if (!desc->maxmhz)
desc->maxmhz = xcalloc(desc->ncpuspos, sizeof(char *));
- xasprintf(&(desc->maxmhz[idx]), "%.4f",
- (float)path_read_s32(_PATH_SYS_CPU
- "/cpu%d/cpufreq/cpuinfo_max_freq", num) / 1000);
+ xasprintf(&(desc->maxmhz[idx]), "%.4f", (float) mhz / 1000);
}
static void
read_min_mhz(struct lscpu_desc *desc, int idx)
{
int num = real_cpu_num(desc, idx);
+ int mhz = 0;
if (!path_exist(_PATH_SYS_CPU "/cpu%d/cpufreq/cpuinfo_min_freq", num))
return;
+ if (__path_read_s32(&mhz, _PATH_SYS_CPU
+ "/cpu%d/cpufreq/cpuinfo_min_freq", num) != 0)
+ return;
+
if (!desc->minmhz)
desc->minmhz = xcalloc(desc->ncpuspos, sizeof(char *));
- xasprintf(&(desc->minmhz[idx]), "%.4f",
- (float)path_read_s32(_PATH_SYS_CPU
- "/cpu%d/cpufreq/cpuinfo_min_freq", num) / 1000);
+ xasprintf(&(desc->minmhz[idx]), "%.4f", (float) mhz / 1000);
}
static int
--
2.43.0

View File

@ -2,7 +2,7 @@
Summary: A collection of basic system utilities
Name: util-linux
Version: 2.32.1
Release: 43%{?dist}
Release: 44%{?dist}.1
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
@ -292,6 +292,11 @@ 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
### RHEL-8.9.Z
###
# RHEL-13741 - lscpu: avoid EBUSY on cpuinfo_max_freq
Patch99: 0099-lscpu-avoid-EBUSY-on-cpuinfo_max_freq.patch
%description
The util-linux package contains a large variety of low-level system
@ -1140,6 +1145,9 @@ fi
%{_libdir}/python*/site-packages/libmount/
%changelog
* Wed Jan 10 2024 Karel Zak <kzak@redhat.com> 2.32.1-44.el8_9.1
- fix RHEL-13741 - lscpu: avoid EBUSY on cpuinfo_max_freq
* 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