summaryrefslogtreecommitdiffstats
path: root/external/poky/meta/recipes-core/util-linux/util-linux
diff options
context:
space:
mode:
Diffstat (limited to 'external/poky/meta/recipes-core/util-linux/util-linux')
-rw-r--r--external/poky/meta/recipes-core/util-linux/util-linux/0001-hwclock-fix-for-glibc-2.31-settimeofday.patch112
-rw-r--r--external/poky/meta/recipes-core/util-linux/util-linux/0001-include-cleanup-pidfd-inckudes.patch42
-rw-r--r--external/poky/meta/recipes-core/util-linux/util-linux/0001-kill-include-sys-types.h-before-checking-SYS_pidfd_s.patch64
-rw-r--r--external/poky/meta/recipes-core/util-linux/util-linux/0001-libfdisk-script-accept-sector-size-ignore-unknown-he.patch137
-rw-r--r--external/poky/meta/recipes-core/util-linux/util-linux/run-ptest20
-rw-r--r--external/poky/meta/recipes-core/util-linux/util-linux/util-linux-native-qsort.patch33
6 files changed, 374 insertions, 34 deletions
diff --git a/external/poky/meta/recipes-core/util-linux/util-linux/0001-hwclock-fix-for-glibc-2.31-settimeofday.patch b/external/poky/meta/recipes-core/util-linux/util-linux/0001-hwclock-fix-for-glibc-2.31-settimeofday.patch
new file mode 100644
index 00000000..0672c354
--- /dev/null
+++ b/external/poky/meta/recipes-core/util-linux/util-linux/0001-hwclock-fix-for-glibc-2.31-settimeofday.patch
@@ -0,0 +1,112 @@
+From ee85d3967ea09b215fcea5efdd90bbbf5e74a681 Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak@redhat.com>
+Date: Wed, 19 Feb 2020 15:50:47 +0100
+Subject: [PATCH] hwclock: fix for glibc 2.31 settimeofday()
+
+glibc announce:
+ ... 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).
+
+It means we need to call settimeofday(NULL, tz) and settimeofday(tv, NULL).
+
+Unfortunately, settimeofday(NULL, tz) has very special warp-clock
+semantic if used as the very first settimeofday() call. It means we
+have to be sure that we do not touch warp-clock if we need only need
+to modify system TZ. So, let's always call settimeofday(NULL, 0)
+before settimeofday(NULL, tz) for UTC rtc mode when modify system TZ.
+
+Upstream-Status: Backport [https://github.com/karelzak/util-linux/commit/ee85d3967ea09b215fcea5efdd90bbbf5e74a681]
+
+CC: J William Piggott <elseifthen@gmx.com>
+Signed-off-by: Karel Zak <kzak@redhat.com>
+Addresses: https://github.com/karelzak/util-linux/issues/957
+Signed-off-by: Liwei Song <liwei.song@windriver.com>
+---
+ sys-utils/hwclock.c | 49 ++++++++++++++++++++++++++-------------------
+ 1 file changed, 28 insertions(+), 21 deletions(-)
+
+diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c
+index e736da7179f8..16576bc186ff 100644
+--- a/sys-utils/hwclock.c
++++ b/sys-utils/hwclock.c
+@@ -658,6 +658,9 @@ display_time(struct timeval hwctime)
+ * PCIL: persistent_clock_is_local, sets the "11 minute mode" timescale.
+ * firsttime: locks the warp_clock function (initialized to 1 at boot).
+ *
++ * Note that very first settimeofday(NULL, tz) modifies warp-clock as well as
++ * system TZ.
++ *
+ * +---------------------------------------------------------------------------+
+ * | op | RTC scale | settimeofday calls |
+ * |---------|-----------|-----------------------------------------------------|
+@@ -675,41 +678,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 function."));
++ else
++ printf(_("Calling settimeofday(NULL, %d) to set "
++ "persistent_clock_is_local and "
++ "the kernel timezone.\n"), minuteswest);
++
++ if (ctl->universal && minuteswest)
++ printf(_("Calling settimeofday(NULL, %d) to set "
++ "the kernel timezone.\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, 0) to set "
++ "the kernel 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 */
++ /* warp-clock */
++ if (ctl->universal)
++ rc = settimeofday(NULL, &tz_utc); /* lock to UTC */
++ else
++ rc = settimeofday(NULL, &tz); /* set PCIL and TZ */
++
++ /* set timezone */
++ if (!rc && ctl->universal && minuteswest)
+ rc = settimeofday(NULL, &tz);
+- if (ctl->systz && ctl->universal) /* lock warp_clock */
+- rc = settimeofday(NULL, &tz_utc);
++
++ /* set time */
+ if (!rc && ctl->hctosys)
+- rc = settimeofday(&newtime, &tz);
+- else if (!rc)
+- rc = settimeofday(NULL, &tz);
++ rc = settimeofday(&newtime, NULL);
+
+ if (rc) {
+ warn(_("settimeofday() failed"));
+--
+2.17.1
+
diff --git a/external/poky/meta/recipes-core/util-linux/util-linux/0001-include-cleanup-pidfd-inckudes.patch b/external/poky/meta/recipes-core/util-linux/util-linux/0001-include-cleanup-pidfd-inckudes.patch
new file mode 100644
index 00000000..0ef6fb4e
--- /dev/null
+++ b/external/poky/meta/recipes-core/util-linux/util-linux/0001-include-cleanup-pidfd-inckudes.patch
@@ -0,0 +1,42 @@
+From 0a4035ff2e4fd5b5ae0cf8f8665696c2aff53b75 Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak@redhat.com>
+Date: Tue, 10 Mar 2020 11:43:16 +0100
+Subject: [PATCH] include: cleanup pidfd inckudes
+
+Upstream-Status: Backport [https://github.com/karelzak/util-linux/commit/0a4035ff2e4fd5b5ae0cf8f8665696c2aff53b75]
+
+Signed-off-by: Karel Zak <kzak@redhat.com>
+Signed-off-by: Benjamin Fair <benjaminfair@google.com>
+---
+ include/pidfd-utils.h | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/include/pidfd-utils.h b/include/pidfd-utils.h
+index 0baedd2c9..4a6c3a604 100644
+--- a/include/pidfd-utils.h
++++ b/include/pidfd-utils.h
+@@ -3,10 +3,10 @@
+
+ #if defined(__linux__)
+ # include <sys/syscall.h>
+-# if defined(SYS_pidfd_send_signal)
++# if defined(SYS_pidfd_send_signal) && defined(SYS_pidfd_open)
+ # include <sys/types.h>
+
+-# ifndef HAVE_PIDFD_OPEN
++# ifndef HAVE_PIDFD_SEND_SIGNAL
+ static inline int pidfd_send_signal(int pidfd, int sig, siginfo_t *info,
+ unsigned int flags)
+ {
+@@ -14,7 +14,7 @@ static inline int pidfd_send_signal(int pidfd, int sig, siginfo_t *info,
+ }
+ # endif
+
+-# ifndef HAVE_PIDFD_SEND_SIGNAL
++# ifndef HAVE_PIDFD_OPEN
+ static inline int pidfd_open(pid_t pid, unsigned int flags)
+ {
+ return syscall(SYS_pidfd_open, pid, flags);
+--
+2.26.1.301.g55bc3eb7cb9-goog
+
diff --git a/external/poky/meta/recipes-core/util-linux/util-linux/0001-kill-include-sys-types.h-before-checking-SYS_pidfd_s.patch b/external/poky/meta/recipes-core/util-linux/util-linux/0001-kill-include-sys-types.h-before-checking-SYS_pidfd_s.patch
new file mode 100644
index 00000000..e43e1287
--- /dev/null
+++ b/external/poky/meta/recipes-core/util-linux/util-linux/0001-kill-include-sys-types.h-before-checking-SYS_pidfd_s.patch
@@ -0,0 +1,64 @@
+From 3cfde0370d3a8949df0c5bcf447cec6692910ed2 Mon Sep 17 00:00:00 2001
+From: Sami Kerola <kerolasa@iki.fi>
+Date: Sat, 15 Feb 2020 21:12:50 +0000
+Subject: [PATCH] kill: include sys/types.h before checking
+ SYS_pidfd_send_signal
+
+Including sys/types.h must happen before SYS_pidfd_send_signal is checked,
+because that header defines variable in normal conditions. When sys/types.h
+does not have SYS_pidfd_send_signal then fallback is defined in config.h
+that is included by default, and has therefore worked fine before and after
+this change.
+
+Upstream-Status: Backport [https://github.com/karelzak/util-linux/commit/3cfde0370d3a8949df0c5bcf447cec6692910ed2]
+
+Signed-off-by: Sami Kerola <kerolasa@iki.fi>
+Signed-off-by: Benjamin Fair <benjaminfair@google.com>
+---
+ include/pidfd-utils.h | 18 ++++++++++--------
+ 1 file changed, 10 insertions(+), 8 deletions(-)
+
+diff --git a/include/pidfd-utils.h b/include/pidfd-utils.h
+index 593346576..0baedd2c9 100644
+--- a/include/pidfd-utils.h
++++ b/include/pidfd-utils.h
+@@ -1,26 +1,28 @@
+ #ifndef UTIL_LINUX_PIDFD_UTILS
+ #define UTIL_LINUX_PIDFD_UTILS
+
+-#if defined(__linux__) && defined(SYS_pidfd_send_signal)
+-# include <sys/types.h>
++#if defined(__linux__)
+ # include <sys/syscall.h>
++# if defined(SYS_pidfd_send_signal)
++# include <sys/types.h>
+
+-# ifndef HAVE_PIDFD_OPEN
++# ifndef HAVE_PIDFD_OPEN
+ static inline int pidfd_send_signal(int pidfd, int sig, siginfo_t *info,
+ unsigned int flags)
+ {
+ return syscall(SYS_pidfd_send_signal, pidfd, sig, info, flags);
+ }
+-# endif
++# endif
+
+-# ifndef HAVE_PIDFD_SEND_SIGNAL
++# ifndef HAVE_PIDFD_SEND_SIGNAL
+ static inline int pidfd_open(pid_t pid, unsigned int flags)
+ {
+ return syscall(SYS_pidfd_open, pid, flags);
+ }
+-# endif
++# endif
+
+-# define UL_HAVE_PIDFD 1
++# define UL_HAVE_PIDFD 1
+
+-#endif /* __linux__ && SYS_pidfd_send_signal */
++# endif /* SYS_pidfd_send_signal */
++#endif /* __linux__ */
+ #endif /* UTIL_LINUX_PIDFD_UTILS */
+--
+2.26.1.301.g55bc3eb7cb9-goog
+
diff --git a/external/poky/meta/recipes-core/util-linux/util-linux/0001-libfdisk-script-accept-sector-size-ignore-unknown-he.patch b/external/poky/meta/recipes-core/util-linux/util-linux/0001-libfdisk-script-accept-sector-size-ignore-unknown-he.patch
new file mode 100644
index 00000000..911f70bc
--- /dev/null
+++ b/external/poky/meta/recipes-core/util-linux/util-linux/0001-libfdisk-script-accept-sector-size-ignore-unknown-he.patch
@@ -0,0 +1,137 @@
+From 00e53f17c8462cb34ece08cc10db60a7da29a305 Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak@redhat.com>
+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()
+
+Upstream-Status: Backport [https://github.com/karelzak/util-linux/commit/00e53f17c8462cb34ece08cc10db60a7da29a305]
+
+Addresses: https://github.com/karelzak/util-linux/issues/949
+Signed-off-by: Karel Zak <kzak@redhat.com>
+Signed-off-by: Pierre-Jean Texier <pjtexier@koncepto.io>
+---
+ 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 bb6e1c6..c0bea70 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 a21771b..d3e67fa 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 "<name>: 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.7.4
+
diff --git a/external/poky/meta/recipes-core/util-linux/util-linux/run-ptest b/external/poky/meta/recipes-core/util-linux/util-linux/run-ptest
index fbc2f9b5..e135ee58 100644
--- a/external/poky/meta/recipes-core/util-linux/util-linux/run-ptest
+++ b/external/poky/meta/recipes-core/util-linux/util-linux/run-ptest
@@ -1,5 +1,18 @@
#!/bin/sh
+
+# When udevd (from eudev) is running most eject/mount tests will fail because
+# of automount. We need to stop udevd before executing util-linux's tests.
+# The systemd-udevd daemon doesn't change the outcome of util-linux's tests.
+UDEV_PID="`pidof "@base_sbindir@/udevd"`"
+if [ "x$UDEV_PID" != "x" ]; then
+ /etc/init.d/udev stop
+fi
+
+current_path=$(readlink -f $0)
+export bindir=$(dirname $current_path)
+export PATH=$bindir/bin:$PATH
+
cd tests || exit 1
comps=$(find ts/ -type f -perm -111 -regex ".*/[^\.~]*" | sort)
@@ -16,10 +29,15 @@ res=0
count=0
for ts in $comps;
do
- $ts | sed '{
+ $ts | sed -u '{
s/^\(.*\):\(.*\) \.\.\. OK$/PASS: \1:\2/
s/^\(.*\):\(.*\) \.\.\. FAILED \(.*\)$/FAIL: \1:\2 \3/
s/^\(.*\):\(.*\) \.\.\. SKIPPED \(.*\)$/SKIP: \1:\2 \3/
}'
done
+
+if [ "x$UDEV_PID" != "x" ]; then
+ /etc/init.d/udev start
+fi
+
diff --git a/external/poky/meta/recipes-core/util-linux/util-linux/util-linux-native-qsort.patch b/external/poky/meta/recipes-core/util-linux/util-linux/util-linux-native-qsort.patch
deleted file mode 100644
index 68bf22de..00000000
--- a/external/poky/meta/recipes-core/util-linux/util-linux/util-linux-native-qsort.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From f220d809be1baa654503bf6ff52f3630b0d7015c Mon Sep 17 00:00:00 2001
-From: Robert Yang <liezhi.yang@windriver.com>
-Date: Wed, 26 Mar 2014 01:30:29 +0000
-Subject: [PATCH] sun.c: use qsort() to instead of qsort_r()
-
-qsort_r() was added to glibc in version 2.8, so there is no qsort_r() on
-the host like CentOS 5.x.
-
-Upstream-Status: Inappropriate [Other]
-
-Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
----
- libfdisk/src/sun.c | 5 ++---
- 1 file changed, 2 insertions(+), 3 deletions(-)
-
-Index: util-linux-2.24.2/libfdisk/src/sun.c
-===================================================================
---- util-linux-2.24.2.orig/libfdisk/src/sun.c
-+++ util-linux-2.24.2/libfdisk/src/sun.c
-@@ -431,10 +431,9 @@ static int sun_verify_disklabel(struct f
- }
- verify_sun_starts = starts;
-
-- qsort_r(array,ARRAY_SIZE(array),sizeof(array[0]),
-- (int (*)(const void *,const void *,void *)) verify_sun_cmp,
-- verify_sun_starts);
--
-+ qsort(array,ARRAY_SIZE(array),sizeof(array[0]),
-+ (int (*)(const void *,const void *)) verify_sun_cmp);
-+
- if (array[0] == -1) {
- fdisk_info(cxt, _("No partitions defined."));
- return 0;