From 80ee1a2612b5bafb358c5015d68d9ac6fa61c17b Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Fri, 22 Sep 2023 16:01:36 +0200 Subject: [PATCH 1/5] composefs-info: Fix warnings about unused asprintf return value Signed-off-by: Alexander Larsson --- tools/composefs-info.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/composefs-info.c b/tools/composefs-info.c index cf2e553f..ca421329 100644 --- a/tools/composefs-info.c +++ b/tools/composefs-info.c @@ -107,8 +107,11 @@ static void print_node(struct lcfs_node_s *node, char *parent_path) for (size_t i = 0; i < lcfs_node_get_n_children(node); i++) { struct lcfs_node_s *child = lcfs_node_get_child(node, i); cleanup_free char *path = NULL; + int r; - asprintf(&path, "%s/%s", parent_path, lcfs_node_get_name(child)); + r = asprintf(&path, "%s/%s", parent_path, lcfs_node_get_name(child)); + if (r < 0) + oom(); uint32_t mode = lcfs_node_get_mode(child); uint32_t type = mode & S_IFMT; @@ -198,8 +201,11 @@ static void dump_node(struct lcfs_node_s *node, char *path) for (size_t i = 0; i < lcfs_node_get_n_children(node); i++) { struct lcfs_node_s *child = lcfs_node_get_child(node, i); cleanup_free char *child_path = NULL; + int r; - asprintf(&child_path, "%s/%s", path, lcfs_node_get_name(child)); + r = asprintf(&child_path, "%s/%s", path, lcfs_node_get_name(child)); + if (r < 0) + oom(); dump_node(child, child_path); } From 50892ccdfd6f46a5479b92ce4938b7b1b1688d45 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Fri, 22 Sep 2023 16:02:48 +0200 Subject: [PATCH 2/5] Fix distcheck and srcdir!=builddir checks Signed-off-by: Alexander Larsson --- tests/Makefile.am | 10 +++++++++- tests/test-checksums.sh | 2 +- tests/test-random-fuse.sh | 10 +++++----- tests/test-units.sh | 2 +- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 070152e7..a01c927b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -9,7 +9,15 @@ if ENABLE_VALGRIND VALGRIND_PREFIX=libtool --mode=execute ${VALGRIND} --quiet --leak-check=yes --error-exitcode=42 endif -EXTRA_DIST = test-checksums.sh $(patsubst %,assets/%,${TEST_ASSETS_SMALL}) $(patsubst %,assets/%.sha256_erofs,${TEST_ASSETS_SMALL}) +EXTRA_DIST = \ + gendir \ + dumpdir \ + test-lib.sh \ + test-units.sh \ + test-random-fuse.sh \ + test-checksums.sh \ + integration.sh \ + $(patsubst %,assets/%,${TEST_ASSETS_SMALL}) $(patsubst %,assets/%.sha256_erofs,${TEST_ASSETS_SMALL}) check-checksums: VALGRIND_PREFIX="${VALGRIND_PREFIX}" $(srcdir)/test-checksums.sh "$(builddir)/../tools/" "$(srcdir)/assets" "${TEST_ASSETS}" diff --git a/tests/test-checksums.sh b/tests/test-checksums.sh index c9acde55..97f12b82 100755 --- a/tests/test-checksums.sh +++ b/tests/test-checksums.sh @@ -4,7 +4,7 @@ BINDIR="$1" ASSET_DIR="$2" TEST_ASSETS="$3" -. test-lib.sh +. $(dirname $0)/test-lib.sh has_fsck=$(check_erofs_fsck) diff --git a/tests/test-random-fuse.sh b/tests/test-random-fuse.sh index 6c93dda5..dabf2111 100755 --- a/tests/test-random-fuse.sh +++ b/tests/test-random-fuse.sh @@ -12,7 +12,7 @@ exit_cleanup() { trap exit_cleanup EXIT -. test-lib.sh +. $(dirname $0)/test-lib.sh GENDIRARGS="" if [ ${can_whiteout} == "n" ]; then @@ -25,8 +25,8 @@ fi test_random() { echo Generating root dir - ./gendir $GENDIRARGS $workdir/root - ./dumpdir --userxattr --whiteout $workdir/root > $workdir/root.dump + $(dirname $0)/gendir $GENDIRARGS $workdir/root + $(dirname $0)/dumpdir --userxattr --whiteout $workdir/root > $workdir/root.dump echo Generating composefs image ${VALGRIND_PREFIX} ${BINDIR}/mkcomposefs --digest-store=$workdir/objects $workdir/root $workdir/root.cfs if [ $has_fsck == y ]; then @@ -49,7 +49,7 @@ test_random() { mkdir -p $workdir/mnt echo Mounting composefs image using fuse ${BINDIR}/composefs-fuse -o source=$workdir/root.cfs,basedir=$workdir/objects $workdir/mnt - ./dumpdir --userxattr --whiteout $workdir/mnt > $workdir/fuse.dump + $(dirname $0)/dumpdir --userxattr --whiteout $workdir/mnt > $workdir/fuse.dump ${VALGRIND_PREFIX} ${BINDIR}/mkcomposefs --digest-store=$workdir/objects $workdir/mnt $workdir/fuse.cfs if [ $has_fsck == y ]; then @@ -65,7 +65,7 @@ test_random() { fi ${BINDIR}/composefs-fuse -o source=$workdir/fuse.cfs,basedir=$workdir/objects $workdir/mnt - ./dumpdir --userxattr --whiteout $workdir/mnt > $workdir/fuse2.dump + $(dirname $0)/dumpdir --userxattr --whiteout $workdir/mnt > $workdir/fuse2.dump umount $workdir/mnt # fuse.cfs and fuse2.cfs files differ due to whiteout conversions and non-user xattrs. diff --git a/tests/test-units.sh b/tests/test-units.sh index f0381a78..c10b5be3 100755 --- a/tests/test-units.sh +++ b/tests/test-units.sh @@ -7,7 +7,7 @@ set -e workdir=$(mktemp -d /var/tmp/lcfs-test.XXXXXX) trap 'rm -rf -- "$workdir"' EXIT -. test-lib.sh +. $(dirname $0)/test-lib.sh function makeimage () { local dir=$1 From 4e29478ade5f1a8322e3c9a0aa1d2fb6bf25fe60 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Fri, 22 Sep 2023 16:03:30 +0200 Subject: [PATCH 3/5] Ensure manpages are properly installed Signed-off-by: Alexander Larsson --- Makefile.am | 21 +++++++++++++++++---- configure.ac | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index 55580dc2..9a98213c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,14 +1,27 @@ SUBDIRS=libcomposefs tools tests +CLEANFILES= + +MANPAGES=\ + man/mount.composefs.md \ + man/mkcomposefs.md + EXTRA_DIST=\ composefs.pc.in \ composefs.spec.in \ - composefs.spec + composefs.spec \ + ${MANPAGES} pkgconfig_DATA = composefs.pc +if ENABLE_MAN + man/%.1: man/%.md - pandoc $+ -s -t man > $@ + mkdir -p man + ${PANDOC} $+ -s -t man > $@ + +man1_MANS = $(MANPAGES:.md=.1) + +CLEANFILES += ${man1_MANS} -install-man: man/mount.composefs.1 man/mkcomposefs.1 - install -m 644 -D --target-directory=$(DESTDIR)$(mandir)/man1 $^ +endif diff --git a/configure.ac b/configure.ac index 67fa2ded..cf2768e1 100644 --- a/configure.ac +++ b/configure.ac @@ -69,6 +69,24 @@ AC_DEFUN([CC_CHECK_FLAGS_APPEND], [ done ]) +AC_ARG_ENABLE(man, + [AS_HELP_STRING([--enable-man], + [generate man pages [default=auto]])],, + enable_man=maybe) + +AS_IF([test "$enable_man" != no], [ + AC_PATH_PROG([PANDOC], [pandoc]) + AS_IF([test -z "$PANDOC"], [ + AS_IF([test "$enable_man" = yes], [ + AC_MSG_ERROR([pandoc is required for --enable-man]) + ]) + enable_man=no + ],[ + enable_man=yes + ]) +]) +AM_CONDITIONAL(ENABLE_MAN, test "$enable_man" != no) + ################################################## # Visibility handling ################################################## From 22d0730091f351bac707f3ffbc012e256f5ab86e Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Fri, 22 Sep 2023 16:04:37 +0200 Subject: [PATCH 4/5] Update specfile for release Signed-off-by: Alexander Larsson --- composefs.spec.in | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/composefs.spec.in b/composefs.spec.in index 134842f1..4401a506 100644 --- a/composefs.spec.in +++ b/composefs.spec.in @@ -7,7 +7,7 @@ License: GPLv2+ URL: https://github.com/containers/composefs Source0: https://github.com/containers/composefs/releases/download/%{version}/%{name}-%{version}.tar.xz -BuildRequires: gcc automake libtool openssl-devel yajl-devel +BuildRequires: gcc automake libtool openssl-devel yajl-devel pandoc fuse3-devel Requires: %{name}-libs = %{version}-%{release} %description @@ -31,8 +31,10 @@ Library files for %{name}. %build %configure \ - --disable-static - + --disable-static \ + --enable-man \ + --with-yajl \ + --with-fuse %make_build %install @@ -51,7 +53,9 @@ rm -rf %{buildroot}%{_libdir}/libcomposefs.la %license COPYING COPYING.LIB %doc README.md %{_bindir}/mkcomposefs +%{_bindir}/composefs-info %{_sbindir}/mount.composefs +%{_mandir}/man*/*.gz %changelog * Fri Apr 21 2023 Alexander Larsson From 951adcc337df5c159957a405389190974598450c Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Fri, 22 Sep 2023 14:45:00 +0200 Subject: [PATCH 5/5] Bump version to 0.9.0 This is the first stable release of composefs. Starting now, we guarantee a stable library ABI and a binary stable file format. The later means that any image build from an identical lcfs_node tree and identical write options, will produce a file that is binary identical to a later run even with a different version. The same is true for an mkcomposefs run with the same options. Major changes since 0.1.4: * All required overlayfs xattr changes are now upstream and the corresponding image generation changes have been made in composefs. This includes support for escaping overlayfs xattrs and whiteouts for nested overlayfs mounts. * fs-verity built-in signature support was dropped in favour of userspace signatures. * The erofs iamges now uses the new bloom filter for faster xattr lookups. This is backward compatible and old erofs version still work (sans the speedup). * Files can now be inlined in the erofs image to avoid overhead of using redirections for small files. * There is a new API to regenerate a lcfs_node tree from a composefs image file. * There is a new composefs-info tool that lets you dump info about images, including what objects it refers to and which ones are missing from a given basedir. * Various fixes, cleanups and new tests Signed-off-by: Alexander Larsson --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index cf2768e1..2ac8ef31 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ([2.69]) -AC_INIT([composefs], [0.1.4], [giuseppe@scrivano.org]) +AC_INIT([composefs], [0.9.0], [giuseppe@scrivano.org]) AC_CONFIG_SRCDIR([tools/mkcomposefs.c]) AC_CONFIG_HEADERS([config.h]) AC_SYS_LARGEFILE