diff mbox series

package/util-linux: fix compile issue with older kernel headers

Message ID ZNYwAHizfBKfreRi@waldemar-brodkorb.de
State Accepted
Headers show
Series package/util-linux: fix compile issue with older kernel headers | expand

Commit Message

Waldemar Brodkorb Aug. 11, 2023, 12:56 p.m. UTC
Linux added mnt_id member to struct statx in commit:
fa2fcf4f1df1559a0a4ee0f46915b496cc2ebf60

Linux 5.4.0 was released on 24. November 2019, but it seems this change
never got backported to 5.4.252.

Upstream added a patch to guard the use of the member in commit:
https://github.com/util-linux/util-linux/commit/c0136ac0c98b18208508fbcfac31a843e0bb8a37

Add the patch to fix an autobuild failure.

Fixes:
 - http://autobuild.buildroot.net/results/d50/d502bc9236b577e2470a30ffc39c21579b038a1c

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
 .../0001-libmount-ifdef-statx-call.patch      | 57 +++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 package/util-linux/0001-libmount-ifdef-statx-call.patch

Comments

Yann E. MORIN Aug. 12, 2023, 2:04 p.m. UTC | #1
Waldemar, All,

On 2023-08-11 14:56 +0200, Waldemar Brodkorb spake thusly:
> Linux added mnt_id member to struct statx in commit:
> fa2fcf4f1df1559a0a4ee0f46915b496cc2ebf60
> 
> Linux 5.4.0 was released on 24. November 2019, but it seems this change
> never got backported to 5.4.252.
> 
> Upstream added a patch to guard the use of the member in commit:
> https://github.com/util-linux/util-linux/commit/c0136ac0c98b18208508fbcfac31a843e0bb8a37
> 
> Add the patch to fix an autobuild failure.
> 
> Fixes:
>  - http://autobuild.buildroot.net/results/d50/d502bc9236b577e2470a30ffc39c21579b038a1c
> 
> Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>

Applied to master, thanks.

I tries to look when this strted to appear, but we do have quite a few
different kind of failrues for util-linux. But upstream added use of
mnt_id back in 2.38, so we can backport this to our maintenace branches,
which all have util-linux 2.38.

Regards,
Yann E. MORIN.

> ---
>  .../0001-libmount-ifdef-statx-call.patch      | 57 +++++++++++++++++++
>  1 file changed, 57 insertions(+)
>  create mode 100644 package/util-linux/0001-libmount-ifdef-statx-call.patch
> 
> diff --git a/package/util-linux/0001-libmount-ifdef-statx-call.patch b/package/util-linux/0001-libmount-ifdef-statx-call.patch
> new file mode 100644
> index 0000000000..ba44650bd3
> --- /dev/null
> +++ b/package/util-linux/0001-libmount-ifdef-statx-call.patch
> @@ -0,0 +1,57 @@
> +From c0136ac0c98b18208508fbcfac31a843e0bb8a37 Mon Sep 17 00:00:00 2001
> +From: Karel Zak <kzak@redhat.com>
> +Date: Thu, 3 Aug 2023 12:39:19 +0200
> +Subject: [PATCH] libmount: ifdef statx() call
> +
> +In this case the statx() is use to get mount ID. It's optional and not
> +required. Let's #ifdef the statx() call and also check for stx_mnt_id
> +struct member.
> +
> +Fixes: https://github.com/util-linux/util-linux/issues/2415
> +Signed-off-by: Karel Zak <kzak@redhat.com>
> +Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
> +Upstream: https://github.com/util-linux/util-linux/commit/c0136ac0c98b18208508fbcfac31a843e0bb8a37
> +---
> + configure.ac              | 5 ++++-
> + libmount/src/hook_mount.c | 2 ++
> + 2 files changed, 6 insertions(+), 1 deletion(-)
> +
> +diff --git a/configure.ac b/configure.ac
> +index a3cf330b5..ae721c7ac 100644
> +--- a/configure.ac
> ++++ b/configure.ac
> +@@ -525,7 +525,10 @@ AC_CHECK_MEMBERS([struct termios.c_line],,,
> +     [[#include <termios.h>]])
> + 
> + AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec],,,
> +-	[#include <sys/stat.h>])
> ++    [[#include <sys/stat.h>]])
> ++
> ++AC_CHECK_MEMBERS([struct statx.stx_mnt_id],,,
> ++    [[#include <linux/stat.h>]])
> + 
> + AC_CHECK_DECLS([_NL_TIME_WEEK_1STDAY],[],[],[[#include <langinfo.h>]])
> + 
> +diff --git a/libmount/src/hook_mount.c b/libmount/src/hook_mount.c
> +index d69a018ec..056338c49 100644
> +--- a/libmount/src/hook_mount.c
> ++++ b/libmount/src/hook_mount.c
> +@@ -294,6 +294,7 @@ static int hook_create_mount(struct libmnt_context *cxt,
> + 		/* cleanup after fail (libmount may only try the FS type) */
> + 		close_sysapi_fds(api);
> + 
> ++#if defined(HAVE_STRUCT_STATX) && defined(HAVE_STRUCT_STATX_STX_MNT_ID)
> + 	if (!rc && cxt->fs) {
> + 		struct statx st;
> + 
> +@@ -306,6 +307,7 @@ static int hook_create_mount(struct libmnt_context *cxt,
> + 				fs->id = cxt->fs->id;
> + 		}
> + 	}
> ++#endif
> + 
> + done:
> + 	DBG(HOOK, ul_debugobj(hs, "create FS done [rc=%d, id=%d]", rc, cxt->fs ? cxt->fs->id : -1));
> +-- 
> +2.39.2
> +
> -- 
> 2.39.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
Peter Korsgaard Sept. 12, 2023, 6:16 a.m. UTC | #2
>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

 > Waldemar, All,
 > On 2023-08-11 14:56 +0200, Waldemar Brodkorb spake thusly:
 >> Linux added mnt_id member to struct statx in commit:
 >> fa2fcf4f1df1559a0a4ee0f46915b496cc2ebf60
 >> 
 >> Linux 5.4.0 was released on 24. November 2019, but it seems this change
 >> never got backported to 5.4.252.
 >> 
 >> Upstream added a patch to guard the use of the member in commit:
 >> https://github.com/util-linux/util-linux/commit/c0136ac0c98b18208508fbcfac31a843e0bb8a37
 >> 
 >> Add the patch to fix an autobuild failure.
 >> 
 >> Fixes:
 >> - http://autobuild.buildroot.net/results/d50/d502bc9236b577e2470a30ffc39c21579b038a1c
 >> 
 >> Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>

 > Applied to master, thanks.

 > I tries to look when this strted to appear, but we do have quite a few
 > different kind of failrues for util-linux. But upstream added use of
 > mnt_id back in 2.38, so we can backport this to our maintenace branches,
 > which all have util-linux 2.38.

2.38 does not have libmount/src/hook_mount.c, so it cannot be directly
applicable to 2.38.

I'll skip it for now, but feel free to send a patch for 2.38 as well if
needed.
diff mbox series

Patch

diff --git a/package/util-linux/0001-libmount-ifdef-statx-call.patch b/package/util-linux/0001-libmount-ifdef-statx-call.patch
new file mode 100644
index 0000000000..ba44650bd3
--- /dev/null
+++ b/package/util-linux/0001-libmount-ifdef-statx-call.patch
@@ -0,0 +1,57 @@ 
+From c0136ac0c98b18208508fbcfac31a843e0bb8a37 Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak@redhat.com>
+Date: Thu, 3 Aug 2023 12:39:19 +0200
+Subject: [PATCH] libmount: ifdef statx() call
+
+In this case the statx() is use to get mount ID. It's optional and not
+required. Let's #ifdef the statx() call and also check for stx_mnt_id
+struct member.
+
+Fixes: https://github.com/util-linux/util-linux/issues/2415
+Signed-off-by: Karel Zak <kzak@redhat.com>
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+Upstream: https://github.com/util-linux/util-linux/commit/c0136ac0c98b18208508fbcfac31a843e0bb8a37
+---
+ configure.ac              | 5 ++++-
+ libmount/src/hook_mount.c | 2 ++
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index a3cf330b5..ae721c7ac 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -525,7 +525,10 @@ AC_CHECK_MEMBERS([struct termios.c_line],,,
+     [[#include <termios.h>]])
+ 
+ AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec],,,
+-	[#include <sys/stat.h>])
++    [[#include <sys/stat.h>]])
++
++AC_CHECK_MEMBERS([struct statx.stx_mnt_id],,,
++    [[#include <linux/stat.h>]])
+ 
+ AC_CHECK_DECLS([_NL_TIME_WEEK_1STDAY],[],[],[[#include <langinfo.h>]])
+ 
+diff --git a/libmount/src/hook_mount.c b/libmount/src/hook_mount.c
+index d69a018ec..056338c49 100644
+--- a/libmount/src/hook_mount.c
++++ b/libmount/src/hook_mount.c
+@@ -294,6 +294,7 @@ static int hook_create_mount(struct libmnt_context *cxt,
+ 		/* cleanup after fail (libmount may only try the FS type) */
+ 		close_sysapi_fds(api);
+ 
++#if defined(HAVE_STRUCT_STATX) && defined(HAVE_STRUCT_STATX_STX_MNT_ID)
+ 	if (!rc && cxt->fs) {
+ 		struct statx st;
+ 
+@@ -306,6 +307,7 @@ static int hook_create_mount(struct libmnt_context *cxt,
+ 				fs->id = cxt->fs->id;
+ 		}
+ 	}
++#endif
+ 
+ done:
+ 	DBG(HOOK, ul_debugobj(hs, "create FS done [rc=%d, id=%d]", rc, cxt->fs ? cxt->fs->id : -1));
+-- 
+2.39.2
+