summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/util-linux/util-linux
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/util-linux/util-linux')
-rw-r--r--meta/recipes-core/util-linux/util-linux/0001-hwclock-fix-for-glibc-2.31-settimeofday.patch112
-rw-r--r--meta/recipes-core/util-linux/util-linux/0001-include-cleanup-pidfd-inckudes.patch42
-rw-r--r--meta/recipes-core/util-linux/util-linux/0001-kill-include-sys-types.h-before-checking-SYS_pidfd_s.patch64
-rw-r--r--meta/recipes-core/util-linux/util-linux/0001-libfdisk-script-accept-sector-size-ignore-unknown-he.patch137
-rw-r--r--meta/recipes-core/util-linux/util-linux/0001-login-utils-include-libgen.h-for-basename-API.patch60
-rw-r--r--meta/recipes-core/util-linux/util-linux/avoid_parallel_tests.patch27
-rw-r--r--meta/recipes-core/util-linux/util-linux/configure-sbindir.patch19
-rw-r--r--meta/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch12
-rw-r--r--meta/recipes-core/util-linux/util-linux/fcntl-lock.c332
-rw-r--r--meta/recipes-core/util-linux/util-linux/mit-license.patch45
-rw-r--r--meta/recipes-core/util-linux/util-linux/ptest.patch15
-rw-r--r--meta/recipes-core/util-linux/util-linux/run-ptest34
12 files changed, 496 insertions, 403 deletions
diff --git a/meta/recipes-core/util-linux/util-linux/0001-hwclock-fix-for-glibc-2.31-settimeofday.patch b/meta/recipes-core/util-linux/util-linux/0001-hwclock-fix-for-glibc-2.31-settimeofday.patch
deleted file mode 100644
index 0672c3546a..0000000000
--- a/meta/recipes-core/util-linux/util-linux/0001-hwclock-fix-for-glibc-2.31-settimeofday.patch
+++ /dev/null
@@ -1,112 +0,0 @@
-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/meta/recipes-core/util-linux/util-linux/0001-include-cleanup-pidfd-inckudes.patch b/meta/recipes-core/util-linux/util-linux/0001-include-cleanup-pidfd-inckudes.patch
deleted file mode 100644
index 0ef6fb4ec7..0000000000
--- a/meta/recipes-core/util-linux/util-linux/0001-include-cleanup-pidfd-inckudes.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-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/meta/recipes-core/util-linux/util-linux/0001-kill-include-sys-types.h-before-checking-SYS_pidfd_s.patch b/meta/recipes-core/util-linux/util-linux/0001-kill-include-sys-types.h-before-checking-SYS_pidfd_s.patch
deleted file mode 100644
index e43e12873f..0000000000
--- a/meta/recipes-core/util-linux/util-linux/0001-kill-include-sys-types.h-before-checking-SYS_pidfd_s.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-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/meta/recipes-core/util-linux/util-linux/0001-libfdisk-script-accept-sector-size-ignore-unknown-he.patch b/meta/recipes-core/util-linux/util-linux/0001-libfdisk-script-accept-sector-size-ignore-unknown-he.patch
deleted file mode 100644
index 911f70bc1f..0000000000
--- a/meta/recipes-core/util-linux/util-linux/0001-libfdisk-script-accept-sector-size-ignore-unknown-he.patch
+++ /dev/null
@@ -1,137 +0,0 @@
-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/meta/recipes-core/util-linux/util-linux/0001-login-utils-include-libgen.h-for-basename-API.patch b/meta/recipes-core/util-linux/util-linux/0001-login-utils-include-libgen.h-for-basename-API.patch
new file mode 100644
index 0000000000..6258710e1e
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/0001-login-utils-include-libgen.h-for-basename-API.patch
@@ -0,0 +1,60 @@
+From d44e3ad1f6f8b5c1b3098bb7d537943a4c21d22f Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 3 Dec 2023 19:59:46 -0800
+Subject: [PATCH] login-utils: include libgen.h for basename API
+
+musl has removed the non-prototype declaration of basename from string.h [1] which now results in build errors with clang-17+ compiler
+
+include libgen.h for using the posix declaration of the funciton.
+
+Fixes
+
+../util-linux-2.39.2/login-utils/su-common.c:847:20: error: call to undeclared function 'basename'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
+ 847 | shell_basename = basename(shell);
+ | ^
+
+[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7
+
+Upstream-Status: Submitted [https://github.com/util-linux/util-linux/pull/2615]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+---
+ login-utils/su-common.c | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/login-utils/su-common.c b/login-utils/su-common.c
+index b674920..3297c78 100644
+--- a/login-utils/su-common.c
++++ b/login-utils/su-common.c
+@@ -26,6 +26,7 @@
+ #include <sys/types.h>
+ #include <pwd.h>
+ #include <grp.h>
++#include <libgen.h>
+ #include <security/pam_appl.h>
+ #ifdef HAVE_SECURITY_PAM_MISC_H
+ # include <security/pam_misc.h>
+@@ -840,17 +841,20 @@ static void run_shell(
+ su->simulate_login ? " login" : "",
+ su->fast_startup ? " fast-start" : ""));
+
++ char* tmp = xstrdup(shell);
+ if (su->simulate_login) {
+ char *arg0;
+ char *shell_basename;
+
+- shell_basename = basename(shell);
++ shell_basename = basename(tmp);
+ arg0 = xmalloc(strlen(shell_basename) + 2);
+ arg0[0] = '-';
+ strcpy(arg0 + 1, shell_basename);
+ args[0] = arg0;
+- } else
+- args[0] = basename(shell);
++ } else {
++ args[0] = basename(tmp);
++ }
++ free(tmp);
+
+ if (su->fast_startup)
+ args[argno++] = "-f";
diff --git a/meta/recipes-core/util-linux/util-linux/avoid_parallel_tests.patch b/meta/recipes-core/util-linux/util-linux/avoid_parallel_tests.patch
index 748b6ef096..85ad7a5575 100644
--- a/meta/recipes-core/util-linux/util-linux/avoid_parallel_tests.patch
+++ b/meta/recipes-core/util-linux/util-linux/avoid_parallel_tests.patch
@@ -1,20 +1,29 @@
+From 0b05e4695a0616badef71dfa459a00ef6ff1b521 Mon Sep 17 00:00:00 2001
+From: Tudor Florea <tudor.florea@enea.com>
+Date: Mon, 14 Jun 2021 14:00:31 +0200
+Subject: [PATCH] util-linux: Add ptest
+
Ptest needs buildtest-TESTS and runtest-TESTS targets.
serial-tests is required to generate those targets.
-Revert run.sh script accordingly to serialize running tests
+Revert run.sh script accordingly to serialize running tests
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
-Upstream-Status: Inappropriate
+Upstream-Status: Inappropriate
+
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
-Index: util-linux-2.32/configure.ac
-===================================================================
---- util-linux-2.32.orig/configure.ac
-+++ util-linux-2.32/configure.ac
+diff --git a/configure.ac b/configure.ac
+index 890212f..870e817 100644
+--- a/configure.ac
++++ b/configure.ac
@@ -11,7 +11,7 @@ AC_CONFIG_MACRO_DIR([m4])
dnl AC_USE_SYSTEM_EXTENSIONS must be called before any macros that run
- dnl the compiler (like AC_PROG_LIBTOOL) to avoid autoconf errors.
+ dnl the compiler (like LT_INIT) to avoid autoconf errors.
AC_USE_SYSTEM_EXTENSIONS
--AM_INIT_AUTOMAKE([-Wall foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects])
-+AM_INIT_AUTOMAKE([-Wall foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects serial-tests])
+-AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects])
++AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects serial-tests])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
[AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
diff --git a/meta/recipes-core/util-linux/util-linux/configure-sbindir.patch b/meta/recipes-core/util-linux/util-linux/configure-sbindir.patch
index e475289f65..75adeca188 100644
--- a/meta/recipes-core/util-linux/util-linux/configure-sbindir.patch
+++ b/meta/recipes-core/util-linux/util-linux/configure-sbindir.patch
@@ -1,3 +1,8 @@
+From c79222a9a5e3425c55e150edc0b7ac59c573aa2f Mon Sep 17 00:00:00 2001
+From: Phil Blundell <pb@pbcl.net>
+Date: Mon, 24 Sep 2012 07:24:51 +0100
+Subject: [PATCH] util-linux: Ensure that ${sbindir} is respected
+
util-linux: take ${sbindir} from the environment if it is set there
fix the test, the [ ] syntax was getting eaten by autoconf
@@ -5,11 +10,15 @@ Signed-off-by: Phil Blundell <pb@pbcl.net>
Signed-off-by: Saul Wold <sgw@linux.intel.com
Upstream-Status: Inappropriate [configuration]
-Index: util-linux-2.31/configure.ac
-===================================================================
---- util-linux-2.31.orig/configure.ac
-+++ util-linux-2.31/configure.ac
-@@ -89,7 +89,10 @@ AC_SUBST([runstatedir])
+---
+ configure.ac | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 36c24b4..890212f 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -102,7 +102,10 @@ AC_SUBST([runstatedir])
usrbin_execdir='${exec_prefix}/bin'
AC_SUBST([usrbin_execdir])
diff --git a/meta/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch b/meta/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch
index 417ca1d98f..815ae9c915 100644
--- a/meta/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch
+++ b/meta/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch
@@ -1,4 +1,7 @@
-Display testname for subtest
+From fc5de1de898fd1a372a2fd2fa493dc57323a029d Mon Sep 17 00:00:00 2001
+From: Tudor Florea <tudor.florea@enea.com>
+Date: Thu, 3 Dec 2015 04:08:00 +0100
+Subject: [PATCH] Display testname for subtest
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Upstream-Status: Pending
@@ -8,10 +11,10 @@ Upstream-Status: Pending
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/functions.sh b/tests/functions.sh
-index 5246605..b24dc15 100644
+index 5a562a3..098145e 100644
--- a/tests/functions.sh
+++ b/tests/functions.sh
-@@ -320,7 +320,7 @@ function ts_init_subtest {
+@@ -437,7 +437,7 @@ function ts_init_subtest {
if [ "$TS_PARSABLE" != "yes" ]; then
[ $TS_NSUBTESTS -eq 1 ] && echo
@@ -20,6 +23,3 @@ index 5246605..b24dc15 100644
fi
}
---
-2.8.3
-
diff --git a/meta/recipes-core/util-linux/util-linux/fcntl-lock.c b/meta/recipes-core/util-linux/util-linux/fcntl-lock.c
new file mode 100644
index 0000000000..966d8c5ecb
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/fcntl-lock.c
@@ -0,0 +1,332 @@
+// From https://github.com/magnumripper/fcntl-lock
+// SPDX-License-Identifier: MIT
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2003-2005 H. Peter Anvin - All Rights Reserved
+ * Copyright 2015 magnum (fcntl version)
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall
+ * be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * ----------------------------------------------------------------------- */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <signal.h>
+#include <ctype.h>
+#include <string.h>
+#include <paths.h>
+#include <sysexits.h>
+#include <sys/types.h>
+#include <sys/file.h>
+#include <sys/time.h>
+#include <sys/wait.h>
+
+#define PACKAGE_STRING "magnum"
+#define _(x) (x)
+
+static const struct option long_options[] = {
+ { "shared", 0, NULL, 's' },
+ { "exclusive", 0, NULL, 'x' },
+ { "unlock", 0, NULL, 'u' },
+ { "nonblocking", 0, NULL, 'n' },
+ { "nb", 0, NULL, 'n' },
+ { "timeout", 1, NULL, 'w' },
+ { "wait", 1, NULL, 'w' },
+ { "close", 0, NULL, 'o' },
+ { "help", 0, NULL, 'h' },
+ { "version", 0, NULL, 'V' },
+ { 0, 0, 0, 0 }
+};
+
+const char *program;
+
+static void usage(int ex)
+{
+ fputs("fcntl-lock (" PACKAGE_STRING ")\n", stderr);
+ fprintf(stderr,
+ _("Usage: %1$s [-sxun][-w #] fd#\n"
+ " %1$s [-sxon][-w #] file [-c] command...\n"
+ " %1$s [-sxon][-w #] directory [-c] command...\n"
+ " -s --shared Get a shared lock\n"
+ " -x --exclusive Get an exclusive lock\n"
+ " -u --unlock Remove a lock\n"
+ " -n --nonblock Fail rather than wait\n"
+ " -w --timeout Wait for a limited amount of time\n"
+ " -o --close Close file descriptor before running command\n"
+ " -c --command Run a single command string through the shell\n"
+ " -h --help Display this text\n"
+ " -V --version Display version\n"),
+ program);
+ exit(ex);
+}
+
+
+static sig_atomic_t timeout_expired = 0;
+
+static void timeout_handler(int sig)
+{
+ (void)sig;
+
+ timeout_expired = 1;
+}
+
+
+static char * strtotimeval(const char *str, struct timeval *tv)
+{
+ char *s;
+ long fs; /* Fractional seconds */
+ int i;
+
+ tv->tv_sec = strtol(str, &s, 10);
+ fs = 0;
+
+ if ( *s == '.' ) {
+ s++;
+
+ for ( i = 0 ; i < 6 ; i++ ) {
+ if ( !isdigit(*s) )
+ break;
+
+ fs *= 10;
+ fs += *s++ - '0';
+ }
+
+ for ( ; i < 6; i++ )
+ fs *= 10;
+
+ while ( isdigit(*s) )
+ s++;
+ }
+
+ tv->tv_usec = fs;
+ return s;
+}
+
+int main(int argc, char *argv[])
+{
+ struct itimerval timeout, old_timer;
+ int have_timeout = 0;
+ int type = F_WRLCK;
+ int block = F_SETLKW;
+ int fd = -1;
+ int opt, ix;
+ int do_close = 0;
+ int err;
+ int status;
+ char *eon;
+ char **cmd_argv = NULL, *sh_c_argv[4];
+ struct flock lock;
+ const char *filename = NULL;
+ struct sigaction sa, old_sa;
+
+ program = argv[0];
+
+ if ( argc < 2 )
+ usage(EX_USAGE);
+
+ memset(&timeout, 0, sizeof timeout);
+
+ optopt = 0;
+ while ( (opt = getopt_long(argc, argv, "+sexnouw:hV?", long_options, &ix)) != EOF ) {
+ switch(opt) {
+ case 's':
+ type = F_RDLCK;
+ break;
+ case 'e':
+ case 'x':
+ type = F_WRLCK;
+ break;
+ case 'u':
+ type = F_UNLCK;
+ break;
+ case 'o':
+ do_close = 1;
+ break;
+ case 'n':
+ block = F_SETLK;
+ break;
+ case 'w':
+ have_timeout = 1;
+ eon = strtotimeval(optarg, &timeout.it_value);
+ if ( *eon )
+ usage(EX_USAGE);
+ break;
+ case 'V':
+ printf("fcntl-lock (%s)\n", PACKAGE_STRING);
+ exit(0);
+ default:
+ /* optopt will be set if this was an unrecognized option, i.e. *not* 'h' or '?' */
+ usage(optopt ? EX_USAGE : 0);
+ break;
+ }
+ }
+
+ if ( argc > optind+1 ) {
+ /* Run command */
+
+ if ( !strcmp(argv[optind+1], "-c") ||
+ !strcmp(argv[optind+1], "--command") ) {
+
+ if ( argc != optind+3 ) {
+ fprintf(stderr, _("%s: %s requires exactly one command argument\n"),
+ program, argv[optind+1]);
+ exit(EX_USAGE);
+ }
+
+ cmd_argv = sh_c_argv;
+
+ cmd_argv[0] = getenv("SHELL");
+ if ( !cmd_argv[0] || !*cmd_argv[0] )
+ cmd_argv[0] = _PATH_BSHELL;
+
+ cmd_argv[1] = "-c";
+ cmd_argv[2] = argv[optind+2];
+ cmd_argv[3] = 0;
+ } else {
+ cmd_argv = &argv[optind+1];
+ }
+
+ filename = argv[optind];
+ fd = open(filename, O_RDWR|O_NOCTTY|O_CREAT, 0666);
+ /* Linux doesn't like O_CREAT on a directory, even though it should be a
+ no-op */
+ if (fd < 0 && errno == EISDIR)
+ fd = open(filename, O_RDONLY|O_NOCTTY);
+
+ if ( fd < 0 ) {
+ err = errno;
+ fprintf(stderr, _("%s: cannot open lock file %s: %s\n"),
+ program, argv[optind], strerror(err));
+ exit((err == ENOMEM||err == EMFILE||err == ENFILE) ? EX_OSERR :
+ (err == EROFS||err == ENOSPC) ? EX_CANTCREAT :
+ EX_NOINPUT);
+ }
+
+ } else if (optind < argc) {
+ /* Use provided file descriptor */
+
+ fd = (int)strtol(argv[optind], &eon, 10);
+ if ( *eon || !argv[optind] ) {
+ fprintf(stderr, _("%s: bad number: %s\n"), program, argv[optind]);
+ exit(EX_USAGE);
+ }
+
+ } else {
+ /* Bad options */
+
+ fprintf(stderr, _("%s: requires file descriptor, file or directory\n"),
+ program);
+ exit(EX_USAGE);
+ }
+
+
+ if ( have_timeout ) {
+ if ( timeout.it_value.tv_sec == 0 &&
+ timeout.it_value.tv_usec == 0 ) {
+ /* -w 0 is equivalent to -n; this has to be special-cased
+ because setting an itimer to zero means disabled! */
+
+ have_timeout = 0;
+ block = F_SETLK;
+ } else {
+ memset(&sa, 0, sizeof sa);
+
+ sa.sa_handler = timeout_handler;
+ sa.sa_flags = SA_RESETHAND;
+ sigaction(SIGALRM, &sa, &old_sa);
+
+ setitimer(ITIMER_REAL, &timeout, &old_timer);
+ }
+ }
+
+ memset(&lock, 0, sizeof(lock));
+ lock.l_type = type;
+ while ( fcntl(fd, block, &lock) ) {
+ switch( (err = errno) ) {
+ case EAGAIN: /* -n option set and failed to lock */
+ case EACCES: /* -n option set and failed to lock */
+ exit(1);
+ case EINTR: /* Signal received */
+ if ( timeout_expired )
+ exit(1); /* -w option set and failed to lock */
+ continue; /* otherwise try again */
+ default: /* Other errors */
+ if ( filename )
+ fprintf(stderr, "%s: %s: %s\n", program, filename, strerror(err));
+ else
+ fprintf(stderr, "%s: %d: %s\n", program, fd, strerror(err));
+ exit((err == ENOLCK||err == ENOMEM) ? EX_OSERR : EX_DATAERR);
+ }
+ }
+
+ if ( have_timeout ) {
+ setitimer(ITIMER_REAL, &old_timer, NULL); /* Cancel itimer */
+ sigaction(SIGALRM, &old_sa, NULL); /* Cancel signal handler */
+ }
+
+ status = 0;
+
+ if ( cmd_argv ) {
+ pid_t w, f;
+
+ /* Clear any inherited settings */
+ signal(SIGCHLD, SIG_DFL);
+ f = fork();
+
+ if ( f < 0 ) {
+ err = errno;
+ fprintf(stderr, _("%s: fork failed: %s\n"), program, strerror(err));
+ exit(EX_OSERR);
+ } else if ( f == 0 ) {
+ if ( do_close )
+ close(fd);
+ err = errno;
+ execvp(cmd_argv[0], cmd_argv);
+ /* execvp() failed */
+ fprintf(stderr, "%s: %s: %s\n", program, cmd_argv[0], strerror(err));
+ _exit((err == ENOMEM) ? EX_OSERR: EX_UNAVAILABLE);
+ } else {
+ do {
+ w = waitpid(f, &status, 0);
+ if (w == -1 && errno != EINTR)
+ break;
+ } while ( w != f );
+
+ if (w == -1) {
+ err = errno;
+ status = EXIT_FAILURE;
+ fprintf(stderr, "%s: waitpid failed: %s\n", program, strerror(err));
+ } else if ( WIFEXITED(status) )
+ status = WEXITSTATUS(status);
+ else if ( WIFSIGNALED(status) )
+ status = WTERMSIG(status) + 128;
+ else
+ status = EX_OSERR; /* WTF? */
+ }
+ }
+
+ return status;
+}
diff --git a/meta/recipes-core/util-linux/util-linux/mit-license.patch b/meta/recipes-core/util-linux/util-linux/mit-license.patch
new file mode 100644
index 0000000000..afbec98f18
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/mit-license.patch
@@ -0,0 +1,45 @@
+From 5b8fab1584017d9d9be008c23b90128bba41a7b5 Mon Sep 17 00:00:00 2001
+From: Richard Purdie <richard.purdie@linuxfoundation.org>
+Date: Thu, 28 Mar 2024 12:16:57 +0000
+Subject: [PATCH] README.licensing/flock: Add MIT license mention
+
+Looking at the license text, flock.c is under the MIT license (see
+https://spdx.org/licenses/MIT).
+
+Add an SPDX license identifier header and add to the list of licenses the
+source so everything is correctly listed/identified.
+
+Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
+
+Upstream-Status: Submitted [https://github.com/util-linux/util-linux/pull/2870]
+
+---
+ README.licensing | 2 ++
+ sys-utils/flock.c | 4 +++-
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/README.licensing b/README.licensing
+index 4454f8392a..535ad34813 100644
+--- a/README.licensing
++++ b/README.licensing
+@@ -12,6 +12,8 @@ There is code under:
+
+ * LGPL-2.1-or-later - GNU Lesser General Public License 2.1 or any later version
+
++ * MIT - MIT License
++
+ * BSD-2-Clause - Simplified BSD License
+
+ * BSD-3-Clause - BSD 3-Clause "New" or "Revised" License
+diff --git a/sys-utils/flock.c b/sys-utils/flock.c
+index fed29d7270..7d878ff810 100644
+--- a/sys-utils/flock.c
++++ b/sys-utils/flock.c
+@@ -1,4 +1,6 @@
+-/* Copyright 2003-2005 H. Peter Anvin - All Rights Reserved
++/* SPDX-License-Identifier: MIT
++ *
++ * Copyright 2003-2005 H. Peter Anvin - All Rights Reserved
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
diff --git a/meta/recipes-core/util-linux/util-linux/ptest.patch b/meta/recipes-core/util-linux/util-linux/ptest.patch
index 0537f7d856..6221de7182 100644
--- a/meta/recipes-core/util-linux/util-linux/ptest.patch
+++ b/meta/recipes-core/util-linux/util-linux/ptest.patch
@@ -1,23 +1,24 @@
-Define TESTS variable
+From d0a69ce80c579cbb7627a2f20e8b92e006a8d8ad Mon Sep 17 00:00:00 2001
+From: Tudor Florea <tudor.florea@enea.com>
+Date: Thu, 3 Dec 2015 04:08:00 +0100
+Subject: [PATCH] Define TESTS variable
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Upstream-Status: Pending
+
---
Makefile.am | 1 +
1 file changed, 1 insertion(+)
diff --git a/Makefile.am b/Makefile.am
-index bbaccb1..7d5a6bb 100644
+index effbb02..7d2bd1e 100644
--- a/Makefile.am
+++ b/Makefile.am
-@@ -48,6 +48,7 @@ systemdsystemunit_DATA =
+@@ -57,6 +57,7 @@ systemdsystemunit_DATA =
dist_bashcompletion_DATA =
check_PROGRAMS =
dist_check_SCRIPTS =
+TESTS = $(check_PROGRAMS)
PATHFILES =
-
---
-2.8.3
-
+ ADOCFILES_COMMON =
diff --git a/meta/recipes-core/util-linux/util-linux/run-ptest b/meta/recipes-core/util-linux/util-linux/run-ptest
index e135ee583b..7b6b1d1dc2 100644
--- a/meta/recipes-core/util-linux/util-linux/run-ptest
+++ b/meta/recipes-core/util-linux/util-linux/run-ptest
@@ -13,31 +13,23 @@ 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)
-
-
-echo
-echo "-------------------- util-linux regression tests --------------------"
-echo
-echo " For development purpose only. "
-echo " Don't execute on production system! "
-echo
-
-res=0
-count=0
-for ts in $comps;
-do
- $ts | sed -u '{
+# losetup tests will be skipped and/or fail otherwise
+modprobe loop
+
+# required for mount/fallback test to pass
+# systemd does this by default, but ptest images do not use it
+# see https://man7.org/linux/man-pages/man7/mount_namespaces.7.html
+# for a long description of mount namespaces in Linux
+mount --make-shared /
+
+# lsfd/option-inet has races in the test script:
+# https://github.com/util-linux/util-linux/issues/2399
+./tests/run.sh --use-system-commands --parsable --show-diff --exclude=lsfd/option-inet | 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
-