From 38f4f3bfbe2f9625737af15422423b00c32ee076 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Tue, 19 Aug 2025 09:02:44 -0700 Subject: [PATCH] strace: Fix uio test and ignore pwritev|pwrite64 tests on musl The pwritev and pwrite64 are wrappers over pwritev2 syscall in musl but strace assumes glibc behavior, ignore them for now Signed-off-by: Khem Raj Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie --- ...gnore-pwritev-pwrite64-tests-on-musl.patch | 56 +++++++++++++++++++ ...01-tests-fix-uio.test-with-musl-libc.patch | 30 ++++++++++ meta/recipes-devtools/strace/strace_6.16.bb | 4 ++ 3 files changed, 90 insertions(+) create mode 100644 meta/recipes-devtools/strace/strace/0001-Ignore-pwritev-pwrite64-tests-on-musl.patch create mode 100644 meta/recipes-devtools/strace/strace/0001-tests-fix-uio.test-with-musl-libc.patch diff --git a/meta/recipes-devtools/strace/strace/0001-Ignore-pwritev-pwrite64-tests-on-musl.patch b/meta/recipes-devtools/strace/strace/0001-Ignore-pwritev-pwrite64-tests-on-musl.patch new file mode 100644 index 0000000000..f21f68001f --- /dev/null +++ b/meta/recipes-devtools/strace/strace/0001-Ignore-pwritev-pwrite64-tests-on-musl.patch @@ -0,0 +1,56 @@ +From 13fd22ad0df5b80c428d3ecc0114fb340f3b3894 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Mon, 18 Aug 2025 22:18:58 -0700 +Subject: [PATCH] Ignore pwritev/pwrite64 tests on musl + +musl uses wrappers for pwritev and pwrite64 using +pwritev2 syscall [1], however the test exepcts that the +program will call pwritev and pwrite64 ( glibc behavior ) + +This can be fixed if the function calls are changed to +use syscall() API directly, but that needs change upstream [2] + +Issue is reported upstream [3] + +[1] https://git.musl-libc.org/cgit/musl/commit/src?id=5370070fded61b569196764673a4fc8440aac79e +[2] https://github.com/strace/strace/pull/347 +[3] https://github.com/strace/strace/issues/349 + +Upstream-Status: Inappropriate [Musl Specific] +Signed-off-by: Khem Raj +--- + tests/pread64-pwrite64.gen.test | 2 ++ + tests/preadv-pwritev.gen.test | 2 ++ + tests/pwritev.gen.test | 2 ++ + 3 files changed, 6 insertions(+) + +--- a/tests/pread64-pwrite64.gen.test ++++ b/tests/pread64-pwrite64.gen.test +@@ -1,4 +1,7 @@ + #!/bin/sh -efu + # Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pread64-pwrite64 -a21 -eread=0 -ewrite=1 -e trace=pread64,pwrite64 -P pread64-pwrite64-tmpfile -P /dev/zero -P /dev/null); do not edit. + . "${srcdir=.}/init.sh" ++ ++skip_ "Test not ported to musl, musl generates pwritev2" ++ + run_strace_match_diff -a21 -eread=0 -ewrite=1 -e trace=pread64,pwrite64 -P pread64-pwrite64-tmpfile -P /dev/zero -P /dev/null +--- a/tests/preadv-pwritev.gen.test ++++ b/tests/preadv-pwritev.gen.test +@@ -1,4 +1,7 @@ + #!/bin/sh -efu + # Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (preadv-pwritev -a19 -eread=0 -ewrite=1 -e trace=preadv,pwritev); do not edit. + . "${srcdir=.}/init.sh" ++ ++skip_ "Test not ported to musl, musl generates pwritev2" ++ + run_strace_match_diff -a19 -eread=0 -ewrite=1 -e trace=preadv,pwritev +--- a/tests/pwritev.gen.test ++++ b/tests/pwritev.gen.test +@@ -1,4 +1,7 @@ + #!/bin/sh -efu + # Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (pwritev -a22 -s7); do not edit. + . "${srcdir=.}/init.sh" ++ ++skip_ "Test not ported to musl, musl generates pwritev2" ++ + run_strace_match_diff -a22 -s7 diff --git a/meta/recipes-devtools/strace/strace/0001-tests-fix-uio.test-with-musl-libc.patch b/meta/recipes-devtools/strace/strace/0001-tests-fix-uio.test-with-musl-libc.patch new file mode 100644 index 0000000000..a879ca50ca --- /dev/null +++ b/meta/recipes-devtools/strace/strace/0001-tests-fix-uio.test-with-musl-libc.patch @@ -0,0 +1,30 @@ +From 7fadf6947761cc5248aa4a376bb9517481dbaa52 Mon Sep 17 00:00:00 2001 +From: Gyorgy Sarvari +Date: Tue, 12 Aug 2025 20:02:31 +0200 +Subject: [PATCH] tests: fix uio.test with musl-libc + +musl-libc handles the pwrite calls differently than glibc, making +the uio test fail. Using glibc, there are separated pwrite and pwritev +calls, however musl uses only pwritev2 for both pwrite and pwritev. + +To account to this difference, modify the expected matching regexp +to also match the musl output (append it with an OR). + +Upstream-Status: Backport [https://github.com/strace/strace/pull/347] +Signed-off-by: Gyorgy Sarvari +Signed-off-by: Khem Raj +--- + tests/uio.expected | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/uio.expected b/tests/uio.expected +index 98d5c06..2a712a1 100644 +--- a/tests/uio.expected ++++ b/tests/uio.expected +@@ -1,4 +1,4 @@ + pread(64)?\(0, "\\0\\0\\0\\0", 4, 1004211379570065135\) += 4 + preadv\(0, \[\{iov_base="\\0\\0\\0\\0", iov_len=4\}\], 1, 1004211379570065135\) += 4 +-pwrite(64)?\(0, "\\0\\0\\0\\0", 4, 1004211379570065135\) += 4 +-pwritev\(0, \[\{iov_base="\\0\\0\\0\\0", iov_len=4\}\], 1, 1004211379570065135\) += 4 ++pwrite(64)?\(0, "\\0\\0\\0\\0", 4, 1004211379570065135\) += 4|pwritev2\(0, \[\{iov_base="\\0\\0\\0\\0", iov_len=4}], 1, 1004211379570065135, RWF_NOAPPEND\) += 4 ++pwritev\(0, \[\{iov_base="\\0\\0\\0\\0", iov_len=4\}\], 1, 1004211379570065135\) += 4|pwritev2\(0, \[\{iov_base="\\0\\0\\0\\0", iov_len=4}], 1, 1004211379570065135, RWF_NOAPPEND\) += 4 diff --git a/meta/recipes-devtools/strace/strace_6.16.bb b/meta/recipes-devtools/strace/strace_6.16.bb index 3e6b855df0..0552caa2b6 100644 --- a/meta/recipes-devtools/strace/strace_6.16.bb +++ b/meta/recipes-devtools/strace/strace_6.16.bb @@ -14,6 +14,10 @@ SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/strace-${PV}.tar.xz \ file://skip-load.patch \ file://0001-configure-Use-autoconf-macro-to-detect-largefile-sup.patch \ file://0002-tests-Replace-off64_t-with-off_t.patch \ + file://0001-tests-fix-uio.test-with-musl-libc.patch \ + " +SRC_URI:append:libc-musl = "\ + file://0001-Ignore-pwritev-pwrite64-tests-on-musl.patch \ " SRC_URI[sha256sum] = "3d7aee7e4f044b2f67f3d51a8a76eda18076e9fb2774de54ac351d777d4ebffa" -- 2.47.2