diff options
Diffstat (limited to 'meta/recipes-core/util-linux')
12 files changed, 610 insertions, 188 deletions
diff --git a/meta/recipes-core/util-linux/util-linux-libuuid_2.36.2.bb b/meta/recipes-core/util-linux/util-linux-libuuid_2.39.3.bb index 9612c491cd..ec04c1d384 100644 --- a/meta/recipes-core/util-linux/util-linux-libuuid_2.36.2.bb +++ b/meta/recipes-core/util-linux/util-linux-libuuid_2.39.3.bb @@ -6,10 +6,13 @@ require util-linux.inc inherit autotools gettext pkgconfig S = "${WORKDIR}/util-linux-${PV}" + +EXTRA_AUTORECONF += "--exclude=gtkdocize" EXTRA_OECONF += "--disable-all-programs --enable-libuuid" + LICENSE = "BSD-3-Clause" -do_install_append() { +do_install:append() { rm -rf ${D}${datadir} ${D}${bindir} ${D}${base_bindir} ${D}${sbindir} ${D}${base_sbindir} ${D}${exec_prefix}/sbin } diff --git a/meta/recipes-core/util-linux/util-linux.inc b/meta/recipes-core/util-linux/util-linux.inc index cbf6102ee0..d506783f9a 100644 --- a/meta/recipes-core/util-linux/util-linux.inc +++ b/meta/recipes-core/util-linux/util-linux.inc @@ -6,13 +6,15 @@ disk partitioning, kernel message management, filesystem creation, and system lo SECTION = "base" -LICENSE = "GPLv2+ & LGPLv2.1+ & BSD-3-Clause & BSD-4-Clause" -LICENSE_${PN}-libblkid = "LGPLv2.1+" -LICENSE_${PN}-libfdisk = "LGPLv2.1+" -LICENSE_${PN}-libmount = "LGPLv2.1+" -LICENSE_${PN}-libsmartcols = "LGPLv2.1+" +LICENSE = "GPL-1.0-or-later & GPL-2.0-or-later & LGPL-2.1-or-later & BSD-2-Clause & BSD-3-Clause & BSD-4-Clause & MIT" +LICENSE:${PN}-fcntl-lock = "MIT" +LICENSE:${PN}-fdisk = "GPL-1.0-or-later" +LICENSE:${PN}-libblkid = "LGPL-2.1-or-later" +LICENSE:${PN}-libfdisk = "LGPL-2.1-or-later" +LICENSE:${PN}-libmount = "LGPL-2.1-or-later" +LICENSE:${PN}-libsmartcols = "LGPL-2.1-or-later" -LIC_FILES_CHKSUM = "file://README.licensing;md5=0fd5c050c6187d2bf0a4492b7f4e33da \ +LIC_FILES_CHKSUM = "file://README.licensing;md5=cc80239f106687ab39ef0271ff5cf4ba \ file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ file://Documentation/licenses/COPYING.GPL-2.0-or-later;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ file://Documentation/licenses/COPYING.LGPL-2.1-or-later;md5=4fbd65380cdd255951079008b364516c \ @@ -23,12 +25,12 @@ LIC_FILES_CHKSUM = "file://README.licensing;md5=0fd5c050c6187d2bf0a4492b7f4e33da file://libblkid/COPYING;md5=693bcbbe16d3a4a4b37bc906bc01cc04 \ file://libfdisk/COPYING;md5=693bcbbe16d3a4a4b37bc906bc01cc04 \ file://libsmartcols/COPYING;md5=693bcbbe16d3a4a4b37bc906bc01cc04 \ -" + " -FILESEXTRAPATHS_prepend := "${THISDIR}/util-linux:" +FILESEXTRAPATHS:prepend := "${THISDIR}/util-linux:" MAJOR_VERSION = "${@'.'.join(d.getVar('PV').split('.')[0:2])}" -BPN = "util-linux" -SRC_URI = "${KERNELORG_MIRROR}/linux/utils/${BPN}/v${MAJOR_VERSION}/${BP}.tar.xz \ +SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-linux-${PV}.tar.xz \ + file://mit-license.patch \ file://configure-sbindir.patch \ file://runuser.pamd \ file://runuser-l.pamd \ @@ -36,6 +38,8 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/${BPN}/v${MAJOR_VERSION}/${BP}.tar.xz file://run-ptest \ file://display_testname_for_subtest.patch \ file://avoid_parallel_tests.patch \ - file://Automake-use-EXTRA_LTLIBRARIES-instead-of-noinst_LTL.patch \ + file://0001-login-utils-include-libgen.h-for-basename-API.patch \ + file://fcntl-lock.c \ " -SRC_URI[sha256sum] = "f7516ba9d8689343594356f0e5e1a5f0da34adfbc89023437735872bb5024c5f" + +SRC_URI[sha256sum] = "7b6605e48d1a49f43cc4b4cfc59f313d0dd5402fa40b96810bd572e167dfed0f" 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/Automake-use-EXTRA_LTLIBRARIES-instead-of-noinst_LTL.patch b/meta/recipes-core/util-linux/util-linux/Automake-use-EXTRA_LTLIBRARIES-instead-of-noinst_LTL.patch deleted file mode 100644 index 272518914e..0000000000 --- a/meta/recipes-core/util-linux/util-linux/Automake-use-EXTRA_LTLIBRARIES-instead-of-noinst_LTL.patch +++ /dev/null @@ -1,49 +0,0 @@ -Author: Luca Boccassi <luca.boccassi@microsoft.com> -Description: Automake: use EXTRA_LTLIBRARIES instead of noinst_LTLIBRARIES - noinst_LTLIBRARIES causes the libraries to be always built - unconditionally. EXTRA_LTLIBRARIES causes them to be built - only if other build target needs them. - In other words, avoid building libcommon.a and libtcolors.a - unless they are needed by another library/executable and - save some build time. -Upstream-Status: backport, commit:c65953d72bbc7412f32e566d9fa6e780d84f0696 ---- a/Makefile.am -+++ b/Makefile.am -@@ -39,7 +39,7 @@ bashcompletiondir = @bashcompletiondir@ - - dist_noinst_HEADERS = - noinst_PROGRAMS = --noinst_LTLIBRARIES = -+EXTRA_LTLIBRARIES = - usrbin_exec_PROGRAMS = - usrsbin_exec_PROGRAMS = - dist_man_MANS = -@@ -169,7 +169,7 @@ else - edit_cmd += -e 's|@vendordir[@]||g' - endif - --CLEANFILES += $(PATHFILES) -+CLEANFILES += $(PATHFILES) $(EXTRA_LTLIBRARIES) - EXTRA_DIST += $(PATHFILES:=.in) - - $(PATHFILES): Makefile ---- a/lib/Makemodule.am -+++ b/lib/Makemodule.am -@@ -9,7 +9,7 @@ - # Note that you need "make install-strip" (or proper rpm / Debian build) - # to generate binaries with only relevant stuff. - # --noinst_LTLIBRARIES += libcommon.la -+EXTRA_LTLIBRARIES += libcommon.la - libcommon_la_CFLAGS = $(AM_CFLAGS) - libcommon_la_SOURCES = \ - lib/blkdev.c \ -@@ -59,7 +59,7 @@ libcommon_la_SOURCES += lib/sysfs.c - endif - endif - --noinst_LTLIBRARIES += libtcolors.la -+EXTRA_LTLIBRARIES += libtcolors.la - libtcolors_la_CFLAGS = $(AM_CFLAGS) - libtcolors_la_SOURCES = lib/colors.c lib/color-names.c include/colors.h include/color-names.h - libtcolors_la_LIBADD = 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 - diff --git a/meta/recipes-core/util-linux/util-linux_2.36.2.bb b/meta/recipes-core/util-linux/util-linux_2.39.3.bb index c79cf782d1..2cd7750afc 100644 --- a/meta/recipes-core/util-linux/util-linux_2.36.2.bb +++ b/meta/recipes-core/util-linux/util-linux_2.39.3.bb @@ -1,7 +1,6 @@ require util-linux.inc -#gtk-doc is not enabled as it requires xmlto which requires util-linux -inherit autotools gettext manpages pkgconfig systemd update-alternatives python3-dir bash-completion ptest +inherit autotools gettext manpages pkgconfig systemd update-alternatives python3-dir bash-completion ptest gtk-doc DEPENDS = "libcap-ng ncurses virtual/crypt zlib util-linux-libuuid" PACKAGES =+ "${PN}-swaponoff" @@ -10,12 +9,12 @@ PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'pylibmount', '${PN}-pylibmou python util_linux_binpackages () { def pkg_hook(f, pkg, file_regex, output_pattern, modulename): pn = d.getVar('PN') - d.appendVar('RRECOMMENDS_%s' % pn, ' %s' % pkg) + d.appendVar('RRECOMMENDS:%s' % pn, ' %s' % pkg) - if d.getVar('ALTERNATIVE_' + pkg): + if d.getVar('ALTERNATIVE:' + pkg): return if d.getVarFlag('ALTERNATIVE_LINK_NAME', modulename): - d.setVar('ALTERNATIVE_' + pkg, modulename) + d.setVar('ALTERNATIVE:' + pkg, modulename) bindirs = sorted(list(set(d.expand("${base_sbindir} ${base_bindir} ${sbindir} ${bindir}").split()))) for dir in bindirs: @@ -37,13 +36,14 @@ python util_linux_binpackages () { continue pkg = os.path.basename(os.readlink(file)) - extras[pkg] = extras.get(pkg, '') + ' ' + file.replace(dvar, '', 1) + extras.setdefault(pkg, []) + extras[pkg].append(file.replace(dvar, '', 1)) pn = d.getVar('PN') for pkg, links in extras.items(): - of = d.getVar('FILES_' + pn + '-' + pkg) - links = of + links - d.setVar('FILES_' + pn + '-' + pkg, links) + of = d.getVar('FILES:' + pn + '-' + pkg) + links = of + " " + " ".join(sorted(links)) + d.setVar('FILES:' + pn + '-' + pkg, links) } # we must execute before update-alternatives PACKAGE_PREPROCESS_FUNCS @@ -61,19 +61,18 @@ PACKAGESPLITFUNCS =+ "util_linux_libpackages" PACKAGES_DYNAMIC = "^${PN}-.*" -CACHED_CONFIGUREVARS += "scanf_cv_alloc_modifier=ms" UTIL_LINUX_LIBDIR = "${libdir}" -UTIL_LINUX_LIBDIR_class-target = "${base_libdir}" +UTIL_LINUX_LIBDIR:class-target = "${base_libdir}" EXTRA_OECONF = "\ --enable-libuuid --enable-libblkid \ \ --enable-fsck --enable-kill --enable-last --enable-mesg \ - --enable-mount --enable-partx --enable-raw --enable-rfkill \ + --enable-mount --enable-partx --enable-rfkill \ --enable-unshare --enable-write \ \ - --disable-bfs --disable-chfn-chsh --disable-login \ + --disable-bfs --disable-login \ --disable-makeinstall-chown --disable-minix --disable-newgrp \ - --disable-use-tty-group --disable-vipw \ + --disable-use-tty-group --disable-vipw --disable-raw \ \ --without-udev \ \ @@ -81,17 +80,17 @@ EXTRA_OECONF = "\ --libdir='${UTIL_LINUX_LIBDIR}' \ " -EXTRA_OECONF_append_class-target = " --enable-setpriv" -EXTRA_OECONF_append_class-native = " --without-cap-ng --disable-setpriv" -EXTRA_OECONF_append_class-nativesdk = " --without-cap-ng --disable-setpriv" -EXTRA_OECONF_append = " --disable-hwclock-gplv3" +EXTRA_OECONF:append:class-target = " --enable-setpriv" +EXTRA_OECONF:append:class-native = " --without-cap-ng --disable-setpriv" +EXTRA_OECONF:append:class-nativesdk = " --without-cap-ng --disable-setpriv" +EXTRA_OECONF:append = " --disable-hwclock-gplv3" # enable pcre2 for native/nativesdk to match host distros # this helps to keep same expectations when using the SDK or # build host versions during development # PACKAGECONFIG ?= "pcre2" -PACKAGECONFIG_class-target ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" +PACKAGECONFIG:class-target ?= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'chfn-chsh pam', '', d)}" # inherit manpages requires this to be present, however util-linux does not have # configuration options, and installs manpages always PACKAGECONFIG[manpages] = "" @@ -105,46 +104,53 @@ PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline" # PCRE support in hardlink PACKAGECONFIG[pcre2] = ",,libpcre2" PACKAGECONFIG[cryptsetup] = "--with-cryptsetup,--without-cryptsetup,cryptsetup" +PACKAGECONFIG[chfn-chsh] = "--enable-chfn-chsh,--disable-chfn-chsh," +PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux" EXTRA_OEMAKE = "ARCH=${TARGET_ARCH} CPU= CPUOPT= 'OPT=${CFLAGS}'" -ALLOW_EMPTY_${PN} = "1" -FILES_${PN} = "" -FILES_${PN}-doc += "${datadir}/getopt/getopt-*.*" -FILES_${PN}-dev += "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.la" -FILES_${PN}-mount = "${sysconfdir}/default/mountall" -FILES_${PN}-runuser = "${sysconfdir}/pam.d/runuser*" -FILES_${PN}-su = "${sysconfdir}/pam.d/su-l" -CONFFILES_${PN}-su = "${sysconfdir}/pam.d/su-l" -FILES_${PN}-pylibmount = "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.so \ +ALLOW_EMPTY:${PN} = "1" +FILES:${PN} = "" +FILES:${PN}-doc += "${datadir}/getopt/getopt-*.*" +FILES:${PN}-dev += "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.la" +FILES:${PN}-mount = "${sysconfdir}/default/mountall" +FILES:${PN}-runuser = "${sysconfdir}/pam.d/runuser*" +FILES:${PN}-su = "${sysconfdir}/pam.d/su-l" +CONFFILES:${PN}-su = "${sysconfdir}/pam.d/su-l" +FILES:${PN}-pylibmount = "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.so \ ${PYTHON_SITEPACKAGES_DIR}/libmount/__init__.* \ ${PYTHON_SITEPACKAGES_DIR}/libmount/__pycache__/*" # Util-linux' blkid replaces the e2fsprogs one -RCONFLICTS_${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid" -RREPLACES_${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid" +RCONFLICTS:${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid" +RREPLACES:${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid" -RRECOMMENDS_${PN}_class-native = "" -RRECOMMENDS_${PN}_class-nativesdk = "" -RDEPENDS_${PN}_class-native = "" -RDEPENDS_${PN}_class-nativesdk = "" +RRECOMMENDS:${PN}:class-native = "" +RRECOMMENDS:${PN}:class-nativesdk = "" +RDEPENDS:${PN}:class-native = "" +RDEPENDS:${PN}:class-nativesdk = "" -RDEPENDS_${PN} += " util-linux-libuuid" -RDEPENDS_${PN}-dev += " util-linux-libuuid-dev" +RDEPENDS:${PN} += " util-linux-libuuid" +RDEPENDS:${PN}-dev += " util-linux-libuuid-dev" -RPROVIDES_${PN}-dev = "${PN}-libblkid-dev ${PN}-libmount-dev" +RPROVIDES:${PN}-dev = "${PN}-libblkid-dev ${PN}-libmount-dev" -RDEPENDS_${PN}-bash-completion += "${PN}-lsblk" -RDEPENDS_${PN}-ptest += "bash bc btrfs-tools coreutils e2fsprogs grep iproute2 kmod mdadm procps sed socat which xz" -RRECOMMENDS_${PN}-ptest += "kernel-module-scsi-debug" -RDEPENDS_${PN}-swaponoff = "${PN}-swapon ${PN}-swapoff" -ALLOW_EMPTY_${PN}-swaponoff = "1" +RDEPENDS:${PN}-bash-completion += "${PN}-lsblk" +RDEPENDS:${PN}-ptest += "bash bc btrfs-tools coreutils e2fsprogs findutils grep iproute2 kmod procps sed socat which xz" +RRECOMMENDS:${PN}-ptest += "kernel-module-scsi-debug kernel-module-sd-mod kernel-module-loop kernel-module-algif-hash" +RDEPENDS:${PN}-swaponoff = "${PN}-swapon ${PN}-swapoff" +ALLOW_EMPTY:${PN}-swaponoff = "1" #SYSTEMD_PACKAGES = "${PN}-uuidd ${PN}-fstrim" -SYSTEMD_SERVICE_${PN}-uuidd = "uuidd.socket uuidd.service" -SYSTEMD_AUTO_ENABLE_${PN}-uuidd = "disable" -SYSTEMD_SERVICE_${PN}-fstrim = "fstrim.timer fstrim.service" -SYSTEMD_AUTO_ENABLE_${PN}-fstrim = "disable" +SYSTEMD_SERVICE:${PN}-uuidd = "uuidd.socket uuidd.service" +SYSTEMD_AUTO_ENABLE:${PN}-uuidd = "disable" +SYSTEMD_SERVICE:${PN}-fstrim = "fstrim.timer fstrim.service" +SYSTEMD_AUTO_ENABLE:${PN}-fstrim = "disable" + +do_compile:append () { + cp ${UNPACKDIR}/fcntl-lock.c ${S}/fcntl-lock.c + ${CC} ${CFLAGS} ${LDFLAGS} ${S}/fcntl-lock.c -o ${B}/fcntl-lock +} do_install () { # with ccache the timestamps on compiled files may @@ -181,13 +187,15 @@ do_install () { echo 'MOUNTALL="-t nonfs,nosmbfs,noncpfs"' > ${D}${sysconfdir}/default/mountall rm -f ${D}${bindir}/chkdupexe + + install -m 0755 ${B}/fcntl-lock ${D}${bindir} } -do_install_append_class-target () { +do_install:append:class-target () { if [ "${@bb.utils.filter('PACKAGECONFIG', 'pam', d)}" ]; then install -d ${D}${sysconfdir}/pam.d - install -m 0644 ${WORKDIR}/runuser.pamd ${D}${sysconfdir}/pam.d/runuser - install -m 0644 ${WORKDIR}/runuser-l.pamd ${D}${sysconfdir}/pam.d/runuser-l + install -m 0644 ${UNPACKDIR}/runuser.pamd ${D}${sysconfdir}/pam.d/runuser + install -m 0644 ${UNPACKDIR}/runuser-l.pamd ${D}${sysconfdir}/pam.d/runuser-l # Required for "su -" aka "su --login" because # otherwise it uses "other", which has "auth pam_deny.so" # and thus prevents the operation. @@ -196,14 +204,14 @@ do_install_append_class-target () { } # nologin causes a conflict with shadow-native # kill causes a conflict with coreutils-native (if ${bindir}==${base_bindir}) -do_install_append_class-native () { +do_install:append:class-native () { rm -f ${D}${base_sbindir}/nologin rm -f ${D}${base_bindir}/kill } # dm-verity support introduces a circular build dependency, so util-linux-libuuid is split out for target builds # Need to build libuuid for uuidgen, but then delete it and let the other recipe ship it -do_install_append () { +do_install:append () { rm -rf ${D}${includedir}/uuid ${D}${libdir}/pkgconfig/uuid.pc ${D}${libdir}/libuuid* ${D}${base_libdir}/libuuid* } @@ -212,24 +220,29 @@ ALTERNATIVE_PRIORITY = "80" ALTERNATIVE_LINK_NAME[blkid] = "${base_sbindir}/blkid" ALTERNATIVE_LINK_NAME[blockdev] = "${base_sbindir}/blockdev" ALTERNATIVE_LINK_NAME[cal] = "${bindir}/cal" +ALTERNATIVE_LINK_NAME[chfn] = "${bindir}/chfn" +ALTERNATIVE_LINK_NAME[chsh] = "${bindir}/chsh" ALTERNATIVE_LINK_NAME[chrt] = "${bindir}/chrt" ALTERNATIVE_LINK_NAME[dmesg] = "${base_bindir}/dmesg" ALTERNATIVE_LINK_NAME[eject] = "${bindir}/eject" ALTERNATIVE_LINK_NAME[fallocate] = "${bindir}/fallocate" ALTERNATIVE_LINK_NAME[fdisk] = "${base_sbindir}/fdisk" +ALTERNATIVE_LINK_NAME[findfs] = "${sbindir}/findfs" ALTERNATIVE_LINK_NAME[flock] = "${bindir}/flock" ALTERNATIVE_LINK_NAME[fsck] = "${base_sbindir}/fsck" ALTERNATIVE_LINK_NAME[fsfreeze] = "${sbindir}/fsfreeze" ALTERNATIVE_LINK_NAME[fstrim] = "${base_sbindir}/fstrim" ALTERNATIVE_LINK_NAME[getopt] = "${base_bindir}/getopt" -ALTERNATIVE_${PN}-agetty = "getty" +ALTERNATIVE:${PN}-agetty = "getty" ALTERNATIVE_LINK_NAME[getty] = "${base_sbindir}/getty" ALTERNATIVE_TARGET[getty] = "${base_sbindir}/agetty" ALTERNATIVE_LINK_NAME[hexdump] = "${bindir}/hexdump" ALTERNATIVE_LINK_NAME[hwclock] = "${base_sbindir}/hwclock" ALTERNATIVE_LINK_NAME[ionice] = "${bindir}/ionice" +ALTERNATIVE_LINK_NAME[ipcrm] = "${bindir}/ipcrm" +ALTERNATIVE_LINK_NAME[ipcs] = "${bindir}/ipcs" ALTERNATIVE_LINK_NAME[kill] = "${base_bindir}/kill" -ALTERNATIVE_${PN}-last = "last lastb" +ALTERNATIVE:${PN}-last = "last lastb" ALTERNATIVE_LINK_NAME[last] = "${bindir}/last" ALTERNATIVE_LINK_NAME[lastb] = "${bindir}/lastb" ALTERNATIVE_LINK_NAME[logger] = "${bindir}/logger" @@ -249,6 +262,7 @@ ALTERNATIVE_LINK_NAME[renice] = "${bindir}/renice" ALTERNATIVE_LINK_NAME[rev] = "${bindir}/rev" ALTERNATIVE_LINK_NAME[rfkill] = "${sbindir}/rfkill" ALTERNATIVE_LINK_NAME[rtcwake] = "${sbindir}/rtcwake" +ALTERNATIVE_LINK_NAME[scriptreplay] = "${bindir}/scriptreplay" ALTERNATIVE_LINK_NAME[setpriv] = "${bindir}/setpriv" ALTERNATIVE_LINK_NAME[setsid] = "${bindir}/setsid" ALTERNATIVE_LINK_NAME[su] = "${base_bindir}/su" @@ -263,13 +277,16 @@ ALTERNATIVE_LINK_NAME[utmpdump] = "${bindir}/utmpdump" ALTERNATIVE_LINK_NAME[uuidgen] = "${bindir}/uuidgen" ALTERNATIVE_LINK_NAME[wall] = "${bindir}/wall" -ALTERNATIVE_${PN}-doc = "\ +ALTERNATIVE:${PN}-doc = "\ blkid.8 eject.1 findfs.8 fsck.8 kill.1 last.1 lastb.1 libblkid.3 logger.1 mesg.1 \ mountpoint.1 nologin.8 rfkill.8 sulogin.8 utmpdump.1 uuid.3 wall.1\ " -ALTERNATIVE_${PN}-doc += "${@bb.utils.contains('PACKAGECONFIG', 'pam', 'su.1', '', d)}" +ALTERNATIVE:${PN}-doc += "${@bb.utils.contains('PACKAGECONFIG', 'pam', 'su.1', '', d)}" +ALTERNATIVE:${PN}-doc += "${@bb.utils.contains('PACKAGECONFIG', 'chfn-chsh', 'chfn.1 chsh.1', '', d)}" ALTERNATIVE_LINK_NAME[blkid.8] = "${mandir}/man8/blkid.8" +ALTERNATIVE_LINK_NAME[chfn.1] = "${mandir}/man1/chfn.1" +ALTERNATIVE_LINK_NAME[chsh.1] = "${mandir}/man1/chsh.1" ALTERNATIVE_LINK_NAME[eject.1] = "${mandir}/man1/eject.1" ALTERNATIVE_LINK_NAME[findfs.8] = "${mandir}/man8/findfs.8" ALTERNATIVE_LINK_NAME[fsck.8] = "${mandir}/man8/fsck.8" @@ -289,7 +306,6 @@ ALTERNATIVE_LINK_NAME[utmpdump.1] = "${mandir}/man1/utmpdump.1" ALTERNATIVE_LINK_NAME[uuid.3] = "${mandir}/man3/uuid.3" ALTERNATIVE_LINK_NAME[wall.1] = "${mandir}/man1/wall.1" - BBCLASSEXTEND = "native nativesdk" PTEST_BINDIR = "1" @@ -306,27 +322,27 @@ do_install_ptest() { cp ${S}/tests/*.sh ${D}${PTEST_PATH}/tests/ cp -pR ${S}/tests/expected ${D}${PTEST_PATH}/tests/expected cp -pR ${S}/tests/ts ${D}${PTEST_PATH}/tests/ - cp ${WORKDIR}/build/config.h ${D}${PTEST_PATH} - - # The original paths of executables to be tested point to a local folder containing - # the executables. We want to test the installed executables, not the local copies. - # So strip the paths, the executables will be located via "which" - sed -i \ - -e '/^TS_CMD/ s|$top_builddir/||g' \ - -e '/^TS_HELPER/ s|$top_builddir|${PTEST_PATH}|g' \ - ${D}${PTEST_PATH}/tests/commands.sh - - # Change 'if [ ! -x "$1" ]' to 'if [ ! -x "`which $1 2>/dev/null`"]' - sed -i -e \ - '/^\tif[[:space:]]\[[[:space:]]![[:space:]]-x[[:space:]]"$1"/s|$1|`which $1 2>/dev/null`|g' \ - ${D}${PTEST_PATH}/tests/functions.sh - - # Running "kill" without the the complete path would use the shell's built-in kill - sed -i -e \ - '/^TS_CMD_KILL/ s|kill|${PTEST_PATH}/bin/kill|g' \ - ${D}${PTEST_PATH}/tests/commands.sh - - - sed -i 's|@base_sbindir@|${base_sbindir}|g' ${D}${PTEST_PATH}/run-ptest + cp ${B}/config.h ${D}${PTEST_PATH} + + sed -i 's|@base_sbindir@|${base_sbindir}|g' ${D}${PTEST_PATH}/run-ptest + + # chfn needs PAM + if ! ${@bb.utils.contains('PACKAGECONFIG', 'pam', 'true', 'false', d)}; then + rm -rf ${D}${PTEST_PATH}/tests/ts/chfn + fi + # remove raid tests, known failures and avoid dependency on mdadm therefore + # See https://github.com/util-linux/util-linux/commit/7519c3edab120b14623931d5ddb16fdc6e7cad5d + rm -rf ${D}${PTEST_PATH}/tests/ts/blkid/md-raid0-whole + rm -rf ${D}${PTEST_PATH}/tests/ts/blkid/md-raid1-part + rm -rf ${D}${PTEST_PATH}/tests/ts/blkid/md-raid1-whole + rm -rf ${D}${PTEST_PATH}/tests/ts/fdisk/align-512-4K-md +} +# Delete tests not working on musl +do_install_ptest:append:libc-musl() { + for t in tests/ts/col/multibyte \ + tests/ts/lib/timeutils \ + tests/ts/dmesg/limit; do + rm -rf ${D}${PTEST_PATH}/$t + done } |