Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/btrfs-progs: bump version to 6.9.2
@ 2024-07-14 12:49 Julien Olivain
  2024-07-14 13:16 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 2+ messages in thread
From: Julien Olivain @ 2024-07-14 12:49 UTC (permalink / raw)
  To: buildroot; +Cc: Julien Olivain

For change log since v5.16.2, see:
https://github.com/kdave/btrfs-progs/blob/v6.9.2/CHANGES

This commit also adds a _CONF_ENV when using a uClibc toolchain.
btrfs-progs is now using glibc printf functions, if the <printf.h>
header is present. uClibc provides this header, but not the functions.
This configuration environment variable will prevent the header of
being detected, which will make brtfs-progs to use a workaround.

This commit also adds a patch to fix compilation with gcc 5.x and 6.x.

Signed-off-by: Julien Olivain <ju.o@free.fr>
---
Patch tested on branch master at commit 804edd8 with command:

    utils/docker-run make check-package
    ...
    0 warnings generated

    utils/test-pkg -a -p btrfs-progs
    ...
    41 builds, 3 skipped, 0 build failed, 0 legal-info failed, 0 show-info failed

Also tested with the runtime test proposed at:
https://patchwork.ozlabs.org/project/buildroot/patch/20240713173149.346681-1-ju.o@free.fr/

Also tested host-btrfs-progs by building a qemu config with a btrfs rootfs.
(I'll probably write a fs runtime test later for that case...).
---
 ...compat-fix-fallthrough-definition-fo.patch | 63 +++++++++++++++++++
 package/btrfs-progs/btrfs-progs.hash          |  2 +-
 package/btrfs-progs/btrfs-progs.mk            | 13 +++-
 3 files changed, 76 insertions(+), 2 deletions(-)
 create mode 100644 package/btrfs-progs/0001-btrfs-progs-kerncompat-fix-fallthrough-definition-fo.patch

diff --git a/package/btrfs-progs/0001-btrfs-progs-kerncompat-fix-fallthrough-definition-fo.patch b/package/btrfs-progs/0001-btrfs-progs-kerncompat-fix-fallthrough-definition-fo.patch
new file mode 100644
index 0000000000..1bad695210
--- /dev/null
+++ b/package/btrfs-progs/0001-btrfs-progs-kerncompat-fix-fallthrough-definition-fo.patch
@@ -0,0 +1,63 @@
+From 156a9237fb31145a1f082fe13ff1866aafca5174 Mon Sep 17 00:00:00 2001
+From: Julien Olivain <ju.o@free.fr>
+Date: Sun, 14 Jul 2024 12:52:33 +0200
+Subject: [PATCH] btrfs-progs: kerncompat: fix fallthrough definition for gcc
+ 5.x and 6.x.
+
+Commit [1] 3a1d4aa089 "btrfs-progs: fix fallthrough cases with proper
+attributes" introduced a macro "fallthrough" to better handle compiler
+warnings of fallthrough situations.
+
+This macro is defined using the "__has_attribute" built-in
+function-like macro, which was introduced in GCC 5. See [2]. It then
+test for the "__fallthrough__" attribute, which was introduced in
+GCC 7. See [3].
+
+When compiling with a gcc version which supports "__has_attribute" and
+not the "__fallthrough__" attribute, compilation fails with error
+message:
+
+    common/format-output.c: In function 'print_escaped':
+    common/format-output.c:78:4: error: 'fallthrough' undeclared (first use in this function)
+        fallthrough;
+        ^
+btrfs-progs claim to support gcc at minimal version 4.8 in [4].
+
+This commit fixes this issue by adding the missing definition.
+
+The definition of the unsupported case is duplicated, because testing
+for "__has_attribute" and an attribute at the same time is not
+portable. See the cpp "__has_attribute" documentation [5].
+
+Note: the issue was found with Buildroot Linux [6], while testing with
+the command "utils/test-pkg -a -p btrfs-progs".
+
+[1] https://github.com/kdave/btrfs-progs/commit/3a1d4aa089419b7c94b31ff87122fa74907e1aa6
+[2] https://gcc.gnu.org/gcc-5/changes.html
+[3] https://gcc.gnu.org/gcc-7/changes.html
+[4] https://github.com/kdave/btrfs-progs/tree/v6.9.2#build-compatibility
+[5] https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html
+[6] https://buildroot.org/
+
+Signed-off-by: Julien Olivain <ju.o@free.fr>
+Upstream: Proposed: https://github.com/kdave/btrfs-progs/pull/842
+---
+ include/kerncompat.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/include/kerncompat.h b/include/kerncompat.h
+index 31cd9d8d..bcd46bde 100644
+--- a/include/kerncompat.h
++++ b/include/kerncompat.h
+@@ -305,6 +305,8 @@ static inline void up_read(struct rw_semaphore *sem)
+ #if defined __has_attribute
+ # if __has_attribute(__fallthrough__)
+ #  define fallthrough			__attribute__((__fallthrough__))
++# else
++#  define fallthrough			do {} while (0)  /* fallthrough */
+ # endif
+ #else
+ # define fallthrough			do {} while (0)  /* fallthrough */
+-- 
+2.45.2
+
diff --git a/package/btrfs-progs/btrfs-progs.hash b/package/btrfs-progs/btrfs-progs.hash
index 14eeb1ca07..082e8c1cdc 100644
--- a/package/btrfs-progs/btrfs-progs.hash
+++ b/package/btrfs-progs/btrfs-progs.hash
@@ -1,5 +1,5 @@
 # From https://www.kernel.org/pub/linux/kernel/people/kdave/btrfs-progs/sha256sums.asc
-sha256  9e9b303a1d0fd9ceaaf204ee74c1c8fa1fd55794e223d9fe2bc62875ecbd53d2  btrfs-progs-v5.16.2.tar.xz
+sha256  43865bb272dc0ab2585de3605434d81ba217578f0897bf700cd36c14ac40652a  btrfs-progs-v6.9.2.tar.xz
 # Locally computed
 sha256  0d5bf346df9e635a29dcdddf832dc5b002ca6cdc1c5c9c6c567d2a61bb0c5c15  COPYING
 sha256  dc626520dcd53a22f727af3ee42c770e56c97a64fe3adb063799d8ab032fe551  libbtrfsutil/COPYING
diff --git a/package/btrfs-progs/btrfs-progs.mk b/package/btrfs-progs/btrfs-progs.mk
index 9bf50ccfda..be8162fdcc 100644
--- a/package/btrfs-progs/btrfs-progs.mk
+++ b/package/btrfs-progs/btrfs-progs.mk
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-BTRFS_PROGS_VERSION = 5.16.2
+BTRFS_PROGS_VERSION = 6.9.2
 BTRFS_PROGS_SITE = $(BR2_KERNEL_MIRROR)/linux/kernel/people/kdave/btrfs-progs
 BTRFS_PROGS_SOURCE = btrfs-progs-v$(BTRFS_PROGS_VERSION).tar.xz
 BTRFS_PROGS_DEPENDENCIES = host-pkgconf lzo util-linux zlib
@@ -13,6 +13,17 @@ BTRFS_PROGS_LICENSE = GPL-2.0, LGPL-2.1+ (libbtrfsutil)
 BTRFS_PROGS_LICENSE_FILES = COPYING libbtrfsutil/COPYING
 BTRFS_PROGS_INSTALL_STAGING = YES
 
+# btrfs-progs uses the glibc register_printf_specifier() and
+# register_printf_modifier() functions, if the header <printf.h> is
+# detected at configure time. uClibc has this header, but does not
+# provide those functions. This leads to build failure. In case no
+# header is present, btrfs-progs is providing a workaround. We disable
+# the <printf.h> header detection for uClibc toolchains. Musl libc is
+# not impacted, because it does not provide a <printf.h> header.
+ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
+BTRFS_PROGS_CONF_ENV += ac_cv_header_printf_h=no
+endif
+
 # Doesn't autodetect static-only and tries to build both
 ifeq ($(BR2_STATIC_LIBS),y)
 BTRFS_PROGS_MAKE_OPTS = static
-- 
2.45.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/btrfs-progs: bump version to 6.9.2
  2024-07-14 12:49 [Buildroot] [PATCH 1/1] package/btrfs-progs: bump version to 6.9.2 Julien Olivain
@ 2024-07-14 13:16 ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-07-14 13:16 UTC (permalink / raw)
  To: Julien Olivain; +Cc: buildroot

Hello,

Thanks for the patch!

On Sun, 14 Jul 2024 14:49:10 +0200
Julien Olivain <ju.o@free.fr> wrote:

> +# btrfs-progs uses the glibc register_printf_specifier() and
> +# register_printf_modifier() functions, if the header <printf.h> is
> +# detected at configure time. uClibc has this header, but does not
> +# provide those functions. This leads to build failure. In case no
> +# header is present, btrfs-progs is providing a workaround. We disable
> +# the <printf.h> header detection for uClibc toolchains. Musl libc is
> +# not impacted, because it does not provide a <printf.h> header.
> +ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
> +BTRFS_PROGS_CONF_ENV += ac_cv_header_printf_h=no
> +endif

Then what about improving the configure.ac detection logic to not check
for printf.h but rather the availability of register_printf_specifier()
and register_printf_modifier() ? This would be the right thing to do in
this situation.

Do you think you could have a look into this?

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-07-14 13:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-14 12:49 [Buildroot] [PATCH 1/1] package/btrfs-progs: bump version to 6.9.2 Julien Olivain
2024-07-14 13:16 ` Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox