diff --git a/Makefile b/Makefile index 14bca83..ee14507 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ -all : avro avro-libcxx boost boost-libcxx catch2 clang clang-runtime cmake cppzmq fmt fmt-libcxx json jsoncons jwt-cpp libarchive mungefs nanodbc nanodbc-libcxx qpid-proton qpid-proton-libcxx redis spdlog spdlog-libcxx zeromq4-1 zeromq4-1-libcxx +all : avro avro-libcxx boost boost-libcxx catch2 clang clang-runtime cmake cppzmq fmt fmt-libcxx json jsoncons jwt-cpp mungefs nanodbc nanodbc-libcxx qpid-proton qpid-proton-libcxx redis spdlog spdlog-libcxx zeromq4-1 zeromq4-1-libcxx -server-libstdcxx : avro boost catch2 clang cppzmq fmt json jsoncons libarchive nanodbc spdlog zeromq4-1 +server-libstdcxx : avro boost catch2 clang cppzmq fmt json jsoncons nanodbc spdlog zeromq4-1 -server-libcxx : avro-libcxx boost-libcxx catch2 clang clang-runtime cppzmq fmt-libcxx json jsoncons libarchive nanodbc-libcxx spdlog-libcxx zeromq4-1-libcxx +server-libcxx : avro-libcxx boost-libcxx catch2 clang clang-runtime cppzmq fmt-libcxx json jsoncons nanodbc-libcxx spdlog-libcxx zeromq4-1-libcxx server : server-libstdcxx server-libcxx @@ -115,15 +115,7 @@ jwt-cpp_clean : @rm -rf jwt-cpp* @rm -rf $(JWT-CPP_PACKAGE) -$(LIBARCHIVE_PACKAGE) : $(CMAKE_PACKAGE) $(CLANG_PACKAGE) - ./build.py $(BUILD_OPTIONS) libarchive > libarchive.log 2>&1 -libarchive : $(LIBARCHIVE_PACKAGE) -libarchive_clean : - @echo "Cleaning libarchive..." - @rm -rf libarchive* - @rm -rf $(LIBARCHIVE_PACKAGE) - -$(MUNGEFS_PACKAGE) : $(CPPZMQ_PACKAGE) $(LIBARCHIVE_PACKAGE) $(AVRO_PACKAGE) $(CLANG-RUNTIME_PACKAGE) $(ZEROMQ4-1_PACKAGE) +$(MUNGEFS_PACKAGE) : $(CPPZMQ_PACKAGE) $(AVRO_PACKAGE) $(CLANG-RUNTIME_PACKAGE) $(ZEROMQ4-1_PACKAGE) ./build.py $(BUILD_OPTIONS) mungefs > mungefs.log 2>&1 mungefs : $(MUNGEFS_PACKAGE) mungefs_clean : @@ -183,7 +175,7 @@ zeromq4-1_clean : @rm -rf zeromq4-1* @rm -rf $(ZEROMQ4-1_PACKAGE) $(ZEROMQ4-1-LIBCXX_PACKAGE) -clean : avro_clean boost_clean catch2_clean clang_clean clang-runtime_clean cmake_clean cppzmq_clean fmt_clean json_clean jsoncons_clean jwt-cpp_clean libarchive_clean mungefs_clean nanodbc_clean qpid-proton_clean redis_clean spdlog_clean zeromq4-1_clean +clean : avro_clean boost_clean catch2_clean clang_clean clang-runtime_clean cmake_clean cppzmq_clean fmt_clean json_clean jsoncons_clean jwt-cpp_clean mungefs_clean nanodbc_clean qpid-proton_clean redis_clean spdlog_clean zeromq4-1_clean @echo "Cleaning generated files..." @rm -rf packages.mk @echo "Done." diff --git a/build.py b/build.py index 6ffb33c..318e2e6 100755 --- a/build.py +++ b/build.py @@ -224,8 +224,6 @@ def apply_patches(): log.debug('fmt_libcxx_root: [{0}]'.format(fmt_libcxx_root)) json_root = get_local_path('json',[]) log.debug('json_root: [{0}]'.format(json_root)) - libarchive_root = get_local_path('libarchive',[]) - log.debug('libarchive_root: [{0}]'.format(libarchive_root)) # build boost install path boost_info = get_versions()['boost'] @@ -258,11 +256,6 @@ def apply_patches(): avro_libcxx_install_prefix = os.path.join(avro_libcxx_info['externals_root'], avro_libcxx_subdirectory) avro_libcxx_rpath = os.path.join(avro_libcxx_install_prefix, 'lib') - libarchive_info = get_versions()['libarchive'] - libarchive_subdirectory = '{0}{1}-{2}'.format('libarchive', libarchive_info['version_string'], libarchive_info['consortium_build_number']) - libarchive_install_prefix = os.path.join(libarchive_info['externals_root'], libarchive_subdirectory) - libarchive_rpath = os.path.join(libarchive_install_prefix, 'lib') - zmq_info = get_versions()['zeromq4-1'] zmq_subdirectory = '{0}{1}-{2}'.format('zeromq4-1', zmq_info['version_string'], zmq_info['consortium_build_number']) zmq_install_prefix = os.path.join(zmq_info['externals_root'], zmq_subdirectory) @@ -384,8 +377,6 @@ def apply_patches(): i = re.sub("TEMPLATE_BOOST_LIBCXX_ROOT", boost_libcxx_root, i) i = re.sub("TEMPLATE_BOOST_RPATH", boost_rpath, i) i = re.sub("TEMPLATE_BOOST_LIBCXX_RPATH", boost_libcxx_rpath, i) - i = re.sub("TEMPLATE_LIBARCHIVE_PATH", libarchive_root, i) - i = re.sub("TEMPLATE_LIBARCHIVE_RPATH", libarchive_rpath, i) i = re.sub("TEMPLATE_AVRO_RPATH", avro_rpath, i) i = re.sub("TEMPLATE_AVRO_PATH", avro_root, i) i = re.sub("TEMPLATE_AVRO_LIBCXX_RPATH", avro_libcxx_rpath, i) diff --git a/install_prerequisites.py b/install_prerequisites.py index a927339..a001543 100755 --- a/install_prerequisites.py +++ b/install_prerequisites.py @@ -75,6 +75,7 @@ def main(): 'git', 'gpg', 'help2man', + 'libarchive-dev', 'libbz2-dev', 'libcurl4-gnutls-dev', 'libfuse-dev', @@ -132,6 +133,7 @@ def main(): 'git', 'glibc-devel', 'help2man', + 'libarchive-devel', 'libcurl-devel', 'libicu-devel', 'libmicrohttpd-devel', diff --git a/patches/libarchive/from-debian/lzip-large-dict.patch b/patches/libarchive/from-debian/lzip-large-dict.patch deleted file mode 100644 index e5a17d1..0000000 --- a/patches/libarchive/from-debian/lzip-large-dict.patch +++ /dev/null @@ -1,55 +0,0 @@ -Description: Support lzip dictionary size up to 512MB. -Bug-Debian: https://bugs.debian.org/1001901 -Forwarded: https://github.com/libarchive/libarchive/pull/1645 -Author: Peter Pentchev -Last-Update: 2021-12-22 - ---- a/libarchive/archive_read_support_filter_xz.c -+++ b/libarchive/archive_read_support_filter_xz.c -@@ -293,8 +293,8 @@ - /* Second through fifth bytes are dictionary size, stored in - * little-endian order. The minimum dictionary size is - * 1 << 12(4KiB) which the lzma of LZMA SDK uses with option -- * -d12 and the maximum dictionary size is 1 << 27(128MiB) -- * which the one uses with option -d27. -+ * -d12 and the maximum dictionary size is 1 << 29(512MiB) -+ * which the one uses with option -d29. - * NOTE: A comment of LZMA SDK source code says this dictionary - * range is from 1 << 12 to 1 << 30. */ - dicsize = archive_le32dec(buffer+1); -@@ -377,7 +377,7 @@ - - /* Dictionary size. */ - log2dic = buffer[5] & 0x1f; -- if (log2dic < 12 || log2dic > 27) -+ if (log2dic < 12 || log2dic > 29) - return (0); - bits_checked += 8; - -@@ -562,7 +562,7 @@ - - /* Get dictionary size. */ - log2dic = h[5] & 0x1f; -- if (log2dic < 12 || log2dic > 27) -+ if (log2dic < 12 || log2dic > 29) - return (ARCHIVE_FATAL); - dicsize = 1U << log2dic; - if (log2dic > 12) ---- a/libarchive/archive_write_add_filter_xz.c -+++ b/libarchive/archive_write_add_filter_xz.c -@@ -251,13 +251,13 @@ - int ds, log2dic, wedges; - - /* Calculate a coded dictionary size */ -- if (dict_size < (1 << 12) || dict_size > (1 << 27)) { -+ if (dict_size < (1 << 12) || dict_size > (1 << 29)) { - archive_set_error(f->archive, ARCHIVE_ERRNO_MISC, - "Unacceptable dictionary size for lzip: %d", - dict_size); - return (ARCHIVE_FATAL); - } -- for (log2dic = 27; log2dic >= 12; log2dic--) { -+ for (log2dic = 29; log2dic >= 12; log2dic--) { - if (dict_size & (1 << log2dic)) - break; - } diff --git a/patches/libarchive/from-debian/typos.patch b/patches/libarchive/from-debian/typos.patch deleted file mode 100644 index ab7da81..0000000 --- a/patches/libarchive/from-debian/typos.patch +++ /dev/null @@ -1,175 +0,0 @@ -Description: Correct some typographical errors. -Forwarded: https://github.com/libarchive/libarchive/pull/1249 -Author: Peter Pentchev -Last-Update: 2021-12-22 - ---- a/libarchive/archive_string.c -+++ b/libarchive/archive_string.c -@@ -3521,7 +3521,7 @@ - - if (sc->to_cp == CP_C_LOCALE) { - /* -- * "C" locale special process. -+ * "C" locale special processing. - */ - u16 = _p; - ll = 0; -@@ -3640,7 +3640,7 @@ - avail = as16->buffer_length - 2; - if (sc->from_cp == CP_C_LOCALE) { - /* -- * "C" locale special process. -+ * "C" locale special processing. - */ - count = 0; - while (count < length && *s) { ---- a/libarchive/test/test_compat_lzip.c -+++ b/libarchive/test/test_compat_lzip.c -@@ -48,7 +48,7 @@ - rm -r $dir - } - # --# Make a lzip file from splitted tar file. -+# Make a lzip file from the split tar file. - # - name=test_compat_lzip_1 - dir="$name`date +%Y%m%d%H%M%S`.$USER" -@@ -76,7 +76,7 @@ - */ - - /* -- * Verify our ability to read sample files compatibly with lzip. -+ * Verify our ability to read the sample files compatibly with lzip. - * - * In particular: - * * lzip will read multiple lzip streams, concatenating the output ---- a/README.md -+++ b/README.md -@@ -181,7 +181,7 @@ - libraries. This also reduces the size of statically-linked - binaries in environments where that matters. - --* The library is generally _thread safe_ depending on the platform: -+* The library is generally _thread-safe_ depending on the platform: - it does not define any global variables of its own. However, some - platforms do not provide fully thread-safe versions of key C library - functions. On those platforms, libarchive will use the non-thread-safe -@@ -193,7 +193,7 @@ - multiple threads. Of course, those modules are completely - optional and you can use the rest of libarchive without them. - --* The library is _not_ thread aware, however. It does no locking -+* The library is _not_ thread-aware, however. It does no locking - or thread management of any kind. If you create a libarchive - object and need to access it from multiple threads, you will - need to provide your own locking. ---- a/libarchive/archive_read_support_format_cpio.c -+++ b/libarchive/archive_read_support_format_cpio.c -@@ -825,9 +825,9 @@ - } - - /* -- * NOTE: if a filename suffix is ".z", it is the file gziped by afio. -- * it would be nice that we can show uncompressed file size and we can -- * uncompressed file contents automatically, unfortunately we have nothing -+ * NOTE: if a filename suffix is ".z", it is a file gzipped by afio. -+ * it would be nice if we could show uncompressed file size and -+ * uncompress file contents automatically, unfortunately we have nothing - * to get a uncompressed file size while reading each header. It means - * we also cannot uncompress file contents under our framework. - */ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1015,8 +1015,8 @@ - CMAKE_C_COMPILER_ID MATCHES "^Clang$") - # - # During checking iconv proto type, we should use -Werror to avoid the -- # success of iconv detection with a warning which success is a miss -- # detection. So this needs for all build mode(even it's a release mode). -+ # success of iconv detection with a warning, which would be a false -+ # positive. So this is needed for all build modes, even in release mode. - # - SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror") - ENDIF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR ---- a/libarchive/archive_read_support_filter_uu.c -+++ b/libarchive/archive_read_support_filter_uu.c -@@ -231,8 +231,8 @@ - size_t nbytes_req = (*ravail+1023) & ~1023U; - ssize_t tested; - -- /* Increase reading bytes if it is not enough to at least -- * new two lines. */ -+ /* Increase reading bytes if it is not enough for at least -+ * two new lines. */ - if (nbytes_req < (size_t)*ravail + 160) - nbytes_req <<= 1; - -@@ -403,7 +403,7 @@ - - /* - * Calculate a new buffer size for in_buff. -- * Increase its value until it has enough size we need. -+ * Increase its value until it is enough for our needs. - */ - newsize = uudecode->in_allocated; - do { -@@ -464,7 +464,7 @@ - if (uudecode->in_cnt) { - /* - * If there is remaining data which is saved by -- * previous calling, use it first. -+ * a previous call, use it first. - */ - if (ensure_in_buff_size(self, uudecode, - avail_in + uudecode->in_cnt) != ARCHIVE_OK) ---- a/libarchive/archive_read_support_format_mtree.c -+++ b/libarchive/archive_read_support_format_mtree.c -@@ -392,8 +392,8 @@ - if (len >= MAX_LINE_LEN) - return (-1); - -- /* Increase reading bytes if it is not enough to at least -- * new two lines. */ -+ /* Increase reading bytes if it is not enough for at least -+ * two new lines. */ - if (nbytes_req < (size_t)*ravail + 160) - nbytes_req <<= 1; - -@@ -516,7 +516,7 @@ - - /* - * Test whether there is a set of mtree keywords. -- * Returns the number of keyword. -+ * Returns the number of keywords. - * Returns -1 if we got incorrect sequence. - * This function expects a set of "keyword=value". - * When "unset" is specified, expects a set of "keyword". -@@ -568,8 +568,8 @@ - --len; - value = 1; - } -- /* A keyword should have a its value unless -- * "/unset" operation. */ -+ /* A keyword should have a value unless this is -+ * an "/unset" operation. */ - if (!unset && value == 0) - return (-1); - } -@@ -755,7 +755,7 @@ - } else if (form_D == 1) { - if (!last_is_path && keywords > 0) - /* This this is not `form D' -- * and We cannot accept mixed -+ * and we cannot accept mixed - * format. */ - break; - } -@@ -808,7 +808,7 @@ - * to read the entire mtree file into memory up front. - * - * The parsing is done in two steps. First, it is decided if a line -- * changes the global defaults and if it is, processed accordingly. -+ * changes the global defaults and if it does, it is processed accordingly. - * Otherwise, the options of the line are merged with the current - * global options. - */ diff --git a/patches/libarchive/from-debian/upstream-fix-32bit-size-cast.patch b/patches/libarchive/from-debian/upstream-fix-32bit-size-cast.patch deleted file mode 100644 index 9616451..0000000 --- a/patches/libarchive/from-debian/upstream-fix-32bit-size-cast.patch +++ /dev/null @@ -1,48 +0,0 @@ -Description: Fix size_t cast in read_mac_metadata_blob - The size_t data type on 32 bit systems is smaller than int64_t. Check - the int64_t value before casting to size_t. If the value is too large - then stop operation instead of continuing operation with truncated - value. -Origin: upstream, https://github.com/libarchive/libarchive/commit/a7ce8a6aa7b710986ab918761c8d2ff1b0e9f537 -Author: Samanta Navarro -Last-Updated: 2021-12-22 - ---- a/libarchive/archive_read_support_format_tar.c -+++ b/libarchive/archive_read_support_format_tar.c -@@ -1396,6 +1396,7 @@ - struct archive_entry *entry, const void *h, size_t *unconsumed) - { - int64_t size; -+ size_t msize; - const void *data; - const char *p, *name; - const wchar_t *wp, *wname; -@@ -1434,6 +1435,11 @@ - - /* Read the body as a Mac OS metadata blob. */ - size = archive_entry_size(entry); -+ msize = (size_t)size; -+ if (size < 0 || (uintmax_t)msize != (uintmax_t)size) { -+ *unconsumed = 0; -+ return (ARCHIVE_FATAL); -+ } - - /* - * TODO: Look beyond the body here to peek at the next header. -@@ -1447,13 +1453,13 @@ - * Q: Is the above idea really possible? Even - * when there are GNU or pax extension entries? - */ -- data = __archive_read_ahead(a, (size_t)size, NULL); -+ data = __archive_read_ahead(a, msize, NULL); - if (data == NULL) { - *unconsumed = 0; - return (ARCHIVE_FATAL); - } -- archive_entry_copy_mac_metadata(entry, data, (size_t)size); -- *unconsumed = (size_t)((size + 511) & ~ 511); -+ archive_entry_copy_mac_metadata(entry, data, msize); -+ *unconsumed = (msize + 511) & ~ 511; - tar_flush_unconsumed(a, unconsumed); - return (tar_read_header(a, tar, entry, unconsumed)); - } diff --git a/patches/libarchive/from-debian/upstream-fixup-file-flags.patch b/patches/libarchive/from-debian/upstream-fixup-file-flags.patch deleted file mode 100644 index 4550e22..0000000 --- a/patches/libarchive/from-debian/upstream-fixup-file-flags.patch +++ /dev/null @@ -1,199 +0,0 @@ -Description: archive_write_disk_posix: fix writing fflags broken in 8a1bd5c - The fixup list was erroneously assumed to be directories only. - Only in the case of critical file flags modification (e.g. SF_IMMUTABLE - on BSD systems), other file types (e.g. regular files or symbolic links) - may be added to the fixup list. We still need to verify that we are writing - to the correct file type, so compare the archive entry file type with - the file type of the file to be modified. -Origin: upstream, https://github.com/libarchive/libarchive/commit/ede459d2ebb879f5eedb6f7abea203be0b334230 -Author: Martin Matuska -Last-Updated: 2021-12-22 - ---- a/libarchive/archive_write_disk_posix.c -+++ b/libarchive/archive_write_disk_posix.c -@@ -173,6 +173,7 @@ - struct fixup_entry *next; - struct archive_acl acl; - mode_t mode; -+ __LA_MODE_T filetype; - int64_t atime; - int64_t birthtime; - int64_t mtime; -@@ -357,6 +358,7 @@ - - static int la_opendirat(int, const char *); - static int la_mktemp(struct archive_write_disk *); -+static int la_verify_filetype(mode_t, __LA_MODE_T); - static void fsobj_error(int *, struct archive_string *, int, const char *, - const char *); - static int check_symlinks_fsobj(char *, int *, struct archive_string *, -@@ -465,6 +467,39 @@ - } - - static int -+la_verify_filetype(mode_t mode, __LA_MODE_T filetype) { -+ int ret = 0; -+ -+ switch (filetype) { -+ case AE_IFREG: -+ ret = (S_ISREG(mode)); -+ break; -+ case AE_IFDIR: -+ ret = (S_ISDIR(mode)); -+ break; -+ case AE_IFLNK: -+ ret = (S_ISLNK(mode)); -+ break; -+ case AE_IFSOCK: -+ ret = (S_ISSOCK(mode)); -+ break; -+ case AE_IFCHR: -+ ret = (S_ISCHR(mode)); -+ break; -+ case AE_IFBLK: -+ ret = (S_ISBLK(mode)); -+ break; -+ case AE_IFIFO: -+ ret = (S_ISFIFO(mode)); -+ break; -+ default: -+ break; -+ } -+ -+ return (ret); -+} -+ -+static int - lazy_stat(struct archive_write_disk *a) - { - if (a->pst != NULL) { -@@ -822,6 +857,7 @@ - fe = current_fixup(a, archive_entry_pathname(entry)); - if (fe == NULL) - return (ARCHIVE_FATAL); -+ fe->filetype = archive_entry_filetype(entry); - fe->fixup |= TODO_MODE_BASE; - fe->mode = a->mode; - } -@@ -832,6 +868,7 @@ - fe = current_fixup(a, archive_entry_pathname(entry)); - if (fe == NULL) - return (ARCHIVE_FATAL); -+ fe->filetype = archive_entry_filetype(entry); - fe->mode = a->mode; - fe->fixup |= TODO_TIMES; - if (archive_entry_atime_is_set(entry)) { -@@ -865,6 +902,7 @@ - fe = current_fixup(a, archive_entry_pathname(entry)); - if (fe == NULL) - return (ARCHIVE_FATAL); -+ fe->filetype = archive_entry_filetype(entry); - fe->fixup |= TODO_ACLS; - archive_acl_copy(&fe->acl, archive_entry_acl(entry)); - } -@@ -877,6 +915,7 @@ - fe = current_fixup(a, archive_entry_pathname(entry)); - if (fe == NULL) - return (ARCHIVE_FATAL); -+ fe->filetype = archive_entry_filetype(entry); - fe->mac_metadata = malloc(metadata_size); - if (fe->mac_metadata != NULL) { - memcpy(fe->mac_metadata, metadata, -@@ -891,6 +930,7 @@ - fe = current_fixup(a, archive_entry_pathname(entry)); - if (fe == NULL) - return (ARCHIVE_FATAL); -+ fe->filetype = archive_entry_filetype(entry); - fe->fixup |= TODO_FFLAGS; - /* TODO: Complete this.. defer fflags from below. */ - } -@@ -2463,7 +2503,7 @@ - struct fixup_entry *next, *p; - struct stat st; - char *c; -- int fd, ret; -+ int fd, ret, openflags; - - archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, - ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA, -@@ -2490,32 +2530,53 @@ - if (p->fixup == 0) - goto skip_fixup_entry; - else { -- fd = open(p->name, O_BINARY | O_NOFOLLOW | O_RDONLY -+ /* -+ * We need to verify if the type of the file -+ * we are going to open matches the file type -+ * of the fixup entry. -+ */ -+ openflags = O_BINARY | O_NOFOLLOW | O_RDONLY -+ | O_CLOEXEC; - #if defined(O_DIRECTORY) -- | O_DIRECTORY -+ if (p->filetype == AE_IFDIR) -+ openflags |= O_DIRECTORY; - #endif -- | O_CLOEXEC); -+ fd = open(p->name, openflags); -+ -+#if defined(O_DIRECTORY) - /* -- ` * If we don't support O_DIRECTORY, -- * or open() has failed, we must stat() -- * to verify that we are opening a directory -+ * If we support O_DIRECTORY and open was -+ * successful we can skip the file type check -+ * for directories. For other file types -+ * we need to verify via fstat() or lstat() - */ --#if defined(O_DIRECTORY) -- if (fd == -1) { -+ if (fd == -1 || p->filetype != AE_IFDIR) { -+#if HAVE_FSTAT -+ if (fd > 0 && ( -+ fstat(fd, &st) != 0 || -+ la_verify_filetype(st.st_mode, -+ p->filetype) == 0)) { -+ goto skip_fixup_entry; -+ } else -+#endif - if (lstat(p->name, &st) != 0 || -- !S_ISDIR(st.st_mode)) { -+ la_verify_filetype(st.st_mode, -+ p->filetype) == 0) { - goto skip_fixup_entry; - } - } - #else - #if HAVE_FSTAT - if (fd > 0 && ( -- fstat(fd, &st) != 0 || !S_ISDIR(st.st_mode))) { -+ fstat(fd, &st) != 0 || -+ la_verify_filetype(st.st_mode, -+ p->filetype) == 0)) { - goto skip_fixup_entry; - } else - #endif - if (lstat(p->name, &st) != 0 || -- !S_ISDIR(st.st_mode)) { -+ la_verify_filetype(st.st_mode, -+ p->filetype) == 0) { - goto skip_fixup_entry; - } - #endif -@@ -2689,6 +2750,7 @@ - fe->next = a->fixup_list; - a->fixup_list = fe; - fe->fixup = 0; -+ fe->filetype = 0; - fe->name = strdup(pathname); - return (fe); - } -@@ -3811,6 +3873,7 @@ - le = current_fixup(a, a->name); - if (le == NULL) - return (ARCHIVE_FATAL); -+ le->filetype = archive_entry_filetype(a->entry); - le->fixup |= TODO_FFLAGS; - le->fflags_set = set; - /* Store the mode if it's not already there. */ diff --git a/patches/libarchive/from-debian/upstream-fixup-symlinks.patch b/patches/libarchive/from-debian/upstream-fixup-symlinks.patch deleted file mode 100644 index eeb5890..0000000 --- a/patches/libarchive/from-debian/upstream-fixup-symlinks.patch +++ /dev/null @@ -1,185 +0,0 @@ -Description: Fix following symlinks when processing the fixup list - The previous fix in b41daecb5 was incomplete. Fixup entries are - given the original path without calling cleanup_pathname(). - To make sure we don't follow a symlink, we must strip trailing - slashes from the path. - . - The fixup entries are always directories. Make sure we try to modify - only directories by providing O_DIRECTORY to open() (if supported) - and if it fails to check directory via lstat(). -Origin: upstream, https://github.com/libarchive/libarchive/commit/8a1bd5c18e896f0411a991240ce0d772bb02c840 -Author: Martin Matuska -Last-Updated: 2021-12-22 - ---- a/libarchive/archive_write_disk_posix.c -+++ b/libarchive/archive_write_disk_posix.c -@@ -2462,6 +2462,7 @@ - struct archive_write_disk *a = (struct archive_write_disk *)_a; - struct fixup_entry *next, *p; - struct stat st; -+ char *c; - int fd, ret; - - archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, -@@ -2475,24 +2476,49 @@ - while (p != NULL) { - fd = -1; - a->pst = NULL; /* Mark stat cache as out-of-date. */ -- if (p->fixup & -- (TODO_TIMES | TODO_MODE_BASE | TODO_ACLS | TODO_FFLAGS)) { -- fd = open(p->name, -- O_WRONLY | O_BINARY | O_NOFOLLOW | O_CLOEXEC); -+ -+ /* We must strip trailing slashes from the path to avoid -+ dereferencing symbolic links to directories */ -+ c = p->name; -+ while (*c != '\0') -+ c++; -+ while (c != p->name && *(c - 1) == '/') { -+ c--; -+ *c = '\0'; -+ } -+ -+ if (p->fixup == 0) -+ goto skip_fixup_entry; -+ else { -+ fd = open(p->name, O_BINARY | O_NOFOLLOW | O_RDONLY -+#if defined(O_DIRECTORY) -+ | O_DIRECTORY -+#endif -+ | O_CLOEXEC); -+ /* -+ ` * If we don't support O_DIRECTORY, -+ * or open() has failed, we must stat() -+ * to verify that we are opening a directory -+ */ -+#if defined(O_DIRECTORY) - if (fd == -1) { -- /* If we cannot lstat, skip entry */ -- if (lstat(p->name, &st) != 0) -+ if (lstat(p->name, &st) != 0 || -+ !S_ISDIR(st.st_mode)) { - goto skip_fixup_entry; -- /* -- * If we deal with a symbolic link, mark -- * it in the fixup mode to ensure no -- * modifications are made to its target. -- */ -- if (S_ISLNK(st.st_mode)) { -- p->mode &= ~S_IFMT; -- p->mode |= S_IFLNK; - } - } -+#else -+#if HAVE_FSTAT -+ if (fd > 0 && ( -+ fstat(fd, &st) != 0 || !S_ISDIR(st.st_mode))) { -+ goto skip_fixup_entry; -+ } else -+#endif -+ if (lstat(p->name, &st) != 0 || -+ !S_ISDIR(st.st_mode)) { -+ goto skip_fixup_entry; -+ } -+#endif - } - if (p->fixup & TODO_TIMES) { - set_times(a, fd, p->mode, p->name, -@@ -2504,14 +2530,13 @@ - if (p->fixup & TODO_MODE_BASE) { - #ifdef HAVE_FCHMOD - if (fd >= 0) -- fchmod(fd, p->mode); -+ fchmod(fd, p->mode & 07777); - else - #endif - #ifdef HAVE_LCHMOD -- lchmod(p->name, p->mode); -+ lchmod(p->name, p->mode & 07777); - #else -- if (!S_ISLNK(p->mode)) -- chmod(p->name, p->mode); -+ chmod(p->name, p->mode & 07777); - #endif - } - if (p->fixup & TODO_ACLS) -@@ -2664,7 +2689,6 @@ - fe->next = a->fixup_list; - a->fixup_list = fe; - fe->fixup = 0; -- fe->mode = 0; - fe->name = strdup(pathname); - return (fe); - } ---- a/libarchive/test/test_write_disk_fixup.c -+++ b/libarchive/test/test_write_disk_fixup.c -@@ -47,26 +47,50 @@ - /* - * Create a file - */ -- assertMakeFile("victim", 0600, "a"); -+ assertMakeFile("file", 0600, "a"); -+ -+ /* -+ * Create a directory -+ */ -+ assertMakeDir("dir", 0700); - - /* - * Create a directory and a symlink with the same name - */ - -- /* Directory: dir */ -+ /* Directory: dir1 */ -+ assert((ae = archive_entry_new()) != NULL); -+ archive_entry_copy_pathname(ae, "dir1/"); -+ archive_entry_set_mode(ae, AE_IFDIR | 0555); -+ assertEqualIntA(ad, 0, archive_write_header(ad, ae)); -+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); -+ archive_entry_free(ae); -+ -+ /* Directory: dir2 */ - assert((ae = archive_entry_new()) != NULL); -- archive_entry_copy_pathname(ae, "dir"); -- archive_entry_set_mode(ae, AE_IFDIR | 0606); -+ archive_entry_copy_pathname(ae, "dir2/"); -+ archive_entry_set_mode(ae, AE_IFDIR | 0555); - assertEqualIntA(ad, 0, archive_write_header(ad, ae)); - assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); - archive_entry_free(ae); - -- /* Symbolic Link: dir -> foo */ -+ /* Symbolic Link: dir1 -> dir */ -+ assert((ae = archive_entry_new()) != NULL); -+ archive_entry_copy_pathname(ae, "dir1"); -+ archive_entry_set_mode(ae, AE_IFLNK | 0777); -+ archive_entry_set_size(ae, 0); -+ archive_entry_copy_symlink(ae, "dir"); -+ assertEqualIntA(ad, 0, r = archive_write_header(ad, ae)); -+ if (r >= ARCHIVE_WARN) -+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); -+ archive_entry_free(ae); -+ -+ /* Symbolic Link: dir2 -> file */ - assert((ae = archive_entry_new()) != NULL); -- archive_entry_copy_pathname(ae, "dir"); -+ archive_entry_copy_pathname(ae, "dir2"); - archive_entry_set_mode(ae, AE_IFLNK | 0777); - archive_entry_set_size(ae, 0); -- archive_entry_copy_symlink(ae, "victim"); -+ archive_entry_copy_symlink(ae, "file"); - assertEqualIntA(ad, 0, r = archive_write_header(ad, ae)); - if (r >= ARCHIVE_WARN) - assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); -@@ -75,7 +99,9 @@ - assertEqualInt(ARCHIVE_OK, archive_write_free(ad)); - - /* Test the entries on disk. */ -- assertIsSymlink("dir", "victim", 0); -- assertFileMode("victim", 0600); -+ assertIsSymlink("dir1", "dir", 0); -+ assertIsSymlink("dir2", "file", 0); -+ assertFileMode("dir", 0700); -+ assertFileMode("file", 0600); - #endif - } diff --git a/patches/libarchive/from-rhel/libarchive-3.5.3-Fix-CVE-2022-26280.patch b/patches/libarchive/from-rhel/libarchive-3.5.3-Fix-CVE-2022-26280.patch deleted file mode 100644 index 1fd9431..0000000 --- a/patches/libarchive/from-rhel/libarchive-3.5.3-Fix-CVE-2022-26280.patch +++ /dev/null @@ -1,14 +0,0 @@ -# Patch sources from libarchive upstream -# Source: https://github.com/libarchive/libarchive/commit/cfaa28168a07ea4a53276b63068f94fce37d6aff - ---- libarchive-3.5.3/libarchive/archive_read_support_format_zip.c.old 2022-05-18 08:55:50.861574517 +0000 -+++ libarchive-3.5.3/libarchive/archive_read_support_format_zip.c 2022-05-18 08:57:03.049574517 +0000 -@@ -1657,7 +1657,7 @@ zipx_lzma_alone_init(struct archive_read - */ - - /* Read magic1,magic2,lzma_params from the ZIPX stream. */ -- if((p = __archive_read_ahead(a, 9, NULL)) == NULL) { -+ if(zip->entry_bytes_remaining < 9 || (p = __archive_read_ahead(a, 9, NULL)) == NULL) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Truncated lzma data"); - return (ARCHIVE_FATAL); diff --git a/patches/libarchive/from-rhel/libarchive-3.5.3-Fix-CVE-2022-36227.patch b/patches/libarchive/from-rhel/libarchive-3.5.3-Fix-CVE-2022-36227.patch deleted file mode 100644 index 59b56ac..0000000 --- a/patches/libarchive/from-rhel/libarchive-3.5.3-Fix-CVE-2022-36227.patch +++ /dev/null @@ -1,38 +0,0 @@ -From bff38efe8c110469c5080d387bec62a6ca15b1a5 Mon Sep 17 00:00:00 2001 -From: obiwac -Date: Fri, 22 Jul 2022 22:41:10 +0200 -Subject: [PATCH] libarchive: Handle a `calloc` returning NULL (fixes #1754) - ---- - libarchive/archive_write.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/libarchive/archive_write.c b/libarchive/archive_write.c -index 66592e82..27626b54 100644 ---- a/libarchive/archive_write.c -+++ b/libarchive/archive_write.c -@@ -201,6 +201,10 @@ __archive_write_allocate_filter(struct archive *_a) - struct archive_write_filter *f; - - f = calloc(1, sizeof(*f)); -+ -+ if (f == NULL) -+ return (NULL); -+ - f->archive = _a; - f->state = ARCHIVE_WRITE_FILTER_STATE_NEW; - if (a->filter_first == NULL) -@@ -548,6 +552,10 @@ archive_write_open2(struct archive *_a, void *client_data, - a->client_data = client_data; - - client_filter = __archive_write_allocate_filter(_a); -+ -+ if (client_filter == NULL) -+ return (ARCHIVE_FATAL); -+ - client_filter->open = archive_write_client_open; - client_filter->write = archive_write_client_write; - client_filter->close = archive_write_client_close; --- -2.37.3 - diff --git a/patches/libarchive/from-rhel/libarchive-3.5.3-Fix-size-filed-in-pax-header.patch b/patches/libarchive/from-rhel/libarchive-3.5.3-Fix-size-filed-in-pax-header.patch deleted file mode 100644 index 1339f91..0000000 --- a/patches/libarchive/from-rhel/libarchive-3.5.3-Fix-size-filed-in-pax-header.patch +++ /dev/null @@ -1,41 +0,0 @@ -From afef3d7fc131df0dac09a46b8673898860a193db Mon Sep 17 00:00:00 2001 -From: Zdenek Zambersky -Date: Tue, 11 Jan 2022 14:43:27 +0100 -Subject: [PATCH] Fixed size filed in pax header - ---- - libarchive/archive_write_set_format_pax.c | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - -diff --git a/libarchive/archive_write_set_format_pax.c b/libarchive/archive_write_set_format_pax.c -index a2b27107..52911491 100644 ---- a/libarchive/archive_write_set_format_pax.c -+++ b/libarchive/archive_write_set_format_pax.c -@@ -1028,10 +1028,8 @@ archive_write_pax_header(struct archive_write *a, - archive_string_init(&entry_name); - archive_strcpy(&entry_name, archive_entry_pathname(entry_main)); - -- /* If file size is too large, add 'size' to pax extended attrs. */ -+ /* If file size is too large, we need pax extended attrs. */ - if (archive_entry_size(entry_main) >= (((int64_t)1) << 33)) { -- add_pax_attr_int(&(pax->pax_header), "size", -- archive_entry_size(entry_main)); - need_extension = 1; - } - -@@ -1347,6 +1345,12 @@ archive_write_pax_header(struct archive_write *a, - mapsize + pax->sparse_map_padding + sparse_total); - } - -+ /* If file size is too large, add 'size' to pax extended attrs. */ -+ if (archive_entry_size(entry_main) >= (((int64_t)1) << 33)) { -+ add_pax_attr_int(&(pax->pax_header), "size", -+ archive_entry_size(entry_main)); -+ } -+ - /* Format 'ustar' header for main entry. - * - * The trouble with file size: If the reader can't understand --- -2.34.3 - diff --git a/patches/libarchive/from-rhel/openssl3-rmd160failure.patch b/patches/libarchive/from-rhel/openssl3-rmd160failure.patch deleted file mode 100644 index 4ae0f30..0000000 --- a/patches/libarchive/from-rhel/openssl3-rmd160failure.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- libarchive-3.5.1/libarchive/archive_digest.c.old 2021-05-27 15:46:54.988302284 +0200 -+++ libarchive-3.5.1/libarchive/archive_digest.c 2021-05-27 15:50:03.519746886 +0200 -@@ -432,9 +432,11 @@ - static int - __archive_ripemd160init(archive_rmd160_ctx *ctx) - { -+ int ret; - if ((*ctx = EVP_MD_CTX_new()) == NULL) - return (ARCHIVE_FAILED); -- EVP_DigestInit(*ctx, EVP_ripemd160()); -+ if (!(ret = EVP_DigestInit(*ctx, EVP_ripemd160()))) -+ return (ARCHIVE_FAILED); - return (ARCHIVE_OK); - } - diff --git a/versions.json b/versions.json index 1981c15..797ecab 100644 --- a/versions.json +++ b/versions.json @@ -826,104 +826,16 @@ "json" ] }, - "libarchive": { - "commitish": "v3.5.2", - "version_string": "3.5.2", - "license": "BSD-2-Clause", - "consortium_build_number": "0", - "package_revision": "5", - "externals_root": "opt/irods-externals", - "patches": [ - "libarchive/from-debian/typos.patch", - "libarchive/from-debian/lzip-large-dict.patch", - "libarchive/from-debian/upstream-fixup-symlinks.patch", - "libarchive/from-debian/upstream-fixup-file-flags.patch", - "libarchive/from-debian/upstream-fix-32bit-size-cast.patch", - "libarchive/from-rhel/openssl3-rmd160failure.patch", - "libarchive/from-rhel/libarchive-3.5.3-Fix-CVE-2022-26280.patch", - "libarchive/from-rhel/libarchive-3.5.3-Fix-size-filed-in-pax-header.patch", - "libarchive/from-rhel/libarchive-3.5.3-Fix-CVE-2022-36227.patch" - ], - "build_steps": [ - "TEMPLATE_CMAKE_EXECUTABLE -DCMAKE_USER_MAKE_RULES_OVERRIDE=TEMPLATE_SCRIPT_PATH/ClangOverrides.txt -DCMAKE_C_FLAGS:STRING=-fPIC -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=TEMPLATE_INSTALL_PREFIX .", - "make -jTEMPLATE_JOBS", - "make install" - ], - "external_build_steps": [ - "ls -l TEMPLATE_INSTALL_PREFIX/../* ; cp -rf TEMPLATE_INSTALL_PREFIX/../* ../../ ; ls -l ../../" - ], - "fpm_directories": ["bin","include","lib","share"], - "distro_dependencies": { - "rhel": { - "8": [ - "glibc", - "zlib", - "bzip2-libs", - "openssl-libs", - "libxml2", - "xz-libs >= 5.2.2", - "libzstd" - ], - "9": [ - "glibc", - "zlib", - "bzip2-libs", - "openssl-libs", - "libxml2", - "xz-libs >= 5.2.2" - ] - }, - "debian": { - "11": [ - "libc6", - "libz1", - "libbz2-1.0", - "libssl1.1", - "libxml2" - ], - "12": [ - "libc6", - "libz1", - "libbz2-1.0", - "libssl3", - "libxml2" - ] - }, - "ubuntu": { - "20.04": [ - "libc6", - "libz1", - "libbz2-1.0", - "libssl1.1", - "libxml2" - ], - "22.04": [ - "libc6", - "libz1", - "libbz2-1.0", - "libssl3", - "libxml2" - ], - "24.04": [ - "libc6", - "libz1", - "libbz2-1.0", - "libssl3", - "libxml2" - ] - } - } - }, "mungefs": { "commitish": "1.0.7", "version_string": "1.0.7", "license": "BSD-3-Clause", "consortium_build_number": "1", - "package_revision": "2", + "package_revision": "3", "externals_root": "opt/irods-externals", "build_steps": [ "mkdir -p build", - "cd build; rm -f CMakeCache.txt;TEMPLATE_CMAKE_EXECUTABLE -G 'Unix Makefiles' -Dcppzmq_INCLUDE_DIR=TEMPLATE_CPPZMQ_PATH/include -DZeroMQ_INCLUDE_DIR=TEMPLATE_ZMQ_PATH/include -DZeroMQ_LIBRARY=TEMPLATE_ZMQ_PATH/lib/libzmq.so -DAVROCPP_INCLUDE_DIR=TEMPLATE_AVRO_PATH/include -DAVROCPP_LIBRARY=TEMPLATE_AVRO_PATH/lib/libavrocpp.so -DAVROCPP_AVROGEN_EXECUTABLE=TEMPLATE_AVRO_PATH/bin/avrogencpp -DBOOST_ROOT=TEMPLATE_BOOST_ROOT -DLibArchive_INCLUDE_DIRS=TEMPLATE_LIBARCHIVE_PATH/include -DLibArchive_LIBRARIES=TEMPLATE_LIBARCHIVE_PATH/lib/libarchive.so -DLibArchive_INCLUDE_DIR=TEMPLATE_LIBARCHIVE_PATH/include -DLibArchive_LIBRARY=TEMPLATE_LIBARCHIVE_PATH/lib/libarchive.so -DCMAKE_INSTALL_PREFIX=TEMPLATE_INSTALL_PREFIX -DCMAKE_CXX_COMPILER=TEMPLATE_CLANGPP_EXECUTABLE -DCMAKE_C_COMPILER=TEMPLATE_CLANG_EXECUTABLE -DCMAKE_CXX_FLAGS='-Wno-deprecated-declarations' -DCMAKE_INSTALL_RPATH=/TEMPLATE_BOOST_RPATH\\;/TEMPLATE_AVRO_RPATH\\;/TEMPLATE_ZMQ_RPATH\\;/TEMPLATE_LIBARCHIVE_RPATH ..", + "cd build; rm -f CMakeCache.txt;TEMPLATE_CMAKE_EXECUTABLE -G 'Unix Makefiles' -Dcppzmq_INCLUDE_DIR=TEMPLATE_CPPZMQ_PATH/include -DZeroMQ_INCLUDE_DIR=TEMPLATE_ZMQ_PATH/include -DZeroMQ_LIBRARY=TEMPLATE_ZMQ_PATH/lib/libzmq.so -DAVROCPP_INCLUDE_DIR=TEMPLATE_AVRO_PATH/include -DAVROCPP_LIBRARY=TEMPLATE_AVRO_PATH/lib/libavrocpp.so -DAVROCPP_AVROGEN_EXECUTABLE=TEMPLATE_AVRO_PATH/bin/avrogencpp -DBOOST_ROOT=TEMPLATE_BOOST_ROOT -DCMAKE_INSTALL_PREFIX=TEMPLATE_INSTALL_PREFIX -DCMAKE_CXX_COMPILER=TEMPLATE_CLANGPP_EXECUTABLE -DCMAKE_C_COMPILER=TEMPLATE_CLANG_EXECUTABLE -DCMAKE_CXX_FLAGS='-Wno-deprecated-declarations' -DCMAKE_INSTALL_RPATH=/TEMPLATE_BOOST_RPATH\\;/TEMPLATE_AVRO_RPATH\\;/TEMPLATE_ZMQ_RPATH ..", "cd build; env LD_LIBRARY_PATH=TEMPLATE_BOOST_ROOT/lib make -jTEMPLATE_JOBS; make install" ], "external_build_steps": [ @@ -932,7 +844,6 @@ "fpm_directories": ["bin"], "interdependencies": [ "boost", - "libarchive", "avro", "zeromq4-1" ], @@ -942,12 +853,14 @@ "glibc", "libgcc", "libstdc++", + "libarchive", "fuse-libs" ], "9": [ "glibc", "libgcc", "libstdc++", + "libarchive", "fuse-libs" ] }, @@ -956,12 +869,14 @@ "libc6", "libgcc-s1", "libstdc++6", + "libarchive13", "libfuse2" ], "12": [ "libc6", "libgcc-s1", "libstdc++6", + "libarchive13", "libfuse2" ] }, @@ -970,18 +885,21 @@ "libc6", "libgcc-s1", "libstdc++6", + "libarchive13", "libfuse2" ], "22.04": [ "libc6", "libgcc-s1", "libstdc++6", + "libarchive13", "libfuse2" ], "24.04": [ "libc6", "libgcc-s1", "libstdc++6", + "libarchive13", "libfuse2" ] }