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/debian/changelog b/debian/changelog index c9bbbbb1d..554565abe 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +e2fsprogs (1.47.2~rc1-2) unstable; urgency=medium + + * Fix fuseext2 transition to account for /usr-move (Closes: #1088838) + * Fix orphan_file support on big endian systems. + * Mke2fs will allow "-r 1" since fsarchiver uses it rather pointlessly + * Allow building e2fsprogs without libarchive-dev installed to make life + easier for bootstrapping for new Debian ports (Closes: #1078693) + + -- Theodore Y. Ts'o Tue, 03 Dec 2024 23:40:01 -0500 + e2fsprogs (1.47.2~rc1-1) unstable; urgency=medium * New upstream version @@ -6,8 +16,8 @@ e2fsprogs (1.47.2~rc1-1) unstable; urgency=medium suitable for pre-1995 1.2 version kernels and a typo will just end up confusing the user and leaving them with a file system missing most modern ext4 features, including no support for on-line resizing and no - support for post-2038 timestamps. Closes: #1086603) - * Add support for gnu.translator extended attrbitues in tar files fed to + support for post-2038 timestamps. (Closes: #1086603) + * Add support for gnu.translator extended attrbutes in tar files fed to mke2fs -d. * Avoid a spurious failure in badblocks when -n or -w is specified twice. (Closes: #1087341) diff --git a/debian/control b/debian/control index bc582cd8a..2d1cfd88f 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: e2fsprogs Section: admin Priority: required Maintainer: Theodore Y. Ts'o -Build-Depends: dpkg-dev (>= 1.22.5), gettext, texinfo, pkgconf, libarchive-dev, libfuse3-dev [linux-any kfreebsd-any] , debhelper-compat (= 12), dh-exec, libblkid-dev, uuid-dev, m4, udev [linux-any], systemd [linux-any], systemd-dev [linux-any], cron [linux-any], dh-sequence-movetousr +Build-Depends: dpkg-dev (>= 1.22.5), gettext, texinfo, pkgconf, libarchive-dev , libfuse3-dev [linux-any kfreebsd-any] , debhelper-compat (= 12), dh-exec, libblkid-dev, uuid-dev, m4, udev [linux-any], systemd [linux-any], systemd-dev [linux-any], cron [linux-any], dh-sequence-movetousr Rules-Requires-Root: no Standards-Version: 4.7.0 Homepage: http://e2fsprogs.sourceforge.net diff --git a/debian/fuse2fs.postinst b/debian/fuse2fs.postinst new file mode 100644 index 000000000..38384fff2 --- /dev/null +++ b/debian/fuse2fs.postinst @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e + +# begin-remove-after: released:trixie +if test "$1" = configure && dpkg --compare-versions "$2" lt 1.47.2~rc1-1~; then + # DEP17 P1 mitigation. + for cmd in /sbin/mount.fuse-ext2 /sbin/mount.fuseext2; do + dpkg-divert --package fuse2fs --no-rename --divert "$cmd.usr-is-merged" --remove "$cmd" + done +fi +# end-remove-after: released:trixie + +#DEBHELPER# diff --git a/debian/fuse2fs.postrm b/debian/fuse2fs.postrm new file mode 100644 index 000000000..68a43f8ef --- /dev/null +++ b/debian/fuse2fs.postrm @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e + +# begin-remove-after: released:trixie +if test "$1" = remove || test "$1" = upgrade -o "$1" = failed-upgrade - o "$1" = abort-install -o "$1" = abort-upgrade && dpkg --compare-versions "$2" lt 1.47.2~rc1-1~; then + # DEP17 P1 mitigation. + for cmd in /sbin/mount.fuse-ext2 /sbin/mount.fuseext2; do + dpkg-divert --package fuse2fs --no-rename --divert "$cmd.usr-is-merged" --remove "$cmd" + done +fi +# end-remove-after: released:trixie + +#DEBHELPER# diff --git a/debian/fuse2fs.preinst b/debian/fuse2fs.preinst new file mode 100644 index 000000000..24e250471 --- /dev/null +++ b/debian/fuse2fs.preinst @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e + +# begin-remove-after: released:trixie +if test "$1" = install -o "$1" = upgrade && dpkg --compare-versions "$2" lt 1.47.2~rc1-1~; then + # DEP17 P1 mitigation. + for cmd in /sbin/mount.fuse-ext2 /sbin/mount.fuseext2; do + dpkg-divert --package fuse2fs --no-rename --divert "$cmd.usr-is-merged" --add "$cmd" + done +fi +# end-remove-after: released:trixie + +#DEBHELPER# 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. + 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 @@ static int reinit_orphan_block(ext2_filsys fs, * 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/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/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, 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 @@ errcode_t __populate_fs_from_tar(ext2_filsys fs, ext2_ino_t root_ino, uselocale(old_locale); freelocale(archive_locale); return retval; -#endif } + +#endif /* CONFIG_DISABLE_LIBARCHIVE */ 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 @@ static void PRS(int argc, char *argv[]) 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"