Hi Helmut&Ted,

Quoting Helmut Grohne (2024-08-15 07:19:52)
> On Thu, Aug 15, 2024 at 12:14:52AM -0400, Theodore Ts'o wrote:
> > This only passes the "it builds, ship it!" test, but it appears that
> > it might be enough to replace
> 
> My message was primarily targeted at getting an agreement on the
> direction of a solution. As you imply that you are ok with this kind of
> solution, I guess Johannes will volunteer to supply a patch for detailed
> discussion.

please find a tested patch attached which is only little more than what was
provided by Ted already. I built this with and without nocheck. When built with
nocheck, libarchive-dev does not get installed and attempting to use the
resulting package will yield:

Copying files into the device: __populate_fs_from_tar: you need libarchive to
be able to process tarballs mke2fs: Operation not permitted while populating
file system

After installing libarchive13t64, I was able to create filesystems from
tarballs as usual. Building without nocheck, tests pass fine.

Does this look okay?

Thanks!

cheers, josch
diff -Nru e2fsprogs-1.47.1/debian/changelog e2fsprogs-1.47.1/debian/changelog
--- e2fsprogs-1.47.1/debian/changelog	2024-05-20 21:28:06.000000000 +0200
+++ e2fsprogs-1.47.1/debian/changelog	2024-08-21 11:40:08.000000000 +0200
@@ -1,3 +1,10 @@
+e2fsprogs (1.47.1-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Allow building without archive.h (Closes: #1078693)
+
+ -- Johannes Schauer Marin Rodrigues <jo...@debian.org>  Wed, 21 Aug 2024 11:40:08 +0200
+
 e2fsprogs (1.47.1-1) unstable; urgency=medium
 
   * New upstream version
diff -Nru e2fsprogs-1.47.1/debian/control e2fsprogs-1.47.1/debian/control
--- e2fsprogs-1.47.1/debian/control	2024-05-20 21:28:06.000000000 +0200
+++ e2fsprogs-1.47.1/debian/control	2024-08-21 11:29:04.000000000 +0200
@@ -2,7 +2,7 @@
 Section: admin
 Priority: required
 Maintainer: Theodore Y. Ts'o <ty...@mit.edu>
-Build-Depends: dpkg-dev (>= 1.22.5), gettext, texinfo, pkgconf, libarchive-dev, libfuse3-dev [linux-any kfreebsd-any] <!pkg.e2fsprogs.no-fuse2fs>, 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 <!nocheck>, libfuse3-dev [linux-any kfreebsd-any] <!pkg.e2fsprogs.no-fuse2fs>, 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 -Nru e2fsprogs-1.47.1/debian/.gitignore e2fsprogs-1.47.1/debian/.gitignore
--- e2fsprogs-1.47.1/debian/.gitignore	2024-05-20 21:28:06.000000000 +0200
+++ e2fsprogs-1.47.1/debian/.gitignore	1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-!patches
diff -Nru e2fsprogs-1.47.1/debian/patches/bootstrap.patch e2fsprogs-1.47.1/debian/patches/bootstrap.patch
--- e2fsprogs-1.47.1/debian/patches/bootstrap.patch	1970-01-01 01:00:00.000000000 +0100
+++ e2fsprogs-1.47.1/debian/patches/bootstrap.patch	2024-08-21 11:40:08.000000000 +0200
@@ -0,0 +1,65 @@
+Description: Allow building without archive.h
+ Since src:libarchive build-depends on libext2fs-dev, a build dependency cycle
+ is created which breaks architecture bootstrap.
+ .
+ This patch allows building e2fsprogs even if archive.h is not present by
+ adding the necessary forward declarations, typedefs and preprocessor
+ definitions if archive.h was not found.
+Author: Theodore Y. Ts'o <ty...@mit.edu>
+Bug-Debian: https://bugs.debian.org/1078693
+
+--- a/misc/create_inode_libarchive.c
++++ b/misc/create_inode_libarchive.c
+@@ -18,15 +18,23 @@
+ #include "create_inode_libarchive.h"
+ #include "support/nls-enable.h"
+ 
+-#ifdef HAVE_ARCHIVE_H
+-
+ /* 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
+ 
++#ifdef HAVE_ARCHIVE_H
+ #include <archive.h>
+ #include <archive_entry.h>
++#else
++struct archive;
++struct archive_entry;
++#define	ARCHIVE_EOF	  1	/* Found end of archive. */
++#define	ARCHIVE_OK	  0	/* Operation was successful. */
++#include <unistd.h>  /* ssize_t */
++typedef ssize_t la_ssize_t;
++#endif
++
+ #include <libgen.h>
+ #include <locale.h>
+ 
+@@ -541,7 +549,6 @@ static errcode_t handle_entry(ext2_filsy
+ 	}
+ 	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 +556,6 @@ errcode_t __populate_fs_from_tar(ext2_fi
+ 				 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 +701,4 @@ out:
+ 	uselocale(old_locale);
+ 	freelocale(archive_locale);
+ 	return retval;
+-#endif
+ }
diff -Nru e2fsprogs-1.47.1/debian/patches/series e2fsprogs-1.47.1/debian/patches/series
--- e2fsprogs-1.47.1/debian/patches/series	1970-01-01 01:00:00.000000000 +0100
+++ e2fsprogs-1.47.1/debian/patches/series	2024-08-21 11:35:57.000000000 +0200
@@ -0,0 +1 @@
+bootstrap.patch

Attachment: signature.asc
Description: signature

Reply via email to