Re: [OE-core][scarthgap][PATCH 2/2] libpcre2: fix RunGrepTest Failure on Busybox systems

Yoann Congal
2026-02-08T23:50:02Z

On Tue Jan 20, 2026 at 8:36 AM CET, Shaik Moin via lists.openembedded.org wrote:
> The PCRE2 RunGrepTest script uses the Gnu Coreutils form:
> head -1
>
> Busybox does not support this shorthand option and reports:
> head: invalid option --'1'
>
> which cause the grep tests fail when running ptest on yocto.
> Replace head -1 with head -n 1 . This makes RunGrepTest work
> correctly.
>
> Signed-off-by: Shaik Moin <moins@kpit.com>
> ---
> .../0001-test-Fix-head-1-Busybox.patch | 38 +++++++++++++++++++
> .../recipes-support/libpcre/libpcre2_10.43.bb | 1 +
> 2 files changed, 39 insertions(+)
> create mode 100644 meta/recipes-support/libpcre/libpcre2/0001-test-Fix-head-1-Busybox.patch

Hello,

Is this patch also needed on master? If yes, please send it there.

Thanks!

>
> diff --git a/meta/recipes-support/libpcre/libpcre2/0001-test-Fix-head-1-Busybox.patch b/meta/recipes-support/libpcre/libpcre2/0001-test-Fix-head-1-Busybox.patch
> new file mode 100644
> index 0000000000..abfc995cee
> --- /dev/null
> +++ b/meta/recipes-support/libpcre/libpcre2/0001-test-Fix-head-1-Busybox.patch
> @@ -0,0 +1,38 @@
> +From 1b2c3d4e5f6a7b8c9d0 Mon Sep 17 00:00:00 2001
> +From: Shaik Moin <moins@kpit.com>
> +Date: Tue, 18 Nov 2025 10:30:00 +0530
> +Subject: [PATCH] tests: Fix head options for BusyBox compatibility
> +
> +BusyBox does not accept the GNU coreutils shorthand forms:
> + head -1
> +
> +It requires:
> + head -n 1
> +
> +This causes RunGrepTest test data to fail on
> +Yocto-based systems that use BusyBox.
> +
> +Replace all occurrences of `head -1` â†’ `head -n 1`
This commit message (and also in 1/2) looks to have an encoding problem.

> +
> +This aligns the scripts with POSIX syntax and fixes failing
> +grep tests in RunGrepTest (including testtrygrep).
> +
> +Upstream-Status: Inappropriate [oe-specific]

I disagree: To me, this patch looks appropriate for upstream.

> +Signed-off-by: Shaik Moin <moins@kpit.com>
> +---
> +
> +diff --git a/RunGrepTest b/RunGrepTest
> +index 1c7bbd2..ab4f310 100755
> +--- a/RunGrepTest
> ++++ b/RunGrepTest
> +@@ -728,7 +728,7 @@ echo "---------------------------- Test
> + echo "RC=$?" >>testtrygrep
> +
> + echo "---------------------------- Test 132 -----------------------------" >>testtrygrep
> +-(cd $srcdir; exec 3<testdata/grepinput; $valgrind $vjs $pcre2grep -m1 -A3 '^match' <&3; echo '---'; head -1 <&3; exec 3<&-) >>testtrygrep 2>&1
> ++(cd $srcdir; exec 3<testdata/grepinput; $valgrind $vjs $pcre2grep -m1 -A3 '^match' <&3; echo '---'; head -n 1 <&3; exec 3<&-) >>testtrygrep 2>&1
> + echo "RC=$?" >>testtrygrep
> +
> + echo "---------------------------- Test 133 -----------------------------" >>testtrygrep
> +--
> +2.34.1
> diff --git a/meta/recipes-support/libpcre/libpcre2_10.43.bb b/meta/recipes-support/libpcre/libpcre2_10.43.bb
> index 57c4f0d0e7..f250f35584 100644
> --- a/meta/recipes-support/libpcre/libpcre2_10.43.bb
> +++ b/meta/recipes-support/libpcre/libpcre2_10.43.bb
> @@ -12,6 +12,7 @@ LIC_FILES_CHKSUM = "file://LICENCE;md5=321a5eb46acae6b6c1ff2c7a866d836a"
>
> SRC_URI = "${GITHUB_BASE_URI}/download/pcre2-${PV}/pcre2-${PV}.tar.bz2 \
> file://run-ptest \
> + file://0001-test-Fix-head-1-Busybox.patch \
> "
>
> GITHUB_BASE_URI = "https://github.com/PCRE2Project/pcre2/releases"

--
Yoann Congal
Smile ECS