The branch main has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=2e113ef82465598b8c26e0ca415fbe90677fbd47
commit 2e113ef82465598b8c26e0ca415fbe90677fbd47 Merge: 4bf049bfeefd 76141d3306de Author: Martin Matuska <m...@freebsd.org> AuthorDate: 2025-06-01 20:16:26 +0000 Commit: Martin Matuska <m...@freebsd.org> CommitDate: 2025-06-01 20:54:46 +0000 libarchive: merge from vendor branch libarchive 3.8.1 New features: #2088 7-zip reader: improve self-extracting archive detection #2137 zip writer: added XZ, LZMA, ZSTD and BZIP2 support #2403 zip writer: added LZMA + RISCV BCJ filter #2601 bsdtar: support --mtime and --clamp-mtime #2602 libarchive: mbedtls 3.x compatibility Security fixes: #2422 tar reader: Handle truncation in the middle of a GNU long linkname CVE-2024-57970 #2532 tar reader: fix unchecked return value in list_item_verbose() CVE-2025-25724 #2532 unzip: fix null pointer dereference CVE-2025-1632 #2568 warc: prevent signed integer overflow #2584 rar: do not skip past EOF while reading #2588 tar: fix overflow in build_ustar_entry #2598 rar: fix double free with over 4 billion nodes #2599 rar: fix heap-buffer-overflow Important bugfixes: #2399 7-zip reader: add SPARC filter support for non-LZMA compressors #2405 tar reader: ignore ustar size when pax size is present #2435 tar writer: fix bug when -s/a/b/ used more than once with b flag #2459 7-zip reader: add POWERPC filter support for non-LZMA compressors #2519 libarchive: handle ARCHIVE_FILTER_LZOP in archive_read_append_filter #2539 libarchive: add missing seeker function to archive_read_open_FILE() #2544 gzip: allow setting the original filename for gzip compressed files #2564 libarchive: improve lseek handling #2582 rar: support large headers on 32 bit systems #2587 bsdtar: don't hardlink negative inode files together #2596 rar: support large headers on 32 bit systems #2606 libarchive: support @-prefixed Unix epoch timestamps as date strings #2634 tar: Support negative time values with pax #2637 tar: Keep block alignment after pax error #2642 libarchive: fix FILE_skip regression #2643 tar: Handle extra bytes after sparse entries #2649 compress: Prevent call stack overflow #2651 iso9660: always check archive_string_ensure return value CVE: CVE-2024-57970, CVE-2025-1632, CVE-2025-25724 PR: 286944 (exp-run, 3.8.0) MFC after: 2 weeks contrib/libarchive/COPYING | 2 +- contrib/libarchive/NEWS | 8 + contrib/libarchive/README.md | 9 +- .../github_actions/install-macos-dependencies.sh | 19 + contrib/libarchive/cpio/cpio.c | 2 +- contrib/libarchive/cpio/test/test_format_newc.c | 12 +- contrib/libarchive/cpio/test/test_option_a.c | 2 +- contrib/libarchive/cpio/test/test_option_c.c | 8 +- contrib/libarchive/libarchive/archive.h | 57 +- contrib/libarchive/libarchive/archive_acl.c | 14 +- .../libarchive/libarchive/archive_acl_private.h | 2 +- contrib/libarchive/libarchive/archive_cmdline.c | 2 +- .../libarchive/archive_cryptor_private.h | 8 + contrib/libarchive/libarchive/archive_digest.c | 344 +- .../libarchive/libarchive/archive_digest_private.h | 35 +- .../libarchive/archive_disk_acl_freebsd.c | 4 +- contrib/libarchive/libarchive/archive_entry.c | 54 +- contrib/libarchive/libarchive/archive_entry.h | 84 +- .../libarchive/archive_entry_link_resolver.c | 8 + .../libarchive/libarchive/archive_entry_locale.h | 2 +- .../libarchive/libarchive/archive_entry_private.h | 13 +- .../libarchive/libarchive/archive_hmac_private.h | 2 +- contrib/libarchive/libarchive/archive_match.c | 102 +- contrib/libarchive/libarchive/archive_options.c | 4 +- .../libarchive/archive_options_private.h | 4 +- contrib/libarchive/libarchive/archive_pack_dev.h | 2 +- .../{archive_getdate.c => archive_parse_date.c} | 65 +- contrib/libarchive/libarchive/archive_platform.h | 5 + .../libarchive/libarchive/archive_platform_acl.h | 2 +- .../libarchive/libarchive/archive_platform_xattr.h | 2 +- contrib/libarchive/libarchive/archive_ppmd7.c | 11 +- contrib/libarchive/libarchive/archive_ppmd8.c | 15 +- .../libarchive/libarchive/archive_ppmd_private.h | 18 +- .../libarchive/libarchive/archive_random_private.h | 2 +- contrib/libarchive/libarchive/archive_rb.h | 2 +- contrib/libarchive/libarchive/archive_read.c | 6 - .../libarchive/archive_read_append_filter.c | 4 + .../libarchive/archive_read_disk_entry_from_file.c | 2 +- .../libarchive/archive_read_disk_posix.c | 9 +- .../libarchive/archive_read_disk_private.h | 7 +- .../libarchive/libarchive/archive_read_format.3 | 15 + .../libarchive/libarchive/archive_read_open_fd.c | 42 +- .../libarchive/libarchive/archive_read_open_file.c | 121 +- .../libarchive/archive_read_open_filename.c | 61 +- .../archive_read_support_filter_by_code.c | 14 - .../archive_read_support_filter_compress.c | 3 +- .../libarchive/archive_read_support_filter_lz4.c | 1 - .../libarchive/archive_read_support_format_7zip.c | 445 +- .../archive_read_support_format_by_code.c | 15 - .../libarchive/archive_read_support_format_cab.c | 7 +- .../libarchive/archive_read_support_format_cpio.c | 22 +- .../archive_read_support_format_iso9660.c | 4 +- .../libarchive/archive_read_support_format_lha.c | 73 +- .../libarchive/archive_read_support_format_rar.c | 184 +- .../libarchive/archive_read_support_format_rar5.c | 101 +- .../libarchive/archive_read_support_format_tar.c | 409 +- .../libarchive/archive_read_support_format_warc.c | 7 +- .../libarchive/archive_read_support_format_xar.c | 355 +- .../libarchive/archive_read_support_format_zip.c | 33 +- contrib/libarchive/libarchive/archive_string.c | 141 +- .../libarchive/archive_string_composition.h | 3 +- .../libarchive/libarchive/archive_string_sprintf.c | 11 +- contrib/libarchive/libarchive/archive_time.c | 163 + .../{archive_getdate.h => archive_time_private.h} | 26 +- contrib/libarchive/libarchive/archive_util.c | 76 +- .../libarchive/archive_version_details.c | 405 +- contrib/libarchive/libarchive/archive_write.c | 2 +- .../archive_write_add_filter_b64encode.c | 2 +- .../libarchive/archive_write_add_filter_gzip.c | 19 +- .../libarchive/archive_write_add_filter_uuencode.c | 2 +- .../libarchive/archive_write_disk_posix.c | 15 +- .../libarchive/archive_write_open_filename.c | 8 +- .../libarchive/archive_write_set_format_7zip.c | 298 +- .../libarchive/archive_write_set_format_gnutar.c | 16 +- .../libarchive/archive_write_set_format_iso9660.c | 25 +- .../libarchive/archive_write_set_format_mtree.c | 123 +- .../libarchive/archive_write_set_format_pax.c | 6 +- .../libarchive/archive_write_set_format_xar.c | 692 +- .../libarchive/archive_write_set_format_zip.c | 986 +- .../libarchive/archive_write_set_options.3 | 43 +- contrib/libarchive/libarchive/libarchive-formats.5 | 20 +- .../libarchive/libarchive/test/read_open_memory.c | 2 +- .../libarchive/test/test_7zip_filename_encoding.c | 200 +- contrib/libarchive/libarchive/test/test_acl_pax.c | 8 +- .../libarchive/test/test_acl_platform_nfs4.c | 10 +- .../libarchive/test/test_acl_platform_posix1e.c | 3 +- .../libarchive/libarchive/test/test_acl_posix1e.c | 8 +- contrib/libarchive/libarchive/test/test_acl_text.c | 2 +- .../libarchive/test/test_archive_match_time.c | 71 +- ...archive_getdate.c => test_archive_parse_date.c} | 21 +- .../test/test_archive_string_conversion.c | 4 +- .../libarchive/test/test_compat_gtar_large.c | 224 + .../libarchive/test/test_compat_solaris_tar_acl.c | 4 +- .../libarchive/test/test_compat_star_acl.c | 6 +- contrib/libarchive/libarchive/test/test_entry.c | 2 +- .../libarchive/libarchive/test/test_open_file.c | 9 +- .../test/test_read_disk_directory_traversals.c | 2 +- .../libarchive/test/test_read_format_7zip.c | 315 +- .../test_read_format_7zip_deflate_powerpc.7z.uu | 55 + .../test_read_format_7zip_extract_second.7z.uu | 22 +- .../test/test_read_format_7zip_lzma2_powerpc.7z.uu | 48 + .../test/test_read_format_7zip_lzma2_riscv.7z.uu | 49 + .../test/test_read_format_7zip_lzma2_sparc.7z.uu | 51 + .../test/test_read_format_7zip_sfx_elf.elf.uu | 9442 ++++++++++++++++++++ .../test_read_format_7zip_sfx_modified_pe.exe.uu | 109 + .../test/test_read_format_7zip_sfx_pe.exe.uu | 4751 ++++++++++ .../test/test_read_format_7zip_zstd_sparc.7z.uu | 59 + .../test/test_read_format_gtar_redundant_L.c | 40 + .../test_read_format_gtar_redundant_L.tar.Z.uu | 16 + .../libarchive/test/test_read_format_gtar_sparse.c | 8 +- .../test/test_read_format_gtar_sparse_length.c | 53 + .../test_read_format_gtar_sparse_length.tar.Z.uu | 12 + ...est_read_format_gtar_sparse_skip_entry.tar.Z.uu | 18 +- .../libarchive/test/test_read_format_rar.c | 74 +- .../libarchive/test/test_read_format_rar5.c | 29 +- .../test/test_read_format_rar5_unicode.rar.uu | 18 +- .../test/test_read_format_rar_encryption.c | 4 +- .../test/test_read_format_rar_endarc_huge.rar.uu | 4 + .../test/test_read_format_rar_newsub_huge.rar.uu | 5 + .../test/test_read_format_rar_overflow.c | 48 + .../test/test_read_format_rar_overflow.rar.uu | 11 + .../test/test_read_format_rar_symlink_huge.rar.uu | 5 + .../test_read_format_tar_empty_with_gnulabel.c | 2 +- .../test/test_read_format_tar_mac_metadata.c | 85 + .../test_read_format_tar_mac_metadata_1.tar.uu | 231 + .../test/test_read_format_tar_pax_g_large.c | 53 + .../test/test_read_format_tar_pax_g_large.tar.uu | 49 + .../test/test_read_format_tar_pax_negative_time.c | 68 + .../test_read_format_tar_pax_negative_time.tar.uu | 60 + .../libarchive/test/test_read_format_warc.c | 24 + .../test/test_read_format_warc_incomplete.warc.uu | 10 + .../libarchive/test/test_read_format_zip.c | 5 +- .../test/test_read_pax_empty_val_no_nl.c | 65 + .../test/test_read_pax_empty_val_no_nl.tar.uu | 60 + .../libarchive/test/test_read_position.c | 2 +- .../libarchive/libarchive/test/test_sparse_basic.c | 8 +- .../libarchive/libarchive/test/test_tar_large.c | 2 +- .../libarchive/test/test_write_disk_perms.c | 8 +- .../test/test_write_disk_secure_noabsolutepaths.c | 4 +- .../libarchive/test/test_write_filter_gzip.c | 5 +- .../libarchive/test/test_write_format_7zip.c | 6 + .../libarchive/test/test_write_format_7zip_large.c | 6 + .../libarchive/test/test_write_format_gnutar.c | 29 +- .../test/test_write_format_mtree_preset_digests.c | 2107 +++++ .../libarchive/test/test_write_format_tar_sparse.c | 4 +- .../libarchive/test/test_write_format_xar.c | 39 + .../test/test_write_format_zip64_stream.c | 192 +- .../test/test_write_format_zip_compression_bzip2.c | 362 + .../test_write_format_zip_compression_lzmaxz.c | 425 + .../test/test_write_format_zip_compression_store.c | 277 +- .../test/test_write_format_zip_compression_zstd.c | 366 + .../test/test_write_format_zip_entry_size_unset.c | 150 +- .../libarchive/test/test_write_format_zip_file.c | 164 +- .../test/test_write_format_zip_file_zip64.c | 192 +- .../libarchive/test/test_write_format_zip_large.c | 35 +- .../libarchive/test/test_write_format_zip_stream.c | 156 +- contrib/libarchive/libarchive_fe/passphrase.c | 10 +- contrib/libarchive/tar/bsdtar.1 | 74 +- contrib/libarchive/tar/bsdtar.c | 35 +- contrib/libarchive/tar/bsdtar.h | 12 +- contrib/libarchive/tar/cmdline.c | 2 + contrib/libarchive/tar/subst.c | 1 + contrib/libarchive/tar/test/test_list_item.c | 63 + contrib/libarchive/tar/test/test_list_item.tar.uu | 169 + contrib/libarchive/tar/test/test_option_C_mtree.c | 4 +- .../{test_option_P.c => test_option_P_upper.c} | 0 .../libarchive/tar/test/test_option_ignore_zeros.c | 4 +- contrib/libarchive/tar/test/test_option_mtime.c | 82 + contrib/libarchive/tar/test/test_option_s.c | 14 +- contrib/libarchive/tar/test/test_stdio.c | 48 +- contrib/libarchive/tar/util.c | 57 +- contrib/libarchive/tar/write.c | 4 + contrib/libarchive/test_utils/test_common.h | 2 +- contrib/libarchive/test_utils/test_main.c | 192 +- contrib/libarchive/test_utils/test_utils.c | 48 + contrib/libarchive/test_utils/test_utils.h | 11 +- contrib/libarchive/unzip/bsdunzip.c | 21 +- contrib/libarchive/unzip/la_getline.h | 16 + lib/libarchive/Makefile | 3 +- lib/libarchive/tests/Makefile | 35 +- usr.bin/tar/tests/Makefile | 5 +- 181 files changed, 25587 insertions(+), 2345 deletions(-) diff --cc contrib/libarchive/README.md index 933de6986425,000000000000..0d63357292ec mode 100644,000000..100644 --- a/contrib/libarchive/README.md +++ b/contrib/libarchive/README.md @@@ -1,244 -1,0 +1,247 @@@ +# Welcome to libarchive! + +The libarchive project develops a portable, efficient C library that +can read and write streaming archives in a variety of formats. It +also includes implementations of the common `tar`, `cpio`, and `zcat` +command-line tools that use the libarchive library. + +## Questions? Issues? + +* https://www.libarchive.org is the home for ongoing + libarchive development, including documentation, + and links to the libarchive mailing lists. +* To report an issue, use the issue tracker at + https://github.com/libarchive/libarchive/issues +* To submit an enhancement to libarchive, please + submit a pull request via GitHub: https://github.com/libarchive/libarchive/pulls + +## Contents of the Distribution + +This distribution bundle includes the following major components: + +* **libarchive**: a library for reading and writing streaming archives +* **tar**: the 'bsdtar' program is a full-featured 'tar' implementation built on libarchive +* **cpio**: the 'bsdcpio' program is a different interface to essentially the same functionality +* **cat**: the 'bsdcat' program is a simple replacement tool for zcat, bzcat, xzcat, and such +* **unzip**: the 'bsdunzip' program is a simple replacement tool for Info-ZIP's unzip +* **examples**: Some small example programs that you may find useful. +* **examples/minitar**: a compact sample demonstrating use of libarchive. +* **contrib**: Various items sent to me by third parties; please contact the authors with any questions. + +The top-level directory contains the following information files: + +* **NEWS** - highlights of recent changes +* **COPYING** - what you can do with this +* **INSTALL** - installation instructions +* **README** - this file +* **CMakeLists.txt** - input for "cmake" build tool, see INSTALL +* **configure** - configuration script, see INSTALL for details. If your copy of the source lacks a `configure` script, you can try to construct it by running the script in `build/autogen.sh` (or use `cmake`). + +The following files in the top-level directory are used by the 'configure' script: + +* `Makefile.am`, `aclocal.m4`, `configure.ac` - used to build this distribution, only needed by maintainers +* `Makefile.in`, `config.h.in` - templates used by configure script + +## Documentation + +In addition to the informational articles and documentation +in the online [libarchive Wiki](https://github.com/libarchive/libarchive/wiki), +the distribution also includes a number of manual pages: + + * bsdtar.1 explains the use of the bsdtar program + * bsdcpio.1 explains the use of the bsdcpio program + * bsdcat.1 explains the use of the bsdcat program + * libarchive.3 gives an overview of the library as a whole + * archive_read.3, archive_write.3, archive_write_disk.3, and + archive_read_disk.3 provide detailed calling sequences for the read + and write APIs + * archive_entry.3 details the "struct archive_entry" utility class + * archive_internals.3 provides some insight into libarchive's + internal structure and operation. + * libarchive-formats.5 documents the file formats supported by the library + * cpio.5, mtree.5, and tar.5 provide detailed information about these + popular archive formats, including hard-to-find details about + modern cpio and tar variants. + +The manual pages above are provided in the 'doc' directory in +a number of different formats. + +You should also read the copious comments in `archive.h` and the +source code for the sample programs for more details. Please let us +know about any errors or omissions you find. + +## Supported Formats + +Currently, the library automatically detects and reads the following formats: + + * Old V7 tar archives + * POSIX ustar + * GNU tar format (including GNU long filenames, long link names, and sparse files) + * Solaris 9 extended tar format (including ACLs) + * POSIX pax interchange format + * POSIX octet-oriented cpio + * SVR4 ASCII cpio + * Binary cpio (big-endian or little-endian) + * PWB binary cpio + * ISO9660 CD-ROM images (with optional Rockridge or Joliet extensions) + * ZIP archives (with uncompressed or "deflate" compressed entries, including support for encrypted Zip archives) - * ZIPX archives (with support for bzip2, ppmd8, lzma and xz compressed entries) ++ * ZIPX archives (with support for bzip2, zstd, ppmd8, lzma and xz compressed entries) + * GNU and BSD 'ar' archives + * 'mtree' format + * 7-Zip archives (including archives that use zstandard compression) + * Microsoft CAB format + * LHA and LZH archives + * RAR and RAR 5.0 archives (with some limitations due to RAR's proprietary status) ++ * WARC archives + * XAR archives + +The library also detects and handles any of the following before evaluating the archive: + + * uuencoded files + * files with RPM wrapper + * gzip compression + * bzip2 compression + * compress/LZW compression + * lzma, lzip, and xz compression + * lz4 compression + * lzop compression + * zstandard compression + +The library can create archives in any of the following formats: + + * POSIX ustar + * POSIX pax interchange format + * "restricted" pax format, which will create ustar archives except for + entries that require pax extensions (for long filenames, ACLs, etc). + * Old GNU tar format + * Old V7 tar format + * POSIX octet-oriented cpio + * SVR4 "newc" cpio + * Binary cpio (little-endian) + * PWB binary cpio + * shar archives + * ZIP archives (with uncompressed or "deflate" compressed entries) ++ * ZIPX archives (with bzip2, zstd, lzma or xz compressed entries) + * GNU and BSD 'ar' archives + * 'mtree' format + * ISO9660 format - * 7-Zip archives ++ * 7-Zip archives (including archives that use zstandard compression) ++ * WARC archives + * XAR archives + +When creating archives, the result can be filtered with any of the following: + + * uuencode ++ * base64 + * gzip compression + * bzip2 compression + * compress/LZW compression + * lzma, lzip, and xz compression + * lz4 compression + * lzop compression + * zstandard compression + +## Notes about the Library Design + +The following notes address many of the most common +questions we are asked about libarchive: + +* This is a heavily stream-oriented system. That means that + it is optimized to read or write the archive in a single + pass from beginning to end. For example, this allows + libarchive to process archives too large to store on disk + by processing them on-the-fly as they are read from or + written to a network or tape drive. This also makes + libarchive useful for tools that need to produce + archives on-the-fly (such as webservers that provide + archived contents of a users account). + +* In-place modification and random access to the contents + of an archive are not directly supported. For some formats, + this is not an issue: For example, tar.gz archives are not + designed for random access. In some other cases, libarchive + can re-open an archive and scan it from the beginning quickly + enough to provide the needed abilities even without true + random access. Of course, some applications do require true + random access; those applications should consider alternatives + to libarchive. + +* The library is designed to be extended with new compression and + archive formats. The only requirement is that the format be + readable or writable as a stream and that each archive entry be + independent. There are articles on the libarchive Wiki explaining + how to extend libarchive. + +* On read, compression and format are always detected automatically. + +* The same API is used for all formats; it should be very + easy for software using libarchive to transparently handle + any of libarchive's archiving formats. + +* Libarchive's automatic support for decompression can be used + without archiving by explicitly selecting the "raw" and "empty" + formats. + +* I've attempted to minimize static link pollution. If you don't + explicitly invoke a particular feature (such as support for a + particular compression or format), it won't get pulled in to + statically-linked programs. In particular, if you don't explicitly + enable a particular compression or decompression support, you won't + need to link against the corresponding compression or decompression + 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: + 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 + functions. Patches to improve this are of great interest to us. + +* The function `archive_write_disk_header()` is _not_ thread safe on + POSIX machines and could lead to security issue resulting in world + writeable directories. Thus it must be mutexed by the calling code. + This is due to calling `umask(oldumask = umask(0))`, which sets the + umask for the whole process to 0 for a short time frame. + In case other thread calls the same function in parallel, it might + get interrupted by it and cause the executable to use umask=0 for the + remaining execution. + This will then lead to implicitly created directories to have 777 + permissions without sticky bit. + +* In particular, libarchive's modules to read or write a directory + tree do use `chdir()` to optimize the directory traversals. This + can cause problems for programs that expect to do disk access from + 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 + 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. + +* On read, the library accepts whatever blocks you hand it. + Your read callback is free to pass the library a byte at a time + or mmap the entire archive and give it to the library at once. + On write, the library always produces correctly-blocked output. + +* The object-style approach allows you to have multiple archive streams + open at once. bsdtar uses this in its "@archive" extension. + +* The archive itself is read/written using callback functions. + You can read an archive directly from an in-memory buffer or + write it to a socket, if you wish. There are some utility + functions to provide easy-to-use "open file," etc, capabilities. + +* The read/write APIs are designed to allow individual entries + to be read or written to any data source: You can create + a block of data in memory and add it to a tar archive without + first writing a temporary file. You can also read an entry from + an archive and write the data directly to a socket. If you want + to read/write entries to disk, there are convenience functions to + make this especially easy. + +* Note: The "pax interchange format" is a POSIX standard extended tar + format that should be used when the older _ustar_ format is not + appropriate. It has many advantages over other tar formats + (including the legacy GNU tar format) and is widely supported by + current tar implementations. - diff --cc contrib/libarchive/build/ci/github_actions/install-macos-dependencies.sh index 000000000000,2aa4823fc3d0..2aa4823fc3d0 mode 000000,100755..100755 --- a/contrib/libarchive/build/ci/github_actions/install-macos-dependencies.sh +++ b/contrib/libarchive/build/ci/github_actions/install-macos-dependencies.sh diff --cc contrib/libarchive/libarchive/archive_time.c index 000000000000,3352c809bd11..3352c809bd11 mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/archive_time.c +++ b/contrib/libarchive/libarchive/archive_time.c diff --cc contrib/libarchive/libarchive/test/test_compat_gtar_large.c index 000000000000,633b20c0a9f8..633b20c0a9f8 mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_compat_gtar_large.c +++ b/contrib/libarchive/libarchive/test/test_compat_gtar_large.c diff --cc contrib/libarchive/libarchive/test/test_read_format_7zip_deflate_powerpc.7z.uu index 000000000000,a7db07ca424f..a7db07ca424f mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_read_format_7zip_deflate_powerpc.7z.uu +++ b/contrib/libarchive/libarchive/test/test_read_format_7zip_deflate_powerpc.7z.uu diff --cc contrib/libarchive/libarchive/test/test_read_format_7zip_lzma2_powerpc.7z.uu index 000000000000,75940eadcb99..75940eadcb99 mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_read_format_7zip_lzma2_powerpc.7z.uu +++ b/contrib/libarchive/libarchive/test/test_read_format_7zip_lzma2_powerpc.7z.uu diff --cc contrib/libarchive/libarchive/test/test_read_format_7zip_lzma2_riscv.7z.uu index 000000000000,5f1e8fb7d218..5f1e8fb7d218 mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_read_format_7zip_lzma2_riscv.7z.uu +++ b/contrib/libarchive/libarchive/test/test_read_format_7zip_lzma2_riscv.7z.uu diff --cc contrib/libarchive/libarchive/test/test_read_format_7zip_lzma2_sparc.7z.uu index 000000000000,2ebafa01b84b..2ebafa01b84b mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_read_format_7zip_lzma2_sparc.7z.uu +++ b/contrib/libarchive/libarchive/test/test_read_format_7zip_lzma2_sparc.7z.uu diff --cc contrib/libarchive/libarchive/test/test_read_format_7zip_sfx_elf.elf.uu index 000000000000,ec859e042274..ec859e042274 mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_read_format_7zip_sfx_elf.elf.uu +++ b/contrib/libarchive/libarchive/test/test_read_format_7zip_sfx_elf.elf.uu diff --cc contrib/libarchive/libarchive/test/test_read_format_7zip_sfx_modified_pe.exe.uu index 000000000000,bf558c6e275f..bf558c6e275f mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_read_format_7zip_sfx_modified_pe.exe.uu +++ b/contrib/libarchive/libarchive/test/test_read_format_7zip_sfx_modified_pe.exe.uu diff --cc contrib/libarchive/libarchive/test/test_read_format_7zip_sfx_pe.exe.uu index 000000000000,fc1a745994c6..fc1a745994c6 mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_read_format_7zip_sfx_pe.exe.uu +++ b/contrib/libarchive/libarchive/test/test_read_format_7zip_sfx_pe.exe.uu diff --cc contrib/libarchive/libarchive/test/test_read_format_7zip_zstd_sparc.7z.uu index 000000000000,ae94baa944a2..ae94baa944a2 mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_read_format_7zip_zstd_sparc.7z.uu +++ b/contrib/libarchive/libarchive/test/test_read_format_7zip_zstd_sparc.7z.uu diff --cc contrib/libarchive/libarchive/test/test_read_format_gtar_redundant_L.c index 000000000000,167445c074f3..167445c074f3 mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_read_format_gtar_redundant_L.c +++ b/contrib/libarchive/libarchive/test/test_read_format_gtar_redundant_L.c diff --cc contrib/libarchive/libarchive/test/test_read_format_gtar_redundant_L.tar.Z.uu index 000000000000,3a0e447bf78a..3a0e447bf78a mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_read_format_gtar_redundant_L.tar.Z.uu +++ b/contrib/libarchive/libarchive/test/test_read_format_gtar_redundant_L.tar.Z.uu diff --cc contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_length.c index 000000000000,e8f3955b3384..e8f3955b3384 mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_length.c +++ b/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_length.c diff --cc contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_length.tar.Z.uu index 000000000000,a8667b861569..a8667b861569 mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_length.tar.Z.uu +++ b/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_length.tar.Z.uu diff --cc contrib/libarchive/libarchive/test/test_read_format_rar_endarc_huge.rar.uu index 000000000000,0a0db80e17e6..0a0db80e17e6 mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_read_format_rar_endarc_huge.rar.uu +++ b/contrib/libarchive/libarchive/test/test_read_format_rar_endarc_huge.rar.uu diff --cc contrib/libarchive/libarchive/test/test_read_format_rar_newsub_huge.rar.uu index 000000000000,b2255b195985..b2255b195985 mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_read_format_rar_newsub_huge.rar.uu +++ b/contrib/libarchive/libarchive/test/test_read_format_rar_newsub_huge.rar.uu diff --cc contrib/libarchive/libarchive/test/test_read_format_rar_overflow.c index 000000000000,b39ed6b2ba67..b39ed6b2ba67 mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_read_format_rar_overflow.c +++ b/contrib/libarchive/libarchive/test/test_read_format_rar_overflow.c diff --cc contrib/libarchive/libarchive/test/test_read_format_rar_overflow.rar.uu index 000000000000,48fd3fd9cb0d..48fd3fd9cb0d mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_read_format_rar_overflow.rar.uu +++ b/contrib/libarchive/libarchive/test/test_read_format_rar_overflow.rar.uu diff --cc contrib/libarchive/libarchive/test/test_read_format_rar_symlink_huge.rar.uu index 000000000000,7827e1b4f9bc..7827e1b4f9bc mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_read_format_rar_symlink_huge.rar.uu +++ b/contrib/libarchive/libarchive/test/test_read_format_rar_symlink_huge.rar.uu diff --cc contrib/libarchive/libarchive/test/test_read_format_tar_mac_metadata.c index 000000000000,b4745a22ee3b..b4745a22ee3b mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_read_format_tar_mac_metadata.c +++ b/contrib/libarchive/libarchive/test/test_read_format_tar_mac_metadata.c diff --cc contrib/libarchive/libarchive/test/test_read_format_tar_mac_metadata_1.tar.uu index 000000000000,20b2cf5efe26..20b2cf5efe26 mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_read_format_tar_mac_metadata_1.tar.uu +++ b/contrib/libarchive/libarchive/test/test_read_format_tar_mac_metadata_1.tar.uu diff --cc contrib/libarchive/libarchive/test/test_read_format_tar_pax_g_large.c index 000000000000,c4771e699777..c4771e699777 mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_read_format_tar_pax_g_large.c +++ b/contrib/libarchive/libarchive/test/test_read_format_tar_pax_g_large.c diff --cc contrib/libarchive/libarchive/test/test_read_format_tar_pax_g_large.tar.uu index 000000000000,c37d35547d26..c37d35547d26 mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_read_format_tar_pax_g_large.tar.uu +++ b/contrib/libarchive/libarchive/test/test_read_format_tar_pax_g_large.tar.uu diff --cc contrib/libarchive/libarchive/test/test_read_format_tar_pax_negative_time.c index 000000000000,b4edc3c2d951..b4edc3c2d951 mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_read_format_tar_pax_negative_time.c +++ b/contrib/libarchive/libarchive/test/test_read_format_tar_pax_negative_time.c diff --cc contrib/libarchive/libarchive/test/test_read_format_tar_pax_negative_time.tar.uu index 000000000000,fdf3fc304bc8..fdf3fc304bc8 mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_read_format_tar_pax_negative_time.tar.uu +++ b/contrib/libarchive/libarchive/test/test_read_format_tar_pax_negative_time.tar.uu diff --cc contrib/libarchive/libarchive/test/test_read_format_warc_incomplete.warc.uu index 000000000000,b91b97ef32d7..b91b97ef32d7 mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_read_format_warc_incomplete.warc.uu +++ b/contrib/libarchive/libarchive/test/test_read_format_warc_incomplete.warc.uu diff --cc contrib/libarchive/libarchive/test/test_read_pax_empty_val_no_nl.c index 000000000000,f985488754fd..f985488754fd mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_read_pax_empty_val_no_nl.c +++ b/contrib/libarchive/libarchive/test/test_read_pax_empty_val_no_nl.c diff --cc contrib/libarchive/libarchive/test/test_read_pax_empty_val_no_nl.tar.uu index 000000000000,5de8b25ecccd..5de8b25ecccd mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_read_pax_empty_val_no_nl.tar.uu +++ b/contrib/libarchive/libarchive/test/test_read_pax_empty_val_no_nl.tar.uu diff --cc contrib/libarchive/libarchive/test/test_write_format_mtree_preset_digests.c index 000000000000,cdf789b4b002..cdf789b4b002 mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_write_format_mtree_preset_digests.c +++ b/contrib/libarchive/libarchive/test/test_write_format_mtree_preset_digests.c diff --cc contrib/libarchive/libarchive/test/test_write_format_zip_compression_bzip2.c index 000000000000,7ec83309ee80..7ec83309ee80 mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_write_format_zip_compression_bzip2.c +++ b/contrib/libarchive/libarchive/test/test_write_format_zip_compression_bzip2.c diff --cc contrib/libarchive/libarchive/test/test_write_format_zip_compression_lzmaxz.c index 000000000000,c5bb2d659a04..c5bb2d659a04 mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_write_format_zip_compression_lzmaxz.c +++ b/contrib/libarchive/libarchive/test/test_write_format_zip_compression_lzmaxz.c diff --cc contrib/libarchive/libarchive/test/test_write_format_zip_compression_zstd.c index 000000000000,002026a4c0d3..002026a4c0d3 mode 000000,100644..100644 --- a/contrib/libarchive/libarchive/test/test_write_format_zip_compression_zstd.c +++ b/contrib/libarchive/libarchive/test/test_write_format_zip_compression_zstd.c diff --cc contrib/libarchive/tar/test/test_list_item.c index 000000000000,fd131c475275..fd131c475275 mode 000000,100644..100644 --- a/contrib/libarchive/tar/test/test_list_item.c +++ b/contrib/libarchive/tar/test/test_list_item.c diff --cc contrib/libarchive/tar/test/test_list_item.tar.uu index 000000000000,f0e174793438..f0e174793438 mode 000000,100644..100644 --- a/contrib/libarchive/tar/test/test_list_item.tar.uu +++ b/contrib/libarchive/tar/test/test_list_item.tar.uu diff --cc contrib/libarchive/tar/test/test_option_mtime.c index 000000000000,75cdb8390bc0..75cdb8390bc0 mode 000000,100644..100644 --- a/contrib/libarchive/tar/test/test_option_mtime.c +++ b/contrib/libarchive/tar/test/test_option_mtime.c diff --cc contrib/libarchive/test_utils/test_main.c index 76fcd79406ff,afd077fc6d0b..fe330e5a052e --- a/contrib/libarchive/test_utils/test_main.c +++ b/contrib/libarchive/test_utils/test_main.c @@@ -3542,6 -3554,59 +3554,59 @@@ test_summarize(int failed, int skips_nu memset(failed_lines, 0, sizeof(failed_lines)); } + /* + * Set or unset environment variable. + */ + static void + set_environment(const char *key, const char *value) + { + + #if defined(_WIN32) && !defined(__CYGWIN__) + if (!SetEnvironmentVariable(key, value)) { + fprintf(stderr, "SetEnvironmentVariable failed with %d\n", + (int)GetLastError()); + } + #else + if (value == NULL) { + if (unsetenv(key) == -1) + fprintf(stderr, "unsetenv: %s\n", strerror(errno)); + } else { + if (setenv(key, value, 1) == -1) + fprintf(stderr, "setenv: %s\n", strerror(errno)); + } + #endif + } + + /* + * Enforce C locale for (sub)processes. + */ + static void -set_c_locale() ++set_c_locale(void) + { + static const char *lcs[] = { + "LC_ADDRESS", + "LC_ALL", + "LC_COLLATE", + "LC_CTYPE", + "LC_IDENTIFICATION", + "LC_MEASUREMENT", + "LC_MESSAGES", + "LC_MONETARY", + "LC_NAME", + "LC_NUMERIC", + "LC_PAPER", + "LC_TELEPHONE", + "LC_TIME", + NULL + }; + size_t i; + + setlocale(LC_ALL, "C"); + set_environment("LANG", "C"); + for (i = 0; lcs[i] != NULL; i++) + set_environment(lcs[i], NULL); + } + /* * Actually run a single test, with appropriate setup and cleanup. */ diff --cc contrib/libarchive/unzip/la_getline.h index 000000000000,d7588731943d..d7588731943d mode 000000,100644..100644 --- a/contrib/libarchive/unzip/la_getline.h +++ b/contrib/libarchive/unzip/la_getline.h diff --cc lib/libarchive/Makefile index a68b938ca978,000000000000..fed73c388318 mode 100644,000000..100644 --- a/lib/libarchive/Makefile +++ b/lib/libarchive/Makefile @@@ -1,413 -1,0 +1,414 @@@ +.include <src.opts.mk> + +PACKAGE=lib${LIB} +_LIBARCHIVEDIR= ${SRCTOP}/contrib/libarchive + +LIB= archive + +# FreeBSD SHLIB_MAJOR value is managed as part of the FreeBSD system. +# It has no real relation to the libarchive version number. +SHLIB_MAJOR= 7 + +CFLAGS+= -I${.OBJDIR} +CFLAGS+= -I${SRCTOP}/sys/contrib/zstd/lib +.include "Makefile.inc" + +.if ${MACHINE_ARCH:Marm*} != "" || ${MACHINE_ARCH:Mpowerpc*} != "" +NO_WCAST_ALIGN= yes +.if ${MACHINE_ARCH:M*64*} == "" +CFLAGS+= -DPPMD_32BIT +.endif +.endif +NO_WCAST_ALIGN.clang= + +.PATH: ${_LIBARCHIVEDIR}/libarchive + +# Headers to be installed in /usr/include +INCS= archive.h archive_entry.h + +# Sources to be compiled. +SRCS= archive_acl.c \ + archive_blake2sp_ref.c \ + archive_blake2s_ref.c \ + archive_check_magic.c \ + archive_cmdline.c \ + archive_cryptor.c \ + archive_disk_acl_freebsd.c \ + archive_digest.c \ + archive_entry.c \ + archive_entry_copy_stat.c \ + archive_entry_link_resolver.c \ + archive_entry_sparse.c \ + archive_entry_stat.c \ + archive_entry_strmode.c \ + archive_entry_xattr.c \ - archive_getdate.c \ + archive_hmac.c \ + archive_match.c \ + archive_options.c \ + archive_pack_dev.c \ ++ archive_parse_date.c \ + archive_pathmatch.c \ + archive_ppmd7.c \ + archive_ppmd8.c \ + archive_random.c \ + archive_rb.c \ + archive_read.c \ + archive_read_add_passphrase.c \ + archive_read_append_filter.c \ + archive_read_data_into_fd.c \ + archive_read_disk_entry_from_file.c \ + archive_read_disk_posix.c \ + archive_read_disk_set_standard_lookup.c \ + archive_read_extract.c \ + archive_read_extract2.c \ + archive_read_open_fd.c \ + archive_read_open_file.c \ + archive_read_open_filename.c \ + archive_read_open_memory.c \ + archive_read_set_format.c \ + archive_read_set_options.c \ + archive_read_support_filter_all.c \ + archive_read_support_filter_bzip2.c \ + archive_read_support_filter_by_code.c \ + archive_read_support_filter_compress.c \ + archive_read_support_filter_gzip.c \ + archive_read_support_filter_grzip.c \ + archive_read_support_filter_lrzip.c \ + archive_read_support_filter_lz4.c \ + archive_read_support_filter_lzop.c \ + archive_read_support_filter_none.c \ + archive_read_support_filter_program.c \ + archive_read_support_filter_rpm.c \ + archive_read_support_filter_uu.c \ + archive_read_support_filter_xz.c \ + archive_read_support_filter_zstd.c \ + archive_read_support_format_7zip.c \ + archive_read_support_format_all.c \ + archive_read_support_format_ar.c \ + archive_read_support_format_by_code.c \ + archive_read_support_format_cab.c \ + archive_read_support_format_cpio.c \ + archive_read_support_format_empty.c \ + archive_read_support_format_iso9660.c \ + archive_read_support_format_lha.c \ + archive_read_support_format_mtree.c \ + archive_read_support_format_rar.c \ + archive_read_support_format_rar5.c \ + archive_read_support_format_raw.c \ + archive_read_support_format_tar.c \ + archive_read_support_format_warc.c \ + archive_read_support_format_xar.c \ + archive_read_support_format_zip.c \ + archive_string.c \ + archive_string_sprintf.c \ ++ archive_time.c \ + archive_util.c \ + archive_version_details.c \ + archive_virtual.c \ + archive_write.c \ + archive_write_add_filter.c \ + archive_write_disk_set_standard_lookup.c \ + archive_write_disk_posix.c \ + archive_write_open_fd.c \ + archive_write_open_file.c \ + archive_write_open_filename.c \ + archive_write_open_memory.c \ + archive_write_add_filter_b64encode.c \ + archive_write_add_filter_by_name.c \ + archive_write_add_filter_bzip2.c \ + archive_write_add_filter_compress.c \ + archive_write_add_filter_grzip.c \ + archive_write_add_filter_gzip.c \ + archive_write_add_filter_lrzip.c \ + archive_write_add_filter_lz4.c \ + archive_write_add_filter_lzop.c \ + archive_write_add_filter_none.c \ + archive_write_add_filter_program.c \ + archive_write_add_filter_uuencode.c \ + archive_write_add_filter_xz.c \ + archive_write_add_filter_zstd.c \ + archive_write_set_format.c \ + archive_write_set_format_7zip.c \ + archive_write_set_format_ar.c \ + archive_write_set_format_by_name.c \ + archive_write_set_format_cpio.c \ + archive_write_set_format_cpio_binary.c \ + archive_write_set_format_cpio_newc.c \ + archive_write_set_format_cpio_odc.c \ + archive_write_set_format_filter_by_ext.c \ + archive_write_set_format_gnutar.c \ + archive_write_set_format_iso9660.c \ + archive_write_set_format_mtree.c \ + archive_write_set_format_pax.c \ + archive_write_set_format_raw.c \ + archive_write_set_format_shar.c \ + archive_write_set_format_ustar.c \ + archive_write_set_format_v7tar.c \ + archive_write_set_format_warc.c \ + archive_write_set_format_xar.c \ + archive_write_set_format_zip.c \ + archive_write_set_passphrase.c \ + archive_write_set_options.c \ + filter_fork_posix.c + +# Man pages to be installed. +MAN= archive_entry.3 \ + archive_entry_acl.3 \ + archive_entry_linkify.3 \ + archive_entry_misc.3 \ + archive_entry_paths.3 \ + archive_entry_perms.3 \ + archive_entry_stat.3 \ + archive_entry_time.3 \ + archive_read.3 \ + archive_read_data.3 \ + archive_read_disk.3 \ + archive_read_extract.3 \ + archive_read_filter.3 \ + archive_read_format.3 \ + archive_read_free.3 \ + archive_read_header.3 \ + archive_read_new.3 \ + archive_read_open.3 \ + archive_read_set_options.3 \ + archive_util.3 \ + archive_write.3 \ + archive_write_blocksize.3 \ + archive_write_data.3 \ + archive_write_disk.3 \ + archive_write_filter.3 \ + archive_write_finish_entry.3 \ + archive_write_format.3 \ + archive_write_free.3 \ + archive_write_header.3 \ + archive_write_new.3 \ + archive_write_open.3 \ + archive_write_set_options.3 \ + cpio.5 \ + libarchive.3 \ + libarchive_changes.3 \ + libarchive_internals.3 \ + libarchive-formats.5 \ + tar.5 + +# Symlink the man pages under each function name. +MLINKS+= archive_entry.3 archive_entry_clear.3 +MLINKS+= archive_entry.3 archive_entry_clone.3 +MLINKS+= archive_entry.3 archive_entry_free.3 +MLINKS+= archive_entry.3 archive_entry_new.3 +MLINKS+= archive_entry_acl.3 archive_entry_acl_add_entry.3 +MLINKS+= archive_entry_acl.3 archive_entry_acl_add_entry_w.3 +MLINKS+= archive_entry_acl.3 archive_entry_acl_clear.3 +MLINKS+= archive_entry_acl.3 archive_entry_acl_count.3 +MLINKS+= archive_entry_acl.3 archive_entry_acl_next.3 +MLINKS+= archive_entry_acl.3 archive_entry_acl_next_w.3 +MLINKS+= archive_entry_acl.3 archive_entry_acl_reset.3 +MLINKS+= archive_entry_acl.3 archive_entry_acl_text_w.3 +MLINKS+= archive_entry_linkify.3 archive_entry_linkresolver.3 +MLINKS+= archive_entry_linkify.3 archive_entry_linkresolver_new.3 +MLINKS+= archive_entry_linkify.3 archive_entry_linkresolver_set_strategy.3 +MLINKS+= archive_entry_linkify.3 archive_entry_linkresolver_free.3 +MLINKS+= archive_entry_paths.3 archive_entry_copy_hardlink.3 +MLINKS+= archive_entry_paths.3 archive_entry_copy_hardlink_w.3 +MLINKS+= archive_entry_paths.3 archive_entry_copy_link.3 +MLINKS+= archive_entry_paths.3 archive_entry_copy_link_w.3 +MLINKS+= archive_entry_paths.3 archive_entry_copy_pathname.3 +MLINKS+= archive_entry_paths.3 archive_entry_copy_pathname_w.3 +MLINKS+= archive_entry_paths.3 archive_entry_copy_sourcepath.3 +MLINKS+= archive_entry_paths.3 archive_entry_copy_symlink.3 +MLINKS+= archive_entry_paths.3 archive_entry_copy_symlink_w.3 +MLINKS+= archive_entry_paths.3 archive_entry_hardlink.3 +MLINKS+= archive_entry_paths.3 archive_entry_hardlink_w.3 +MLINKS+= archive_entry_paths.3 archive_entry_pathname.3 +MLINKS+= archive_entry_paths.3 archive_entry_pathname_w.3 +MLINKS+= archive_entry_paths.3 archive_entry_set_hardlink.3 +MLINKS+= archive_entry_paths.3 archive_entry_set_link.3 +MLINKS+= archive_entry_paths.3 archive_entry_set_pathname.3 +MLINKS+= archive_entry_paths.3 archive_entry_set_symlink.3 +MLINKS+= archive_entry_paths.3 archive_entry_symlink.3 +MLINKS+= archive_entry_paths.3 archive_entry_symlink_w.3 +MLINKS+= archive_entry_paths.3 archive_entry_update_symlink_utf8.3 +MLINKS+= archive_entry_paths.3 archive_entry_update_hardlink_utf8.3 *** 1073 LINES SKIPPED ***