From e998a685f7dd16987f02b6b9b1acefb0bf9ee216 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 20 May 2020 16:47:06 +0200 Subject: [PATCH] 2.35.2-1: upstream stable update --- ...accept-sector-size-ignore-unknown-he.patch | 134 -------------- ...e-Protect-setting-in-systemd-service.patch | 34 ---- 0003-lsblk-fix-P-regression-from-v2.34.patch | 80 --------- 0004-hwclock-make-glibc-2.31-compatible.patch | 165 ------------------ util-linux.spec | 16 +- 5 files changed, 6 insertions(+), 423 deletions(-) delete mode 100644 0001-libfdisk-script-accept-sector-size-ignore-unknown-he.patch delete mode 100644 0002-fstrim-do-not-use-Protect-setting-in-systemd-service.patch delete mode 100644 0003-lsblk-fix-P-regression-from-v2.34.patch delete mode 100644 0004-hwclock-make-glibc-2.31-compatible.patch diff --git a/0001-libfdisk-script-accept-sector-size-ignore-unknown-he.patch b/0001-libfdisk-script-accept-sector-size-ignore-unknown-he.patch deleted file mode 100644 index 9d624f2..0000000 --- a/0001-libfdisk-script-accept-sector-size-ignore-unknown-he.patch +++ /dev/null @@ -1,134 +0,0 @@ -From 00e53f17c8462cb34ece08cc10db60a7da29a305 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Tue, 4 Feb 2020 15:11:19 +0100 -Subject: [PATCH] libfdisk: (script) accept sector-size, ignore unknown headers - -- add sector-size between supported headers (already in --dump output) - -- report unknown headers by -ENOTSUP - -- ignore ENOTSUP in sfdisk (but print warning) and in fdisk_script_read_file() - -Addresses: https://github.com/karelzak/util-linux/issues/949 -Signed-off-by: Karel Zak ---- - disk-utils/sfdisk.c | 6 +++++- - libfdisk/src/script.c | 49 +++++++++++++++++++++++-------------------- - 2 files changed, 31 insertions(+), 24 deletions(-) - -diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c -index bb6e1c6df..c0bea7046 100644 ---- a/disk-utils/sfdisk.c -+++ b/disk-utils/sfdisk.c -@@ -1782,7 +1782,11 @@ static int command_fdisk(struct sfdisk *sf, int argc, char **argv) - } - - rc = fdisk_script_read_line(dp, stdin, buf, sizeof(buf)); -- if (rc < 0) { -+ if (rc == -ENOTSUP) { -+ buf[sizeof(buf) - 1] = '\0'; -+ fdisk_warnx(sf->cxt, _("Unknown script header '%s' -- ignore."), buf); -+ continue; -+ } else if (rc < 0) { - DBG(PARSE, ul_debug("script parsing failed, trying sfdisk specific commands")); - buf[sizeof(buf) - 1] = '\0'; - rc = loop_control_commands(sf, dp, buf); -diff --git a/libfdisk/src/script.c b/libfdisk/src/script.c -index a21771b6a..d3e67fa9c 100644 ---- a/libfdisk/src/script.c -+++ b/libfdisk/src/script.c -@@ -805,8 +805,12 @@ static inline int is_header_line(const char *s) - /* parses ": value", note modifies @s*/ - static int parse_line_header(struct fdisk_script *dp, char *s) - { -- int rc = -EINVAL; -+ size_t i; - char *name, *value; -+ static const char *supported[] = { -+ "label", "unit", "label-id", "device", "grain", -+ "first-lba", "last-lba", "table-length", "sector-size" -+ }; - - DBG(SCRIPT, ul_debugobj(dp, " parse header '%s'", s)); - -@@ -816,7 +820,7 @@ static int parse_line_header(struct fdisk_script *dp, char *s) - name = s; - value = strchr(s, ':'); - if (!value) -- goto done; -+ return -EINVAL; - *value = '\0'; - value++; - -@@ -825,32 +829,30 @@ static int parse_line_header(struct fdisk_script *dp, char *s) - ltrim_whitespace((unsigned char *) value); - rtrim_whitespace((unsigned char *) value); - -+ if (!*name || !*value) -+ return -EINVAL; -+ -+ /* check header name */ -+ for (i = 0; i < ARRAY_SIZE(supported); i++) { -+ if (strcmp(name, supported[i]) == 0) -+ break; -+ } -+ if (i == ARRAY_SIZE(supported)) -+ return -ENOTSUP; -+ -+ /* header specific actions */ - if (strcmp(name, "label") == 0) { - if (dp->cxt && !fdisk_get_label(dp->cxt, value)) -- goto done; /* unknown label name */ -+ return -EINVAL; /* unknown label name */ - dp->force_label = 1; -+ - } else if (strcmp(name, "unit") == 0) { - if (strcmp(value, "sectors") != 0) -- goto done; /* only "sectors" supported */ -- } else if (strcmp(name, "label-id") == 0 -- || strcmp(name, "device") == 0 -- || strcmp(name, "grain") == 0 -- || strcmp(name, "first-lba") == 0 -- || strcmp(name, "last-lba") == 0 -- || strcmp(name, "table-length") == 0) { -- ; /* whatever is possible */ -- } else -- goto done; /* unknown header */ -+ return -EINVAL; /* only "sectors" supported */ - -- if (*name && *value) -- rc = fdisk_script_set_header(dp, name, value); --done: -- if (rc) -- DBG(SCRIPT, ul_debugobj(dp, "header parse error: " -- "[rc=%d, name='%s', value='%s']", -- rc, name, value)); -- return rc; -+ } - -+ return fdisk_script_set_header(dp, name, value); - } - - /* returns zero terminated string with next token and @str is updated */ -@@ -1363,7 +1365,8 @@ int fdisk_script_set_fgets(struct fdisk_script *dp, - * - * Reads next line into dump. - * -- * Returns: 0 on success, <0 on error, 1 when nothing to read. -+ * Returns: 0 on success, <0 on error, 1 when nothing to read. For unknown headers -+ * returns -ENOTSUP, it's usually safe to ignore this error. - */ - int fdisk_script_read_line(struct fdisk_script *dp, FILE *f, char *buf, size_t bufsz) - { -@@ -1428,7 +1431,7 @@ int fdisk_script_read_file(struct fdisk_script *dp, FILE *f) - - while (!feof(f)) { - rc = fdisk_script_read_line(dp, f, buf, sizeof(buf)); -- if (rc) -+ if (rc && rc != -ENOTSUP) - break; - } - --- -2.24.1 - diff --git a/0002-fstrim-do-not-use-Protect-setting-in-systemd-service.patch b/0002-fstrim-do-not-use-Protect-setting-in-systemd-service.patch deleted file mode 100644 index 5ba1d2b..0000000 --- a/0002-fstrim-do-not-use-Protect-setting-in-systemd-service.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 61b384b36105fe682ddf16b9379f446d935603bc Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Tue, 4 Feb 2020 16:17:42 +0100 -Subject: [PATCH] fstrim: do not use Protect setting in systemd service - -The ProtectHome= and ProtectSystem= settings mounts all stuff for the service in read-only mode. - -The fstrim ioctl operates on read-only mountpoint file descriptor, but -on some read-only filesystem the operation can fail, so since -2d22ac64e4 we check for read-only volumes and skip it. - -References: Upstream: http://github.com/karelzak/util-linux/commit/2d22ac64e4d6e6732640f38b7232b5bcdc84a877 -Addresses: https://github.com/karelzak/util-linux/issues/948 -Signed-off-by: Karel Zak ---- - sys-utils/fstrim.service.in | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/sys-utils/fstrim.service.in b/sys-utils/fstrim.service.in -index a8b631730..b58728ef4 100644 ---- a/sys-utils/fstrim.service.in -+++ b/sys-utils/fstrim.service.in -@@ -6,8 +6,6 @@ ConditionVirtualization=!container - [Service] - Type=oneshot - ExecStart=@sbindir@/fstrim --fstab --verbose --quiet --ProtectSystem=strict --ProtectHome=read-only - PrivateDevices=no - PrivateNetwork=yes - PrivateUsers=no --- -2.24.1 - diff --git a/0003-lsblk-fix-P-regression-from-v2.34.patch b/0003-lsblk-fix-P-regression-from-v2.34.patch deleted file mode 100644 index 6d9b6da..0000000 --- a/0003-lsblk-fix-P-regression-from-v2.34.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 91b636b5654576d0b808d0030ca9d773099e1db9 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Tue, 25 Feb 2020 15:31:23 +0100 -Subject: [PATCH] lsblk: fix -P regression from v2.34 - -Since v2.34 --list prints devices only once to make the output -user-readable. Unfortunately, it's regression for scripts/applications -where we need to parse lsblk output. So, let's make --pairs and --raw -backwardly compatible with versions before 2.34 and print all hierarchy. - -Addresses: https://github.com/ibm-s390-tools/s390-tools/issues/80 -Signed-off-by: Karel Zak ---- - misc-utils/lsblk.8 | 10 ++++++---- - misc-utils/lsblk.c | 9 +++++---- - 2 files changed, 11 insertions(+), 8 deletions(-) - -diff --git a/misc-utils/lsblk.8 b/misc-utils/lsblk.8 -index 373a80ee2..416b28298 100644 ---- a/misc-utils/lsblk.8 -+++ b/misc-utils/lsblk.8 -@@ -96,7 +96,8 @@ also \fB\-\-tree\fR if necessary. - .BR \-l , " \-\-list" - Produce output in the form of a list. The output does not provide information - about relationships between devices and since version 2.34 every device is --printed only once. -+printed only once if \fB\-\-pairs\fR or \fB\-\-raw\fR not specified (the -+parsable outputs are maintained in backwardly compatible way). - .TP - .BR \-M , " \-\-merge" - Group parents of sub-trees to provide more readable output for RAIDs and -@@ -122,14 +123,15 @@ specified in the format \fI+list\fP (e.g., \fBlsblk \-o +UUID\fP). - Output all available columns. - .TP - .BR \-P , " \-\-pairs" --Produce output in the form of key="value" pairs. --All potentially unsafe characters are hex-escaped (\\x). -+Produce output in the form of key="value" pairs. The output lines are still ordered by -+dependencies. All potentially unsafe characters are hex-escaped (\\x). - .TP - .BR \-p , " \-\-paths" - Print full device paths. - .TP - .BR \-r , " \-\-raw" --Produce output in raw format. All potentially unsafe characters are hex-escaped -+Produce output in raw format. The output lines are still ordered by -+dependencies. All potentially unsafe characters are hex-escaped - (\\x) in the NAME, KNAME, LABEL, PARTLABEL and MOUNTPOINT columns. - .TP - .BR \-S , " \-\-scsi" -diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c -index 441655e24..72ac7b483 100644 ---- a/misc-utils/lsblk.c -+++ b/misc-utils/lsblk.c -@@ -1058,8 +1058,8 @@ static void device_to_scols( - if (!parent && dev->wholedisk) - parent = dev->wholedisk; - -- /* Do not print device more than one in --list mode */ -- if (!(lsblk->flags & LSBLK_TREE) && dev->is_printed) -+ /* Do not print device more than once on --list if tree order is not requested */ -+ if (!(lsblk->flags & LSBLK_TREE) && !lsblk->force_tree_order && dev->is_printed) - return; - - if (lsblk->merge && list_count_entries(&dev->parents) > 1) { -@@ -2044,8 +2044,9 @@ int main(int argc, char *argv[]) - * /sys is no more sorted */ - lsblk->sort_id = COL_MAJMIN; - -- /* For --inverse --list we still follow parent->child relation */ -- if (lsblk->inverse && !(lsblk->flags & LSBLK_TREE)) -+ /* For --{inverse,raw,pairs} --list we still follow parent->child relation */ -+ if (!(lsblk->flags & LSBLK_TREE) -+ && (lsblk->inverse || lsblk->flags & LSBLK_EXPORT || lsblk->flags & LSBLK_RAW)) - lsblk->force_tree_order = 1; - - if (lsblk->sort_id >= 0 && column_id_to_number(lsblk->sort_id) < 0) { --- -2.24.1 - diff --git a/0004-hwclock-make-glibc-2.31-compatible.patch b/0004-hwclock-make-glibc-2.31-compatible.patch deleted file mode 100644 index 2feec6a..0000000 --- a/0004-hwclock-make-glibc-2.31-compatible.patch +++ /dev/null @@ -1,165 +0,0 @@ -From 0967f9a3f18e0320571db8dbc347c1e38b97f286 Mon Sep 17 00:00:00 2001 -From: J William Piggott -Date: Fri, 21 Feb 2020 20:03:47 -0500 -Subject: [PATCH] hwclock: make glibc 2.31 compatible - -______________________________________________________ -GNU C Library NEWS -- history of user-visible changes. -Version 2.31 -Deprecated and removed features, and other changes affecting compatibility: - -* The settimeofday function can still be used to set a system-wide time - zone when the operating system supports it. This is because the Linux - kernel reused the API, on some architectures, to describe a system-wide - time-zone-like offset between the software clock maintained by the kernel, - and the "RTC" clock that keeps time when the system is shut down. - - However, to reduce the odds of this offset being set by accident, - settimeofday can no longer be used to set the time and the offset - simultaneously. If both of its two arguments are non-null, the call - will fail (setting errno to EINVAL). - - Callers attempting to set this offset should also be prepared for the call - to fail and set errno to ENOSYS; this already happens on the Hurd and on - some Linux architectures. The Linux kernel maintainers are discussing a - more principled replacement for the reused API. After a replacement - becomes available, we will change settimeofday to fail with ENOSYS on all - platforms when its 'tzp' argument is not a null pointer. - - settimeofday itself is obsolescent according to POSIX. Programs that set - the system time should use clock_settime and/or the adjtime family of - functions instead. We may cease to make settimeofday available to newly - linked binaries after there is a replacement for Linux's time-zone-like - offset API. -______________________________________________________ - -hwclock(8) had one settimeofday(2) call where both args were set for ---hctosys when the RTC was ticking UTC. This allowed setting the system -time, timezone, and locking the warp_clock function with a single call. -That operation now takes 3 calls of settimeofday(2). - -Although this common operation now takes three calls, the overall logic -for the set_system_clock() function was simplified. - -Co-Author: Karel Zak -Signed-off-by: J William Piggott ---- - sys-utils/hwclock.c | 71 +++++++++++++++++++++++---------------------- - 1 file changed, 37 insertions(+), 34 deletions(-) - -diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c -index e736da717..1191a8571 100644 ---- a/sys-utils/hwclock.c -+++ b/sys-utils/hwclock.c -@@ -643,28 +643,28 @@ display_time(struct timeval hwctime) - * tz.tz_minuteswest argument and sets PCIL (see below). At boot settimeofday(2) - * has one-shot access to this function as shown in the table below. - * -- * +-------------------------------------------------------------------+ -- * | settimeofday(tv, tz) | -- * |-------------------------------------------------------------------| -- * | Arguments | System Time | PCIL | | warp_clock | -- * | tv | tz | set | warped | set | firsttime | locked | -- * |---------|---------|---------------|------|-----------|------------| -- * | pointer | NULL | yes | no | no | 1 | no | -- * | pointer | pointer | yes | no | no | 0 | yes | -- * | NULL | ptr2utc | no | no | no | 0 | yes | -- * | NULL | pointer | no | yes | yes | 0 | yes | -- * +-------------------------------------------------------------------+ -+ * +-------------------------------------------------------------------------+ -+ * | settimeofday(tv, tz) | -+ * |-------------------------------------------------------------------------| -+ * | Arguments | System Time | TZ | PCIL | | warp_clock | -+ * | tv | tz | set | warped | set | set | firsttime | locked | -+ * |---------|---------|---------------|-----|------|-----------|------------| -+ * | pointer | NULL | yes | no | no | no | 1 | no | -+ * | NULL | ptr2utc | no | no | yes | no | 0 | yes | -+ * | NULL | pointer | no | yes | yes | yes | 0 | yes | -+ * +-------------------------------------------------------------------------+ - * ptr2utc: tz.tz_minuteswest is zero (UTC). - * PCIL: persistent_clock_is_local, sets the "11 minute mode" timescale. - * firsttime: locks the warp_clock function (initialized to 1 at boot). -+ * Since glibc v2.31 settimeofday() will fail if both args are non NULL - * - * +---------------------------------------------------------------------------+ - * | op | RTC scale | settimeofday calls | - * |---------|-----------|-----------------------------------------------------| - * | systz | Local | 1) warps system time*, sets PCIL* and kernel tz | - * | systz | UTC | 1st) locks warp_clock* 2nd) sets kernel tz | -- * | hctosys | Local | 1st) sets PCIL* 2nd) sets system time and kernel tz | -- * | hctosys | UTC | 1) sets system time and kernel tz | -+ * | hctosys | Local | 1st) sets PCIL* & kernel tz 2nd) sets system time | -+ * | hctosys | UTC | 1st) locks warp* 2nd) sets tz 3rd) sets system time | - * +---------------------------------------------------------------------------+ - * * only on first call after boot - */ -@@ -675,42 +675,45 @@ set_system_clock(const struct hwclock_control *ctl, - struct tm broken; - int minuteswest; - int rc = 0; -- const struct timezone tz_utc = { 0 }; - - localtime_r(&newtime.tv_sec, &broken); - minuteswest = -get_gmtoff(&broken) / 60; - - if (ctl->verbose) { -- if (ctl->hctosys && !ctl->universal) -- printf(_("Calling settimeofday(NULL, %d) to set " -- "persistent_clock_is_local.\n"), minuteswest); -- if (ctl->systz && ctl->universal) -+ if (ctl->universal) { - puts(_("Calling settimeofday(NULL, 0) " -- "to lock the warp function.")); -+ "to lock the warp_clock function.")); -+ if (!( ctl->universal && !minuteswest )) -+ printf(_("Calling settimeofday(NULL, %d) " -+ "to set the kernel timezone.\n"), -+ minuteswest); -+ } else -+ printf(_("Calling settimeofday(NULL, %d) to warp " -+ "System time, set PCIL and the kernel tz.\n"), -+ minuteswest); -+ - if (ctl->hctosys) -- printf(_("Calling settimeofday(%ld.%06ld, %d)\n"), -- newtime.tv_sec, newtime.tv_usec, minuteswest); -- else { -- printf(_("Calling settimeofday(NULL, %d) "), minuteswest); -- if (ctl->universal) -- puts(_("to set the kernel timezone.")); -- else -- puts(_("to warp System time.")); -- } -+ printf(_("Calling settimeofday(%ld.%06ld, NULL) " -+ "to set the System time.\n"), -+ newtime.tv_sec, newtime.tv_usec); - } - - if (!ctl->testing) { -+ const struct timezone tz_utc = { 0 }; - const struct timezone tz = { minuteswest }; - -- if (ctl->hctosys && !ctl->universal) /* set PCIL */ -- rc = settimeofday(NULL, &tz); -- if (ctl->systz && ctl->universal) /* lock warp_clock */ -+ /* If UTC RTC: lock warp_clock and PCIL */ -+ if (ctl->universal) - rc = settimeofday(NULL, &tz_utc); -- if (!rc && ctl->hctosys) -- rc = settimeofday(&newtime, &tz); -- else if (!rc) -+ -+ /* Set kernel tz; if localtime RTC: warp_clock and set PCIL */ -+ if (!rc && !( ctl->universal && !minuteswest )) - rc = settimeofday(NULL, &tz); - -+ /* Set the System Clock */ -+ if ((!rc || errno == ENOSYS) && ctl->hctosys) -+ rc = settimeofday(&newtime, NULL); -+ - if (rc) { - warn(_("settimeofday() failed")); - return EXIT_FAILURE; --- -2.25.2 - diff --git a/util-linux.spec b/util-linux.spec index b3e9a50..eae812e 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -1,8 +1,8 @@ ### Header Summary: A collection of basic system utilities Name: util-linux -Version: 2.35.1 -Release: 9%{?dist} +Version: 2.35.2 +Release: 1%{?dist} License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain URL: http://en.wikipedia.org/wiki/Util-linux @@ -107,14 +107,6 @@ Requires: libfdisk = %{version}-%{release} ### # 151635 - makeing /var/log/lastlog Patch0: 2.28-login-lastlog-create.patch -# https://github.com/karelzak/util-linux/issues/949 -Patch1: 0001-libfdisk-script-accept-sector-size-ignore-unknown-he.patch -# https://github.com/karelzak/util-linux/issues/948 -Patch2: 0002-fstrim-do-not-use-Protect-setting-in-systemd-service.patch -# https://github.com/ibm-s390-tools/s390-tools/issues/80 -Patch3: 0003-lsblk-fix-P-regression-from-v2.34.patch -# 1823463 - hwclock unable to set system time -Patch4: 0004-hwclock-make-glibc-2.31-compatible.patch %description The util-linux package contains a large variety of low-level system @@ -941,6 +933,10 @@ fi %{_libdir}/python*/site-packages/libmount/ %changelog +* Wed May 20 2020 Karel Zak - 2.35.2-1 +- upgrade to upstream bug fix release 2.35.2 + https://www.kernel.org/pub/linux/utils/util-linux/v2.35/v2.35.2-ReleaseNotes + * Wed Apr 15 2020 Karel Zak - 2.35.1-9 - fix copy & past bug in specfile changelog