strace: Fix fallocate ptest build with newer musl
PATCH 1/1 strace: Fix fallocate ptest build with newer musl
musl now defines FALLOC_FL_WRITE_ZEROES and the other fallocate operation flags in <fcntl.h>, but not the deprecated FALLOC_FL_NO_HIDE_STALE. tests/fallocate.c assumes that when FALLOC_FL_WRITE_ZEROES is defined all FALLOC_FL_* constants are (true for glibc, which includes <linux/falloc.h>), so it skips <linux/falloc.h> and do_compile_ptest_base fails:
src/xlat/falloc_flags.h:24:7: error: use of undeclared identifier 'FALLOC_FL_NO_HIDE_STALE'
Include <linux/falloc.h> unless FALLOC_FL_NO_HIDE_STALE is defined too.
AI-Generated: Uses Claude Code
Signed-off-by Khem Raj <[email protected]>
--- ...fallocate-test-build-with-newer-musl.patch | 47 +++++++++++++++++++ meta/recipes-devtools/strace/strace_7.3.bb | 1 + 2 files changed, 48 insertions(+) create mode 100644 meta/recipes-devtools/strace/strace/0001-tests-fix-fallocate-test-build-with-newer-musl.patch
meta/recipes-devtools/strace/strace/0001-tests-fix-fallocate-test-build-with-newer-musl.patch new file +47 -0
@@ -0,0 +1,47 @@ +From 66b1687dd6b60b0c6fd957f11eb66f5ce7edc7d6 Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Sat, 21 Nov 2026 16:12:50 -0800 +Subject: [PATCH] tests: fix fallocate test build with newer musl + +The test assumed that if <fcntl.h> defines FALLOC_FL_WRITE_ZEROES it +also defines every other FALLOC_FL_* constant, as glibc does by +including <linux/falloc.h>. musl now defines FALLOC_FL_WRITE_ZEROES +and the other operation flags in <fcntl.h> itself, but not the +deprecated FALLOC_FL_NO_HIDE_STALE, so the build fails: + + src/xlat/falloc_flags.h:24:7: error: use of undeclared identifier 'FALLOC_FL_NO_HIDE_STALE' + +Include <linux/falloc.h> unless both FALLOC_FL_WRITE_ZEROES and +FALLOC_FL_NO_HIDE_STALE are already defined, and also undefine +FALLOC_FL_WRITE_ZEROES before including it. + +* tests/fallocate.c: Check FALLOC_FL_NO_HIDE_STALE as well, undefine +FALLOC_FL_WRITE_ZEROES. + +Upstream-Status: Submitted [https://github.com/strace/strace/pull/441] +Signed-off-by: Khem Raj <[email protected]> +--- + tests/fallocate.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/tests/fallocate.c b/tests/fallocate.c +index 2c28ad8..34d2839 100644 +--- a/tests/fallocate.c ++++ b/tests/fallocate.c +@@ -18,7 +18,7 @@ + # include <fcntl.h> + # include <stdio.h> + +-# ifndef FALLOC_FL_WRITE_ZEROES ++# if !defined FALLOC_FL_WRITE_ZEROES || !defined FALLOC_FL_NO_HIDE_STALE + /* Avoid conflicts between <fcntl.h> and <linux/falloc.h>. */ + # undef FALLOC_FL_KEEP_SIZE + # undef FALLOC_FL_PUNCH_HOLE +@@ -27,6 +27,7 @@ + # undef FALLOC_FL_ZERO_RANGE + # undef FALLOC_FL_INSERT_RANGE + # undef FALLOC_FL_UNSHARE_RANGE ++# undef FALLOC_FL_WRITE_ZEROES + # include <linux/falloc.h> + # endif +
meta/recipes-devtools/strace/strace_7.3.bb +1 -0
@@ -16,6 +16,7 @@ SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/strace-${PV}.tar.xz \ file://0002-tests-Replace-off64_t-with-off_t.patch \ file://0001-m4-Backport-ax_prog_cc_for_build.m4-macros.patch \ file://0001-Handle-both-bpf-link-and-bpf_link-anon_inode-names.patch \ + file://0001-tests-fix-fallocate-test-build-with-newer-musl.patch \ " SRC_URI[sha256sum] = "529634c40910895a9a1f3c5c1e65da2ca9ed72fb158dfc4bcc89efdf05e39b72"