[Buildroot] [PATCH] package/erofs-utils: bump version to 1.2

Gao Xiang hsiangkao at aol.com
Thu Dec 17 09:33:56 UTC 2020


- add selinux support;
- add erofsfuse support;
- add 0001-erofs-utils-fix-multiple-definition-of-sbi.patch [1];
- add 0002-erofs-utils-fuse-fix-linking-when-using-with-selinux.patch [2];
- add 0003-erofs-utils-fuse-disable-backtrace-if-unsupported.patch.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git/patch/?id=6c938b755682629a26f85e5540f40c0d316130ed
[2] https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git/patch/?id=f1f9659e98ea925a100e50332309955f5b2b4234

Signed-off-by: Gao Xiang <hsiangkao at aol.com>
---
build regression fixes are included.

 ...utils-fix-multiple-definition-of-sbi.patch | 62 ++++++++++++++
 ...-fix-linking-when-using-with-selinux.patch | 33 ++++++++
 ...use-disable-backtrace-if-unsupported.patch | 82 +++++++++++++++++++
 package/erofs-utils/Config.in                 | 11 +++
 package/erofs-utils/erofs-utils.hash          |  2 +-
 package/erofs-utils/erofs-utils.mk            | 18 +++-
 6 files changed, 205 insertions(+), 3 deletions(-)
 create mode 100644 package/erofs-utils/0001-erofs-utils-fix-multiple-definition-of-sbi.patch
 create mode 100644 package/erofs-utils/0002-erofs-utils-fuse-fix-linking-when-using-with-selinux.patch
 create mode 100644 package/erofs-utils/0003-erofs-utils-fuse-disable-backtrace-if-unsupported.patch

diff --git a/package/erofs-utils/0001-erofs-utils-fix-multiple-definition-of-sbi.patch b/package/erofs-utils/0001-erofs-utils-fix-multiple-definition-of-sbi.patch
new file mode 100644
index 000000000000..374c9ab72db4
--- /dev/null
+++ b/package/erofs-utils/0001-erofs-utils-fix-multiple-definition-of-sbi.patch
@@ -0,0 +1,62 @@
+From 6c938b755682629a26f85e5540f40c0d316130ed Mon Sep 17 00:00:00 2001
+From: Gao Xiang <hsiangkao at aol.com>
+Date: Tue, 8 Dec 2020 18:57:41 +0800
+Subject: erofs-utils: fix multiple definition of `sbi'
+
+As nl6720 reported [1], lib/inode.o (mkfs) and lib/super.o (erofsfuse)
+could be compiled together by some options. Fix it now.
+
+[1] https://lore.kernel.org/r/10789285.Na0ui7I3VY@walnut
+
+Link: https://lore.kernel.org/r/20201208105741.9614-1-hsiangkao@aol.com
+Fixes: 5e35b75ad499 ("erofs-utils: introduce fuse implementation")
+Reported-by: nl6720 <nl6720 at gmail.com>
+Reviewed-by: Li Guifu <bluce.lee at aliyun.com>
+Signed-off-by: Gao Xiang <hsiangkao at aol.com>
+---
+ lib/config.c | 1 +
+ lib/inode.c  | 2 --
+ lib/super.c  | 2 --
+ 3 files changed, 1 insertion(+), 4 deletions(-)
+
+diff --git a/lib/config.c b/lib/config.c
+index 3155112..3ecd481 100644
+--- a/lib/config.c
++++ b/lib/config.c
+@@ -11,6 +11,7 @@
+ #include "erofs/internal.h"
+ 
+ struct erofs_configure cfg;
++struct erofs_sb_info sbi;
+ 
+ void erofs_init_configure(void)
+ {
+diff --git a/lib/inode.c b/lib/inode.c
+index 3d634fc..0c4839d 100644
+--- a/lib/inode.c
++++ b/lib/inode.c
+@@ -22,8 +22,6 @@
+ #include "erofs/xattr.h"
+ #include "erofs/exclude.h"
+ 
+-struct erofs_sb_info sbi;
+-
+ #define S_SHIFT                 12
+ static unsigned char erofs_ftype_by_mode[S_IFMT >> S_SHIFT] = {
+ 	[S_IFREG >> S_SHIFT]  = EROFS_FT_REG_FILE,
+diff --git a/lib/super.c b/lib/super.c
+index 2d36692..025cefe 100644
+--- a/lib/super.c
++++ b/lib/super.c
+@@ -11,8 +11,6 @@
+ #include "erofs/io.h"
+ #include "erofs/print.h"
+ 
+-struct erofs_sb_info sbi;
+-
+ static bool check_layout_compatibility(struct erofs_sb_info *sbi,
+ 				       struct erofs_super_block *dsb)
+ {
+-- 
+cgit 1.2.3-1.el7
+
diff --git a/package/erofs-utils/0002-erofs-utils-fuse-fix-linking-when-using-with-selinux.patch b/package/erofs-utils/0002-erofs-utils-fuse-fix-linking-when-using-with-selinux.patch
new file mode 100644
index 000000000000..bea3168b53da
--- /dev/null
+++ b/package/erofs-utils/0002-erofs-utils-fuse-fix-linking-when-using-with-selinux.patch
@@ -0,0 +1,33 @@
+From f1f9659e98ea925a100e50332309955f5b2b4234 Mon Sep 17 00:00:00 2001
+From: David Michael <fedora.dm0 at gmail.com>
+Date: Thu, 10 Dec 2020 21:29:43 -0500
+Subject: erofs-utils: fuse: fix linking when using --with-selinux
+
+The libselinux functions selabel_open and selabel_close are called
+by lib/config.c, so include libselinux in CFLAGS and LIBS to fix
+building erofsfuse.
+
+Link: https://lore.kernel.org/r/87360dnkh4.fsf@gmail.com
+Signed-off-by: David Michael <fedora.dm0 at gmail.com>
+Reviewed-and-tested-by: Li Guifu <bluce.lee at aliyun.com>
+Signed-off-by: Gao Xiang <hsiangkao at aol.com>
+---
+ fuse/Makefile.am | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/fuse/Makefile.am b/fuse/Makefile.am
+index f14f6fd..e7757bc 100644
+--- a/fuse/Makefile.am
++++ b/fuse/Makefile.am
+@@ -5,6 +5,6 @@ AUTOMAKE_OPTIONS = foreign
+ bin_PROGRAMS     = erofsfuse
+ erofsfuse_SOURCES = dir.c main.c
+ erofsfuse_CFLAGS = -Wall -Werror -I$(top_srcdir)/include
+-erofsfuse_CFLAGS += -DFUSE_USE_VERSION=26 ${libfuse_CFLAGS}
+-erofsfuse_LDADD = $(top_builddir)/lib/liberofs.la ${libfuse_LIBS} ${liblz4_LIBS}
++erofsfuse_CFLAGS += -DFUSE_USE_VERSION=26 ${libfuse_CFLAGS} ${libselinux_CFLAGS}
++erofsfuse_LDADD = $(top_builddir)/lib/liberofs.la ${libfuse_LIBS} ${liblz4_LIBS} ${libselinux_LIBS}
+ 
+-- 
+cgit 1.2.3-1.el7
+
diff --git a/package/erofs-utils/0003-erofs-utils-fuse-disable-backtrace-if-unsupported.patch b/package/erofs-utils/0003-erofs-utils-fuse-disable-backtrace-if-unsupported.patch
new file mode 100644
index 000000000000..4881df30c423
--- /dev/null
+++ b/package/erofs-utils/0003-erofs-utils-fuse-disable-backtrace-if-unsupported.patch
@@ -0,0 +1,82 @@
+From 833563ffd3126b6e85fc54402c6d68c29a30264c Mon Sep 17 00:00:00 2001
+From: Gao Xiang <hsiangkao at aol.com>
+Date: Thu, 17 Dec 2020 16:59:04 +0800
+Subject: [PATCH] erofs-utils: fuse: disable backtrace if unsupported
+
+backtrace is a GNU extension, enable it conditionally.
+
+Signed-off-by: Gao Xiang <hsiangkao at aol.com>
+---
+ configure.ac | 3 ++-
+ fuse/main.c  | 8 ++++++--
+ 2 files changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index d5fdfb8a3d17..28926c303c5c 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -96,6 +96,7 @@ AC_ARG_VAR([LZ4_LIBS], [linker flags for lz4])
+ # Checks for header files.
+ AC_CHECK_HEADERS(m4_flatten([
+ 	dirent.h
++	execinfo.h
+ 	fcntl.h
+ 	getopt.h
+ 	inttypes.h
+@@ -147,7 +148,7 @@ AC_CHECK_DECL(lseek64,[AC_DEFINE(HAVE_LSEEK64_PROTOTYPE, 1,
+    #include <unistd.h>])
+ 
+ # Checks for library functions.
+-AC_CHECK_FUNCS([fallocate gettimeofday memset realpath strdup strerror strrchr strtoull])
++AC_CHECK_FUNCS([backtrace fallocate gettimeofday memset realpath strdup strerror strrchr strtoull])
+ 
+ # Configure libuuid
+ AS_IF([test "x$with_uuid" != "xno"], [
+diff --git a/fuse/main.c b/fuse/main.c
+index 1e24efe110c2..c16291272e75 100644
+--- a/fuse/main.c
++++ b/fuse/main.c
+@@ -6,7 +6,6 @@
+  */
+ #include <stdlib.h>
+ #include <string.h>
+-#include <execinfo.h>
+ #include <signal.h>
+ #include <libgen.h>
+ #include <fuse.h>
+@@ -168,6 +167,9 @@ static int optional_opt_func(void *data, const char *arg, int key,
+ 	return 1;
+ }
+ 
++#if defined(HAVE_EXECINFO_H) && defined(HAVE_BACKTRACE)
++#include <execinfo.h>
++
+ static void signal_handle_sigsegv(int signal)
+ {
+ 	void *array[10];
+@@ -187,7 +189,7 @@ static void signal_handle_sigsegv(int signal)
+ 	erofs_dump("========================================\n");
+ 	abort();
+ }
+-
++#endif
+ 
+ int main(int argc, char *argv[])
+ {
+@@ -197,11 +199,13 @@ int main(int argc, char *argv[])
+ 	erofs_init_configure();
+ 	fprintf(stderr, "%s %s\n", basename(argv[0]), cfg.c_version);
+ 
++#if defined(HAVE_EXECINFO_H) && defined(HAVE_BACKTRACE)
+ 	if (signal(SIGSEGV, signal_handle_sigsegv) == SIG_ERR) {
+ 		fprintf(stderr, "failed to initialize signals\n");
+ 		ret = -errno;
+ 		goto err;
+ 	}
++#endif
+ 
+ 	/* parse options */
+ 	ret = fuse_opt_parse(&args, &fusecfg, option_spec, optional_opt_func);
+-- 
+2.24.0
+
diff --git a/package/erofs-utils/Config.in b/package/erofs-utils/Config.in
index ffb2a891d8d6..741501d40b97 100644
--- a/package/erofs-utils/Config.in
+++ b/package/erofs-utils/Config.in
@@ -15,4 +15,15 @@ config BR2_PACKAGE_EROFS_UTILS_LZ4
 	help
 	  Support LZ4 compression algorithm
 
+config BR2_PACKAGE_EROFS_UTILS_EROFSFUSE
+	bool "erofsfuse support"
+	depends on !BR2_STATIC_LIBS # libfuse
+	depends on BR2_TOOLCHAIN_HAS_THREADS # libfuse
+	select BR2_PACKAGE_LIBFUSE
+	help
+	  FUSE file system client for EROFS
+
+comment "erofsfuse needs a toolchain w/ threads, dynamic library"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
+
 endif
diff --git a/package/erofs-utils/erofs-utils.hash b/package/erofs-utils/erofs-utils.hash
index 31624b1817be..cd29ea96ff0a 100644
--- a/package/erofs-utils/erofs-utils.hash
+++ b/package/erofs-utils/erofs-utils.hash
@@ -1,3 +1,3 @@
 # Locally computed
-sha256 a14a30d0d941f6642cad130fbba70a2493fabbe7baa09a8ce7d20745ea3385d6  erofs-utils-1.1.tar.gz
+sha256 b3f65a6b6d8b1dc37694e083e01492041619100211757564adc851e327f1553c  erofs-utils-1.2.tar.gz
 sha256 feee3b3157dcdf78d4f50edefbd5dd7adf8b6d52c11bfaaa746a85a373256713  COPYING
diff --git a/package/erofs-utils/erofs-utils.mk b/package/erofs-utils/erofs-utils.mk
index edc5288b1b56..d4e719470eda 100644
--- a/package/erofs-utils/erofs-utils.mk
+++ b/package/erofs-utils/erofs-utils.mk
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-EROFS_UTILS_VERSION = 1.1
+EROFS_UTILS_VERSION = 1.2
 EROFS_UTILS_SITE = https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git/snapshot
 EROFS_UTILS_LICENSE = GPL-2.0+
 EROFS_UTILS_LICENSE_FILES = COPYING
@@ -21,8 +21,22 @@ else
 EROFS_UTILS_CONF_OPTS += --disable-lz4
 endif
 
+ifeq ($(BR2_PACKAGE_LIBSELINUX),y)
+EROFS_UTILS_CONF_OPTS += --with-selinux
+EROFS_UTILS_DEPENDENCIES += libselinux
+else
+EROFS_UTILS_CONF_OPTS += --without-selinux
+endif
+
+ifeq ($(BR2_PACKAGE_EROFS_UTILS_EROFSFUSE),y)
+EROFS_UTILS_CONF_OPTS += --enable-fuse
+EROFS_UTILS_DEPENDENCIES += libfuse
+else
+EROFS_UTILS_CONF_OPTS += --disable-fuse
+endif
+
 HOST_EROFS_UTILS_DEPENDENCIES = host-pkgconf host-util-linux host-lz4
-HOST_EROFS_UTILS_CONF_OPTS += --enable-lz4
+HOST_EROFS_UTILS_CONF_OPTS += --enable-lz4 --disable-fuse --without-selinux
 
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
-- 
2.24.0



More information about the buildroot mailing list