Explorar el Código

package/btrfs-progs: bump version to 6.9.2

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

This commit also adds two patches:
- one to fix compilation with gcc 5.x and 6.x.
- another to fix compilation with uClibc-ng

Signed-off-by: Julien Olivain <ju.o@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Julien Olivain hace 1 año
padre
commit
522f3dd479

+ 63 - 0
package/btrfs-progs/0001-btrfs-progs-kerncompat-fix-fallthrough-definition-fo.patch

@@ -0,0 +1,63 @@
+From 0d2bf742df7f6b6d91fff8abe3c2f8b6ef0e0c01 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/
+
+Upstream: Proposed: https://github.com/kdave/btrfs-progs/pull/842
+Signed-off-by: Julien Olivain <ju.o@free.fr>
+---
+ 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
+

+ 85 - 0
package/btrfs-progs/0002-btrfs-progs-add-uClibc-ng-compatibility-for-printf-f.patch

@@ -0,0 +1,85 @@
+From 0f34a362c8644f212138fb8de8e0fba54941e757 Mon Sep 17 00:00:00 2001
+From: Julien Olivain <ju.o@free.fr>
+Date: Sun, 14 Jul 2024 16:28:08 +0200
+Subject: [PATCH] btrfs-progs: add uClibc-ng compatibility for printf format
+ %pV
+
+Commit [1] 164bc10d "btrfs-progs: add musl compatibility for printf
+format %pV" added a logic to detect the presence of the glibc
+<printf.h> header, and if present, to use the
+register_printf_specifier() and register_printf_modifier() functions.
+
+The original intent (as the commit log suggests), was to support the
+musl libc, which does not provides this <printf.h> header.
+
+When compiling with another libc, such as uClibc-ng, btrfs-progs fail
+to build with error:
+
+    common/messages.c: In function 'print_va_format':
+    common/messages.c:51:19: error: 'const struct printf_info' has no member named 'user'
+       51 |         if (!(info->user & va_modifier))
+          |                   ^~
+    common/messages.c: In function 'btrfs_no_printk':
+    common/messages.c:76:17: warning: implicit declaration of function 'register_printf_specifier'; did you mean 'register_printf_function'? [-Wimplicit-function-declaration]
+       76 |                 register_printf_specifier('V', print_va_format,
+          |                 ^~~~~~~~~~~~~~~~~~~~~~~~~
+          |                 register_printf_function
+    common/messages.c:78:31: warning: implicit declaration of function 'register_printf_modifier'; did you mean 'register_printf_function'? [-Wimplicit-function-declaration]
+       78 |                 va_modifier = register_printf_modifier(L"p");
+          |                               ^~~~~~~~~~~~~~~~~~~~~~~~
+          |                               register_printf_function
+
+This is because uClibc-ng provides a <printf.h> header, but not the
+register_printf_specifier() and register_printf_modifier() functions.
+See [2]. It mainly includes register_printf_function(). uClibc-ng
+emulates an older glibc behavior. Glibc added support for printf user
+elements in commit [3] (first included in glibc-2.10, in 2009). Checking
+only the <printf.h> is not sufficient.
+
+This commit fixes this build issue by refining the detection logic of
+the <printf.h> functions required by btrfs-progs.
+
+[1] https://github.com/kdave/btrfs-progs/commit/164bc10dfc08d8754d23ef0d6d7281e139d6cd53
+[2] https://gogs.waldemar-brodkorb.de/oss/uclibc-ng/src/v1.0.49/include/printf.h
+[3] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=9d26efa90c6dcbcd6b3e586c9927b6058ef4d529
+
+Upstream: Proposed: https://github.com/kdave/btrfs-progs/pull/843
+Signed-off-by: Julien Olivain <ju.o@free.fr>
+---
+ common/messages.h | 4 +++-
+ configure.ac      | 4 ++++
+ 2 files changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/common/messages.h b/common/messages.h
+index d6d4044d..aced7c9b 100644
+--- a/common/messages.h
++++ b/common/messages.h
+@@ -25,7 +25,9 @@
+ /*
+  * Workaround for custom format %pV that may not be supported on all libcs.
+  */
+-#ifdef HAVE_PRINTF_H
++#if defined(HAVE_PRINTF_H) \
++	&& defined(HAVE_REGISTER_PRINTF_SPECIFIER) \
++	&& defined(HAVE_REGISTER_PRINTF_MODIFIER)
+ #define DECLARE_PV(name)		struct va_format name
+ #define PV_FMT				"%pV"
+ #define PV_VAL(va)			&va
+diff --git a/configure.ac b/configure.ac
+index b69973b3..62b88973 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -95,6 +95,10 @@ AC_CHECK_HEADERS([linux/hw_breakpoint.h])
+ AC_CHECK_HEADERS([linux/fsverity.h])
+ AC_CHECK_HEADERS([printf.h])
+ 
++dnl Check for printf.h functions.
++AC_CHECK_FUNCS([register_printf_specifier])
++AC_CHECK_FUNCS([register_printf_modifier])
++
+ if grep -q 'HAVE_LINUX_FSVERITY_H.*1' confdefs.h; then
+ 	have_fsverity='yes'
+ else
+-- 
+2.45.2
+

+ 1 - 1
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

+ 4 - 1
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,9 @@ BTRFS_PROGS_LICENSE = GPL-2.0, LGPL-2.1+ (libbtrfsutil)
 BTRFS_PROGS_LICENSE_FILES = COPYING libbtrfsutil/COPYING
 BTRFS_PROGS_INSTALL_STAGING = YES
 
+# 0002-btrfs-progs-add-uClibc-ng-compatibility-for-printf-f.patch
+BTRFS_PROGS_AUTORECONF = YES
+
 # Doesn't autodetect static-only and tries to build both
 ifeq ($(BR2_STATIC_LIBS),y)
 BTRFS_PROGS_MAKE_OPTS = static