From 70ccfa5b4bf5c31e975fda1e79b21e943f5ad5b1 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Tue, 3 Dec 2024 23:56:57 -0500 Subject: [PATCH] debian: update debian/patches for 1.47.2~rc1-2 Signed-off-by: Theodore Ts'o --- ...ithout-libarchive-and-HAVE_ARCHIVE_H.patch | 162 ++++++++++++++++++ ...ow-specifying-the-revision-1-via-r-1.patch | 57 ++++++ ...ndian-support-for-orphan_file-file-s.patch | 85 +++++++++ debian/patches/0004-More-reease-note-updates | 48 ++++++ debian/patches/series | 4 + 5 files changed, 356 insertions(+) create mode 100644 debian/patches/0001-Decouple-without-libarchive-and-HAVE_ARCHIVE_H.patch create mode 100644 debian/patches/0002-mke2fs-allow-specifying-the-revision-1-via-r-1.patch create mode 100644 debian/patches/0003-e2fsck-fix-big-endian-support-for-orphan_file-file-s.patch create mode 100644 debian/patches/0004-More-reease-note-updates create mode 100644 debian/patches/series diff --git a/debian/patches/0001-Decouple-without-libarchive-and-HAVE_ARCHIVE_H.patch b/debian/patches/0001-Decouple-without-libarchive-and-HAVE_ARCHIVE_H.patch new file mode 100644 index 000000000..4209e71c0 --- /dev/null +++ b/debian/patches/0001-Decouple-without-libarchive-and-HAVE_ARCHIVE_H.patch @@ -0,0 +1,162 @@ +From: Johannes Schauer Marin Rodrigues +Subject: Decouple --without-libarchive and HAVE_ARCHIVE_H + +To aid bootstrapping, it would be useful to be able to build e2fsprogs +without archive.h as otherwise there is a build dependency loop with +libarchive. If archive.h is not present, add the missing forward +declarations (as opaque structs) and preprocessor definitions and +typedefs. Since this allows building e2fsprogs with libarchive support +even without the archive.h header present on the system, we cannot check +HAVE_ARCHIVE_H anymore to decide whether to build with libarchive +support or not. So if --without-libarchive is passed to ./configure, +CONFIG_DISABLE_LIBARCHIVE gets set and later checked to decide about +libarchive support. + +Origin: upstream +Addresses-Debian-Bug: #1078693 +--- + configure | 3 +++ + configure.ac | 2 ++ + lib/config.h.in | 3 +++ + misc/create_inode_libarchive.c | 46 ++++++++++++++++++++++++++-------- + 5 files changed, 44 insertions(+), 12 deletions(-) + +diff --git a/configure b/configure +index e299be028..f9a7aa4e2 100755 +--- a/configure ++++ b/configure +@@ -13750,6 +13750,9 @@ then + try_libarchive="" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Disabling libarchive support" >&5 + printf "%s\n" "Disabling libarchive support" >&6; } ++ ++printf "%s\n" "#define CONFIG_DISABLE_LIBARCHIVE 1" >>confdefs.h ++ + elif test "$withval" = "direct" + then + try_libarchive="direct" +diff --git a/configure.ac b/configure.ac +index 9a3dff1cf..1f6760403 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1312,6 +1312,8 @@ AS_HELP_STRING([--without-libarchive],[disable use of libarchive]), + then + try_libarchive="" + AC_MSG_RESULT([Disabling libarchive support]) ++ AC_DEFINE(CONFIG_DISABLE_LIBARCHIVE, 1, ++ [Define to 1 to completely disable libarchive]) + elif test "$withval" = "direct" + then + try_libarchive="direct" +diff --git a/lib/config.h.in b/lib/config.h.in +index 04cec72b8..819c43313 100644 +--- a/lib/config.h.in ++++ b/lib/config.h.in +@@ -12,6 +12,9 @@ + /* Define to 1 for features for use by ext4 developers */ + #undef CONFIG_DEVELOPER_FEATURES + ++/* Define to 1 to completely disable libarchive */ ++#undef CONFIG_DISABLE_LIBARCHIVE ++ + /* Define to 1 if using dlopen to access libarchive */ + #undef CONFIG_DLOPEN_LIBARCHIVE + +diff --git a/misc/create_inode_libarchive.c b/misc/create_inode_libarchive.c +index ff697f4c8..d14efe81d 100644 +--- a/misc/create_inode_libarchive.c ++++ b/misc/create_inode_libarchive.c +@@ -13,20 +13,50 @@ + #define _GNU_SOURCE 1 + + #include "config.h" +-#include + #include "create_inode.h" + #include "create_inode_libarchive.h" + #include "support/nls-enable.h" + +-#ifdef HAVE_ARCHIVE_H ++#ifdef CONFIG_DISABLE_LIBARCHIVE ++ ++/* If ./configure was run with --without-libarchive, then only ++ * __populate_fs_from_tar() remains in this file and will return an error. */ ++errcode_t __populate_fs_from_tar(ext2_filsys, ext2_ino_t, const char *, ++ ext2_ino_t, struct hdlinks_s *, ++ struct file_info *, ++ struct fs_ops_callbacks *) { ++ com_err(__func__, 0, ++ _("you need to compile e2fsprogs without --without-libarchive" ++ "be able to process tarballs")); ++ return 1; ++} ++ ++#else ++ ++/* If ./configure was NOT run with --without-libarchive, then build with ++ * support for dlopen()-ing libarchive at runtime. This will also work even ++ * if archive.h is not available at compile-time. See the comment below. */ + + /* 64KiB is the minimum blksize to best minimize system call overhead. */ + //#define COPY_FILE_BUFLEN 65536 + //#define COPY_FILE_BUFLEN 1048576 + #define COPY_FILE_BUFLEN 16777216 + ++/* If archive.h was found, include it as usual. To support easier ++ * bootstrapping, also allow compilation without archive.h present by ++ * declaring the necessary opaque structs and preprocessor definitions. */ ++#ifdef HAVE_ARCHIVE_H + #include + #include ++#else ++struct archive; ++struct archive_entry; ++#define ARCHIVE_EOF 1 /* Found end of archive. */ ++#define ARCHIVE_OK 0 /* Operation was successful. */ ++#include /* ssize_t */ ++typedef ssize_t la_ssize_t; ++#endif /* HAVE_ARCHIVE_H */ ++ + #include + #include + +@@ -175,7 +205,7 @@ static int libarchive_available(void) + + return 1; + } +-#endif ++#endif /* CONFIG_DLOPEN_LIBARCHIVE */ + + static errcode_t __find_path(ext2_filsys fs, ext2_ino_t root, const char *name, + ext2_ino_t *inode) +@@ -541,7 +571,6 @@ static errcode_t handle_entry(ext2_filsys fs, ext2_ino_t root_ino, + } + return 0; + } +-#endif + + errcode_t __populate_fs_from_tar(ext2_filsys fs, ext2_ino_t root_ino, + const char *source_tar, ext2_ino_t root, +@@ -549,12 +578,6 @@ errcode_t __populate_fs_from_tar(ext2_filsys fs, ext2_ino_t root_ino, + struct file_info *target, + struct fs_ops_callbacks *fs_callbacks) + { +-#ifndef HAVE_ARCHIVE_H +- com_err(__func__, 0, +- _("you need to compile e2fsprogs with libarchive to " +- "be able to process tarballs")); +- return 1; +-#else + char *path2, *path3, *dir, *name; + unsigned int dir_exists; + struct archive *a; +@@ -700,5 +723,6 @@ out: + uselocale(old_locale); + freelocale(archive_locale); + return retval; +-#endif + } ++ ++#endif /* CONFIG_DISABLE_LIBARCHIVE */ +-- +2.45.2 + diff --git a/debian/patches/0002-mke2fs-allow-specifying-the-revision-1-via-r-1.patch b/debian/patches/0002-mke2fs-allow-specifying-the-revision-1-via-r-1.patch new file mode 100644 index 000000000..aad37a3e3 --- /dev/null +++ b/debian/patches/0002-mke2fs-allow-specifying-the-revision-1-via-r-1.patch @@ -0,0 +1,57 @@ +From: Theodore Ts'o +Subject: mke2fs: allow specifying the revision 1 via "-r 1" + +The fsarchiver program unconditionally passes -r 1 even though it's +effectively a no-op. To avoid commit 3fffe9dd6be5 breaking +fsarchiver, we'll silently allow the "-r 1" option instead of printing +an error and exiting. + +--- + misc/mke2fs.c | 22 +++++++++++++++++++--- + 1 file changed, 19 insertions(+), 3 deletions(-) + +diff --git a/misc/mke2fs.c b/misc/mke2fs.c +index 170ec9bc3..aa4e45440 100644 +--- a/misc/mke2fs.c ++++ b/misc/mke2fs.c +@@ -1656,6 +1656,7 @@ static void PRS(int argc, char *argv[]) + * Finally, we complain about fs_blocks_count > 2^32 on a non-64bit fs. + */ + blk64_t fs_blocks_count = 0; ++ int r_opt = -1; + char *fs_features = 0; + int fs_features_size = 0; + int use_bsize; +@@ -1932,11 +1933,26 @@ profile_error: + quiet = 1; + break; + case 'r': +- com_err(program_name, 0, +- _("the -r option has been removed.\n\n" ++ r_opt = strtoul(optarg, &tmp, 0); ++ if (*tmp) { ++ com_err(program_name, 0, ++ _("bad revision level - %s"), optarg); ++ exit(1); ++ } ++ if (r_opt > EXT2_MAX_SUPP_REV) { ++ com_err(program_name, EXT2_ET_REV_TOO_HIGH, ++ _("while trying to create revision %d"), r_opt); ++ exit(1); ++ } ++ if (r_opt != EXT2_DYNAMIC_REV) { ++ com_err(program_name, 0, ++ _("the -r option has been removed.\n\n" + "If you really need compatibility with pre-1995 Linux systems, use the\n" + "command-line option \"-E revision=0\".\n")); +- exit(1); ++ exit(1); ++ } ++ fs_param.s_rev_level = r_opt; ++ break; + case 's': + com_err(program_name, 0, + _("the -s option has been removed.\n\n" +-- +2.45.2 + diff --git a/debian/patches/0003-e2fsck-fix-big-endian-support-for-orphan_file-file-s.patch b/debian/patches/0003-e2fsck-fix-big-endian-support-for-orphan_file-file-s.patch new file mode 100644 index 000000000..93d8fb66b --- /dev/null +++ b/debian/patches/0003-e2fsck-fix-big-endian-support-for-orphan_file-file-s.patch @@ -0,0 +1,85 @@ +From: Theodore Ts'o +Subject: e2fsck: fix big-endian support for orphan_file file systems + +--- + e2fsck/super.c | 5 +++-- + lib/ext2fs/ext2_fs.h | 4 ++-- + lib/ext2fs/orphan.c | 12 +++++++----- + 3 files changed, 12 insertions(+), 9 deletions(-) + +diff --git a/e2fsck/super.c b/e2fsck/super.c +index 04d6ddee6..d6bbb6317 100644 +--- a/e2fsck/super.c ++++ b/e2fsck/super.c +@@ -605,8 +605,9 @@ return_abort: + * Update checksum to match expected buffer contents with + * appropriate block number. + */ +- tail->ob_checksum = ext2fs_do_orphan_file_block_csum(fs, +- pd->ino, pd->generation, blk, pd->buf); ++ tail->ob_checksum = ++ ext2fs_cpu_to_le32(ext2fs_do_orphan_file_block_csum(fs, ++ pd->ino, pd->generation, blk, pd->buf)); + } + if (!pd->clear) { + pd->errcode = io_channel_read_blk64(fs->io, blk, 1, +diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h +index 586141f89..3a5eb7387 100644 +--- a/lib/ext2fs/ext2_fs.h ++++ b/lib/ext2fs/ext2_fs.h +@@ -1122,8 +1122,8 @@ static inline unsigned int ext2fs_dir_rec_len(__u8 name_len, + + /* Structure at the tail of orphan block */ + struct ext4_orphan_block_tail { +- __u32 ob_magic; +- __u32 ob_checksum; ++ __le32 ob_magic; ++ __le32 ob_checksum; + }; + + /* +diff --git a/lib/ext2fs/orphan.c b/lib/ext2fs/orphan.c +index 913eb9a03..e256fd220 100644 +--- a/lib/ext2fs/orphan.c ++++ b/lib/ext2fs/orphan.c +@@ -58,7 +58,7 @@ __u32 ext2fs_do_orphan_file_block_csum(ext2_filsys fs, ext2_ino_t ino, + crc = ext2fs_crc32c_le(crc, (unsigned char *)buf, + inodes_per_ob * sizeof(__u32)); + +- return ext2fs_cpu_to_le32(crc); ++ return crc; + } + + struct mkorphan_info { +@@ -101,8 +101,9 @@ static int mkorphan_proc(ext2_filsys fs, + struct ext4_orphan_block_tail *tail; + + tail = ext2fs_orphan_block_tail(fs, oi->buf); +- tail->ob_checksum = ext2fs_do_orphan_file_block_csum(fs, +- oi->ino, oi->generation, new_blk, oi->buf); ++ tail->ob_checksum = ++ ext2fs_cpu_to_le32(ext2fs_do_orphan_file_block_csum(fs, ++ oi->ino, oi->generation, new_blk, oi->buf)); + } + err = io_channel_write_blk64(fs->io, new_blk, 1, oi->buf); + } else /* zerobuf is used to initialize new indirect blocks... */ +@@ -249,13 +250,14 @@ errcode_t ext2fs_orphan_file_block_csum_set(ext2_filsys fs, ext2_ino_t ino, + blk64_t blk, char *buf) + { + struct ext4_orphan_block_tail *tail; ++ __u32 crc; + + if (!ext2fs_has_feature_metadata_csum(fs->super)) + return 0; + + tail = ext2fs_orphan_block_tail(fs, buf); +- return ext2fs_orphan_file_block_csum(fs, ino, blk, buf, +- &tail->ob_checksum); ++ return ext2fs_orphan_file_block_csum(fs, ino, blk, buf, &crc); ++ tail->ob_checksum = ext2fs_cpu_to_le32(crc); + } + + int ext2fs_orphan_file_block_csum_verify(ext2_filsys fs, ext2_ino_t ino, +-- +2.45.2 + diff --git a/debian/patches/0004-More-reease-note-updates b/debian/patches/0004-More-reease-note-updates new file mode 100644 index 000000000..820952356 --- /dev/null +++ b/debian/patches/0004-More-reease-note-updates @@ -0,0 +1,48 @@ +From: Theodore Ts'o +Subject: More release note updates for 1.47.2. + +--- + doc/RelNotes/v1.47.2.txt | 11 +++++++++-- + 2 files changed, 19 insertions(+), 2 deletions(-) + +diff --git a/doc/RelNotes/v1.47.2.txt b/doc/RelNotes/v1.47.2.txt +index 84cd21640..3c27e34ca 100644 +--- a/doc/RelNotes/v1.47.2.txt ++++ b/doc/RelNotes/v1.47.2.txt +@@ -1,4 +1,4 @@ +-E2fsprogs 1.47.2 (November 28, 2024) 6ba18ef7bf4b ++E2fsprogs 1.47.2 (November 28, 2024) 283fcab2c9af + ==================================== + + Updates/Fixes since v1.47.1: +@@ -22,6 +22,8 @@ https://github.com/tytso/e2fsprogs/issues/192) + Fixes + ----- + ++Fix orphan_file support on big endian systems. ++ + Avoid a spurious failure in badblocks when -n or -w is specified twice. + (Addresses Debian Bug #1087341) + +@@ -68,7 +70,7 @@ Enable Continuous Integration testing in Debian's Salsa forge. + Fix a memory leak in oss-fuzz test programs. + + Provide fuseext2 to replace the debian package src:fuse-umfuse-ext2. +-(Addresses Debian Bug #1085590) ++(Addresses Debian Bug #1085590, #1088838) + + Fix the f_badjour_encrypted test to write the error output from mke2fs + and debugfs to a log file so it doesn't mess up the "make check" output +@@ -82,4 +84,9 @@ Clean up groff warnings in man pages. (Addresses Debian Bugs #1086892, + Document the orphan_file feature in the ext4(5) and tune2fs(8) man + pages. (Addresses Debian Bug #1073062) + ++Allow building e2fsprogs without libarchive-dev installed to make life ++easier for bootstrapping for new Debian ports (Addresses Debian Bug ++#1078693) ++ + Various man page cleanups. ++ +-- +2.45.2 + diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 000000000..8cfb8fee8 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,4 @@ +0001-Decouple-without-libarchive-and-HAVE_ARCHIVE_H.patch +0002-mke2fs-allow-specifying-the-revision-1-via-r-1.patch +0003-e2fsck-fix-big-endian-support-for-orphan_file-file-s.patch +0004-More-reease-note-updates