From f31587588bd2a81fd31d2ab9fa6c61e238f5533b Mon Sep 17 00:00:00 2001 From: Chen Qi Date: Tue, 27 May 2025 12:09:12 +0800 Subject: coreutils: upgrade from 9.6 to 9.7 The following patches are dropped as they are merged in new release: - 0001-cksum-port-to-32-bit-uint_fast32_t.patch - 0001-ls-fix-crash-with-context.patch - intermittent-testfailure.patch (From OE-Core rev: 5760d1fb2553e598e5d6405d8fe748edfaa64b94) Signed-off-by: Chen Qi Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie --- .../0001-cksum-port-to-32-bit-uint_fast32_t.patch | 47 ----- .../coreutils/0001-ls-fix-crash-with-context.patch | 101 --------- .../coreutils/intermittent-testfailure.patch | 30 --- meta/recipes-core/coreutils/coreutils_9.6.bb | 232 --------------------- meta/recipes-core/coreutils/coreutils_9.7.bb | 229 ++++++++++++++++++++ 5 files changed, 229 insertions(+), 410 deletions(-) delete mode 100644 meta/recipes-core/coreutils/coreutils/0001-cksum-port-to-32-bit-uint_fast32_t.patch delete mode 100644 meta/recipes-core/coreutils/coreutils/0001-ls-fix-crash-with-context.patch delete mode 100644 meta/recipes-core/coreutils/coreutils/intermittent-testfailure.patch delete mode 100644 meta/recipes-core/coreutils/coreutils_9.6.bb create mode 100644 meta/recipes-core/coreutils/coreutils_9.7.bb (limited to 'meta') diff --git a/meta/recipes-core/coreutils/coreutils/0001-cksum-port-to-32-bit-uint_fast32_t.patch b/meta/recipes-core/coreutils/coreutils/0001-cksum-port-to-32-bit-uint_fast32_t.patch deleted file mode 100644 index 95d7aca809..0000000000 --- a/meta/recipes-core/coreutils/coreutils/0001-cksum-port-to-32-bit-uint_fast32_t.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 7eada35b4fbb48e7fe430d1b18dae7d191f84f8e Mon Sep 17 00:00:00 2001 -From: Paul Eggert -Date: Mon, 17 Feb 2025 02:27:09 -0800 -Subject: [PATCH 2/2] cksum: port to 32-bit uint_fast32_t -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -* src/cksum_vmull.c (cksum_vmull): Don’t assume -uint_fast32_t can hold 64 bits. -Problem reported by Alyssa Ross (Bug#76360). - -Upstream-Status: Backport [7eada35b4fbb48e7fe430d1b18dae7d191f84f8e] -Signed-off-by: Ross Burton ---- - NEWS | 3 +++ - src/cksum_vmull.c | 7 +++++-- - 2 files changed, 8 insertions(+), 2 deletions(-) - -diff --git a/src/cksum_vmull.c b/src/cksum_vmull.c -index 7611c4244..0ff81e225 100644 ---- a/src/cksum_vmull.c -+++ b/src/cksum_vmull.c -@@ -92,7 +92,9 @@ cksum_vmull (FILE *fp, uint_fast32_t *crc_out, uintmax_t *length_out) - data = bswap_neon (data); - /* XOR in initial CRC value (for us 0 so no effect), or CRC value - calculated for previous BUFLEN buffer from fread */ -- xor_crc = vcombine_u64 (vcreate_u64 (0), vcreate_u64 (crc << 32)); -+ -+ uint64_t wcrc = crc; -+ xor_crc = vcombine_u64 (vcreate_u64 (0), vcreate_u64 (wcrc << 32)); - crc = 0; - data = veorq_u64 (data, xor_crc); - data3 = vld1q_u64 ((uint64_t *) (datap + 1)); -@@ -193,7 +195,8 @@ cksum_vmull (FILE *fp, uint_fast32_t *crc_out, uintmax_t *length_out) - { - data = vld1q_u64 ((uint64_t *) (datap)); - data = bswap_neon (data); -- xor_crc = vcombine_u64 (vcreate_u64 (0), vcreate_u64 (crc << 32)); -+ uint64_t wcrc = crc; -+ xor_crc = vcombine_u64 (vcreate_u64 (0), vcreate_u64 (wcrc << 32)); - crc = 0; - data = veorq_u64 (data, xor_crc); - while (bytes_read >= 32) --- -2.45.2 - diff --git a/meta/recipes-core/coreutils/coreutils/0001-ls-fix-crash-with-context.patch b/meta/recipes-core/coreutils/coreutils/0001-ls-fix-crash-with-context.patch deleted file mode 100644 index b1a92875a6..0000000000 --- a/meta/recipes-core/coreutils/coreutils/0001-ls-fix-crash-with-context.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 43a63408630e5064317823702518099f0ea652dd Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?P=C3=A1draig=20Brady?= -Date: Fri, 17 Jan 2025 17:29:34 +0000 -Subject: [PATCH] ls: fix crash with --context - -* src/ls.c (main): Flag that we need to stat() -if we're going to get security context (call file_has_aclinfo_cache). -(file_has_aclinfo_cache): Be defensive and only lookup the device -for the file if the stat has been performed. -(has_capability_cache): Likewise. -* tests/ls/selinux-segfault.sh: Add a test case. -* NEWS: Mention the bug fix. -Reported by Bruno Haible. - -Upstream-Status: Backport -[https://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=915004f403cb25fadb207ddfdbe6a2f43bd44fac] - -Signed-off-by: Yi Zhao ---- - NEWS | 3 +++ - src/ls.c | 10 +++++----- - tests/ls/selinux-segfault.sh | 3 +++ - 3 files changed, 11 insertions(+), 5 deletions(-) - -diff --git a/NEWS b/NEWS -index 3799f75..65867f9 100644 ---- a/NEWS -+++ b/NEWS -@@ -4,6 +4,9 @@ GNU coreutils NEWS -*- outline -*- - - ** Bug fixes - -+ `ls -Z dir` would crash. -+ [bug introduced in coreutils-9.6] -+ - cp fixes support for --update=none-fail, which would have been - rejected as an invalid option. - [bug introduced in coreutils-9.5] -diff --git a/src/ls.c b/src/ls.c -index 3215360..f67167f 100644 ---- a/src/ls.c -+++ b/src/ls.c -@@ -1768,7 +1768,7 @@ main (int argc, char **argv) - - format_needs_stat = ((sort_type == sort_time) | (sort_type == sort_size) - | (format == long_format) -- | print_block_size | print_hyperlink); -+ | print_block_size | print_hyperlink | print_scontext); - format_needs_type = ((! format_needs_stat) - & (recursive | print_with_color | print_scontext - | directories_first -@@ -3309,7 +3309,7 @@ file_has_aclinfo_cache (char const *file, struct fileinfo *f, - static int unsupported_scontext_err; - static dev_t unsupported_device; - -- if (f->stat.st_dev == unsupported_device) -+ if (f->stat_ok && f->stat.st_dev == unsupported_device) - { - ai->buf = ai->u.__gl_acl_ch; - ai->size = 0; -@@ -3322,7 +3322,7 @@ file_has_aclinfo_cache (char const *file, struct fileinfo *f, - errno = 0; - int n = file_has_aclinfo (file, ai, flags); - int err = errno; -- if (n <= 0 && !acl_errno_valid (err)) -+ if (f->stat_ok && n <= 0 && !acl_errno_valid (err)) - { - unsupported_return = n; - unsupported_scontext = ai->scontext; -@@ -3342,14 +3342,14 @@ has_capability_cache (char const *file, struct fileinfo *f) - found that has_capability fails indicating lack of support. */ - static dev_t unsupported_device; - -- if (f->stat.st_dev == unsupported_device) -+ if (f->stat_ok && f->stat.st_dev == unsupported_device) - { - errno = ENOTSUP; - return 0; - } - - bool b = has_capability (file); -- if ( !b && !acl_errno_valid (errno)) -+ if (f->stat_ok && !b && !acl_errno_valid (errno)) - unsupported_device = f->stat.st_dev; - return b; - } -diff --git a/tests/ls/selinux-segfault.sh b/tests/ls/selinux-segfault.sh -index 11623ac..1cac2b5 100755 ---- a/tests/ls/selinux-segfault.sh -+++ b/tests/ls/selinux-segfault.sh -@@ -30,4 +30,7 @@ mkdir sedir || framework_failure_ - ln -sf missing sedir/broken || framework_failure_ - returns_ 1 ls -L -R -Z -m sedir > out || fail=1 - -+# ls 9.6 would segfault with the following -+ls -Z . > out || fail=1 -+ - Exit $fail --- -2.34.1 - diff --git a/meta/recipes-core/coreutils/coreutils/intermittent-testfailure.patch b/meta/recipes-core/coreutils/coreutils/intermittent-testfailure.patch deleted file mode 100644 index 0794532bdf..0000000000 --- a/meta/recipes-core/coreutils/coreutils/intermittent-testfailure.patch +++ /dev/null @@ -1,30 +0,0 @@ -tests/df: Fix intermittent test failure - -The test writes to the disk and means the space used changes. If this -crosses a number boundary, the heading spacing can change: - --Filesystem 1024-blocks Used Available Capacity Mounted on -+Filesystem 1024-blocks Used Available Capacity Mounted on - -The test is to make sure the 1024 blocks element remains the same and -the spacing doesn't matter. Therefore strip any duplicate spaces using tr. - -Submitted: https://github.com/coreutils/coreutils/pull/88 -Upstream-Status: Backport [https://github.com/coreutils/coreutils/commit/c5725c8c4bb21903490a48035286d0f94463642e] -Signed-off-by: Richard Purdie - -Index: coreutils-9.5/tests/df/df-P.sh -=================================================================== ---- coreutils-9.5.orig/tests/df/df-P.sh -+++ coreutils-9.5/tests/df/df-P.sh -@@ -20,8 +20,8 @@ - print_ver_ df - - -- df -P . > t1 || fail=1 --BLOCK_SIZE=1M df -P . > t2 || fail=1 -+ df -P . | tr -s ' ' > t1 || fail=1 -+BLOCK_SIZE=1M df -P . | tr -s ' ' > t2 || fail=1 - - # Since file system utilization may be changing, compare only df's header line. - # That records the block size. E.g., for "1M", it would be: diff --git a/meta/recipes-core/coreutils/coreutils_9.6.bb b/meta/recipes-core/coreutils/coreutils_9.6.bb deleted file mode 100644 index a966c4b448..0000000000 --- a/meta/recipes-core/coreutils/coreutils_9.6.bb +++ /dev/null @@ -1,232 +0,0 @@ -SUMMARY = "The basic file, shell and text manipulation utilities" -DESCRIPTION = "The GNU Core Utilities provide the basic file, shell and text \ -manipulation utilities. These are the core utilities which are expected to exist on \ -every system." -HOMEPAGE = "http://www.gnu.org/software/coreutils/" -BUGTRACKER = "http://debbugs.gnu.org/coreutils" -LICENSE = "GPL-3.0-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464 \ - file://src/ls.c;beginline=1;endline=15;md5=824c1997414aea9f344747bd81cf5a31 \ - " -DEPENDS = "gmp libcap" -DEPENDS:class-native = "" - -inherit autotools gettext texinfo - -SRC_URI = "${GNU_MIRROR}/coreutils/${BP}.tar.xz \ - file://remove-usr-local-lib-from-m4.patch \ - file://intermittent-testfailure.patch \ - file://0001-ls-fix-crash-with-context.patch \ - file://0001-cksum-port-to-32-bit-uint_fast32_t.patch \ - file://run-ptest \ - " -SRC_URI[sha256sum] = "7a0124327b398fd9eb1a6abde583389821422c744ffa10734b24f557610d3283" - -# http://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=v8.27-101-gf5d7c0842 -# -CVE_STATUS[CVE-2016-2781] = "disputed: runcon is not really a sandbox command, use `runcon ... setsid ...` to avoid this particular issue." - -EXTRA_OECONF:class-target = "--enable-install-program=arch,hostname --libexecdir=${libdir}" -EXTRA_OECONF:class-nativesdk = "--enable-install-program=arch,hostname" - -# acl and xattr are not default features -# -PACKAGECONFIG:class-target ??= "\ - ${@bb.utils.filter('DISTRO_FEATURES', 'acl xattr', d)} \ -" - -# The lib/oe/path.py requires xattr -PACKAGECONFIG:class-native ??= "xattr" - -# oe-core builds need xattr support -PACKAGECONFIG:class-nativesdk ??= "xattr" - -# with, without, depends, rdepends -# -PACKAGECONFIG[acl] = "--enable-acl,--disable-acl,acl," -PACKAGECONFIG[xattr] = "--enable-xattr,--disable-xattr,attr," -PACKAGECONFIG[single-binary] = "--enable-single-binary,--disable-single-binary,," -PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux" -PACKAGECONFIG[openssl] = "--with-openssl=yes,--with-openssl=no,openssl" - -# [ base32 base64 df mktemp nice printenv get a special treatment and are not included in this -bindir_progs = "arch basename chcon cksum comm csplit cut dir dircolors dirname du \ - env expand expr factor fmt fold groups head hostid id install \ - join link logname md5sum mkfifo nl nohup nproc od paste pathchk \ - pinky pr printf ptx readlink realpath runcon seq sha1sum sha224sum sha256sum \ - sha384sum sha512sum shred shuf sort split sum tac tail tee test timeout \ - tr truncate tsort tty unexpand uniq unlink uptime users vdir wc who whoami yes" - -base_bindir_progs = "cat chgrp chmod chown cp date dd echo false hostname kill ln ls mkdir \ - mknod mv pwd rm rmdir sleep stty sync touch true uname stat" - -sbindir_progs = "chroot" - -# Split stdbuf into its own package, so one can include -# coreutils-stdbuf without getting the rest of coreutils, but make -# coreutils itself pull in stdbuf, so IMAGE_INSTALL += "coreutils" -# always provides all coreutils -PACKAGE_BEFORE_PN:class-target += "${@bb.utils.contains('PACKAGECONFIG', 'single-binary', '', 'coreutils-stdbuf', d)}" -FILES:coreutils-stdbuf = "${bindir}/stdbuf ${libdir}/coreutils/libstdbuf.so" -RDEPENDS:coreutils:class-target += "${@bb.utils.contains('PACKAGECONFIG', 'single-binary', '', 'coreutils-stdbuf', d)}" - -# However, when the single-binary PACKAGECONFIG is used, stdbuf -# functionality is built into the single coreutils binary, so there's -# no point splitting /usr/bin/stdbuf to its own package. Instead, add -# an RPROVIDE so that rdepending on coreutils-stdbuf will work -# regardless of whether single-binary is in effect. -RPROVIDES:coreutils += "${@bb.utils.contains('PACKAGECONFIG', 'single-binary', 'coreutils-stdbuf', '', d)}" - -# put getlimits into coreutils-getlimits, because other ptest packages such as -# findutils-ptest may need this command. Note that getlimits is a noinst_PROGRAM -PACKAGE_BEFORE_PN:class-target += "${PN}-getlimits" -FILES:${PN}-getlimits = "${bindir}/getlimits" - -# Deal with a separate builddir failure if src doesn't exist when creating version.c/version.h -do_compile:prepend () { - mkdir -p ${B}/src -} - -do_install:class-native() { - autotools_do_install - # remove groups to fix conflict with shadow-native - rm -f ${D}${STAGING_BINDIR_NATIVE}/groups - # The return is a must since native doesn't need the - # do_install:append() in the below. - return -} - -do_install:append() { - for i in df mktemp nice printenv base64; do mv ${D}${bindir}/$i ${D}${bindir}/$i.${BPN}; done - - install -d ${D}${base_bindir} - [ "${base_bindir}" != "${bindir}" ] && for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i.${BPN}; done - - install -d ${D}${sbindir} - [ "${sbindir}" != "${bindir}" ] && for i in ${sbindir_progs}; do mv ${D}${bindir}/$i ${D}${sbindir}/$i.${BPN}; done - - # [ requires special handling because [.coreutils will cause the sed stuff - # in update-alternatives to fail, therefore use lbracket - the name used - # for the actual source file. - mv ${D}${bindir}/[ ${D}${bindir}/lbracket.${BPN} - - # this getlimits noinst_PROGRAM would possibly be needed by other ptest packages - install ${B}/src/getlimits ${D}/${bindir} -} - -inherit update-alternatives - -ALTERNATIVE_PRIORITY = "100" -# Make hostname's priority higher than busybox but lower than net-tools -ALTERNATIVE_PRIORITY[hostname] = "90" -ALTERNATIVE:${PN} = "lbracket ${bindir_progs} ${base_bindir_progs} ${sbindir_progs} base32 base64 nice printenv mktemp df" -ALTERNATIVE:${PN}-doc = "base64.1 nice.1 mktemp.1 df.1 groups.1 kill.1 uptime.1 stat.1 hostname.1" - -ALTERNATIVE_LINK_NAME[hostname.1] = "${mandir}/man1/hostname.1" - -ALTERNATIVE_LINK_NAME[base64] = "${base_bindir}/base64" -ALTERNATIVE_TARGET[base64] = "${bindir}/base64.${BPN}" -ALTERNATIVE_LINK_NAME[base64.1] = "${mandir}/man1/base64.1" - -ALTERNATIVE_LINK_NAME[mktemp] = "${base_bindir}/mktemp" -ALTERNATIVE_TARGET[mktemp] = "${bindir}/mktemp.${BPN}" -ALTERNATIVE_LINK_NAME[mktemp.1] = "${mandir}/man1/mktemp.1" - -ALTERNATIVE_LINK_NAME[df] = "${base_bindir}/df" -ALTERNATIVE_TARGET[df] = "${bindir}/df.${BPN}" -ALTERNATIVE_LINK_NAME[df.1] = "${mandir}/man1/df.1" - -ALTERNATIVE_LINK_NAME[nice] = "${base_bindir}/nice" -ALTERNATIVE_TARGET[nice] = "${bindir}/nice.${BPN}" -ALTERNATIVE_LINK_NAME[nice.1] = "${mandir}/man1/nice.1" - -ALTERNATIVE_LINK_NAME[printenv] = "${base_bindir}/printenv" -ALTERNATIVE_TARGET[printenv] = "${bindir}/printenv.${BPN}" - -ALTERNATIVE_LINK_NAME[lbracket] = "${bindir}/[" -ALTERNATIVE_TARGET[lbracket] = "${bindir}/lbracket.${BPN}" - -ALTERNATIVE_LINK_NAME[groups.1] = "${mandir}/man1/groups.1" -ALTERNATIVE_LINK_NAME[uptime.1] = "${mandir}/man1/uptime.1" -ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1" -ALTERNATIVE_LINK_NAME[stat.1] = "${mandir}/man1/stat.1" - -# The statx() requires glibc >= 2.28 and linux kernel >= 4.11, it doesn't work -# when glibc >= 2.28 ((Ubuntu 20.04 in docker) and kernel < 4.11 (Host OS -# CentOS 7), we can check kernel version and disable it, but that would cause -# two different signatures for coreutils-native, so disable it unconditionally -# for deterministic build. -EXTRA_OECONF:append:class-native = " ac_cv_func_statx=0" - -python __anonymous() { - for prog in d.getVar('base_bindir_progs').split(): - d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir'), prog)) - - for prog in d.getVar('sbindir_progs').split(): - d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('sbindir'), prog)) -} - -BBCLASSEXTEND = "native nativesdk" - -inherit ptest - -RDEPENDS:${PN}-ptest += "bash findutils gawk make perl perl-modules python3-core sed shadow" - -# -dev automatic dependencies fails as we don't want libmodule-build-perl-dev, its too heavy -# may need tweaking if DEPENDS changes -# Can't use ${PN}-dev here since flags with overrides and key expansion not supported -RRECOMMENDS:coreutils-dev[nodeprrecs] = "1" -DEVDEPS = "acl-dev attr-dev gmp-dev libcap-dev bash-dev findutils-dev gawk-dev shadow-dev" -DEVDEPS:class-native = "" -RRECOMMENDS:${PN}-dev += "${DEVDEPS}" - -do_install_ptest () { - install -d ${D}${PTEST_PATH}/tests - cp -r ${S}/tests/* ${D}${PTEST_PATH}/tests - install -d ${D}${PTEST_PATH}/build-aux - install ${S}/build-aux/test-driver ${D}${PTEST_PATH}/build-aux/ - install -Dm 0644 ${B}/lib/config.h ${D}${PTEST_PATH}/lib/config.h - cp ${B}/Makefile ${D}${PTEST_PATH}/ - cp ${S}/init.cfg ${D}${PTEST_PATH}/ - cp -r ${B}/src ${D}${PTEST_PATH}/ - cp -r ${S}/src/*.c ${D}${PTEST_PATH}/src - sed -i '/^VPATH/s/= .*$/= ./g' ${D}${PTEST_PATH}/Makefile - sed -i '/^PROGRAMS/s/^/#/g' ${D}${PTEST_PATH}/Makefile - sed -i '/^Makefile: /s/^.*$/Makefile:/g' ${D}${PTEST_PATH}/Makefile - sed -i '/^abs_srcdir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile - sed -i '/^abs_top_builddir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile - sed -i '/^abs_top_srcdir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile - sed -i '/^CC =/s/ --sysroot=.*recipe-sysroot/ /g' ${D}${PTEST_PATH}/Makefile - sed -i '/^BUILD_LDFLAGS =/d' ${D}${PTEST_PATH}/Makefile - chmod -R 777 ${D}${PTEST_PATH} - - # Disable subcase stty-pairs.sh, it will cause test framework hang - sed -i '/stty-pairs.sh/d' ${D}${PTEST_PATH}/Makefile - - # Disable subcase tail-2/assert.sh as it has issues on 32-bit systems - sed -i '/assert.sh/d' ${D}${PTEST_PATH}/Makefile - - # Tweak test d_type-check to use python3 instead of python - sed -i "1s@.*@#!/usr/bin/python3@" ${D}${PTEST_PATH}/tests/d_type-check - - # Fix for single-binary - for prog in ${D}${PTEST_PATH}/src/*; do - if [ -f $prog ]; then - sed -i "1s@#!.*/src/coreutils @#!${bindir}/coreutils @" $prog - fi - done - - # handle multilib - sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest -} - -do_install_ptest:append:libc-musl () { - # these tests fail due to bash on musl systems - # xmalloc: cannot allocate 16146 bytes - sed -i -e '/tests\/dd\/no-allocate.sh/d' ${D}${PTEST_PATH}/Makefile - sed -i -e '/tests\/split\/line-bytes.sh/d' ${D}${PTEST_PATH}/Makefile -} - -RDEPENDS:${PN}-ptest += "${PN}-getlimits xz \ - ${@bb.utils.contains('PACKAGECONFIG', 'acl', 'acl', '', d)} \ - ${@bb.utils.contains('PACKAGECONFIG', 'xattr', 'attr', '', d)}" diff --git a/meta/recipes-core/coreutils/coreutils_9.7.bb b/meta/recipes-core/coreutils/coreutils_9.7.bb new file mode 100644 index 0000000000..091e1ea2c5 --- /dev/null +++ b/meta/recipes-core/coreutils/coreutils_9.7.bb @@ -0,0 +1,229 @@ +SUMMARY = "The basic file, shell and text manipulation utilities" +DESCRIPTION = "The GNU Core Utilities provide the basic file, shell and text \ +manipulation utilities. These are the core utilities which are expected to exist on \ +every system." +HOMEPAGE = "http://www.gnu.org/software/coreutils/" +BUGTRACKER = "http://debbugs.gnu.org/coreutils" +LICENSE = "GPL-3.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464 \ + file://src/ls.c;beginline=1;endline=15;md5=824c1997414aea9f344747bd81cf5a31 \ + " +DEPENDS = "gmp libcap" +DEPENDS:class-native = "" + +inherit autotools gettext texinfo + +SRC_URI = "${GNU_MIRROR}/coreutils/${BP}.tar.xz \ + file://remove-usr-local-lib-from-m4.patch \ + file://run-ptest \ + " +SRC_URI[sha256sum] = "e8bb26ad0293f9b5a1fc43fb42ba970e312c66ce92c1b0b16713d7500db251bf" + +# http://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=v8.27-101-gf5d7c0842 +# +CVE_STATUS[CVE-2016-2781] = "disputed: runcon is not really a sandbox command, use `runcon ... setsid ...` to avoid this particular issue." + +EXTRA_OECONF:class-target = "--enable-install-program=arch,hostname --libexecdir=${libdir}" +EXTRA_OECONF:class-nativesdk = "--enable-install-program=arch,hostname" + +# acl and xattr are not default features +# +PACKAGECONFIG:class-target ??= "\ + ${@bb.utils.filter('DISTRO_FEATURES', 'acl xattr', d)} \ +" + +# The lib/oe/path.py requires xattr +PACKAGECONFIG:class-native ??= "xattr" + +# oe-core builds need xattr support +PACKAGECONFIG:class-nativesdk ??= "xattr" + +# with, without, depends, rdepends +# +PACKAGECONFIG[acl] = "--enable-acl,--disable-acl,acl," +PACKAGECONFIG[xattr] = "--enable-xattr,--disable-xattr,attr," +PACKAGECONFIG[single-binary] = "--enable-single-binary,--disable-single-binary,," +PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux" +PACKAGECONFIG[openssl] = "--with-openssl=yes,--with-openssl=no,openssl" + +# [ base32 base64 df mktemp nice printenv get a special treatment and are not included in this +bindir_progs = "arch basename chcon cksum comm csplit cut dir dircolors dirname du \ + env expand expr factor fmt fold groups head hostid id install \ + join link logname md5sum mkfifo nl nohup nproc od paste pathchk \ + pinky pr printf ptx readlink realpath runcon seq sha1sum sha224sum sha256sum \ + sha384sum sha512sum shred shuf sort split sum tac tail tee test timeout \ + tr truncate tsort tty unexpand uniq unlink uptime users vdir wc who whoami yes" + +base_bindir_progs = "cat chgrp chmod chown cp date dd echo false hostname kill ln ls mkdir \ + mknod mv pwd rm rmdir sleep stty sync touch true uname stat" + +sbindir_progs = "chroot" + +# Split stdbuf into its own package, so one can include +# coreutils-stdbuf without getting the rest of coreutils, but make +# coreutils itself pull in stdbuf, so IMAGE_INSTALL += "coreutils" +# always provides all coreutils +PACKAGE_BEFORE_PN:class-target += "${@bb.utils.contains('PACKAGECONFIG', 'single-binary', '', 'coreutils-stdbuf', d)}" +FILES:coreutils-stdbuf = "${bindir}/stdbuf ${libdir}/coreutils/libstdbuf.so" +RDEPENDS:coreutils:class-target += "${@bb.utils.contains('PACKAGECONFIG', 'single-binary', '', 'coreutils-stdbuf', d)}" + +# However, when the single-binary PACKAGECONFIG is used, stdbuf +# functionality is built into the single coreutils binary, so there's +# no point splitting /usr/bin/stdbuf to its own package. Instead, add +# an RPROVIDE so that rdepending on coreutils-stdbuf will work +# regardless of whether single-binary is in effect. +RPROVIDES:coreutils += "${@bb.utils.contains('PACKAGECONFIG', 'single-binary', 'coreutils-stdbuf', '', d)}" + +# put getlimits into coreutils-getlimits, because other ptest packages such as +# findutils-ptest may need this command. Note that getlimits is a noinst_PROGRAM +PACKAGE_BEFORE_PN:class-target += "${PN}-getlimits" +FILES:${PN}-getlimits = "${bindir}/getlimits" + +# Deal with a separate builddir failure if src doesn't exist when creating version.c/version.h +do_compile:prepend () { + mkdir -p ${B}/src +} + +do_install:class-native() { + autotools_do_install + # remove groups to fix conflict with shadow-native + rm -f ${D}${STAGING_BINDIR_NATIVE}/groups + # The return is a must since native doesn't need the + # do_install:append() in the below. + return +} + +do_install:append() { + for i in df mktemp nice printenv base64; do mv ${D}${bindir}/$i ${D}${bindir}/$i.${BPN}; done + + install -d ${D}${base_bindir} + [ "${base_bindir}" != "${bindir}" ] && for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i.${BPN}; done + + install -d ${D}${sbindir} + [ "${sbindir}" != "${bindir}" ] && for i in ${sbindir_progs}; do mv ${D}${bindir}/$i ${D}${sbindir}/$i.${BPN}; done + + # [ requires special handling because [.coreutils will cause the sed stuff + # in update-alternatives to fail, therefore use lbracket - the name used + # for the actual source file. + mv ${D}${bindir}/[ ${D}${bindir}/lbracket.${BPN} + + # this getlimits noinst_PROGRAM would possibly be needed by other ptest packages + install ${B}/src/getlimits ${D}/${bindir} +} + +inherit update-alternatives + +ALTERNATIVE_PRIORITY = "100" +# Make hostname's priority higher than busybox but lower than net-tools +ALTERNATIVE_PRIORITY[hostname] = "90" +ALTERNATIVE:${PN} = "lbracket ${bindir_progs} ${base_bindir_progs} ${sbindir_progs} base32 base64 nice printenv mktemp df" +ALTERNATIVE:${PN}-doc = "base64.1 nice.1 mktemp.1 df.1 groups.1 kill.1 uptime.1 stat.1 hostname.1" + +ALTERNATIVE_LINK_NAME[hostname.1] = "${mandir}/man1/hostname.1" + +ALTERNATIVE_LINK_NAME[base64] = "${base_bindir}/base64" +ALTERNATIVE_TARGET[base64] = "${bindir}/base64.${BPN}" +ALTERNATIVE_LINK_NAME[base64.1] = "${mandir}/man1/base64.1" + +ALTERNATIVE_LINK_NAME[mktemp] = "${base_bindir}/mktemp" +ALTERNATIVE_TARGET[mktemp] = "${bindir}/mktemp.${BPN}" +ALTERNATIVE_LINK_NAME[mktemp.1] = "${mandir}/man1/mktemp.1" + +ALTERNATIVE_LINK_NAME[df] = "${base_bindir}/df" +ALTERNATIVE_TARGET[df] = "${bindir}/df.${BPN}" +ALTERNATIVE_LINK_NAME[df.1] = "${mandir}/man1/df.1" + +ALTERNATIVE_LINK_NAME[nice] = "${base_bindir}/nice" +ALTERNATIVE_TARGET[nice] = "${bindir}/nice.${BPN}" +ALTERNATIVE_LINK_NAME[nice.1] = "${mandir}/man1/nice.1" + +ALTERNATIVE_LINK_NAME[printenv] = "${base_bindir}/printenv" +ALTERNATIVE_TARGET[printenv] = "${bindir}/printenv.${BPN}" + +ALTERNATIVE_LINK_NAME[lbracket] = "${bindir}/[" +ALTERNATIVE_TARGET[lbracket] = "${bindir}/lbracket.${BPN}" + +ALTERNATIVE_LINK_NAME[groups.1] = "${mandir}/man1/groups.1" +ALTERNATIVE_LINK_NAME[uptime.1] = "${mandir}/man1/uptime.1" +ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1" +ALTERNATIVE_LINK_NAME[stat.1] = "${mandir}/man1/stat.1" + +# The statx() requires glibc >= 2.28 and linux kernel >= 4.11, it doesn't work +# when glibc >= 2.28 ((Ubuntu 20.04 in docker) and kernel < 4.11 (Host OS +# CentOS 7), we can check kernel version and disable it, but that would cause +# two different signatures for coreutils-native, so disable it unconditionally +# for deterministic build. +EXTRA_OECONF:append:class-native = " ac_cv_func_statx=0" + +python __anonymous() { + for prog in d.getVar('base_bindir_progs').split(): + d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir'), prog)) + + for prog in d.getVar('sbindir_progs').split(): + d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('sbindir'), prog)) +} + +BBCLASSEXTEND = "native nativesdk" + +inherit ptest + +RDEPENDS:${PN}-ptest += "bash findutils gawk make perl perl-modules python3-core sed shadow" + +# -dev automatic dependencies fails as we don't want libmodule-build-perl-dev, its too heavy +# may need tweaking if DEPENDS changes +# Can't use ${PN}-dev here since flags with overrides and key expansion not supported +RRECOMMENDS:coreutils-dev[nodeprrecs] = "1" +DEVDEPS = "acl-dev attr-dev gmp-dev libcap-dev bash-dev findutils-dev gawk-dev shadow-dev" +DEVDEPS:class-native = "" +RRECOMMENDS:${PN}-dev += "${DEVDEPS}" + +do_install_ptest () { + install -d ${D}${PTEST_PATH}/tests + cp -r ${S}/tests/* ${D}${PTEST_PATH}/tests + install -d ${D}${PTEST_PATH}/build-aux + install ${S}/build-aux/test-driver ${D}${PTEST_PATH}/build-aux/ + install -Dm 0644 ${B}/lib/config.h ${D}${PTEST_PATH}/lib/config.h + cp ${B}/Makefile ${D}${PTEST_PATH}/ + cp ${S}/init.cfg ${D}${PTEST_PATH}/ + cp -r ${B}/src ${D}${PTEST_PATH}/ + cp -r ${S}/src/*.c ${D}${PTEST_PATH}/src + sed -i '/^VPATH/s/= .*$/= ./g' ${D}${PTEST_PATH}/Makefile + sed -i '/^PROGRAMS/s/^/#/g' ${D}${PTEST_PATH}/Makefile + sed -i '/^Makefile: /s/^.*$/Makefile:/g' ${D}${PTEST_PATH}/Makefile + sed -i '/^abs_srcdir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile + sed -i '/^abs_top_builddir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile + sed -i '/^abs_top_srcdir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile + sed -i '/^CC =/s/ --sysroot=.*recipe-sysroot/ /g' ${D}${PTEST_PATH}/Makefile + sed -i '/^BUILD_LDFLAGS =/d' ${D}${PTEST_PATH}/Makefile + chmod -R 777 ${D}${PTEST_PATH} + + # Disable subcase stty-pairs.sh, it will cause test framework hang + sed -i '/stty-pairs.sh/d' ${D}${PTEST_PATH}/Makefile + + # Disable subcase tail-2/assert.sh as it has issues on 32-bit systems + sed -i '/assert.sh/d' ${D}${PTEST_PATH}/Makefile + + # Tweak test d_type-check to use python3 instead of python + sed -i "1s@.*@#!/usr/bin/python3@" ${D}${PTEST_PATH}/tests/d_type-check + + # Fix for single-binary + for prog in ${D}${PTEST_PATH}/src/*; do + if [ -f $prog ]; then + sed -i "1s@#!.*/src/coreutils @#!${bindir}/coreutils @" $prog + fi + done + + # handle multilib + sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest +} + +do_install_ptest:append:libc-musl () { + # these tests fail due to bash on musl systems + # xmalloc: cannot allocate 16146 bytes + sed -i -e '/tests\/dd\/no-allocate.sh/d' ${D}${PTEST_PATH}/Makefile + sed -i -e '/tests\/split\/line-bytes.sh/d' ${D}${PTEST_PATH}/Makefile +} + +RDEPENDS:${PN}-ptest += "${PN}-getlimits xz \ + ${@bb.utils.contains('PACKAGECONFIG', 'acl', 'acl', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'xattr', 'attr', '', d)}" -- cgit v1.2.3-54-g00ecf