Files
rpi-buildroot/package/ltp-testsuite/0002-statmount02-Remove-linux-btrfs.h.patch
Petr Vorel 0ccd9300cd package/ltp-testsuite: backport musl build fixes
When building LTP with a musl toolchain with kernel headers >= 6.14,
compilation fails with error:

    In file included from listmount02.c:22:
    listmount.h: In function ‘listmount’:
    listmount.h:18:16: error: variable ‘req’ has initializer but incomplete type
       18 |         struct mnt_id_req req = {
          |                ^~~~~~~~~~

The issue can be reproduced with commands:

    cat >.config <<EOF
    BR2_aarch64=y
    BR2_TOOLCHAIN_BUILDROOT_MUSL=y
    BR2_LINUX_KERNEL=y
    BR2_LINUX_KERNEL_LATEST_VERSION=y
    BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
    BR2_PACKAGE_LTP_TESTSUITE=y
    EOF
    make olddefconfig
    make ltp-testsuite

Backport 2 commits from upstream which fixes LTP on musl on
kernel >= 6.14.

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
[Julien:
 - add commands to reproduce the issue in commit log
 - move _AUTORECONF up to be nearer _VERSION
]
Signed-off-by: Julien Olivain <ju.o@free.fr>
2025-07-20 17:23:58 +02:00

53 lines
2.0 KiB
Diff

From fe8c0dac5ab4aa49c4f977d14f8a8d24cefa6435 Mon Sep 17 00:00:00 2001
From: Petr Vorel <pvorel@suse.cz>
Date: Wed, 4 Jun 2025 16:13:18 +0200
Subject: [PATCH] statmount02: Remove <linux/btrfs.h>
statmount02.c does not need <linux/btrfs.h> because it's skipped.
Avoid using it fixes the problem due the old problem of indirect include
<linux/mount.h> by <linux/fs.h> on Alpine v3.22 (the default Alpine
version in GitHub action), which uses 6.14.2 kernel headers:
In file included from /usr/include/linux/fs.h:19,
from /usr/include/linux/btrfs.h:29,
from statmount02.c:23:
/usr/include/linux/mount.h:155:8: error: redefinition of 'struct statmount'
155 | struct statmount {
| ^~~~~~~~~
In file included from statmount.h:12,
from statmount02.c:20:
../../../../include/lapi/mount.h:58:8: note: originally defined here
58 | struct statmount {
| ^~~~~~~~~
/usr/include/linux/mount.h:193:8: error: redefinition of 'struct mnt_id_req'
193 | struct mnt_id_req {
| ^~~~~~~~~~
../../../../include/lapi/mount.h:49:8: note: originally defined here
49 | struct mnt_id_req {
| ^~~~~~~~~~
Fixes: 5f9942dffe ("Add statmount02 test")
Suggested-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
Upstream: https://github.com/linux-test-project/ltp/commit/fe8c0dac5ab4aa49c4f977d14f8a8d24cefa6435
---
testcases/kernel/syscalls/statmount/statmount02.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/testcases/kernel/syscalls/statmount/statmount02.c b/testcases/kernel/syscalls/statmount/statmount02.c
index 504c558a11..07f877e040 100644
--- a/testcases/kernel/syscalls/statmount/statmount02.c
+++ b/testcases/kernel/syscalls/statmount/statmount02.c
@@ -20,7 +20,6 @@
#include "statmount.h"
#include "lapi/stat.h"
#include "lapi/sched.h"
-#include <linux/btrfs.h>
#define MNTPOINT "mntpoint"
--
2.50.0