pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/archivers/libarchive



Module Name:    pkgsrc
Committed By:   adam
Date:           Sun Sep 15 07:02:22 UTC 2024

Modified Files:
        pkgsrc/archivers/libarchive: Makefile.common
        pkgsrc/archivers/libarchive/files: CMakeLists.txt Makefile.am
            Makefile.in NEWS config.h.in configure configure.ac
        pkgsrc/archivers/libarchive/files/build: version
        pkgsrc/archivers/libarchive/files/build/cmake: config.h.in
        pkgsrc/archivers/libarchive/files/cat: bsdcat.1
        pkgsrc/archivers/libarchive/files/cpio: cmdline.c cpio.c cpio.h
        pkgsrc/archivers/libarchive/files/cpio/test: test_option_c.c
            test_option_t.c test_owner_parse.c
        pkgsrc/archivers/libarchive/files/doc/html: archive_entry.3.html
            archive_entry_acl.3.html archive_entry_linkify.3.html
            archive_entry_misc.3.html archive_entry_paths.3.html
            archive_entry_perms.3.html archive_entry_stat.3.html
            archive_entry_time.3.html archive_read.3.html
            archive_read_add_passphrase.3.html archive_read_data.3.html
            archive_read_disk.3.html archive_read_extract.3.html
            archive_read_filter.3.html archive_read_format.3.html
            archive_read_free.3.html archive_read_header.3.html
            archive_read_new.3.html archive_read_open.3.html
            archive_read_set_options.3.html archive_util.3.html
            archive_write.3.html archive_write_blocksize.3.html
            archive_write_data.3.html archive_write_disk.3.html
            archive_write_filter.3.html archive_write_finish_entry.3.html
            archive_write_format.3.html archive_write_free.3.html
            archive_write_header.3.html archive_write_new.3.html
            archive_write_open.3.html archive_write_set_options.3.html
            archive_write_set_passphrase.3.html bsdcpio.1.html bsdtar.1.html
            cpio.5.html libarchive-formats.5.html libarchive.3.html
            libarchive_changes.3.html libarchive_internals.3.html mtree.5.html
            tar.5.html
        pkgsrc/archivers/libarchive/files/doc/man: archive_entry_perms.3
        pkgsrc/archivers/libarchive/files/doc/pdf: archive_entry.3.pdf
            archive_entry_acl.3.pdf archive_entry_linkify.3.pdf
            archive_entry_misc.3.pdf archive_entry_paths.3.pdf
            archive_entry_perms.3.pdf archive_entry_stat.3.pdf
            archive_entry_time.3.pdf archive_read.3.pdf
            archive_read_add_passphrase.3.pdf archive_read_data.3.pdf
            archive_read_disk.3.pdf archive_read_extract.3.pdf
            archive_read_filter.3.pdf archive_read_format.3.pdf
            archive_read_free.3.pdf archive_read_header.3.pdf
            archive_read_new.3.pdf archive_read_open.3.pdf
            archive_read_set_options.3.pdf archive_util.3.pdf
            archive_write.3.pdf archive_write_blocksize.3.pdf
            archive_write_data.3.pdf archive_write_disk.3.pdf
            archive_write_filter.3.pdf archive_write_finish_entry.3.pdf
            archive_write_format.3.pdf archive_write_free.3.pdf
            archive_write_header.3.pdf archive_write_new.3.pdf
            archive_write_open.3.pdf archive_write_set_options.3.pdf
            archive_write_set_passphrase.3.pdf bsdcpio.1.pdf bsdtar.1.pdf
            cpio.5.pdf libarchive-formats.5.pdf libarchive.3.pdf
            libarchive_changes.3.pdf libarchive_internals.3.pdf mtree.5.pdf
            tar.5.pdf
        pkgsrc/archivers/libarchive/files/doc/text: archive_entry_perms.3.txt
        pkgsrc/archivers/libarchive/files/doc/wiki:
            ManPageArchiveEntryPerms3.wiki
        pkgsrc/archivers/libarchive/files/libarchive: CMakeLists.txt archive.h
            archive_acl.c archive_acl_private.h archive_crc32.h archive_entry.c
            archive_entry.h archive_entry_link_resolver.c archive_entry_perms.3
            archive_entry_private.h archive_match.c archive_private.h
            archive_read.c archive_read_append_filter.c
            archive_read_disk_entry_from_file.c archive_read_disk_windows.c
            archive_read_support_filter_lzop.c
            archive_read_support_filter_rpm.c archive_read_support_filter_uu.c
            archive_read_support_format_7zip.c archive_read_support_format_ar.c
            archive_read_support_format_cab.c
            archive_read_support_format_cpio.c
            archive_read_support_format_iso9660.c
            archive_read_support_format_lha.c archive_read_support_format_rar.c
            archive_read_support_format_rar5.c
            archive_read_support_format_tar.c archive_read_support_format_xar.c
            archive_read_support_format_zip.c archive_string.c archive_util.c
            archive_windows.h archive_write.c
            archive_write_add_filter_b64encode.c
            archive_write_add_filter_bzip2.c
            archive_write_add_filter_compress.c archive_write_add_filter_xz.c
            archive_write_disk_posix.c archive_write_set_format_gnutar.c
            archive_write_set_format_iso9660.c archive_write_set_format_pax.c
            archive_write_set_format_shar.c archive_write_set_format_ustar.c
            archive_write_set_format_v7tar.c archive_write_set_format_xar.c
            archive_write_set_format_zip.c config_freebsd.h
        pkgsrc/archivers/libarchive/files/libarchive/test: CMakeLists.txt
            list.h test_archive_match_time.c test_archive_string_conversion.c
            test_compat_lzip.c test_compat_solaris_pax_sparse.c test_entry.c
            test_gnutar_filename_encoding.c test_link_resolver.c
            test_pax_filename_encoding.c test_read_format_7zip.c
            test_read_format_cpio_afio.c test_read_format_iso_Z.c
            test_read_format_mtree.c test_read_format_rar5.c
            test_read_format_tar.c test_read_format_xar.c
            test_read_format_zip_traditional_encryption_data.c
            test_ustar_filename_encoding.c test_write_filter_zstd.c
            test_write_format_zip.c test_zip_filename_encoding.c
        pkgsrc/archivers/libarchive/files/tar: util.c write.c
        pkgsrc/archivers/libarchive/files/tar/test: test_option_H_upper.c
            test_option_L_upper.c
        pkgsrc/archivers/libarchive/files/test_utils: test_main.c
        pkgsrc/archivers/libarchive/files/unzip: bsdunzip.c

Log Message:
libarchive: updated to 3.7.5

Libarchive 3.7.5

Security fixes:

fix multiple vulnerabilities identified by SAST
cpio: ignore out-of-range gid/uid/size/ino and harden AFIO parsing
lzop: prevent integer overflow
rar4: protect copy_from_lzss_window_to_unp()
rar4: fix CVE-2024-26256
rar4: fix OOB in delta and audio filter
rar4: fix out of boundary access with large files
rar4: add boundary checks to rgb filter
rar4: fix OOB access with unicode filenames
rar5: clear 'data ready' cache on window buffer reallocs
rpm: calculate huge header sizes correctly
unzip: unify EOF handling
util: fix out of boundary access in mktemp functions
uu: stop processing if lines are too long

Important bugfixes:

7zip: fix issue when skipping first file in 7zip archive that is a multiple of 65536 bytes
ar: fix archive entries having no type
lha: do not allow negative file sizes
lha: fix integer truncation on 32-bit systems
shar: check strdup return value
rar5: don't try to read rediculously long names
xar: fix another infinite loop and expat error handling
many Windows fixes, cleanups and improvements


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 pkgsrc/archivers/libarchive/Makefile.common
cvs rdiff -u -r1.12 -r1.13 pkgsrc/archivers/libarchive/files/CMakeLists.txt
cvs rdiff -u -r1.15 -r1.16 pkgsrc/archivers/libarchive/files/Makefile.am
cvs rdiff -u -r1.17 -r1.18 pkgsrc/archivers/libarchive/files/Makefile.in
cvs rdiff -u -r1.16 -r1.17 pkgsrc/archivers/libarchive/files/NEWS
cvs rdiff -u -r1.18 -r1.19 pkgsrc/archivers/libarchive/files/config.h.in
cvs rdiff -u -r1.25 -r1.26 pkgsrc/archivers/libarchive/files/configure
cvs rdiff -u -r1.24 -r1.25 pkgsrc/archivers/libarchive/files/configure.ac
cvs rdiff -u -r1.11 -r1.12 pkgsrc/archivers/libarchive/files/build/version
cvs rdiff -u -r1.12 -r1.13 \
    pkgsrc/archivers/libarchive/files/build/cmake/config.h.in
cvs rdiff -u -r1.3 -r1.4 pkgsrc/archivers/libarchive/files/cat/bsdcat.1
cvs rdiff -u -r1.10 -r1.11 pkgsrc/archivers/libarchive/files/cpio/cmdline.c
cvs rdiff -u -r1.12 -r1.13 pkgsrc/archivers/libarchive/files/cpio/cpio.c
cvs rdiff -u -r1.9 -r1.10 pkgsrc/archivers/libarchive/files/cpio/cpio.h
cvs rdiff -u -r1.8 -r1.9 \
    pkgsrc/archivers/libarchive/files/cpio/test/test_option_c.c
cvs rdiff -u -r1.7 -r1.8 \
    pkgsrc/archivers/libarchive/files/cpio/test/test_option_t.c \
    pkgsrc/archivers/libarchive/files/cpio/test/test_owner_parse.c
cvs rdiff -u -r1.11 -r1.12 \
    pkgsrc/archivers/libarchive/files/doc/html/archive_entry.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_read.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_read_disk.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_util.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_write.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_write_disk.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/bsdcpio.1.html \
    pkgsrc/archivers/libarchive/files/doc/html/bsdtar.1.html \
    pkgsrc/archivers/libarchive/files/doc/html/cpio.5.html \
    pkgsrc/archivers/libarchive/files/doc/html/libarchive-formats.5.html \
    pkgsrc/archivers/libarchive/files/doc/html/libarchive.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/libarchive_internals.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/mtree.5.html \
    pkgsrc/archivers/libarchive/files/doc/html/tar.5.html
cvs rdiff -u -r1.10 -r1.11 \
    pkgsrc/archivers/libarchive/files/doc/html/archive_entry_acl.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_entry_linkify.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_entry_paths.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_entry_perms.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_entry_stat.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_entry_time.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_read_data.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_read_extract.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_read_filter.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_read_format.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_read_free.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_read_header.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_read_new.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_read_open.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_read_set_options.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_write_blocksize.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_write_data.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_write_filter.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_write_finish_entry.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_write_format.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_write_free.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_write_header.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_write_new.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_write_open.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_write_set_options.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/libarchive_changes.3.html
cvs rdiff -u -r1.5 -r1.6 \
    pkgsrc/archivers/libarchive/files/doc/html/archive_entry_misc.3.html
cvs rdiff -u -r1.7 -r1.8 \
    pkgsrc/archivers/libarchive/files/doc/html/archive_read_add_passphrase.3.html \
    pkgsrc/archivers/libarchive/files/doc/html/archive_write_set_passphrase.3.html
cvs rdiff -u -r1.4 -r1.5 \
    pkgsrc/archivers/libarchive/files/doc/man/archive_entry_perms.3
cvs rdiff -u -r1.11 -r1.12 \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_entry.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_read.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_read_disk.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_util.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_write.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_write_disk.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/bsdcpio.1.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/bsdtar.1.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/cpio.5.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/libarchive-formats.5.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/libarchive.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/libarchive_internals.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/mtree.5.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/tar.5.pdf
cvs rdiff -u -r1.10 -r1.11 \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_entry_acl.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_entry_linkify.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_entry_paths.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_entry_perms.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_entry_stat.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_entry_time.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_read_data.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_read_extract.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_read_filter.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_read_format.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_read_free.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_read_header.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_read_new.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_read_open.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_read_set_options.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_write_blocksize.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_write_data.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_write_filter.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_write_finish_entry.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_write_format.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_write_free.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_write_header.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_write_new.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_write_open.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_write_set_options.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/libarchive_changes.3.pdf
cvs rdiff -u -r1.5 -r1.6 \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_entry_misc.3.pdf
cvs rdiff -u -r1.7 -r1.8 \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_read_add_passphrase.3.pdf \
    pkgsrc/archivers/libarchive/files/doc/pdf/archive_write_set_passphrase.3.pdf
cvs rdiff -u -r1.7 -r1.8 \
    pkgsrc/archivers/libarchive/files/doc/text/archive_entry_perms.3.txt
cvs rdiff -u -r1.7 -r1.8 \
    pkgsrc/archivers/libarchive/files/doc/wiki/ManPageArchiveEntryPerms3.wiki
cvs rdiff -u -r1.10 -r1.11 \
    pkgsrc/archivers/libarchive/files/libarchive/CMakeLists.txt \
    pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_rar.c \
    pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_xar.c \
    pkgsrc/archivers/libarchive/files/libarchive/archive_windows.h \
    pkgsrc/archivers/libarchive/files/libarchive/archive_write.c
cvs rdiff -u -r1.17 -r1.18 \
    pkgsrc/archivers/libarchive/files/libarchive/archive.h
cvs rdiff -u -r1.6 -r1.7 \
    pkgsrc/archivers/libarchive/files/libarchive/archive_acl.c \
    pkgsrc/archivers/libarchive/files/libarchive/archive_match.c \
    pkgsrc/archivers/libarchive/files/libarchive/archive_read_append_filter.c \
    pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_filter_uu.c \
    pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_cab.c \
    pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_iso9660.c
cvs rdiff -u -r1.4 -r1.5 \
    pkgsrc/archivers/libarchive/files/libarchive/archive_acl_private.h \
    pkgsrc/archivers/libarchive/files/libarchive/archive_crc32.h \
    pkgsrc/archivers/libarchive/files/libarchive/archive_entry_perms.3 \
    pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_rar5.c \
    pkgsrc/archivers/libarchive/files/libarchive/archive_write_add_filter_b64encode.c \
    pkgsrc/archivers/libarchive/files/libarchive/archive_write_add_filter_compress.c
cvs rdiff -u -r1.14 -r1.15 \
    pkgsrc/archivers/libarchive/files/libarchive/archive_entry.c \
    pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_zip.c
cvs rdiff -u -r1.13 -r1.14 \
    pkgsrc/archivers/libarchive/files/libarchive/archive_entry.h \
    pkgsrc/archivers/libarchive/files/libarchive/archive_read.c \
    pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_iso9660.c \
    pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_tar.c \
    pkgsrc/archivers/libarchive/files/libarchive/archive_util.c
cvs rdiff -u -r1.8 -r1.9 \
    pkgsrc/archivers/libarchive/files/libarchive/archive_entry_link_resolver.c \
    pkgsrc/archivers/libarchive/files/libarchive/archive_private.h \
    pkgsrc/archivers/libarchive/files/libarchive/archive_read_disk_windows.c \
    pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_ustar.c \
    pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_zip.c
cvs rdiff -u -r1.9 -r1.10 \
    pkgsrc/archivers/libarchive/files/libarchive/archive_entry_private.h \
    pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_7zip.c \
    pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_ar.c \
    pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_lha.c \
    pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_shar.c \
    pkgsrc/archivers/libarchive/files/libarchive/config_freebsd.h
cvs rdiff -u -r1.16 -r1.17 \
    pkgsrc/archivers/libarchive/files/libarchive/archive_read_disk_entry_from_file.c
cvs rdiff -u -r1.5 -r1.6 \
    pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_filter_lzop.c \
    pkgsrc/archivers/libarchive/files/libarchive/archive_write_add_filter_bzip2.c \
    pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_v7tar.c
cvs rdiff -u -r1.3 -r1.4 \
    pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_filter_rpm.c
cvs rdiff -u -r1.11 -r1.12 \
    pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_cpio.c \
    pkgsrc/archivers/libarchive/files/libarchive/archive_string.c \
    pkgsrc/archivers/libarchive/files/libarchive/archive_write_disk_posix.c
cvs rdiff -u -r1.7 -r1.8 \
    pkgsrc/archivers/libarchive/files/libarchive/archive_write_add_filter_xz.c \
    pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_gnutar.c \
    pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_xar.c
cvs rdiff -u -r1.12 -r1.13 \
    pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_pax.c
cvs rdiff -u -r1.11 -r1.12 \
    pkgsrc/archivers/libarchive/files/libarchive/test/CMakeLists.txt
cvs rdiff -u -r1.13 -r1.14 \
    pkgsrc/archivers/libarchive/files/libarchive/test/list.h
cvs rdiff -u -r1.4 -r1.5 \
    pkgsrc/archivers/libarchive/files/libarchive/test/test_archive_match_time.c \
    pkgsrc/archivers/libarchive/files/libarchive/test/test_archive_string_conversion.c \
    pkgsrc/archivers/libarchive/files/libarchive/test/test_link_resolver.c \
    pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_cpio_afio.c \
    pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_rar5.c \
    pkgsrc/archivers/libarchive/files/libarchive/test/test_write_filter_zstd.c \
    pkgsrc/archivers/libarchive/files/libarchive/test/test_write_format_zip.c
cvs rdiff -u -r1.3 -r1.4 \
    pkgsrc/archivers/libarchive/files/libarchive/test/test_compat_lzip.c \
    pkgsrc/archivers/libarchive/files/libarchive/test/test_gnutar_filename_encoding.c \
    pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_iso_Z.c \
    pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_zip_traditional_encryption_data.c \
    pkgsrc/archivers/libarchive/files/libarchive/test/test_ustar_filename_encoding.c \
    pkgsrc/archivers/libarchive/files/libarchive/test/test_zip_filename_encoding.c
cvs rdiff -u -r1.2 -r1.3 \
    pkgsrc/archivers/libarchive/files/libarchive/test/test_compat_solaris_pax_sparse.c
cvs rdiff -u -r1.8 -r1.9 \
    pkgsrc/archivers/libarchive/files/libarchive/test/test_entry.c
cvs rdiff -u -r1.7 -r1.8 \
    pkgsrc/archivers/libarchive/files/libarchive/test/test_pax_filename_encoding.c
cvs rdiff -u -r1.6 -r1.7 \
    pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_7zip.c \
    pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_tar.c
cvs rdiff -u -r1.9 -r1.10 \
    pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_mtree.c
cvs rdiff -u -r1.5 -r1.6 \
    pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_xar.c
cvs rdiff -u -r1.9 -r1.10 pkgsrc/archivers/libarchive/files/tar/util.c
cvs rdiff -u -r1.13 -r1.14 pkgsrc/archivers/libarchive/files/tar/write.c
cvs rdiff -u -r1.4 -r1.5 \
    pkgsrc/archivers/libarchive/files/tar/test/test_option_H_upper.c \
    pkgsrc/archivers/libarchive/files/tar/test/test_option_L_upper.c
cvs rdiff -u -r1.6 -r1.7 \
    pkgsrc/archivers/libarchive/files/test_utils/test_main.c
cvs rdiff -u -r1.4 -r1.5 pkgsrc/archivers/libarchive/files/unzip/bsdunzip.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/archivers/libarchive/Makefile.common
diff -u pkgsrc/archivers/libarchive/Makefile.common:1.17 pkgsrc/archivers/libarchive/Makefile.common:1.18
--- pkgsrc/archivers/libarchive/Makefile.common:1.17    Tue Apr 30 06:05:16 2024
+++ pkgsrc/archivers/libarchive/Makefile.common Sun Sep 15 07:02:17 2024
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile.common,v 1.17 2024/04/30 06:05:16 adam Exp $
+# $NetBSD: Makefile.common,v 1.18 2024/09/15 07:02:17 adam Exp $
 # used by archivers/bsdtar/Makefile
 # used by archivers/libarchive/Makefile
 
-DISTNAME=      libarchive-3.7.4
+DISTNAME=      libarchive-3.7.5
 CATEGORIES=    archivers
 MASTER_SITES=  https://www.libarchive.org/downloads/
 DISTFILES=     # empty

Index: pkgsrc/archivers/libarchive/files/CMakeLists.txt
diff -u pkgsrc/archivers/libarchive/files/CMakeLists.txt:1.12 pkgsrc/archivers/libarchive/files/CMakeLists.txt:1.13
--- pkgsrc/archivers/libarchive/files/CMakeLists.txt:1.12       Tue Apr 30 06:05:16 2024
+++ pkgsrc/archivers/libarchive/files/CMakeLists.txt    Sun Sep 15 07:02:17 2024
@@ -1,5 +1,9 @@
 #
 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12 FATAL_ERROR)
+if(APPLE AND CMAKE_VERSION VERSION_LESS "3.17.0")
+  message(WARNING "CMake>=3.17.0 required to make the generated shared library have the same Mach-O headers as autotools")
+endif()
+
 if(POLICY CMP0065)
   cmake_policy(SET CMP0065 NEW) #3.4 don't use `-rdynamic` with executables
 endif()
@@ -83,9 +87,21 @@ SET(LIBARCHIVE_VERSION_STRING  "${VERSIO
 # libarchive 3.1 == interface version 13
 math(EXPR INTERFACE_VERSION  "13 + ${_minor}")
 
-# Set SOVERSION == Interface version
-# ?? Should there be more here ??
-SET(SOVERSION "${INTERFACE_VERSION}")
+# Set SOVERSION so it matches libtool's conventions
+# libtool accepts a string "current:revision:age"; in libarchive, that's set to
+# - current: ${INTERFACE_VERSION} = 13 + ${_minor}
+# - revision: ${_revision}
+# - age: ${_minor}
+# Since libtool computes SOVERSION as "current - age", it's just '13' again
+math(EXPR SOVERSION "${INTERFACE_VERSION} - ${_minor}")
+set(SOVERSION_FULL "${SOVERSION}.${_trimmed_minor}.${_trimmed_revision}")
+
+# Override CMake's default shared library versioning scheme, which uses SOVERSION and VERSION,
+# to match libtool's conventions (see https://github.com/mesonbuild/meson/issues/1451)
+# - compatibility version: current + 1 = ${INTERFACE_VERSION} + 1
+# - current version: ${current + 1}.${revision}
+math(EXPR MACHO_COMPATIBILITY_VERSION "${INTERFACE_VERSION} + 1")
+set(MACHO_CURRENT_VERSION "${MACHO_COMPATIBILITY_VERSION}.${_revision}")
 
 # Enable CMAKE_PUSH_CHECK_STATE() and CMAKE_POP_CHECK_STATE() macros
 # saving and restoring the state of the variables.
@@ -107,7 +123,7 @@ endif ()
 # aggressive about diagnosing build problems; this can get
 # relaxed somewhat in final shipping versions.
 IF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR
-    CMAKE_C_COMPILER_ID MATCHES "^Clang$")
+    CMAKE_C_COMPILER_ID MATCHES "^Clang$" AND NOT MSVC)
   SET(CMAKE_REQUIRED_FLAGS "-Wall -Wformat -Wformat-security")
   #################################################################
   # Set compile flags for all build types.
@@ -144,7 +160,7 @@ IF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" 
     SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-dead_strip")
   ENDIF(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
 ENDIF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR
-       CMAKE_C_COMPILER_ID MATCHES "^Clang$")
+       CMAKE_C_COMPILER_ID MATCHES "^Clang$" AND NOT MSVC)
 IF (CMAKE_C_COMPILER_ID MATCHES "^XL$")
   SET(CMAKE_C_COMPILER "xlc_r")
   SET(CMAKE_REQUIRED_FLAGS "-qflag=e:e -qformat=sec")
@@ -443,7 +459,10 @@ SET(ADDITIONAL_LIBS "")
 # Find ZLIB
 #
 IF(ENABLE_ZLIB)
-  FIND_PACKAGE(ZLIB)
+  # Require zlib >= 1.2.1, see: https://github.com/libarchive/libarchive/issues/615
+  # zlib 1.2.0 should also work, but it is difficult to test for. Let's require
+  # zlib >= 1.2.1 for consistency with the autoconf build.
+  FIND_PACKAGE(ZLIB 1.2.1)
 ELSE()
   SET(ZLIB_FOUND FALSE) # Override cached value
 ENDIF()
@@ -743,7 +762,6 @@ LA_CHECK_INCLUDE_FILE("sys/mkdev.h" HAVE
 LA_CHECK_INCLUDE_FILE("sys/mount.h" HAVE_SYS_MOUNT_H)
 LA_CHECK_INCLUDE_FILE("sys/param.h" HAVE_SYS_PARAM_H)
 LA_CHECK_INCLUDE_FILE("sys/poll.h" HAVE_SYS_POLL_H)
-LA_CHECK_INCLUDE_FILE("sys/queue.h" HAVE_SYS_QUEUE_H)
 LA_CHECK_INCLUDE_FILE("sys/richacl.h" HAVE_SYS_RICHACL_H)
 LA_CHECK_INCLUDE_FILE("sys/select.h" HAVE_SYS_SELECT_H)
 LA_CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
@@ -2174,6 +2192,11 @@ IF(APPLE)
   ADD_DEFINITIONS(-Wno-deprecated-declarations)
 ENDIF(APPLE)
 
+OPTION(DONT_FAIL_ON_CRC_ERROR "Ignore CRC errors during parsing (For fuzzing)" OFF)
+IF(DONT_FAIL_ON_CRC_ERROR)
+  ADD_DEFINITIONS(-DDONT_FAIL_ON_CRC_ERROR=1)
+ENDIF(DONT_FAIL_ON_CRC_ERROR)
+
 IF(ENABLE_TEST)
   ADD_CUSTOM_TARGET(run_all_tests)
 ENDIF(ENABLE_TEST)

Index: pkgsrc/archivers/libarchive/files/Makefile.am
diff -u pkgsrc/archivers/libarchive/files/Makefile.am:1.15 pkgsrc/archivers/libarchive/files/Makefile.am:1.16
--- pkgsrc/archivers/libarchive/files/Makefile.am:1.15  Tue Apr 30 06:05:16 2024
+++ pkgsrc/archivers/libarchive/files/Makefile.am       Sun Sep 15 07:02:17 2024
@@ -371,6 +371,7 @@ libarchive_test_SOURCES= \
        libarchive/test/test_acl_platform_posix1e.c \
        libarchive/test/test_acl_posix1e.c \
        libarchive/test/test_acl_text.c \
+       libarchive/test/test_ar_mode.c \
        libarchive/test/test_archive_api_feature.c \
        libarchive/test/test_archive_clear_error.c \
        libarchive/test/test_archive_cmdline.c \
@@ -380,6 +381,7 @@ libarchive_test_SOURCES= \
        libarchive/test/test_archive_match_path.c \
        libarchive/test/test_archive_match_time.c \
        libarchive/test/test_archive_pathmatch.c \
+       libarchive/test/test_archive_read.c \
        libarchive/test/test_archive_read_add_passphrase.c \
        libarchive/test/test_archive_read_close_twice.c \
        libarchive/test/test_archive_read_close_twice_open_fd.c \
@@ -486,6 +488,7 @@ libarchive_test_SOURCES= \
        libarchive/test/test_read_format_gtar_lzma.c \
        libarchive/test/test_read_format_gtar_sparse.c \
        libarchive/test/test_read_format_gtar_sparse_skip_entry.c \
+       libarchive/test/test_read_format_huge_rpm.c \
        libarchive/test/test_read_format_iso_Z.c \
        libarchive/test/test_read_format_iso_multi_extent.c \
        libarchive/test/test_read_format_iso_xorriso.c \
@@ -520,6 +523,7 @@ libarchive_test_SOURCES= \
        libarchive/test/test_read_format_tar_empty_with_gnulabel.c \
        libarchive/test/test_read_format_tar_filename.c \
        libarchive/test/test_read_format_tar_invalid_pax_size.c \
+       libarchive/test/test_read_format_tar_pax_large_attr.c \
        libarchive/test/test_read_format_tbz.c \
        libarchive/test/test_read_format_tgz.c \
        libarchive/test/test_read_format_tlz.c \
@@ -643,6 +647,7 @@ libarchive_test_SOURCES= \
        libarchive/test/test_write_format_zip_file_zip64.c \
        libarchive/test/test_write_format_zip_large.c \
        libarchive/test/test_write_format_zip_stream.c \
+       libarchive/test/test_write_format_zip_windows_path.c \
        libarchive/test/test_write_format_zip_zip64.c \
        libarchive/test/test_write_open_memory.c \
        libarchive/test/test_write_read_format_zip.c \
@@ -786,6 +791,7 @@ libarchive_test_EXTRA_DIST=\
        libarchive/test/test_read_format_7zip_encryption.7z.uu \
        libarchive/test/test_read_format_7zip_encryption_header.7z.uu \
        libarchive/test/test_read_format_7zip_encryption_partially.7z.uu \
+       libarchive/test/test_read_format_7zip_extract_second.7z.uu \
        libarchive/test/test_read_format_7zip_lzma1.7z.uu \
        libarchive/test/test_read_format_7zip_lzma1_2.7z.uu \
        libarchive/test/test_read_format_7zip_lzma1_lzma2.7z.uu \
@@ -827,8 +833,10 @@ libarchive_test_EXTRA_DIST=\
        libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tar.uu \
        libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu \
        libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu \
+       libarchive/test/test_read_format_huge_rpm.rpm.uu \
        libarchive/test/test_read_format_iso.iso.Z.uu \
        libarchive/test/test_read_format_iso_2.iso.Z.uu \
+       libarchive/test/test_read_format_iso_3.iso.Z.uu \
        libarchive/test/test_read_format_iso_joliet.iso.Z.uu \
        libarchive/test/test_read_format_iso_joliet_by_nero.iso.Z.uu \
        libarchive/test/test_read_format_iso_joliet_long.iso.Z.uu \
@@ -919,6 +927,7 @@ libarchive_test_EXTRA_DIST=\
        libarchive/test/test_read_format_rar5_decode_number_out_of_bounds_read.rar.uu \
        libarchive/test/test_read_format_rar5_window_buf_and_size_desync.rar.uu \
        libarchive/test/test_read_format_rar5_bad_window_sz_in_mltarc_file.rar.uu \
+       libarchive/test/test_read_format_rar5_data_ready_pointer_leak.rar.uu \
        libarchive/test/test_read_format_raw.bufr.uu \
        libarchive/test/test_read_format_raw.data.gz.uu \
        libarchive/test/test_read_format_raw.data.Z.uu \
@@ -929,11 +938,13 @@ libarchive_test_EXTRA_DIST=\
        libarchive/test/test_read_format_tar_empty_pax.tar.Z.uu \
        libarchive/test/test_read_format_tar_filename_koi8r.tar.Z.uu \
        libarchive/test/test_read_format_tar_invalid_pax_size.tar.uu \
+       libarchive/test/test_read_format_tar_pax_large_attr.tar.Z.uu \
        libarchive/test/test_read_format_ustar_filename_cp866.tar.Z.uu \
        libarchive/test/test_read_format_ustar_filename_eucjp.tar.Z.uu \
        libarchive/test/test_read_format_ustar_filename_koi8r.tar.Z.uu \
        libarchive/test/test_read_format_warc.warc.uu \
        libarchive/test/test_read_format_xar_doublelink.xar.uu \
+       libarchive/test/test_read_format_xar_duplicate_filename_node.xar.uu \
        libarchive/test/test_read_format_zip.zip.uu \
        libarchive/test/test_read_format_zip_7075_utf8_paths.zip.uu \
        libarchive/test/test_read_format_zip_7z_deflate.zip.uu \

Index: pkgsrc/archivers/libarchive/files/Makefile.in
diff -u pkgsrc/archivers/libarchive/files/Makefile.in:1.17 pkgsrc/archivers/libarchive/files/Makefile.in:1.18
--- pkgsrc/archivers/libarchive/files/Makefile.in:1.17  Tue Apr 30 06:05:16 2024
+++ pkgsrc/archivers/libarchive/files/Makefile.in       Sun Sep 15 07:02:17 2024
@@ -850,7 +850,7 @@ am__libarchive_test_SOURCES_DIST = libar
        libarchive/test/test_acl_platform_nfs4.c \
        libarchive/test/test_acl_platform_posix1e.c \
        libarchive/test/test_acl_posix1e.c \
-       libarchive/test/test_acl_text.c \
+       libarchive/test/test_acl_text.c libarchive/test/test_ar_mode.c \
        libarchive/test/test_archive_api_feature.c \
        libarchive/test/test_archive_clear_error.c \
        libarchive/test/test_archive_cmdline.c \
@@ -860,6 +860,7 @@ am__libarchive_test_SOURCES_DIST = libar
        libarchive/test/test_archive_match_path.c \
        libarchive/test/test_archive_match_time.c \
        libarchive/test/test_archive_pathmatch.c \
+       libarchive/test/test_archive_read.c \
        libarchive/test/test_archive_read_add_passphrase.c \
        libarchive/test/test_archive_read_close_twice.c \
        libarchive/test/test_archive_read_close_twice_open_fd.c \
@@ -966,6 +967,7 @@ am__libarchive_test_SOURCES_DIST = libar
        libarchive/test/test_read_format_gtar_lzma.c \
        libarchive/test/test_read_format_gtar_sparse.c \
        libarchive/test/test_read_format_gtar_sparse_skip_entry.c \
+       libarchive/test/test_read_format_huge_rpm.c \
        libarchive/test/test_read_format_iso_Z.c \
        libarchive/test/test_read_format_iso_multi_extent.c \
        libarchive/test/test_read_format_iso_xorriso.c \
@@ -1000,6 +1002,7 @@ am__libarchive_test_SOURCES_DIST = libar
        libarchive/test/test_read_format_tar_empty_with_gnulabel.c \
        libarchive/test/test_read_format_tar_filename.c \
        libarchive/test/test_read_format_tar_invalid_pax_size.c \
+       libarchive/test/test_read_format_tar_pax_large_attr.c \
        libarchive/test/test_read_format_tbz.c \
        libarchive/test/test_read_format_tgz.c \
        libarchive/test/test_read_format_tlz.c \
@@ -1123,6 +1126,7 @@ am__libarchive_test_SOURCES_DIST = libar
        libarchive/test/test_write_format_zip_file_zip64.c \
        libarchive/test/test_write_format_zip_large.c \
        libarchive/test/test_write_format_zip_stream.c \
+       libarchive/test/test_write_format_zip_windows_path.c \
        libarchive/test/test_write_format_zip_zip64.c \
        libarchive/test/test_write_open_memory.c \
        libarchive/test/test_write_read_format_zip.c \
@@ -1271,6 +1275,7 @@ am_libarchive_test_OBJECTS = $(am__objec
        libarchive/test/test-test_acl_platform_posix1e.$(OBJEXT) \
        libarchive/test/test-test_acl_posix1e.$(OBJEXT) \
        libarchive/test/test-test_acl_text.$(OBJEXT) \
+       libarchive/test/test-test_ar_mode.$(OBJEXT) \
        libarchive/test/test-test_archive_api_feature.$(OBJEXT) \
        libarchive/test/test-test_archive_clear_error.$(OBJEXT) \
        libarchive/test/test-test_archive_cmdline.$(OBJEXT) \
@@ -1280,6 +1285,7 @@ am_libarchive_test_OBJECTS = $(am__objec
        libarchive/test/test-test_archive_match_path.$(OBJEXT) \
        libarchive/test/test-test_archive_match_time.$(OBJEXT) \
        libarchive/test/test-test_archive_pathmatch.$(OBJEXT) \
+       libarchive/test/test-test_archive_read.$(OBJEXT) \
        libarchive/test/test-test_archive_read_add_passphrase.$(OBJEXT) \
        libarchive/test/test-test_archive_read_close_twice.$(OBJEXT) \
        libarchive/test/test-test_archive_read_close_twice_open_fd.$(OBJEXT) \
@@ -1386,6 +1392,7 @@ am_libarchive_test_OBJECTS = $(am__objec
        libarchive/test/test-test_read_format_gtar_lzma.$(OBJEXT) \
        libarchive/test/test-test_read_format_gtar_sparse.$(OBJEXT) \
        libarchive/test/test-test_read_format_gtar_sparse_skip_entry.$(OBJEXT) \
+       libarchive/test/test-test_read_format_huge_rpm.$(OBJEXT) \
        libarchive/test/test-test_read_format_iso_Z.$(OBJEXT) \
        libarchive/test/test-test_read_format_iso_multi_extent.$(OBJEXT) \
        libarchive/test/test-test_read_format_iso_xorriso.$(OBJEXT) \
@@ -1420,6 +1427,7 @@ am_libarchive_test_OBJECTS = $(am__objec
        libarchive/test/test-test_read_format_tar_empty_with_gnulabel.$(OBJEXT) \
        libarchive/test/test-test_read_format_tar_filename.$(OBJEXT) \
        libarchive/test/test-test_read_format_tar_invalid_pax_size.$(OBJEXT) \
+       libarchive/test/test-test_read_format_tar_pax_large_attr.$(OBJEXT) \
        libarchive/test/test-test_read_format_tbz.$(OBJEXT) \
        libarchive/test/test-test_read_format_tgz.$(OBJEXT) \
        libarchive/test/test-test_read_format_tlz.$(OBJEXT) \
@@ -1543,6 +1551,7 @@ am_libarchive_test_OBJECTS = $(am__objec
        libarchive/test/test-test_write_format_zip_file_zip64.$(OBJEXT) \
        libarchive/test/test-test_write_format_zip_large.$(OBJEXT) \
        libarchive/test/test-test_write_format_zip_stream.$(OBJEXT) \
+       libarchive/test/test-test_write_format_zip_windows_path.$(OBJEXT) \
        libarchive/test/test-test_write_format_zip_zip64.$(OBJEXT) \
        libarchive/test/test-test_write_open_memory.$(OBJEXT) \
        libarchive/test/test-test_write_read_format_zip.$(OBJEXT) \
@@ -1906,6 +1915,7 @@ am__depfiles_remade = cat/$(DEPDIR)/bsdc
        libarchive/test/$(DEPDIR)/test-test_acl_platform_posix1e.Po \
        libarchive/test/$(DEPDIR)/test-test_acl_posix1e.Po \
        libarchive/test/$(DEPDIR)/test-test_acl_text.Po \
+       libarchive/test/$(DEPDIR)/test-test_ar_mode.Po \
        libarchive/test/$(DEPDIR)/test-test_archive_api_feature.Po \
        libarchive/test/$(DEPDIR)/test-test_archive_clear_error.Po \
        libarchive/test/$(DEPDIR)/test-test_archive_cmdline.Po \
@@ -1915,6 +1925,7 @@ am__depfiles_remade = cat/$(DEPDIR)/bsdc
        libarchive/test/$(DEPDIR)/test-test_archive_match_path.Po \
        libarchive/test/$(DEPDIR)/test-test_archive_match_time.Po \
        libarchive/test/$(DEPDIR)/test-test_archive_pathmatch.Po \
+       libarchive/test/$(DEPDIR)/test-test_archive_read.Po \
        libarchive/test/$(DEPDIR)/test-test_archive_read_add_passphrase.Po \
        libarchive/test/$(DEPDIR)/test-test_archive_read_close_twice.Po \
        libarchive/test/$(DEPDIR)/test-test_archive_read_close_twice_open_fd.Po \
@@ -2021,6 +2032,7 @@ am__depfiles_remade = cat/$(DEPDIR)/bsdc
        libarchive/test/$(DEPDIR)/test-test_read_format_gtar_lzma.Po \
        libarchive/test/$(DEPDIR)/test-test_read_format_gtar_sparse.Po \
        libarchive/test/$(DEPDIR)/test-test_read_format_gtar_sparse_skip_entry.Po \
+       libarchive/test/$(DEPDIR)/test-test_read_format_huge_rpm.Po \
        libarchive/test/$(DEPDIR)/test-test_read_format_iso_Z.Po \
        libarchive/test/$(DEPDIR)/test-test_read_format_iso_multi_extent.Po \
        libarchive/test/$(DEPDIR)/test-test_read_format_iso_xorriso.Po \
@@ -2055,6 +2067,7 @@ am__depfiles_remade = cat/$(DEPDIR)/bsdc
        libarchive/test/$(DEPDIR)/test-test_read_format_tar_empty_with_gnulabel.Po \
        libarchive/test/$(DEPDIR)/test-test_read_format_tar_filename.Po \
        libarchive/test/$(DEPDIR)/test-test_read_format_tar_invalid_pax_size.Po \
+       libarchive/test/$(DEPDIR)/test-test_read_format_tar_pax_large_attr.Po \
        libarchive/test/$(DEPDIR)/test-test_read_format_tbz.Po \
        libarchive/test/$(DEPDIR)/test-test_read_format_tgz.Po \
        libarchive/test/$(DEPDIR)/test-test_read_format_tlz.Po \
@@ -2178,6 +2191,7 @@ am__depfiles_remade = cat/$(DEPDIR)/bsdc
        libarchive/test/$(DEPDIR)/test-test_write_format_zip_file_zip64.Po \
        libarchive/test/$(DEPDIR)/test-test_write_format_zip_large.Po \
        libarchive/test/$(DEPDIR)/test-test_write_format_zip_stream.Po \
+       libarchive/test/$(DEPDIR)/test-test_write_format_zip_windows_path.Po \
        libarchive/test/$(DEPDIR)/test-test_write_format_zip_zip64.Po \
        libarchive/test/$(DEPDIR)/test-test_write_open_memory.Po \
        libarchive/test/$(DEPDIR)/test-test_write_read_format_zip.Po \
@@ -2993,6 +3007,7 @@ libarchive_test_SOURCES = \
        libarchive/test/test_acl_platform_posix1e.c \
        libarchive/test/test_acl_posix1e.c \
        libarchive/test/test_acl_text.c \
+       libarchive/test/test_ar_mode.c \
        libarchive/test/test_archive_api_feature.c \
        libarchive/test/test_archive_clear_error.c \
        libarchive/test/test_archive_cmdline.c \
@@ -3002,6 +3017,7 @@ libarchive_test_SOURCES = \
        libarchive/test/test_archive_match_path.c \
        libarchive/test/test_archive_match_time.c \
        libarchive/test/test_archive_pathmatch.c \
+       libarchive/test/test_archive_read.c \
        libarchive/test/test_archive_read_add_passphrase.c \
        libarchive/test/test_archive_read_close_twice.c \
        libarchive/test/test_archive_read_close_twice_open_fd.c \
@@ -3108,6 +3124,7 @@ libarchive_test_SOURCES = \
        libarchive/test/test_read_format_gtar_lzma.c \
        libarchive/test/test_read_format_gtar_sparse.c \
        libarchive/test/test_read_format_gtar_sparse_skip_entry.c \
+       libarchive/test/test_read_format_huge_rpm.c \
        libarchive/test/test_read_format_iso_Z.c \
        libarchive/test/test_read_format_iso_multi_extent.c \
        libarchive/test/test_read_format_iso_xorriso.c \
@@ -3142,6 +3159,7 @@ libarchive_test_SOURCES = \
        libarchive/test/test_read_format_tar_empty_with_gnulabel.c \
        libarchive/test/test_read_format_tar_filename.c \
        libarchive/test/test_read_format_tar_invalid_pax_size.c \
+       libarchive/test/test_read_format_tar_pax_large_attr.c \
        libarchive/test/test_read_format_tbz.c \
        libarchive/test/test_read_format_tgz.c \
        libarchive/test/test_read_format_tlz.c \
@@ -3265,6 +3283,7 @@ libarchive_test_SOURCES = \
        libarchive/test/test_write_format_zip_file_zip64.c \
        libarchive/test/test_write_format_zip_large.c \
        libarchive/test/test_write_format_zip_stream.c \
+       libarchive/test/test_write_format_zip_windows_path.c \
        libarchive/test/test_write_format_zip_zip64.c \
        libarchive/test/test_write_open_memory.c \
        libarchive/test/test_write_read_format_zip.c \
@@ -3399,6 +3418,7 @@ libarchive_test_EXTRA_DIST = \
        libarchive/test/test_read_format_7zip_encryption.7z.uu \
        libarchive/test/test_read_format_7zip_encryption_header.7z.uu \
        libarchive/test/test_read_format_7zip_encryption_partially.7z.uu \
+       libarchive/test/test_read_format_7zip_extract_second.7z.uu \
        libarchive/test/test_read_format_7zip_lzma1.7z.uu \
        libarchive/test/test_read_format_7zip_lzma1_2.7z.uu \
        libarchive/test/test_read_format_7zip_lzma1_lzma2.7z.uu \
@@ -3440,8 +3460,10 @@ libarchive_test_EXTRA_DIST = \
        libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tar.uu \
        libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu \
        libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu \
+       libarchive/test/test_read_format_huge_rpm.rpm.uu \
        libarchive/test/test_read_format_iso.iso.Z.uu \
        libarchive/test/test_read_format_iso_2.iso.Z.uu \
+       libarchive/test/test_read_format_iso_3.iso.Z.uu \
        libarchive/test/test_read_format_iso_joliet.iso.Z.uu \
        libarchive/test/test_read_format_iso_joliet_by_nero.iso.Z.uu \
        libarchive/test/test_read_format_iso_joliet_long.iso.Z.uu \
@@ -3532,6 +3554,7 @@ libarchive_test_EXTRA_DIST = \
        libarchive/test/test_read_format_rar5_decode_number_out_of_bounds_read.rar.uu \
        libarchive/test/test_read_format_rar5_window_buf_and_size_desync.rar.uu \
        libarchive/test/test_read_format_rar5_bad_window_sz_in_mltarc_file.rar.uu \
+       libarchive/test/test_read_format_rar5_data_ready_pointer_leak.rar.uu \
        libarchive/test/test_read_format_raw.bufr.uu \
        libarchive/test/test_read_format_raw.data.gz.uu \
        libarchive/test/test_read_format_raw.data.Z.uu \
@@ -3542,11 +3565,13 @@ libarchive_test_EXTRA_DIST = \
        libarchive/test/test_read_format_tar_empty_pax.tar.Z.uu \
        libarchive/test/test_read_format_tar_filename_koi8r.tar.Z.uu \
        libarchive/test/test_read_format_tar_invalid_pax_size.tar.uu \
+       libarchive/test/test_read_format_tar_pax_large_attr.tar.Z.uu \
        libarchive/test/test_read_format_ustar_filename_cp866.tar.Z.uu \
        libarchive/test/test_read_format_ustar_filename_eucjp.tar.Z.uu \
        libarchive/test/test_read_format_ustar_filename_koi8r.tar.Z.uu \
        libarchive/test/test_read_format_warc.warc.uu \
        libarchive/test/test_read_format_xar_doublelink.xar.uu \
+       libarchive/test/test_read_format_xar_duplicate_filename_node.xar.uu \
        libarchive/test/test_read_format_zip.zip.uu \
        libarchive/test/test_read_format_zip_7075_utf8_paths.zip.uu \
        libarchive/test/test_read_format_zip_7z_deflate.zip.uu \
@@ -5436,6 +5461,9 @@ libarchive/test/test-test_acl_posix1e.$(
 libarchive/test/test-test_acl_text.$(OBJEXT):  \
        libarchive/test/$(am__dirstamp) \
        libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/test-test_ar_mode.$(OBJEXT):  \
+       libarchive/test/$(am__dirstamp) \
+       libarchive/test/$(DEPDIR)/$(am__dirstamp)
 libarchive/test/test-test_archive_api_feature.$(OBJEXT):  \
        libarchive/test/$(am__dirstamp) \
        libarchive/test/$(DEPDIR)/$(am__dirstamp)
@@ -5463,6 +5491,9 @@ libarchive/test/test-test_archive_match_
 libarchive/test/test-test_archive_pathmatch.$(OBJEXT):  \
        libarchive/test/$(am__dirstamp) \
        libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/test-test_archive_read.$(OBJEXT):  \
+       libarchive/test/$(am__dirstamp) \
+       libarchive/test/$(DEPDIR)/$(am__dirstamp)
 libarchive/test/test-test_archive_read_add_passphrase.$(OBJEXT):  \
        libarchive/test/$(am__dirstamp) \
        libarchive/test/$(DEPDIR)/$(am__dirstamp)
@@ -5781,6 +5812,9 @@ libarchive/test/test-test_read_format_gt
 libarchive/test/test-test_read_format_gtar_sparse_skip_entry.$(OBJEXT):  \
        libarchive/test/$(am__dirstamp) \
        libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/test-test_read_format_huge_rpm.$(OBJEXT):  \
+       libarchive/test/$(am__dirstamp) \
+       libarchive/test/$(DEPDIR)/$(am__dirstamp)
 libarchive/test/test-test_read_format_iso_Z.$(OBJEXT):  \
        libarchive/test/$(am__dirstamp) \
        libarchive/test/$(DEPDIR)/$(am__dirstamp)
@@ -5883,6 +5917,9 @@ libarchive/test/test-test_read_format_ta
 libarchive/test/test-test_read_format_tar_invalid_pax_size.$(OBJEXT):  \
        libarchive/test/$(am__dirstamp) \
        libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/test-test_read_format_tar_pax_large_attr.$(OBJEXT):  \
+       libarchive/test/$(am__dirstamp) \
+       libarchive/test/$(DEPDIR)/$(am__dirstamp)
 libarchive/test/test-test_read_format_tbz.$(OBJEXT):  \
        libarchive/test/$(am__dirstamp) \
        libarchive/test/$(DEPDIR)/$(am__dirstamp)
@@ -6252,6 +6289,9 @@ libarchive/test/test-test_write_format_z
 libarchive/test/test-test_write_format_zip_stream.$(OBJEXT):  \
        libarchive/test/$(am__dirstamp) \
        libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/test-test_write_format_zip_windows_path.$(OBJEXT):  \
+       libarchive/test/$(am__dirstamp) \
+       libarchive/test/$(DEPDIR)/$(am__dirstamp)
 libarchive/test/test-test_write_format_zip_zip64.$(OBJEXT):  \
        libarchive/test/$(am__dirstamp) \
        libarchive/test/$(DEPDIR)/$(am__dirstamp)
@@ -6633,6 +6673,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_acl_platform_posix1e.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_acl_posix1e.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_acl_text.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_ar_mode.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_archive_api_feature.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_archive_clear_error.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_archive_cmdline.Po@am__quote@ # am--include-marker
@@ -6642,6 +6683,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_archive_match_path.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_archive_match_time.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_archive_pathmatch.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_archive_read.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_archive_read_add_passphrase.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_archive_read_close_twice.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_archive_read_close_twice_open_fd.Po@am__quote@ # am--include-marker
@@ -6748,6 +6790,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_gtar_lzma.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_gtar_sparse.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_gtar_sparse_skip_entry.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_huge_rpm.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_iso_Z.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_iso_multi_extent.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_iso_xorriso.Po@am__quote@ # am--include-marker
@@ -6782,6 +6825,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_tar_empty_with_gnulabel.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_tar_filename.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_tar_invalid_pax_size.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_tar_pax_large_attr.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_tbz.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_tgz.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_tlz.Po@am__quote@ # am--include-marker
@@ -6905,6 +6949,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_write_format_zip_file_zip64.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_write_format_zip_large.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_write_format_zip_stream.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_write_format_zip_windows_path.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_write_format_zip_zip64.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_write_open_memory.Po@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_write_read_format_zip.Po@am__quote@ # am--include-marker
@@ -11555,6 +11600,20 @@ libarchive/test/test-test_acl_text.obj: 
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/test-test_acl_text.obj 
`if test -f 'libarchive/test/test_acl_text.c'; then $(CYGPATH_W) 'libarchive/test/test_acl_text.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_acl_text.c'; fi`
 
+libarchive/test/test-test_ar_mode.o: libarchive/test/test_ar_mode.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_ar_mode.o -MD -MP -MF 
libarchive/test/$(DEPDIR)/test-test_ar_mode.Tpo -c -o libarchive/test/test-test_ar_mode.o `test -f 'libarchive/test/test_ar_mode.c' || echo '$(srcdir)/'`libarchive/test/test_ar_mode.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_ar_mode.Tpo libarchive/test/$(DEPDIR)/test-test_ar_mode.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libarchive/test/test_ar_mode.c' object='libarchive/test/test-test_ar_mode.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/test-test_ar_mode.o 
`test -f 'libarchive/test/test_ar_mode.c' || echo '$(srcdir)/'`libarchive/test/test_ar_mode.c
+
+libarchive/test/test-test_ar_mode.obj: libarchive/test/test_ar_mode.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_ar_mode.obj -MD -MP -MF 
libarchive/test/$(DEPDIR)/test-test_ar_mode.Tpo -c -o libarchive/test/test-test_ar_mode.obj `if test -f 'libarchive/test/test_ar_mode.c'; then $(CYGPATH_W) 'libarchive/test/test_ar_mode.c'; else 
$(CYGPATH_W) '$(srcdir)/libarchive/test/test_ar_mode.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_ar_mode.Tpo libarchive/test/$(DEPDIR)/test-test_ar_mode.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libarchive/test/test_ar_mode.c' object='libarchive/test/test-test_ar_mode.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/test-test_ar_mode.obj 
`if test -f 'libarchive/test/test_ar_mode.c'; then $(CYGPATH_W) 'libarchive/test/test_ar_mode.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_ar_mode.c'; fi`
+
 libarchive/test/test-test_archive_api_feature.o: libarchive/test/test_archive_api_feature.c
 @am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_archive_api_feature.o -MD 
-MP -MF libarchive/test/$(DEPDIR)/test-test_archive_api_feature.Tpo -c -o libarchive/test/test-test_archive_api_feature.o `test -f 'libarchive/test/test_archive_api_feature.c' || echo 
'$(srcdir)/'`libarchive/test/test_archive_api_feature.c
 @am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_archive_api_feature.Tpo libarchive/test/$(DEPDIR)/test-test_archive_api_feature.Po
@@ -11681,6 +11740,20 @@ libarchive/test/test-test_archive_pathma
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o 
libarchive/test/test-test_archive_pathmatch.obj `if test -f 'libarchive/test/test_archive_pathmatch.c'; then $(CYGPATH_W) 'libarchive/test/test_archive_pathmatch.c'; else $(CYGPATH_W) 
'$(srcdir)/libarchive/test/test_archive_pathmatch.c'; fi`
 
+libarchive/test/test-test_archive_read.o: libarchive/test/test_archive_read.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_archive_read.o -MD -MP -MF 
libarchive/test/$(DEPDIR)/test-test_archive_read.Tpo -c -o libarchive/test/test-test_archive_read.o `test -f 'libarchive/test/test_archive_read.c' || echo 
'$(srcdir)/'`libarchive/test/test_archive_read.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_archive_read.Tpo libarchive/test/$(DEPDIR)/test-test_archive_read.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libarchive/test/test_archive_read.c' object='libarchive/test/test-test_archive_read.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o 
libarchive/test/test-test_archive_read.o `test -f 'libarchive/test/test_archive_read.c' || echo '$(srcdir)/'`libarchive/test/test_archive_read.c
+
+libarchive/test/test-test_archive_read.obj: libarchive/test/test_archive_read.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_archive_read.obj -MD -MP 
-MF libarchive/test/$(DEPDIR)/test-test_archive_read.Tpo -c -o libarchive/test/test-test_archive_read.obj `if test -f 'libarchive/test/test_archive_read.c'; then $(CYGPATH_W) 
'libarchive/test/test_archive_read.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_archive_read.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_archive_read.Tpo libarchive/test/$(DEPDIR)/test-test_archive_read.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libarchive/test/test_archive_read.c' object='libarchive/test/test-test_archive_read.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o 
libarchive/test/test-test_archive_read.obj `if test -f 'libarchive/test/test_archive_read.c'; then $(CYGPATH_W) 'libarchive/test/test_archive_read.c'; else $(CYGPATH_W) 
'$(srcdir)/libarchive/test/test_archive_read.c'; fi`
+
 libarchive/test/test-test_archive_read_add_passphrase.o: libarchive/test/test_archive_read_add_passphrase.c
 @am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT 
libarchive/test/test-test_archive_read_add_passphrase.o -MD -MP -MF libarchive/test/$(DEPDIR)/test-test_archive_read_add_passphrase.Tpo -c -o libarchive/test/test-test_archive_read_add_passphrase.o 
`test -f 'libarchive/test/test_archive_read_add_passphrase.c' || echo '$(srcdir)/'`libarchive/test/test_archive_read_add_passphrase.c
 @am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_archive_read_add_passphrase.Tpo libarchive/test/$(DEPDIR)/test-test_archive_read_add_passphrase.Po
@@ -13165,6 +13238,20 @@ libarchive/test/test-test_read_format_gt
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o 
libarchive/test/test-test_read_format_gtar_sparse_skip_entry.obj `if test -f 'libarchive/test/test_read_format_gtar_sparse_skip_entry.c'; then $(CYGPATH_W) 
'libarchive/test/test_read_format_gtar_sparse_skip_entry.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_gtar_sparse_skip_entry.c'; fi`
 
+libarchive/test/test-test_read_format_huge_rpm.o: libarchive/test/test_read_format_huge_rpm.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_read_format_huge_rpm.o -MD 
-MP -MF libarchive/test/$(DEPDIR)/test-test_read_format_huge_rpm.Tpo -c -o libarchive/test/test-test_read_format_huge_rpm.o `test -f 'libarchive/test/test_read_format_huge_rpm.c' || echo 
'$(srcdir)/'`libarchive/test/test_read_format_huge_rpm.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_read_format_huge_rpm.Tpo libarchive/test/$(DEPDIR)/test-test_read_format_huge_rpm.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libarchive/test/test_read_format_huge_rpm.c' object='libarchive/test/test-test_read_format_huge_rpm.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o 
libarchive/test/test-test_read_format_huge_rpm.o `test -f 'libarchive/test/test_read_format_huge_rpm.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_huge_rpm.c
+
+libarchive/test/test-test_read_format_huge_rpm.obj: libarchive/test/test_read_format_huge_rpm.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_read_format_huge_rpm.obj 
-MD -MP -MF libarchive/test/$(DEPDIR)/test-test_read_format_huge_rpm.Tpo -c -o libarchive/test/test-test_read_format_huge_rpm.obj `if test -f 'libarchive/test/test_read_format_huge_rpm.c'; then 
$(CYGPATH_W) 'libarchive/test/test_read_format_huge_rpm.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_huge_rpm.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_read_format_huge_rpm.Tpo libarchive/test/$(DEPDIR)/test-test_read_format_huge_rpm.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libarchive/test/test_read_format_huge_rpm.c' object='libarchive/test/test-test_read_format_huge_rpm.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o 
libarchive/test/test-test_read_format_huge_rpm.obj `if test -f 'libarchive/test/test_read_format_huge_rpm.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_huge_rpm.c'; else $(CYGPATH_W) 
'$(srcdir)/libarchive/test/test_read_format_huge_rpm.c'; fi`
+
 libarchive/test/test-test_read_format_iso_Z.o: libarchive/test/test_read_format_iso_Z.c
 @am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_read_format_iso_Z.o -MD 
-MP -MF libarchive/test/$(DEPDIR)/test-test_read_format_iso_Z.Tpo -c -o libarchive/test/test-test_read_format_iso_Z.o `test -f 'libarchive/test/test_read_format_iso_Z.c' || echo 
'$(srcdir)/'`libarchive/test/test_read_format_iso_Z.c
 @am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_read_format_iso_Z.Tpo libarchive/test/$(DEPDIR)/test-test_read_format_iso_Z.Po
@@ -13641,6 +13728,20 @@ libarchive/test/test-test_read_format_ta
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o 
libarchive/test/test-test_read_format_tar_invalid_pax_size.obj `if test -f 'libarchive/test/test_read_format_tar_invalid_pax_size.c'; then $(CYGPATH_W) 
'libarchive/test/test_read_format_tar_invalid_pax_size.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_tar_invalid_pax_size.c'; fi`
 
+libarchive/test/test-test_read_format_tar_pax_large_attr.o: libarchive/test/test_read_format_tar_pax_large_attr.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT 
libarchive/test/test-test_read_format_tar_pax_large_attr.o -MD -MP -MF libarchive/test/$(DEPDIR)/test-test_read_format_tar_pax_large_attr.Tpo -c -o 
libarchive/test/test-test_read_format_tar_pax_large_attr.o `test -f 'libarchive/test/test_read_format_tar_pax_large_attr.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_tar_pax_large_attr.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_read_format_tar_pax_large_attr.Tpo libarchive/test/$(DEPDIR)/test-test_read_format_tar_pax_large_attr.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libarchive/test/test_read_format_tar_pax_large_attr.c' object='libarchive/test/test-test_read_format_tar_pax_large_attr.o' libtool=no 
@AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o 
libarchive/test/test-test_read_format_tar_pax_large_attr.o `test -f 'libarchive/test/test_read_format_tar_pax_large_attr.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_tar_pax_large_attr.c
+
+libarchive/test/test-test_read_format_tar_pax_large_attr.obj: libarchive/test/test_read_format_tar_pax_large_attr.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT 
libarchive/test/test-test_read_format_tar_pax_large_attr.obj -MD -MP -MF libarchive/test/$(DEPDIR)/test-test_read_format_tar_pax_large_attr.Tpo -c -o 
libarchive/test/test-test_read_format_tar_pax_large_attr.obj `if test -f 'libarchive/test/test_read_format_tar_pax_large_attr.c'; then $(CYGPATH_W) 
'libarchive/test/test_read_format_tar_pax_large_attr.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_tar_pax_large_attr.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_read_format_tar_pax_large_attr.Tpo libarchive/test/$(DEPDIR)/test-test_read_format_tar_pax_large_attr.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libarchive/test/test_read_format_tar_pax_large_attr.c' object='libarchive/test/test-test_read_format_tar_pax_large_attr.obj' libtool=no 
@AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o 
libarchive/test/test-test_read_format_tar_pax_large_attr.obj `if test -f 'libarchive/test/test_read_format_tar_pax_large_attr.c'; then $(CYGPATH_W) 
'libarchive/test/test_read_format_tar_pax_large_attr.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_tar_pax_large_attr.c'; fi`
+
 libarchive/test/test-test_read_format_tbz.o: libarchive/test/test_read_format_tbz.c
 @am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_read_format_tbz.o -MD -MP 
-MF libarchive/test/$(DEPDIR)/test-test_read_format_tbz.Tpo -c -o libarchive/test/test-test_read_format_tbz.o `test -f 'libarchive/test/test_read_format_tbz.c' || echo 
'$(srcdir)/'`libarchive/test/test_read_format_tbz.c
 @am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_read_format_tbz.Tpo libarchive/test/$(DEPDIR)/test-test_read_format_tbz.Po
@@ -15363,6 +15464,20 @@ libarchive/test/test-test_write_format_z
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o 
libarchive/test/test-test_write_format_zip_stream.obj `if test -f 'libarchive/test/test_write_format_zip_stream.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_zip_stream.c'; else 
$(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_zip_stream.c'; fi`
 
+libarchive/test/test-test_write_format_zip_windows_path.o: libarchive/test/test_write_format_zip_windows_path.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT 
libarchive/test/test-test_write_format_zip_windows_path.o -MD -MP -MF libarchive/test/$(DEPDIR)/test-test_write_format_zip_windows_path.Tpo -c -o 
libarchive/test/test-test_write_format_zip_windows_path.o `test -f 'libarchive/test/test_write_format_zip_windows_path.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_zip_windows_path.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_write_format_zip_windows_path.Tpo libarchive/test/$(DEPDIR)/test-test_write_format_zip_windows_path.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libarchive/test/test_write_format_zip_windows_path.c' object='libarchive/test/test-test_write_format_zip_windows_path.o' libtool=no 
@AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o 
libarchive/test/test-test_write_format_zip_windows_path.o `test -f 'libarchive/test/test_write_format_zip_windows_path.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_zip_windows_path.c
+
+libarchive/test/test-test_write_format_zip_windows_path.obj: libarchive/test/test_write_format_zip_windows_path.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT 
libarchive/test/test-test_write_format_zip_windows_path.obj -MD -MP -MF libarchive/test/$(DEPDIR)/test-test_write_format_zip_windows_path.Tpo -c -o 
libarchive/test/test-test_write_format_zip_windows_path.obj `if test -f 'libarchive/test/test_write_format_zip_windows_path.c'; then $(CYGPATH_W) 
'libarchive/test/test_write_format_zip_windows_path.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_zip_windows_path.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_write_format_zip_windows_path.Tpo libarchive/test/$(DEPDIR)/test-test_write_format_zip_windows_path.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libarchive/test/test_write_format_zip_windows_path.c' object='libarchive/test/test-test_write_format_zip_windows_path.obj' libtool=no 
@AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o 
libarchive/test/test-test_write_format_zip_windows_path.obj `if test -f 'libarchive/test/test_write_format_zip_windows_path.c'; then $(CYGPATH_W) 
'libarchive/test/test_write_format_zip_windows_path.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_zip_windows_path.c'; fi`
+
 libarchive/test/test-test_write_format_zip_zip64.o: libarchive/test/test_write_format_zip_zip64.c
 @am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_write_format_zip_zip64.o 
-MD -MP -MF libarchive/test/$(DEPDIR)/test-test_write_format_zip_zip64.Tpo -c -o libarchive/test/test-test_write_format_zip_zip64.o `test -f 'libarchive/test/test_write_format_zip_zip64.c' || echo 
'$(srcdir)/'`libarchive/test/test_write_format_zip_zip64.c
 @am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_write_format_zip_zip64.Tpo libarchive/test/$(DEPDIR)/test-test_write_format_zip_zip64.Po
@@ -16462,6 +16577,7 @@ distclean: distclean-am
        -rm -f libarchive/test/$(DEPDIR)/test-test_acl_platform_posix1e.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_acl_posix1e.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_acl_text.Po
+       -rm -f libarchive/test/$(DEPDIR)/test-test_ar_mode.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_archive_api_feature.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_archive_clear_error.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_archive_cmdline.Po
@@ -16471,6 +16587,7 @@ distclean: distclean-am
        -rm -f libarchive/test/$(DEPDIR)/test-test_archive_match_path.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_archive_match_time.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_archive_pathmatch.Po
+       -rm -f libarchive/test/$(DEPDIR)/test-test_archive_read.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_archive_read_add_passphrase.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_archive_read_close_twice.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_archive_read_close_twice_open_fd.Po
@@ -16577,6 +16694,7 @@ distclean: distclean-am
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_gtar_lzma.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_gtar_sparse.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_gtar_sparse_skip_entry.Po
+       -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_huge_rpm.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_iso_Z.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_iso_multi_extent.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_iso_xorriso.Po
@@ -16611,6 +16729,7 @@ distclean: distclean-am
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tar_empty_with_gnulabel.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tar_filename.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tar_invalid_pax_size.Po
+       -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tar_pax_large_attr.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tbz.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tgz.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tlz.Po
@@ -16734,6 +16853,7 @@ distclean: distclean-am
        -rm -f libarchive/test/$(DEPDIR)/test-test_write_format_zip_file_zip64.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_write_format_zip_large.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_write_format_zip_stream.Po
+       -rm -f libarchive/test/$(DEPDIR)/test-test_write_format_zip_windows_path.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_write_format_zip_zip64.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_write_open_memory.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_write_read_format_zip.Po
@@ -17241,6 +17361,7 @@ maintainer-clean: maintainer-clean-am
        -rm -f libarchive/test/$(DEPDIR)/test-test_acl_platform_posix1e.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_acl_posix1e.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_acl_text.Po
+       -rm -f libarchive/test/$(DEPDIR)/test-test_ar_mode.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_archive_api_feature.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_archive_clear_error.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_archive_cmdline.Po
@@ -17250,6 +17371,7 @@ maintainer-clean: maintainer-clean-am
        -rm -f libarchive/test/$(DEPDIR)/test-test_archive_match_path.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_archive_match_time.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_archive_pathmatch.Po
+       -rm -f libarchive/test/$(DEPDIR)/test-test_archive_read.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_archive_read_add_passphrase.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_archive_read_close_twice.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_archive_read_close_twice_open_fd.Po
@@ -17356,6 +17478,7 @@ maintainer-clean: maintainer-clean-am
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_gtar_lzma.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_gtar_sparse.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_gtar_sparse_skip_entry.Po
+       -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_huge_rpm.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_iso_Z.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_iso_multi_extent.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_iso_xorriso.Po
@@ -17390,6 +17513,7 @@ maintainer-clean: maintainer-clean-am
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tar_empty_with_gnulabel.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tar_filename.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tar_invalid_pax_size.Po
+       -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tar_pax_large_attr.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tbz.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tgz.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tlz.Po
@@ -17513,6 +17637,7 @@ maintainer-clean: maintainer-clean-am
        -rm -f libarchive/test/$(DEPDIR)/test-test_write_format_zip_file_zip64.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_write_format_zip_large.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_write_format_zip_stream.Po
+       -rm -f libarchive/test/$(DEPDIR)/test-test_write_format_zip_windows_path.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_write_format_zip_zip64.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_write_open_memory.Po
        -rm -f libarchive/test/$(DEPDIR)/test-test_write_read_format_zip.Po

Index: pkgsrc/archivers/libarchive/files/NEWS
diff -u pkgsrc/archivers/libarchive/files/NEWS:1.16 pkgsrc/archivers/libarchive/files/NEWS:1.17
--- pkgsrc/archivers/libarchive/files/NEWS:1.16 Tue Apr 30 06:05:16 2024
+++ pkgsrc/archivers/libarchive/files/NEWS      Sun Sep 15 07:02:17 2024
@@ -1,3 +1,5 @@
+Sep 13, 2024: libarchive 3.7.5 released
+
 Apr 26, 2024: libarchive 3.7.4 released
 
 Apr 08, 2024: libarchive 3.7.3 released

Index: pkgsrc/archivers/libarchive/files/config.h.in
diff -u pkgsrc/archivers/libarchive/files/config.h.in:1.18 pkgsrc/archivers/libarchive/files/config.h.in:1.19
--- pkgsrc/archivers/libarchive/files/config.h.in:1.18  Tue Apr 30 06:05:16 2024
+++ pkgsrc/archivers/libarchive/files/config.h.in       Sun Sep 15 07:02:17 2024
@@ -697,9 +697,6 @@
 /* Define to 1 if you have the <libxml/xmlwriter.h> header file. */
 #undef HAVE_LIBXML_XMLWRITER_H
 
-/* Define to 1 if you have the `z' library (-lz). */
-#undef HAVE_LIBZ
-
 /* Define to 1 if you have the `zstd' library (-lzstd). */
 #undef HAVE_LIBZSTD
 
@@ -1121,9 +1118,6 @@
 /* Define to 1 if you have the <sys/poll.h> header file. */
 #undef HAVE_SYS_POLL_H
 
-/* Define to 1 if you have the <sys/queue.h> header file. */
-#undef HAVE_SYS_QUEUE_H
-
 /* Define to 1 if you have the <sys/richacl.h> header file. */
 #undef HAVE_SYS_RICHACL_H
 
@@ -1256,7 +1250,7 @@
 /* Define to 1 if you have a working FS_IOC_GETFLAGS */
 #undef HAVE_WORKING_FS_IOC_GETFLAGS
 
-/* Define to 1 if you have the <zlib.h> header file. */
+/* Define to 1 if you have zlib >= 1.2.1 */
 #undef HAVE_ZLIB_H
 
 /* Define to 1 if you have the <zstd.h> header file. */

Index: pkgsrc/archivers/libarchive/files/configure
diff -u pkgsrc/archivers/libarchive/files/configure:1.25 pkgsrc/archivers/libarchive/files/configure:1.26
--- pkgsrc/archivers/libarchive/files/configure:1.25    Tue Apr 30 06:05:16 2024
+++ pkgsrc/archivers/libarchive/files/configure Sun Sep 15 07:02:17 2024
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.71 for libarchive 3.7.4.
+# Generated by GNU Autoconf 2.71 for libarchive 3.7.5.
 #
 # Report bugs to <libarchive-discuss%googlegroups.com@localhost>.
 #
@@ -621,8 +621,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='libarchive'
 PACKAGE_TARNAME='libarchive'
-PACKAGE_VERSION='3.7.4'
-PACKAGE_STRING='libarchive 3.7.4'
+PACKAGE_VERSION='3.7.5'
+PACKAGE_STRING='libarchive 3.7.5'
 PACKAGE_BUGREPORT='libarchive-discuss%googlegroups.com@localhost'
 PACKAGE_URL=''
 
@@ -1434,7 +1434,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures libarchive 3.7.4 to adapt to many kinds of systems.
+\`configure' configures libarchive 3.7.5 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1505,7 +1505,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of libarchive 3.7.4:";;
+     short | recursive ) echo "Configuration of libarchive 3.7.5:";;
    esac
   cat <<\_ACEOF
 
@@ -1681,7 +1681,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-libarchive configure 3.7.4
+libarchive configure 3.7.5
 generated by GNU Autoconf 2.71
 
 Copyright (C) 2021 Free Software Foundation, Inc.
@@ -2475,7 +2475,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by libarchive $as_me 3.7.4, which was
+It was created by libarchive $as_me 3.7.5, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   $ $0$ac_configure_args_raw
@@ -3755,7 +3755,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='libarchive'
- VERSION='3.7.4'
+ VERSION='3.7.5'
 
 
 printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -3928,7 +3928,7 @@ AM_BACKSLASH='\'
 
 # Libtool interface version bumps on any API change, so increments
 # whenever libarchive minor version does.
-ARCHIVE_MINOR=$(( (3007004 / 1000) % 1000 ))
+ARCHIVE_MINOR=$(( (3007005 / 1000) % 1000 ))
 # Libarchive 2.7 == libtool interface 9 = 2 + 7
 # Libarchive 2.8 == libtool interface 10 = 2 + 8
 # Libarchive 2.9 == libtool interface 11 = 2 + 8
@@ -3936,7 +3936,7 @@ ARCHIVE_MINOR=$(( (3007004 / 1000) % 100
 # Libarchive 3.1 == libtool interface 13
 ARCHIVE_INTERFACE=`echo $((13 + ${ARCHIVE_MINOR}))`
 # Libarchive revision is bumped on any source change === libtool revision
-ARCHIVE_REVISION=$(( 3007004 % 1000 ))
+ARCHIVE_REVISION=$(( 3007005 % 1000 ))
 # Libarchive minor is bumped on any interface addition === libtool age
 ARCHIVE_LIBTOOL_VERSION=$ARCHIVE_INTERFACE:$ARCHIVE_REVISION:$ARCHIVE_MINOR
 
@@ -3945,33 +3945,33 @@ ARCHIVE_LIBTOOL_VERSION=$ARCHIVE_INTERFA
 printf "%s\n" "#define __LIBARCHIVE_CONFIG_H_INCLUDED 1" >>confdefs.h
 
 
-printf "%s\n" "#define LIBARCHIVE_VERSION_STRING \"3.7.4\"" >>confdefs.h
+printf "%s\n" "#define LIBARCHIVE_VERSION_STRING \"3.7.5\"" >>confdefs.h
 
 
-printf "%s\n" "#define LIBARCHIVE_VERSION_NUMBER \"3007004\"" >>confdefs.h
+printf "%s\n" "#define LIBARCHIVE_VERSION_NUMBER \"3007005\"" >>confdefs.h
 
 
-printf "%s\n" "#define BSDCPIO_VERSION_STRING \"3.7.4\"" >>confdefs.h
+printf "%s\n" "#define BSDCPIO_VERSION_STRING \"3.7.5\"" >>confdefs.h
 
 
-printf "%s\n" "#define BSDTAR_VERSION_STRING \"3.7.4\"" >>confdefs.h
+printf "%s\n" "#define BSDTAR_VERSION_STRING \"3.7.5\"" >>confdefs.h
 
 
-printf "%s\n" "#define BSDCAT_VERSION_STRING \"3.7.4\"" >>confdefs.h
+printf "%s\n" "#define BSDCAT_VERSION_STRING \"3.7.5\"" >>confdefs.h
 
 
-printf "%s\n" "#define BSDUNZIP_VERSION_STRING \"3.7.4\"" >>confdefs.h
+printf "%s\n" "#define BSDUNZIP_VERSION_STRING \"3.7.5\"" >>confdefs.h
 
 
 # The shell variables here must be the same as the AC_SUBST() variables
 # below, but the shell variable names apparently cannot be the same as
 # the m4 macro names above.  Why?  Ask autoconf.
-BSDCPIO_VERSION_STRING=3.7.4
-BSDTAR_VERSION_STRING=3.7.4
-BSDCAT_VERSION_STRING=3.7.4
-BSDUNZIP_VERSION_STRING=3.7.4
-LIBARCHIVE_VERSION_STRING=3.7.4
-LIBARCHIVE_VERSION_NUMBER=3007004
+BSDCPIO_VERSION_STRING=3.7.5
+BSDTAR_VERSION_STRING=3.7.5
+BSDCAT_VERSION_STRING=3.7.5
+BSDUNZIP_VERSION_STRING=3.7.5
+LIBARCHIVE_VERSION_STRING=3.7.5
+LIBARCHIVE_VERSION_NUMBER=3007005
 
 # Substitute the above version numbers into the various files below.
 # Yes, I believe this is the fourth time we define what are essentially
@@ -5651,338 +5651,6 @@ then :
 
 fi
 
-enable_win32_dll=yes
-
-case $host in
-*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
-  if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
-set dummy ${ac_tool_prefix}as; ac_word=$2
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-printf %s "checking for $ac_word... " >&6; }
-if test ${ac_cv_prog_AS+y}
-then :
-  printf %s "(cached) " >&6
-else $as_nop
-  if test -n "$AS"; then
-  ac_cv_prog_AS="$AS" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  case $as_dir in #(((
-    '') as_dir=./ ;;
-    */) ;;
-    *) as_dir=$as_dir/ ;;
-  esac
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
-    ac_cv_prog_AS="${ac_tool_prefix}as"
-    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-AS=$ac_cv_prog_AS
-if test -n "$AS"; then
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AS" >&5
-printf "%s\n" "$AS" >&6; }
-else
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
-printf "%s\n" "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_AS"; then
-  ac_ct_AS=$AS
-  # Extract the first word of "as", so it can be a program name with args.
-set dummy as; ac_word=$2
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-printf %s "checking for $ac_word... " >&6; }
-if test ${ac_cv_prog_ac_ct_AS+y}
-then :
-  printf %s "(cached) " >&6
-else $as_nop
-  if test -n "$ac_ct_AS"; then
-  ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  case $as_dir in #(((
-    '') as_dir=./ ;;
-    */) ;;
-    *) as_dir=$as_dir/ ;;
-  esac
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_AS="as"
-    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_AS=$ac_cv_prog_ac_ct_AS
-if test -n "$ac_ct_AS"; then
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5
-printf "%s\n" "$ac_ct_AS" >&6; }
-else
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
-printf "%s\n" "no" >&6; }
-fi
-
-  if test "x$ac_ct_AS" = x; then
-    AS="false"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    AS=$ac_ct_AS
-  fi
-else
-  AS="$ac_cv_prog_AS"
-fi
-
-  if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
-set dummy ${ac_tool_prefix}dlltool; ac_word=$2
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-printf %s "checking for $ac_word... " >&6; }
-if test ${ac_cv_prog_DLLTOOL+y}
-then :
-  printf %s "(cached) " >&6
-else $as_nop
-  if test -n "$DLLTOOL"; then
-  ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  case $as_dir in #(((
-    '') as_dir=./ ;;
-    */) ;;
-    *) as_dir=$as_dir/ ;;
-  esac
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
-    ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
-    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-DLLTOOL=$ac_cv_prog_DLLTOOL
-if test -n "$DLLTOOL"; then
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
-printf "%s\n" "$DLLTOOL" >&6; }
-else
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
-printf "%s\n" "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_DLLTOOL"; then
-  ac_ct_DLLTOOL=$DLLTOOL
-  # Extract the first word of "dlltool", so it can be a program name with args.
-set dummy dlltool; ac_word=$2
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-printf %s "checking for $ac_word... " >&6; }
-if test ${ac_cv_prog_ac_ct_DLLTOOL+y}
-then :
-  printf %s "(cached) " >&6
-else $as_nop
-  if test -n "$ac_ct_DLLTOOL"; then
-  ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  case $as_dir in #(((
-    '') as_dir=./ ;;
-    */) ;;
-    *) as_dir=$as_dir/ ;;
-  esac
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_DLLTOOL="dlltool"
-    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
-if test -n "$ac_ct_DLLTOOL"; then
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
-printf "%s\n" "$ac_ct_DLLTOOL" >&6; }
-else
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
-printf "%s\n" "no" >&6; }
-fi
-
-  if test "x$ac_ct_DLLTOOL" = x; then
-    DLLTOOL="false"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    DLLTOOL=$ac_ct_DLLTOOL
-  fi
-else
-  DLLTOOL="$ac_cv_prog_DLLTOOL"
-fi
-
-  if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
-set dummy ${ac_tool_prefix}objdump; ac_word=$2
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-printf %s "checking for $ac_word... " >&6; }
-if test ${ac_cv_prog_OBJDUMP+y}
-then :
-  printf %s "(cached) " >&6
-else $as_nop
-  if test -n "$OBJDUMP"; then
-  ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  case $as_dir in #(((
-    '') as_dir=./ ;;
-    */) ;;
-    *) as_dir=$as_dir/ ;;
-  esac
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
-    ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
-    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-OBJDUMP=$ac_cv_prog_OBJDUMP
-if test -n "$OBJDUMP"; then
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
-printf "%s\n" "$OBJDUMP" >&6; }
-else
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
-printf "%s\n" "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_OBJDUMP"; then
-  ac_ct_OBJDUMP=$OBJDUMP
-  # Extract the first word of "objdump", so it can be a program name with args.
-set dummy objdump; ac_word=$2
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-printf %s "checking for $ac_word... " >&6; }
-if test ${ac_cv_prog_ac_ct_OBJDUMP+y}
-then :
-  printf %s "(cached) " >&6
-else $as_nop
-  if test -n "$ac_ct_OBJDUMP"; then
-  ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  case $as_dir in #(((
-    '') as_dir=./ ;;
-    */) ;;
-    *) as_dir=$as_dir/ ;;
-  esac
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_OBJDUMP="objdump"
-    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
-if test -n "$ac_ct_OBJDUMP"; then
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
-printf "%s\n" "$ac_ct_OBJDUMP" >&6; }
-else
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
-printf "%s\n" "no" >&6; }
-fi
-
-  if test "x$ac_ct_OBJDUMP" = x; then
-    OBJDUMP="false"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    OBJDUMP=$ac_ct_OBJDUMP
-  fi
-else
-  OBJDUMP="$ac_cv_prog_OBJDUMP"
-fi
-
-  ;;
-esac
-
-test -z "$AS" && AS=as
-
-
-
-
-
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-
-
-
-
-
-test -z "$OBJDUMP" && OBJDUMP=objdump
-
-
-
-
-
-
 
 case `pwd` in
   *\ * | *\    *)
@@ -9081,7 +8749,256 @@ do
   esac
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
-    ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
+    ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+LIPO=$ac_cv_prog_LIPO
+if test -n "$LIPO"; then
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
+printf "%s\n" "$LIPO" >&6; }
+else
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_LIPO"; then
+  ac_ct_LIPO=$LIPO
+  # Extract the first word of "lipo", so it can be a program name with args.
+set dummy lipo; ac_word=$2
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_LIPO+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  if test -n "$ac_ct_LIPO"; then
+  ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_LIPO="lipo"
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
+if test -n "$ac_ct_LIPO"; then
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
+printf "%s\n" "$ac_ct_LIPO" >&6; }
+else
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+fi
+
+  if test "x$ac_ct_LIPO" = x; then
+    LIPO=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    LIPO=$ac_ct_LIPO
+  fi
+else
+  LIPO="$ac_cv_prog_LIPO"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool; ac_word=$2
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_OTOOL+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  if test -n "$OTOOL"; then
+  ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL=$ac_cv_prog_OTOOL
+if test -n "$OTOOL"; then
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
+printf "%s\n" "$OTOOL" >&6; }
+else
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL"; then
+  ac_ct_OTOOL=$OTOOL
+  # Extract the first word of "otool", so it can be a program name with args.
+set dummy otool; ac_word=$2
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_OTOOL+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  if test -n "$ac_ct_OTOOL"; then
+  ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OTOOL="otool"
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
+if test -n "$ac_ct_OTOOL"; then
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
+printf "%s\n" "$ac_ct_OTOOL" >&6; }
+else
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+fi
+
+  if test "x$ac_ct_OTOOL" = x; then
+    OTOOL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OTOOL=$ac_ct_OTOOL
+  fi
+else
+  OTOOL="$ac_cv_prog_OTOOL"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool64; ac_word=$2
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_OTOOL64+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  if test -n "$OTOOL64"; then
+  ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL64=$ac_cv_prog_OTOOL64
+if test -n "$OTOOL64"; then
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
+printf "%s\n" "$OTOOL64" >&6; }
+else
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL64"; then
+  ac_ct_OTOOL64=$OTOOL64
+  # Extract the first word of "otool64", so it can be a program name with args.
+set dummy otool64; ac_word=$2
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_OTOOL64+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  if test -n "$ac_ct_OTOOL64"; then
+  ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OTOOL64="otool64"
     printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -9091,86 +9008,261 @@ IFS=$as_save_IFS
 
 fi
 fi
-LIPO=$ac_cv_prog_LIPO
-if test -n "$LIPO"; then
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
-printf "%s\n" "$LIPO" >&6; }
+ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
+if test -n "$ac_ct_OTOOL64"; then
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
+printf "%s\n" "$ac_ct_OTOOL64" >&6; }
 else
   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
 printf "%s\n" "no" >&6; }
 fi
 
+  if test "x$ac_ct_OTOOL64" = x; then
+    OTOOL64=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OTOOL64=$ac_ct_OTOOL64
+  fi
+else
+  OTOOL64="$ac_cv_prog_OTOOL64"
+fi
+
+
+
+
+
+
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
+printf %s "checking for -single_module linker flag... " >&6; }
+if test ${lt_cv_apple_cc_single_mod+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  lt_cv_apple_cc_single_mod=no
+      if test -z "$LT_MULTI_MODULE"; then
+       # By default we will add the -single_module flag. You can override
+       # by either setting the environment variable LT_MULTI_MODULE
+       # non-empty at configure time, or by adding -multi_module to the
+       # link flags.
+       rm -rf libconftest.dylib*
+       echo "int foo(void){return 1;}" > conftest.c
+       echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&5
+       $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+         -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+        _lt_result=$?
+       # If there is a non-empty error log, and "single_module"
+       # appears in it, assume the flag caused a linker warning
+        if test -s conftest.err && $GREP single_module conftest.err; then
+         cat conftest.err >&5
+       # Otherwise, if the output was created with a 0 exit code from
+       # the compiler, it worked.
+       elif test -f libconftest.dylib && test 0 = "$_lt_result"; then
+         lt_cv_apple_cc_single_mod=yes
+       else
+         cat conftest.err >&5
+       fi
+       rm -rf libconftest.dylib*
+       rm -f conftest.*
+      fi
 fi
-if test -z "$ac_cv_prog_LIPO"; then
-  ac_ct_LIPO=$LIPO
-  # Extract the first word of "lipo", so it can be a program name with args.
-set dummy lipo; ac_word=$2
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-printf %s "checking for $ac_word... " >&6; }
-if test ${ac_cv_prog_ac_ct_LIPO+y}
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
+printf "%s\n" "$lt_cv_apple_cc_single_mod" >&6; }
+
+    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
+printf %s "checking for -exported_symbols_list linker flag... " >&6; }
+if test ${lt_cv_ld_exported_symbols_list+y}
 then :
   printf %s "(cached) " >&6
 else $as_nop
-  if test -n "$ac_ct_LIPO"; then
-  ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  case $as_dir in #(((
-    '') as_dir=./ ;;
-    */) ;;
-    *) as_dir=$as_dir/ ;;
+  lt_cv_ld_exported_symbols_list=no
+      save_LDFLAGS=$LDFLAGS
+      echo "_main" > conftest.sym
+      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main (void)
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"
+then :
+  lt_cv_ld_exported_symbols_list=yes
+else $as_nop
+  lt_cv_ld_exported_symbols_list=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+    conftest$ac_exeext conftest.$ac_ext
+       LDFLAGS=$save_LDFLAGS
+
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
+printf "%s\n" "$lt_cv_ld_exported_symbols_list" >&6; }
+
+    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
+printf %s "checking for -force_load linker flag... " >&6; }
+if test ${lt_cv_ld_force_load+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  lt_cv_ld_force_load=no
+      cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
+      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
+      echo "$AR cr libconftest.a conftest.o" >&5
+      $AR cr libconftest.a conftest.o 2>&5
+      echo "$RANLIB libconftest.a" >&5
+      $RANLIB libconftest.a 2>&5
+      cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
+      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+      _lt_result=$?
+      if test -s conftest.err && $GREP force_load conftest.err; then
+       cat conftest.err >&5
+      elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then
+       lt_cv_ld_force_load=yes
+      else
+       cat conftest.err >&5
+      fi
+        rm -f conftest.err libconftest.a conftest conftest.c
+        rm -rf conftest.dSYM
+
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
+printf "%s\n" "$lt_cv_ld_force_load" >&6; }
+    case $host_os in
+    rhapsody* | darwin1.[012])
+      _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;;
+    darwin1.*)
+      _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
+    darwin*) # darwin 5.x on
+      # if running on 10.5 or later, the deployment target defaults
+      # to the OS version, if on x86, and 10.4, the deployment
+      # target defaults to 10.4. Don't you love it?
+      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+       10.0,*86*-darwin8*|10.0,*-darwin[912]*)
+         _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
+       10.[012][,.]*)
+         _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
+       10.*|11.*)
+         _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
+      esac
+    ;;
   esac
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_LIPO="lipo"
-    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
+    if test yes = "$lt_cv_apple_cc_single_mod"; then
+      _lt_dar_single_mod='$single_module'
+    fi
+    if test yes = "$lt_cv_ld_exported_symbols_list"; then
+      _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym'
+    else
+      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib'
+    fi
+    if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then
+      _lt_dsymutil='~$DSYMUTIL $lib || :'
+    else
+      _lt_dsymutil=
+    fi
+    ;;
+  esac
+
+# func_munge_path_list VARIABLE PATH
+# -----------------------------------
+# VARIABLE is name of variable containing _space_ separated list of
+# directories to be munged by the contents of PATH, which is string
+# having a format:
+# "DIR[:DIR]:"
+#       string "DIR[ DIR]" will be prepended to VARIABLE
+# ":DIR[:DIR]"
+#       string "DIR[ DIR]" will be appended to VARIABLE
+# "DIRP[:DIRP]::[DIRA:]DIRA"
+#       string "DIRP[ DIRP]" will be prepended to VARIABLE and string
+#       "DIRA[ DIRA]" will be appended to VARIABLE
+# "DIR[:DIR]"
+#       VARIABLE will be replaced by "DIR[ DIR]"
+func_munge_path_list ()
+{
+    case x$2 in
+    x)
+        ;;
+    *:)
+        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\"
+        ;;
+    x:*)
+        eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\"
+        ;;
+    *::*)
+        eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
+        eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\"
+        ;;
+    *)
+        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
+        ;;
+    esac
+}
+
+ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
+"
+if test "x$ac_cv_header_dlfcn_h" = xyes
+then :
+  printf "%s\n" "#define HAVE_DLFCN_H 1" >>confdefs.h
 
 fi
-fi
-ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
-if test -n "$ac_ct_LIPO"; then
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
-printf "%s\n" "$ac_ct_LIPO" >&6; }
-else
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
-printf "%s\n" "no" >&6; }
-fi
 
-  if test "x$ac_ct_LIPO" = x; then
-    LIPO=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    LIPO=$ac_ct_LIPO
-  fi
-else
-  LIPO="$ac_cv_prog_LIPO"
-fi
 
-    if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
-set dummy ${ac_tool_prefix}otool; ac_word=$2
+
+
+
+# Set options
+enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
+set dummy ${ac_tool_prefix}as; ac_word=$2
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 printf %s "checking for $ac_word... " >&6; }
-if test ${ac_cv_prog_OTOOL+y}
+if test ${ac_cv_prog_AS+y}
 then :
   printf %s "(cached) " >&6
 else $as_nop
-  if test -n "$OTOOL"; then
-  ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
+  if test -n "$AS"; then
+  ac_cv_prog_AS="$AS" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
@@ -9183,7 +9275,7 @@ do
   esac
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
-    ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
+    ac_cv_prog_AS="${ac_tool_prefix}as"
     printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -9193,10 +9285,10 @@ IFS=$as_save_IFS
 
 fi
 fi
-OTOOL=$ac_cv_prog_OTOOL
-if test -n "$OTOOL"; then
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
-printf "%s\n" "$OTOOL" >&6; }
+AS=$ac_cv_prog_AS
+if test -n "$AS"; then
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AS" >&5
+printf "%s\n" "$AS" >&6; }
 else
   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
 printf "%s\n" "no" >&6; }
@@ -9204,18 +9296,18 @@ fi
 
 
 fi
-if test -z "$ac_cv_prog_OTOOL"; then
-  ac_ct_OTOOL=$OTOOL
-  # Extract the first word of "otool", so it can be a program name with args.
-set dummy otool; ac_word=$2
+if test -z "$ac_cv_prog_AS"; then
+  ac_ct_AS=$AS
+  # Extract the first word of "as", so it can be a program name with args.
+set dummy as; ac_word=$2
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 printf %s "checking for $ac_word... " >&6; }
-if test ${ac_cv_prog_ac_ct_OTOOL+y}
+if test ${ac_cv_prog_ac_ct_AS+y}
 then :
   printf %s "(cached) " >&6
 else $as_nop
-  if test -n "$ac_ct_OTOOL"; then
-  ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
+  if test -n "$ac_ct_AS"; then
+  ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
@@ -9228,7 +9320,7 @@ do
   esac
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_OTOOL="otool"
+    ac_cv_prog_ac_ct_AS="as"
     printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -9238,17 +9330,17 @@ IFS=$as_save_IFS
 
 fi
 fi
-ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
-if test -n "$ac_ct_OTOOL"; then
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
-printf "%s\n" "$ac_ct_OTOOL" >&6; }
+ac_ct_AS=$ac_cv_prog_ac_ct_AS
+if test -n "$ac_ct_AS"; then
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5
+printf "%s\n" "$ac_ct_AS" >&6; }
 else
   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
 printf "%s\n" "no" >&6; }
 fi
 
-  if test "x$ac_ct_OTOOL" = x; then
-    OTOOL=":"
+  if test "x$ac_ct_AS" = x; then
+    AS="false"
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
@@ -9256,23 +9348,23 @@ yes:)
 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
-    OTOOL=$ac_ct_OTOOL
+    AS=$ac_ct_AS
   fi
 else
-  OTOOL="$ac_cv_prog_OTOOL"
+  AS="$ac_cv_prog_AS"
 fi
 
-    if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
-set dummy ${ac_tool_prefix}otool64; ac_word=$2
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 printf %s "checking for $ac_word... " >&6; }
-if test ${ac_cv_prog_OTOOL64+y}
+if test ${ac_cv_prog_DLLTOOL+y}
 then :
   printf %s "(cached) " >&6
 else $as_nop
-  if test -n "$OTOOL64"; then
-  ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
+  if test -n "$DLLTOOL"; then
+  ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
@@ -9285,7 +9377,7 @@ do
   esac
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
-    ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
+    ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
     printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -9295,10 +9387,10 @@ IFS=$as_save_IFS
 
 fi
 fi
-OTOOL64=$ac_cv_prog_OTOOL64
-if test -n "$OTOOL64"; then
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
-printf "%s\n" "$OTOOL64" >&6; }
+DLLTOOL=$ac_cv_prog_DLLTOOL
+if test -n "$DLLTOOL"; then
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
+printf "%s\n" "$DLLTOOL" >&6; }
 else
   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
 printf "%s\n" "no" >&6; }
@@ -9306,18 +9398,18 @@ fi
 
 
 fi
-if test -z "$ac_cv_prog_OTOOL64"; then
-  ac_ct_OTOOL64=$OTOOL64
-  # Extract the first word of "otool64", so it can be a program name with args.
-set dummy otool64; ac_word=$2
+if test -z "$ac_cv_prog_DLLTOOL"; then
+  ac_ct_DLLTOOL=$DLLTOOL
+  # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 printf %s "checking for $ac_word... " >&6; }
-if test ${ac_cv_prog_ac_ct_OTOOL64+y}
+if test ${ac_cv_prog_ac_ct_DLLTOOL+y}
 then :
   printf %s "(cached) " >&6
 else $as_nop
-  if test -n "$ac_ct_OTOOL64"; then
-  ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
+  if test -n "$ac_ct_DLLTOOL"; then
+  ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
@@ -9330,7 +9422,7 @@ do
   esac
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_OTOOL64="otool64"
+    ac_cv_prog_ac_ct_DLLTOOL="dlltool"
     printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -9340,17 +9432,17 @@ IFS=$as_save_IFS
 
 fi
 fi
-ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
-if test -n "$ac_ct_OTOOL64"; then
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
-printf "%s\n" "$ac_ct_OTOOL64" >&6; }
+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
+if test -n "$ac_ct_DLLTOOL"; then
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
+printf "%s\n" "$ac_ct_DLLTOOL" >&6; }
 else
   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
 printf "%s\n" "no" >&6; }
 fi
 
-  if test "x$ac_ct_OTOOL64" = x; then
-    OTOOL64=":"
+  if test "x$ac_ct_DLLTOOL" = x; then
+    DLLTOOL="false"
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
@@ -9358,228 +9450,134 @@ yes:)
 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
-    OTOOL64=$ac_ct_OTOOL64
+    DLLTOOL=$ac_ct_DLLTOOL
   fi
 else
-  OTOOL64="$ac_cv_prog_OTOOL64"
-fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
-printf %s "checking for -single_module linker flag... " >&6; }
-if test ${lt_cv_apple_cc_single_mod+y}
-then :
-  printf %s "(cached) " >&6
-else $as_nop
-  lt_cv_apple_cc_single_mod=no
-      if test -z "$LT_MULTI_MODULE"; then
-       # By default we will add the -single_module flag. You can override
-       # by either setting the environment variable LT_MULTI_MODULE
-       # non-empty at configure time, or by adding -multi_module to the
-       # link flags.
-       rm -rf libconftest.dylib*
-       echo "int foo(void){return 1;}" > conftest.c
-       echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
--dynamiclib -Wl,-single_module conftest.c" >&5
-       $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
-         -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
-        _lt_result=$?
-       # If there is a non-empty error log, and "single_module"
-       # appears in it, assume the flag caused a linker warning
-        if test -s conftest.err && $GREP single_module conftest.err; then
-         cat conftest.err >&5
-       # Otherwise, if the output was created with a 0 exit code from
-       # the compiler, it worked.
-       elif test -f libconftest.dylib && test 0 = "$_lt_result"; then
-         lt_cv_apple_cc_single_mod=yes
-       else
-         cat conftest.err >&5
-       fi
-       rm -rf libconftest.dylib*
-       rm -f conftest.*
-      fi
+  DLLTOOL="$ac_cv_prog_DLLTOOL"
 fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
-printf "%s\n" "$lt_cv_apple_cc_single_mod" >&6; }
 
-    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
-printf %s "checking for -exported_symbols_list linker flag... " >&6; }
-if test ${lt_cv_ld_exported_symbols_list+y}
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_OBJDUMP+y}
 then :
   printf %s "(cached) " >&6
 else $as_nop
-  lt_cv_ld_exported_symbols_list=no
-      save_LDFLAGS=$LDFLAGS
-      echo "_main" > conftest.sym
-      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
-      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main (void)
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"
-then :
-  lt_cv_ld_exported_symbols_list=yes
-else $as_nop
-  lt_cv_ld_exported_symbols_list=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.beam \
-    conftest$ac_exeext conftest.$ac_ext
-       LDFLAGS=$save_LDFLAGS
+  if test -n "$OBJDUMP"; then
+  ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
 fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
-printf "%s\n" "$lt_cv_ld_exported_symbols_list" >&6; }
+fi
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
+printf "%s\n" "$OBJDUMP" >&6; }
+else
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+fi
 
-    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
-printf %s "checking for -force_load linker flag... " >&6; }
-if test ${lt_cv_ld_force_load+y}
+
+fi
+if test -z "$ac_cv_prog_OBJDUMP"; then
+  ac_ct_OBJDUMP=$OBJDUMP
+  # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_OBJDUMP+y}
 then :
   printf %s "(cached) " >&6
 else $as_nop
-  lt_cv_ld_force_load=no
-      cat > conftest.c << _LT_EOF
-int forced_loaded() { return 2;}
-_LT_EOF
-      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
-      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
-      echo "$AR cr libconftest.a conftest.o" >&5
-      $AR cr libconftest.a conftest.o 2>&5
-      echo "$RANLIB libconftest.a" >&5
-      $RANLIB libconftest.a 2>&5
-      cat > conftest.c << _LT_EOF
-int main() { return 0;}
-_LT_EOF
-      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
-      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
-      _lt_result=$?
-      if test -s conftest.err && $GREP force_load conftest.err; then
-       cat conftest.err >&5
-      elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then
-       lt_cv_ld_force_load=yes
-      else
-       cat conftest.err >&5
-      fi
-        rm -f conftest.err libconftest.a conftest conftest.c
-        rm -rf conftest.dSYM
+  if test -n "$ac_ct_OBJDUMP"; then
+  ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OBJDUMP="objdump"
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
 fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
-printf "%s\n" "$lt_cv_ld_force_load" >&6; }
-    case $host_os in
-    rhapsody* | darwin1.[012])
-      _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;;
-    darwin1.*)
-      _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
-    darwin*) # darwin 5.x on
-      # if running on 10.5 or later, the deployment target defaults
-      # to the OS version, if on x86, and 10.4, the deployment
-      # target defaults to 10.4. Don't you love it?
-      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
-       10.0,*86*-darwin8*|10.0,*-darwin[912]*)
-         _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
-       10.[012][,.]*)
-         _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
-       10.*|11.*)
-         _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
-      esac
-    ;;
-  esac
-    if test yes = "$lt_cv_apple_cc_single_mod"; then
-      _lt_dar_single_mod='$single_module'
-    fi
-    if test yes = "$lt_cv_ld_exported_symbols_list"; then
-      _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym'
-    else
-      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib'
-    fi
-    if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then
-      _lt_dsymutil='~$DSYMUTIL $lib || :'
-    else
-      _lt_dsymutil=
-    fi
-    ;;
-  esac
+fi
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
+printf "%s\n" "$ac_ct_OBJDUMP" >&6; }
+else
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+fi
 
-# func_munge_path_list VARIABLE PATH
-# -----------------------------------
-# VARIABLE is name of variable containing _space_ separated list of
-# directories to be munged by the contents of PATH, which is string
-# having a format:
-# "DIR[:DIR]:"
-#       string "DIR[ DIR]" will be prepended to VARIABLE
-# ":DIR[:DIR]"
-#       string "DIR[ DIR]" will be appended to VARIABLE
-# "DIRP[:DIRP]::[DIRA:]DIRA"
-#       string "DIRP[ DIRP]" will be prepended to VARIABLE and string
-#       "DIRA[ DIRA]" will be appended to VARIABLE
-# "DIR[:DIR]"
-#       VARIABLE will be replaced by "DIR[ DIR]"
-func_munge_path_list ()
-{
-    case x$2 in
-    x)
-        ;;
-    *:)
-        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\"
-        ;;
-    x:*)
-        eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\"
-        ;;
-    *::*)
-        eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
-        eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\"
-        ;;
-    *)
-        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
-        ;;
-    esac
-}
+  if test "x$ac_ct_OBJDUMP" = x; then
+    OBJDUMP="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OBJDUMP=$ac_ct_OBJDUMP
+  fi
+else
+  OBJDUMP="$ac_cv_prog_OBJDUMP"
+fi
 
-ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
-"
-if test "x$ac_cv_header_dlfcn_h" = xyes
-then :
-  printf "%s\n" "#define HAVE_DLFCN_H 1" >>confdefs.h
+  ;;
+esac
 
-fi
+test -z "$AS" && AS=as
 
 
 
 
 
-# Set options
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+
+
+
+
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+
+
+
 
 
 
@@ -14868,12 +14866,6 @@ then :
   printf "%s\n" "#define HAVE_SYS_MOUNT_H 1" >>confdefs.h
 
 fi
-ac_fn_c_check_header_compile "$LINENO" "sys/queue.h" "ac_cv_header_sys_queue_h" "$ac_includes_default"
-if test "x$ac_cv_header_sys_queue_h" = xyes
-then :
-  printf "%s\n" "#define HAVE_SYS_QUEUE_H 1" >>confdefs.h
-
-fi
 
 ac_fn_c_check_header_compile "$LINENO" "sys/param.h" "ac_cv_header_sys_param_h" "$ac_includes_default"
 if test "x$ac_cv_header_sys_param_h" = xyes
@@ -15021,56 +15013,36 @@ fi
 
 
 if test "x$with_zlib" != "xno"; then
-  ac_fn_c_check_header_compile "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
-if test "x$ac_cv_header_zlib_h" = xyes
-then :
-  printf "%s\n" "#define HAVE_ZLIB_H 1" >>confdefs.h
-
-fi
-
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inflate in -lz" >&5
-printf %s "checking for inflate in -lz... " >&6; }
-if test ${ac_cv_lib_z_inflate+y}
-then :
-  printf %s "(cached) " >&6
-else $as_nop
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lz  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  old_LIBS="$LIBS"
+  LIBS="$LIBS -lz"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-char inflate ();
-int
-main (void)
-{
-return inflate ();
-  ;
-  return 0;
-}
+      #include <zlib.h>
+      #if !defined(ZLIB_VERNUM)
+      // zlib 1.2.0 should work too, but it's difficult to test for.
+      // zlib 1.2.1 onwards have ZLIB_VERNUM, which is easy to check.
+      #error zlib >= 1.2.1 is required.
+      #endif
+      // Check that there's an inflate function.
+      int main(int argc, char **argv) { inflate(NULL, 0); return 0; }
+
 _ACEOF
 if ac_fn_c_try_link "$LINENO"
 then :
-  ac_cv_lib_z_inflate=yes
+
+printf "%s\n" "#define HAVE_ZLIB_H 1" >>confdefs.h
+
+      { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found a suitable version of zlib (>= 1.2.1)" >&5
+printf "%s\n" "found a suitable version of zlib (>= 1.2.1)" >&6; }
+
 else $as_nop
-  ac_cv_lib_z_inflate=no
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: could not find a suitable version of zlib (>= 1.2.1)" >&5
+printf "%s\n" "could not find a suitable version of zlib (>= 1.2.1)" >&6; }
+      LIBS="$old_LIBS"
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.beam \
     conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_inflate" >&5
-printf "%s\n" "$ac_cv_lib_z_inflate" >&6; }
-if test "x$ac_cv_lib_z_inflate" = xyes
-then :
-  printf "%s\n" "#define HAVE_LIBZ 1" >>confdefs.h
-
-  LIBS="-lz $LIBS"
-
-fi
-
 fi
 
 
@@ -18747,51 +18719,6 @@ printf "%s\n" "#define SIZEOF_LONG $ac_c
 
 
 # Checks for library functions.
-if test $ac_cv_c_compiler_gnu = yes; then
-    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5
-printf %s "checking whether $CC needs -traditional... " >&6; }
-if test ${ac_cv_prog_gcc_traditional+y}
-then :
-  printf %s "(cached) " >&6
-else $as_nop
-    ac_pattern="Autoconf.*'x'"
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sgtty.h>
-Autoconf TIOCGETP
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "$ac_pattern" >/dev/null 2>&1
-then :
-  ac_cv_prog_gcc_traditional=yes
-else $as_nop
-  ac_cv_prog_gcc_traditional=no
-fi
-rm -rf conftest*
-
-
-  if test $ac_cv_prog_gcc_traditional = no; then
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <termio.h>
-Autoconf TCGETA
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "$ac_pattern" >/dev/null 2>&1
-then :
-  ac_cv_prog_gcc_traditional=yes
-fi
-rm -rf conftest*
-
-  fi
-fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5
-printf "%s\n" "$ac_cv_prog_gcc_traditional" >&6; }
-  if test $ac_cv_prog_gcc_traditional = yes; then
-    CC="$CC -traditional"
-  fi
-fi
-
 
 ac_fn_c_check_header_compile "$LINENO" "sys/mkdev.h" "ac_cv_header_sys_mkdev_h" "$ac_includes_default"
 if test "x$ac_cv_header_sys_mkdev_h" = xyes
@@ -24175,7 +24102,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by libarchive $as_me 3.7.4, which was
+This file was extended by libarchive $as_me 3.7.5, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -24243,7 +24170,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config='$ac_cs_config_escaped'
 ac_cs_version="\\
-libarchive config.status 3.7.4
+libarchive config.status 3.7.5
 configured by $0, generated by GNU Autoconf 2.71,
   with options \\"\$ac_cs_config\\"
 
@@ -24372,11 +24299,11 @@ AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-ma
 sed_quote_subst='$sed_quote_subst'
 double_quote_subst='$double_quote_subst'
 delay_variable_subst='$delay_variable_subst'
+macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
 AS='`$ECHO "$AS" | $SED "$delay_single_quote_subst"`'
 DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
 OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
-macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
-macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
 enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
 enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
 pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
@@ -25405,6 +25332,10 @@ available_tags=''
 
 # ### BEGIN LIBTOOL CONFIG
 
+# Which release of libtool.m4 was used?
+macro_version=$macro_version
+macro_revision=$macro_revision
+
 # Assembler program.
 AS=$lt_AS
 
@@ -25414,10 +25345,6 @@ DLLTOOL=$lt_DLLTOOL
 # Object dumper program.
 OBJDUMP=$lt_OBJDUMP
 
-# Which release of libtool.m4 was used?
-macro_version=$macro_version
-macro_revision=$macro_revision
-
 # Whether or not to build shared libraries.
 build_libtool_libs=$enable_shared
 

Index: pkgsrc/archivers/libarchive/files/configure.ac
diff -u pkgsrc/archivers/libarchive/files/configure.ac:1.24 pkgsrc/archivers/libarchive/files/configure.ac:1.25
--- pkgsrc/archivers/libarchive/files/configure.ac:1.24 Tue Apr 30 06:05:16 2024
+++ pkgsrc/archivers/libarchive/files/configure.ac      Sun Sep 15 07:02:17 2024
@@ -4,8 +4,8 @@ dnl First, define all of the version num
 dnl In particular, this allows the version macro to be used in AC_INIT
 
 dnl These first two version numbers are updated automatically on each release.
-m4_define([LIBARCHIVE_VERSION_S],[3.7.4])
-m4_define([LIBARCHIVE_VERSION_N],[3007004])
+m4_define([LIBARCHIVE_VERSION_S],[3.7.5])
+m4_define([LIBARCHIVE_VERSION_N],[3007005])
 
 dnl bsdtar and bsdcpio versioning tracks libarchive
 m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S())
@@ -113,8 +113,8 @@ AC_PROG_CC
 AM_PROG_CC_C_O
 AC_PROG_CPP
 AC_USE_SYSTEM_EXTENSIONS
-AC_LIBTOOL_WIN32_DLL
-AC_PROG_LIBTOOL
+
+LT_INIT([win32-dll])
 AC_CHECK_TOOL([STRIP],[strip])
 AC_PROG_MKDIR_P
 
@@ -362,7 +362,7 @@ AC_CHECK_HEADERS([locale.h membership.h 
 AC_CHECK_HEADERS([readpassphrase.h signal.h spawn.h])
 AC_CHECK_HEADERS([stdarg.h stdint.h stdlib.h string.h])
 AC_CHECK_HEADERS([sys/acl.h sys/cdefs.h sys/ea.h sys/extattr.h])
-AC_CHECK_HEADERS([sys/ioctl.h sys/mkdev.h sys/mount.h sys/queue.h])
+AC_CHECK_HEADERS([sys/ioctl.h sys/mkdev.h sys/mount.h])
 AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/richacl.h])
 AC_CHECK_HEADERS([sys/select.h sys/statfs.h sys/statvfs.h sys/sysmacros.h])
 AC_CHECK_HEADERS([sys/time.h sys/utime.h sys/utsname.h sys/vfs.h sys/xattr.h])
@@ -380,8 +380,23 @@ AC_ARG_WITH([zlib],
   AS_HELP_STRING([--without-zlib], [Don't build support for gzip through zlib]))
 
 if test "x$with_zlib" != "xno"; then
-  AC_CHECK_HEADERS([zlib.h])
-  AC_CHECK_LIB(z,inflate)
+  old_LIBS="$LIBS"
+  LIBS="$LIBS -lz"
+  AC_LINK_IFELSE([AC_LANG_SOURCE([[
+      #include <zlib.h>
+      #if !defined(ZLIB_VERNUM)
+      // zlib 1.2.0 should work too, but it's difficult to test for.
+      // zlib 1.2.1 onwards have ZLIB_VERNUM, which is easy to check.
+      #error zlib >= 1.2.1 is required.
+      #endif
+      // Check that there's an inflate function.
+      int main(int argc, char **argv) { inflate(NULL, 0); return 0; }
+    ]])],
+    [AC_DEFINE([HAVE_ZLIB_H], [1], [Define to 1 if you have zlib >= 1.2.1])
+      AC_MSG_RESULT([found a suitable version of zlib (>= 1.2.1)])
+    ],
+    [AC_MSG_RESULT([could not find a suitable version of zlib (>= 1.2.1)])
+      LIBS="$old_LIBS"])
 fi
 
 AC_ARG_WITH([bz2lib],
@@ -777,7 +792,6 @@ AX_COMPILE_CHECK_SIZEOF(long)
 AC_CHECK_HEADERS_ONCE([sys/time.h])
 
 # Checks for library functions.
-AC_PROG_GCC_TRADITIONAL
 AC_HEADER_MAJOR
 AC_FUNC_FSEEKO
 AC_FUNC_MEMCMP

Index: pkgsrc/archivers/libarchive/files/build/version
diff -u pkgsrc/archivers/libarchive/files/build/version:1.11 pkgsrc/archivers/libarchive/files/build/version:1.12
--- pkgsrc/archivers/libarchive/files/build/version:1.11        Tue Apr 30 06:05:17 2024
+++ pkgsrc/archivers/libarchive/files/build/version     Sun Sep 15 07:02:17 2024
@@ -1 +1 @@
-3007004
+3007005

Index: pkgsrc/archivers/libarchive/files/build/cmake/config.h.in
diff -u pkgsrc/archivers/libarchive/files/build/cmake/config.h.in:1.12 pkgsrc/archivers/libarchive/files/build/cmake/config.h.in:1.13
--- pkgsrc/archivers/libarchive/files/build/cmake/config.h.in:1.12      Tue Apr 30 06:05:17 2024
+++ pkgsrc/archivers/libarchive/files/build/cmake/config.h.in   Sun Sep 15 07:02:17 2024
@@ -1132,9 +1132,6 @@ typedef uint64_t uintmax_t;
 /* Define to 1 if you have the <sys/poll.h> header file. */
 #cmakedefine HAVE_SYS_POLL_H 1
 
-/* Define to 1 if you have the <sys/queue.h> header file. */
-#cmakedefine HAVE_SYS_QUEUE_H 1
-
 /* Define to 1 if you have the <sys/richacl.h> header file. */
 #cmakedefine HAVE_SYS_RICHACL_H 1
 

Index: pkgsrc/archivers/libarchive/files/cat/bsdcat.1
diff -u pkgsrc/archivers/libarchive/files/cat/bsdcat.1:1.3 pkgsrc/archivers/libarchive/files/cat/bsdcat.1:1.4
--- pkgsrc/archivers/libarchive/files/cat/bsdcat.1:1.3  Fri Apr 12 15:39:46 2024
+++ pkgsrc/archivers/libarchive/files/cat/bsdcat.1      Sun Sep 15 07:02:18 2024
@@ -39,7 +39,7 @@ expands files to standard output.
 .Nm
 typically takes a filename as an argument or reads standard input when used in a
 pipe.
-In both cases decompressed data it written to standard output.
+In both cases decompressed data is written to standard output.
 .Sh EXAMPLES
 To decompress a file:
 .Pp

Index: pkgsrc/archivers/libarchive/files/cpio/cmdline.c
diff -u pkgsrc/archivers/libarchive/files/cpio/cmdline.c:1.10 pkgsrc/archivers/libarchive/files/cpio/cmdline.c:1.11
--- pkgsrc/archivers/libarchive/files/cpio/cmdline.c:1.10       Tue Apr 30 06:05:17 2024
+++ pkgsrc/archivers/libarchive/files/cpio/cmdline.c    Sun Sep 15 07:02:18 2024
@@ -308,17 +308,22 @@ again:
  * Returns NULL if no error, otherwise returns error string for display.
  *
  */
-const char *
-owner_parse(const char *spec, int *uid, int *gid)
+int
+owner_parse(const char *spec, struct cpio_owner *owner, const char **errmsg)
 {
        static char errbuff[128];
        const char *u, *ue, *g;
 
-       *uid = -1;
-       *gid = -1;
+       owner->uid = -1;
+       owner->gid = -1;
 
-       if (spec[0] == '\0')
-               return ("Invalid empty user/group spec");
+       owner->uname = NULL;
+       owner->gname = NULL;
+
+       if (spec[0] == '\0') {
+               *errmsg = "Invalid empty user/group spec";
+               return (-1);
+       }
 
        /*
         * Split spec into [user][:.][group]
@@ -347,23 +352,29 @@ owner_parse(const char *spec, int *uid, 
 
                user = (char *)malloc(ue - u + 1);
                if (user == NULL)
-                       return ("Couldn't allocate memory");
+                       goto alloc_error;
                memcpy(user, u, ue - u);
                user[ue - u] = '\0';
                if ((pwent = getpwnam(user)) != NULL) {
-                       *uid = pwent->pw_uid;
+                       owner->uid = pwent->pw_uid;
+                       owner->uname = strdup(pwent->pw_name);
+                       if (owner->uname == NULL) {
+                               free(user);
+                               goto alloc_error;
+                       }
                        if (*ue != '\0')
-                               *gid = pwent->pw_gid;
+                               owner->gid = pwent->pw_gid;
                } else {
                        char *end;
                        errno = 0;
-                       *uid = (int)strtoul(user, &end, 10);
+                       owner->uid = (int)strtoul(user, &end, 10);
                        if (errno || *end != '\0') {
                                snprintf(errbuff, sizeof(errbuff),
                                    "Couldn't lookup user ``%s''", user);
                                errbuff[sizeof(errbuff) - 1] = '\0';
                                free(user);
-                               return (errbuff);
+                               *errmsg = errbuff;
+                               return (-1);
                        }
                }
                free(user);
@@ -372,18 +383,28 @@ owner_parse(const char *spec, int *uid, 
        if (*g != '\0') {
                struct group *grp;
                if ((grp = getgrnam(g)) != NULL) {
-                       *gid = grp->gr_gid;
+                       owner->gid = grp->gr_gid;
+                       owner->gname = strdup(grp->gr_name);
+                       if (owner->gname == NULL) {
+                               free(owner->uname);
+                               owner->uname = NULL;
+                               goto alloc_error;
+                       }
                } else {
                        char *end;
                        errno = 0;
-                       *gid = (int)strtoul(g, &end, 10);
+                       owner->gid = (int)strtoul(g, &end, 10);
                        if (errno || *end != '\0') {
                                snprintf(errbuff, sizeof(errbuff),
                                    "Couldn't lookup group ``%s''", g);
                                errbuff[sizeof(errbuff) - 1] = '\0';
-                               return (errbuff);
+                               *errmsg = errbuff;
+                               return (-1);
                        }
                }
        }
-       return (NULL);
+       return (0);
+alloc_error:
+       *errmsg = "Couldn't allocate memory";
+       return (-1);
 }

Index: pkgsrc/archivers/libarchive/files/cpio/cpio.c
diff -u pkgsrc/archivers/libarchive/files/cpio/cpio.c:1.12 pkgsrc/archivers/libarchive/files/cpio/cpio.c:1.13
--- pkgsrc/archivers/libarchive/files/cpio/cpio.c:1.12  Fri Apr 12 15:39:47 2024
+++ pkgsrc/archivers/libarchive/files/cpio/cpio.c       Sun Sep 15 07:02:18 2024
@@ -132,9 +132,9 @@ main(int argc, char *argv[])
        static char buff[16384];
        struct cpio _cpio; /* Allocated on stack. */
        struct cpio *cpio;
+       struct cpio_owner owner;
        const char *errmsg;
        char *tptr;
-       int uid, gid;
        int opt, t;
 
        cpio = &_cpio;
@@ -142,6 +142,7 @@ main(int argc, char *argv[])
        cpio->buff = buff;
        cpio->buff_size = sizeof(buff);
 
+
 #if defined(HAVE_SIGACTION) && defined(SIGPIPE)
        { /* Ignore SIGPIPE signals. */
                struct sigaction sa;
@@ -161,7 +162,9 @@ main(int argc, char *argv[])
 #endif
 
        cpio->uid_override = -1;
+       cpio->uname_override = NULL;
        cpio->gid_override = -1;
+       cpio->gname_override = NULL;
        cpio->argv = argv;
        cpio->argc = argc;
        cpio->mode = '\0';
@@ -320,21 +323,21 @@ main(int argc, char *argv[])
                        cpio->quiet = 1;
                        break;
                case 'R': /* GNU cpio, also --owner */
-                       /* TODO: owner_parse should return uname/gname
-                        * also; use that to set [ug]name_override. */
-                       errmsg = owner_parse(cpio->argument, &uid, &gid);
-                       if (errmsg) {
+                       errmsg = NULL;
+                       if (owner_parse(cpio->argument, &owner, &errmsg) != 0) {
+                               if (!errmsg)
+                                       errmsg = "Error parsing owner";
                                lafe_warnc(-1, "%s", errmsg);
                                usage();
                        }
-                       if (uid != -1) {
-                               cpio->uid_override = uid;
-                               cpio->uname_override = NULL;
-                       }
-                       if (gid != -1) {
-                               cpio->gid_override = gid;
-                               cpio->gname_override = NULL;
-                       }
+                       if (owner.uid != -1)
+                               cpio->uid_override = owner.uid;
+                       if (owner.uname != NULL)
+                               cpio->uname_override = owner.uname;
+                       if (owner.gid != -1)
+                               cpio->gid_override = owner.gid;
+                       if (owner.gname != NULL)
+                               cpio->gname_override = owner.gname;
                        break;
                case 'r': /* POSIX 1997 */
                        cpio->option_rename = 1;
@@ -439,11 +442,14 @@ main(int argc, char *argv[])
        }
 
        archive_match_free(cpio->matching);
-       free_cache(cpio->gname_cache);
        free_cache(cpio->uname_cache);
+       free(cpio->uname_override);
+       free_cache(cpio->gname_cache);
+       free(cpio->gname_override);
        archive_read_close(cpio->archive_read_disk);
        archive_read_free(cpio->archive_read_disk);
        free(cpio->destdir);
+
        passphrase_free(cpio->ppbuff);
        return (cpio->return_value);
 }
@@ -728,14 +734,14 @@ file_to_archive(struct cpio *cpio, const
                return (r);
        }
 
-       if (cpio->uid_override >= 0) {
+       if (cpio->uid_override >= 0)
                archive_entry_set_uid(entry, cpio->uid_override);
+       if (cpio->gname_override != NULL)
                archive_entry_set_uname(entry, cpio->uname_override);
-       }
-       if (cpio->gid_override >= 0) {
+       if (cpio->gid_override >= 0)
                archive_entry_set_gid(entry, cpio->gid_override);
+       if (cpio->gname_override != NULL)
                archive_entry_set_gname(entry, cpio->gname_override);
-       }
 
        /*
         * Generate a destination path for this entry.
@@ -1015,8 +1021,12 @@ mode_in(struct cpio *cpio)
                        fprintf(stderr, ".");
                if (cpio->uid_override >= 0)
                        archive_entry_set_uid(entry, cpio->uid_override);
+               if (cpio->uname_override != NULL)
+                       archive_entry_set_uname(entry, cpio->uname_override);
                if (cpio->gid_override >= 0)
                        archive_entry_set_gid(entry, cpio->gid_override);
+               if (cpio->gname_override != NULL)
+                       archive_entry_set_gname(entry, cpio->gname_override);
                r = archive_write_header(ext, entry);
                if (r != ARCHIVE_OK) {
                        fprintf(stderr, "%s: %s\n",

Index: pkgsrc/archivers/libarchive/files/cpio/cpio.h
diff -u pkgsrc/archivers/libarchive/files/cpio/cpio.h:1.9 pkgsrc/archivers/libarchive/files/cpio/cpio.h:1.10
--- pkgsrc/archivers/libarchive/files/cpio/cpio.h:1.9   Fri Apr 12 15:39:47 2024
+++ pkgsrc/archivers/libarchive/files/cpio/cpio.h       Sun Sep 15 07:02:18 2024
@@ -94,8 +94,14 @@ struct cpio {
        char             *ppbuff;
 };
 
-const char *owner_parse(const char *, int *, int *);
+struct cpio_owner {
+        int uid;
+        int gid;
+        char *uname;
+        char *gname;
+};
 
+int owner_parse(const char *, struct cpio_owner *, const char **);
 
 /* Fake short equivalents for long options that otherwise lack them. */
 enum {

Index: pkgsrc/archivers/libarchive/files/cpio/test/test_option_c.c
diff -u pkgsrc/archivers/libarchive/files/cpio/test/test_option_c.c:1.8 pkgsrc/archivers/libarchive/files/cpio/test/test_option_c.c:1.9
--- pkgsrc/archivers/libarchive/files/cpio/test/test_option_c.c:1.8     Fri Apr 12 15:39:47 2024
+++ pkgsrc/archivers/libarchive/files/cpio/test/test_option_c.c Sun Sep 15 07:02:18 2024
@@ -119,9 +119,9 @@ DEFINE_TEST(test_option_c)
        assert(is_octal(e, 76)); /* Entire header is octal digits. */
        assertEqualMem(e + 0, "070707", 6); /* Magic */
        assert(is_octal(e + 6, 6)); /* dev */
-       dev = from_octal(e + 6, 6);
+       dev = (int)from_octal(e + 6, 6);
        assert(is_octal(e + 12, 6)); /* ino */
-       ino = from_octal(e + 12, 6);
+       ino = (int)from_octal(e + 12, 6);
 #if defined(_WIN32) && !defined(__CYGWIN__)
        /* Group members bits and others bits do not work. */
        assertEqualMem(e + 18, "100666", 6); /* Mode */
@@ -129,10 +129,10 @@ DEFINE_TEST(test_option_c)
        assertEqualMem(e + 18, "100644", 6); /* Mode */
 #endif
        if (uid < 0)
-               uid = from_octal(e + 24, 6);
+               uid = (int)from_octal(e + 24, 6);
        assertEqualInt(from_octal(e + 24, 6), uid); /* uid */
        assert(is_octal(e + 30, 6)); /* gid */
-       gid = from_octal(e + 30, 6);
+       gid = (int)from_octal(e + 30, 6);
        assertEqualMem(e + 36, "000001", 6); /* nlink */
        failure("file entries should not have rdev set (dev field was 0%o)",
            dev);

Index: pkgsrc/archivers/libarchive/files/cpio/test/test_option_t.c
diff -u pkgsrc/archivers/libarchive/files/cpio/test/test_option_t.c:1.7 pkgsrc/archivers/libarchive/files/cpio/test/test_option_t.c:1.8
--- pkgsrc/archivers/libarchive/files/cpio/test/test_option_t.c:1.7     Fri Apr 12 15:39:48 2024
+++ pkgsrc/archivers/libarchive/files/cpio/test/test_option_t.c Sun Sep 15 07:02:18 2024
@@ -33,7 +33,7 @@ DEFINE_TEST(test_option_t)
        char *p;
        int r;
        time_t mtime;
-       char date[32];
+       char date[48];
        char date2[32];
        struct tm *tmptr;
 #if defined(HAVE_LOCALTIME_R) || defined(HAVE_LOCALTIME_S)
@@ -89,6 +89,7 @@ DEFINE_TEST(test_option_t)
        mtime = 1;
 #ifdef HAVE_LOCALE_H
        setlocale(LC_ALL, "");
+       setlocale(LC_TIME, "");
 #endif
 #if defined(HAVE_LOCALTIME_S)
         tmptr = localtime_s(&tmbuf, &mtime) ? NULL : &tmbuf;
@@ -99,10 +100,10 @@ DEFINE_TEST(test_option_t)
 #endif
 #if defined(_WIN32) && !defined(__CYGWIN__)
        strftime(date2, sizeof(date2)-1, "%b %d  %Y", tmptr);
-       _snprintf(date, sizeof(date)-1, "%12.12s file", date2);
+       _snprintf(date, sizeof(date)-1, "%12s file", date2);
 #else
        strftime(date2, sizeof(date2)-1, "%b %e  %Y", tmptr);
-       snprintf(date, sizeof(date)-1, "%12.12s file", date2);
+       snprintf(date, sizeof(date)-1, "%12s file", date2);
 #endif
        assertEqualMem(p + 42, date, strlen(date));
        free(p);
Index: pkgsrc/archivers/libarchive/files/cpio/test/test_owner_parse.c
diff -u pkgsrc/archivers/libarchive/files/cpio/test/test_owner_parse.c:1.7 pkgsrc/archivers/libarchive/files/cpio/test/test_owner_parse.c:1.8
--- pkgsrc/archivers/libarchive/files/cpio/test/test_owner_parse.c:1.7  Fri Apr 12 15:39:48 2024
+++ pkgsrc/archivers/libarchive/files/cpio/test/test_owner_parse.c      Sun Sep 15 07:02:18 2024
@@ -55,6 +55,14 @@ int_in_list(int i, const int *l, size_t 
        failure("%d", i);
        return (0);
 }
+
+static void
+free_cpio_owner(struct cpio_owner *owner) {
+       owner->uid = -1;
+       owner->gid = -1;
+       free(owner->uname);
+       free(owner->gname);
+}
 #endif
 
 DEFINE_TEST(test_owner_parse)
@@ -62,49 +70,58 @@ DEFINE_TEST(test_owner_parse)
 #if !defined(ROOT)
        skipping("No uid/gid configuration for this OS");
 #else
-       int uid, gid;
+       struct cpio_owner owner;
+       const char *errstr;
 
-       assert(NULL == owner_parse(ROOT, &uid, &gid));
-       assert(int_in_list(uid, root_uids,
+       assert(0 == owner_parse(ROOT, &owner, &errstr));
+       assert(int_in_list(owner.uid, root_uids,
                sizeof(root_uids)/sizeof(root_uids[0])));
-       assertEqualInt(-1, gid);
-
+       assertEqualInt(-1, owner.gid);
+       free_cpio_owner(&owner);
 
-       assert(NULL == owner_parse(ROOT ":", &uid, &gid));
-       assert(int_in_list(uid, root_uids,
+       assert(0 == owner_parse(ROOT ":", &owner, &errstr));
+       assert(int_in_list(owner.uid, root_uids,
                sizeof(root_uids)/sizeof(root_uids[0])));
-       assert(int_in_list(gid, root_gids,
+       assert(int_in_list(owner.gid, root_gids,
                sizeof(root_gids)/sizeof(root_gids[0])));
+       free_cpio_owner(&owner);
 
-       assert(NULL == owner_parse(ROOT ".", &uid, &gid));
-       assert(int_in_list(uid, root_uids,
+       assert(0 == owner_parse(ROOT ".", &owner, &errstr));
+       assert(int_in_list(owner.uid, root_uids,
                sizeof(root_uids)/sizeof(root_uids[0])));
-       assert(int_in_list(gid, root_gids,
+       assert(int_in_list(owner.gid, root_gids,
                sizeof(root_gids)/sizeof(root_gids[0])));
+       free_cpio_owner(&owner);
 
-       assert(NULL == owner_parse("111", &uid, &gid));
-       assertEqualInt(111, uid);
-       assertEqualInt(-1, gid);
+       assert(0 == owner_parse("111", &owner, &errstr));
+       assertEqualInt(111, owner.uid);
+       assertEqualInt(-1, owner.gid);
+       free_cpio_owner(&owner);
 
-       assert(NULL == owner_parse("112:", &uid, &gid));
-       assertEqualInt(112, uid);
+       assert(0 == owner_parse("112:", &owner, &errstr));
+       assertEqualInt(112, owner.uid);
        /* Can't assert gid, since we don't know gid for user #112. */
+       free_cpio_owner(&owner);
 
-       assert(NULL == owner_parse("113.", &uid, &gid));
-       assertEqualInt(113, uid);
+       assert(0 == owner_parse("113.", &owner, &errstr));
+       assertEqualInt(113, owner.uid);
        /* Can't assert gid, since we don't know gid for user #113. */
+       free_cpio_owner(&owner);
 
-       assert(NULL == owner_parse(":114", &uid, &gid));
-       assertEqualInt(-1, uid);
-       assertEqualInt(114, gid);
-
-       assert(NULL == owner_parse(".115", &uid, &gid));
-       assertEqualInt(-1, uid);
-       assertEqualInt(115, gid);
-
-       assert(NULL == owner_parse("116:117", &uid, &gid));
-       assertEqualInt(116, uid);
-       assertEqualInt(117, gid);
+       assert(0 == owner_parse(":114", &owner, &errstr));
+       assertEqualInt(-1, owner.uid);
+       assertEqualInt(114, owner.gid);
+       free_cpio_owner(&owner);
+
+       assert(0 == owner_parse(".115", &owner, &errstr));
+       assertEqualInt(-1, owner.uid);
+       assertEqualInt(115, owner.gid);
+       free_cpio_owner(&owner);
+
+       assert(0 == owner_parse("116:117", &owner, &errstr));
+       assertEqualInt(116, owner.uid);
+       assertEqualInt(117, owner.gid);
+       free_cpio_owner(&owner);
 
        /*
         * TODO: Lookup current user/group name, build strings and
@@ -112,9 +129,20 @@ DEFINE_TEST(test_owner_parse)
         * users.
         */
 
-       assert(NULL != owner_parse(":nonexistentgroup", &uid, &gid));
-       assert(NULL != owner_parse(ROOT ":nonexistentgroup", &uid, &gid));
-       assert(NULL !=
-           owner_parse("nonexistentuser:nonexistentgroup", &uid, &gid));
+       errstr = NULL;
+       assert(0 != owner_parse(":nonexistentgroup", &owner, &errstr));
+       assertEqualString(errstr, "Couldn't lookup group ``nonexistentgroup''");
+       free_cpio_owner(&owner);
+
+       errstr = NULL;
+       assert(0 != owner_parse(ROOT ":nonexistentgroup", &owner, &errstr));
+       assertEqualString(errstr, "Couldn't lookup group ``nonexistentgroup''");
+       free_cpio_owner(&owner);
+
+       errstr = NULL;
+       assert(0 != owner_parse("nonexistentuser:nonexistentgroup", &owner,
+           &errstr));
+       assertEqualString(errstr, "Couldn't lookup user ``nonexistentuser''");
+       free_cpio_owner(&owner);
 #endif
 }

Index: pkgsrc/archivers/libarchive/files/doc/html/archive_entry.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_entry.3.html:1.11 pkgsrc/archivers/libarchive/files/doc/html/archive_entry.3.html:1.12
--- pkgsrc/archivers/libarchive/files/doc/html/archive_entry.3.html:1.11        Tue Apr 30 06:05:17 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_entry.3.html     Sun Sep 15 07:02:18 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:45 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:04 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_read.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_read.3.html:1.11 pkgsrc/archivers/libarchive/files/doc/html/archive_read.3.html:1.12
--- pkgsrc/archivers/libarchive/files/doc/html/archive_read.3.html:1.11 Tue Apr 30 06:05:17 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_read.3.html      Sun Sep 15 07:02:18 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:45 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:04 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_read_disk.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_read_disk.3.html:1.11 pkgsrc/archivers/libarchive/files/doc/html/archive_read_disk.3.html:1.12
--- pkgsrc/archivers/libarchive/files/doc/html/archive_read_disk.3.html:1.11    Tue Apr 30 06:05:17 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_read_disk.3.html Sun Sep 15 07:02:18 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:46 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:05 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_util.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_util.3.html:1.11 pkgsrc/archivers/libarchive/files/doc/html/archive_util.3.html:1.12
--- pkgsrc/archivers/libarchive/files/doc/html/archive_util.3.html:1.11 Tue Apr 30 06:05:17 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_util.3.html      Sun Sep 15 07:02:18 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:46 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:05 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_write.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_write.3.html:1.11 pkgsrc/archivers/libarchive/files/doc/html/archive_write.3.html:1.12
--- pkgsrc/archivers/libarchive/files/doc/html/archive_write.3.html:1.11        Tue Apr 30 06:05:18 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_write.3.html     Sun Sep 15 07:02:18 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:46 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:05 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_write_disk.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_write_disk.3.html:1.11 pkgsrc/archivers/libarchive/files/doc/html/archive_write_disk.3.html:1.12
--- pkgsrc/archivers/libarchive/files/doc/html/archive_write_disk.3.html:1.11   Tue Apr 30 06:05:18 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_write_disk.3.html        Sun Sep 15 07:02:18 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:46 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:05 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/bsdcpio.1.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/bsdcpio.1.html:1.11 pkgsrc/archivers/libarchive/files/doc/html/bsdcpio.1.html:1.12
--- pkgsrc/archivers/libarchive/files/doc/html/bsdcpio.1.html:1.11      Tue Apr 30 06:05:18 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/bsdcpio.1.html   Sun Sep 15 07:02:19 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:48 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:07 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/bsdtar.1.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/bsdtar.1.html:1.11 pkgsrc/archivers/libarchive/files/doc/html/bsdtar.1.html:1.12
--- pkgsrc/archivers/libarchive/files/doc/html/bsdtar.1.html:1.11       Tue Apr 30 06:05:18 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/bsdtar.1.html    Sun Sep 15 07:02:19 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:48 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:07 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/cpio.5.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/cpio.5.html:1.11 pkgsrc/archivers/libarchive/files/doc/html/cpio.5.html:1.12
--- pkgsrc/archivers/libarchive/files/doc/html/cpio.5.html:1.11 Tue Apr 30 06:05:18 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/cpio.5.html      Sun Sep 15 07:02:19 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:47 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:06 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/libarchive-formats.5.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/libarchive-formats.5.html:1.11 pkgsrc/archivers/libarchive/files/doc/html/libarchive-formats.5.html:1.12
--- pkgsrc/archivers/libarchive/files/doc/html/libarchive-formats.5.html:1.11   Tue Apr 30 06:05:18 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/libarchive-formats.5.html        Sun Sep 15 07:02:19 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:47 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:06 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/libarchive.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/libarchive.3.html:1.11 pkgsrc/archivers/libarchive/files/doc/html/libarchive.3.html:1.12
--- pkgsrc/archivers/libarchive/files/doc/html/libarchive.3.html:1.11   Tue Apr 30 06:05:18 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/libarchive.3.html        Sun Sep 15 07:02:19 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:47 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:06 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/libarchive_internals.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/libarchive_internals.3.html:1.11 pkgsrc/archivers/libarchive/files/doc/html/libarchive_internals.3.html:1.12
--- pkgsrc/archivers/libarchive/files/doc/html/libarchive_internals.3.html:1.11 Tue Apr 30 06:05:18 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/libarchive_internals.3.html      Sun Sep 15 07:02:19 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:47 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:06 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/mtree.5.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/mtree.5.html:1.11 pkgsrc/archivers/libarchive/files/doc/html/mtree.5.html:1.12
--- pkgsrc/archivers/libarchive/files/doc/html/mtree.5.html:1.11        Tue Apr 30 06:05:18 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/mtree.5.html     Sun Sep 15 07:02:19 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:48 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:06 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/tar.5.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/tar.5.html:1.11 pkgsrc/archivers/libarchive/files/doc/html/tar.5.html:1.12
--- pkgsrc/archivers/libarchive/files/doc/html/tar.5.html:1.11  Tue Apr 30 06:05:18 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/tar.5.html       Sun Sep 15 07:02:19 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:48 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:07 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>

Index: pkgsrc/archivers/libarchive/files/doc/html/archive_entry_acl.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_entry_acl.3.html:1.10 pkgsrc/archivers/libarchive/files/doc/html/archive_entry_acl.3.html:1.11
--- pkgsrc/archivers/libarchive/files/doc/html/archive_entry_acl.3.html:1.10    Tue Apr 30 06:05:17 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_entry_acl.3.html Sun Sep 15 07:02:18 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:45 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:04 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_entry_linkify.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_entry_linkify.3.html:1.10 pkgsrc/archivers/libarchive/files/doc/html/archive_entry_linkify.3.html:1.11
--- pkgsrc/archivers/libarchive/files/doc/html/archive_entry_linkify.3.html:1.10        Tue Apr 30 06:05:17 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_entry_linkify.3.html     Sun Sep 15 07:02:18 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:45 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:04 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_entry_paths.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_entry_paths.3.html:1.10 pkgsrc/archivers/libarchive/files/doc/html/archive_entry_paths.3.html:1.11
--- pkgsrc/archivers/libarchive/files/doc/html/archive_entry_paths.3.html:1.10  Tue Apr 30 06:05:17 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_entry_paths.3.html       Sun Sep 15 07:02:18 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:45 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:04 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_entry_perms.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_entry_perms.3.html:1.10 pkgsrc/archivers/libarchive/files/doc/html/archive_entry_perms.3.html:1.11
--- pkgsrc/archivers/libarchive/files/doc/html/archive_entry_perms.3.html:1.10  Tue Apr 30 06:05:17 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_entry_perms.3.html       Sun Sep 15 07:02:18 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:45 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:04 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
@@ -250,7 +250,8 @@ time.</p>
 
 
 <p style="margin-left:6%; margin-top: 1em"><b>archive_entry_set_XXX</b>()
-is an alias for <b>archive_entry_copy_XXX</b>().</p>
+is an alias for <b>archive_entry_copy_XXX</b>(). The strings
+are copied, and don&rsquo;t need to outlive the call.</p>
 
 <p style="margin-left:6%; margin-top: 1em"><b>File
 Flags</b> <br>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_entry_stat.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_entry_stat.3.html:1.10 pkgsrc/archivers/libarchive/files/doc/html/archive_entry_stat.3.html:1.11
--- pkgsrc/archivers/libarchive/files/doc/html/archive_entry_stat.3.html:1.10   Tue Apr 30 06:05:17 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_entry_stat.3.html        Sun Sep 15 07:02:18 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:45 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:04 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_entry_time.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_entry_time.3.html:1.10 pkgsrc/archivers/libarchive/files/doc/html/archive_entry_time.3.html:1.11
--- pkgsrc/archivers/libarchive/files/doc/html/archive_entry_time.3.html:1.10   Tue Apr 30 06:05:17 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_entry_time.3.html        Sun Sep 15 07:02:18 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:45 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:04 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_read_data.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_read_data.3.html:1.10 pkgsrc/archivers/libarchive/files/doc/html/archive_read_data.3.html:1.11
--- pkgsrc/archivers/libarchive/files/doc/html/archive_read_data.3.html:1.10    Tue Apr 30 06:05:17 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_read_data.3.html Sun Sep 15 07:02:18 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:46 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:05 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_read_extract.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_read_extract.3.html:1.10 pkgsrc/archivers/libarchive/files/doc/html/archive_read_extract.3.html:1.11
--- pkgsrc/archivers/libarchive/files/doc/html/archive_read_extract.3.html:1.10 Tue Apr 30 06:05:17 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_read_extract.3.html      Sun Sep 15 07:02:18 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:46 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:05 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_read_filter.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_read_filter.3.html:1.10 pkgsrc/archivers/libarchive/files/doc/html/archive_read_filter.3.html:1.11
--- pkgsrc/archivers/libarchive/files/doc/html/archive_read_filter.3.html:1.10  Tue Apr 30 06:05:17 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_read_filter.3.html       Sun Sep 15 07:02:18 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:46 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:05 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_read_format.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_read_format.3.html:1.10 pkgsrc/archivers/libarchive/files/doc/html/archive_read_format.3.html:1.11
--- pkgsrc/archivers/libarchive/files/doc/html/archive_read_format.3.html:1.10  Tue Apr 30 06:05:17 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_read_format.3.html       Sun Sep 15 07:02:18 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:46 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:05 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_read_free.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_read_free.3.html:1.10 pkgsrc/archivers/libarchive/files/doc/html/archive_read_free.3.html:1.11
--- pkgsrc/archivers/libarchive/files/doc/html/archive_read_free.3.html:1.10    Tue Apr 30 06:05:17 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_read_free.3.html Sun Sep 15 07:02:18 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:46 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:05 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_read_header.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_read_header.3.html:1.10 pkgsrc/archivers/libarchive/files/doc/html/archive_read_header.3.html:1.11
--- pkgsrc/archivers/libarchive/files/doc/html/archive_read_header.3.html:1.10  Tue Apr 30 06:05:17 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_read_header.3.html       Sun Sep 15 07:02:18 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:46 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:05 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_read_new.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_read_new.3.html:1.10 pkgsrc/archivers/libarchive/files/doc/html/archive_read_new.3.html:1.11
--- pkgsrc/archivers/libarchive/files/doc/html/archive_read_new.3.html:1.10     Tue Apr 30 06:05:17 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_read_new.3.html  Sun Sep 15 07:02:18 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:46 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:05 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_read_open.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_read_open.3.html:1.10 pkgsrc/archivers/libarchive/files/doc/html/archive_read_open.3.html:1.11
--- pkgsrc/archivers/libarchive/files/doc/html/archive_read_open.3.html:1.10    Tue Apr 30 06:05:17 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_read_open.3.html Sun Sep 15 07:02:18 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:46 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:05 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_read_set_options.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_read_set_options.3.html:1.10 pkgsrc/archivers/libarchive/files/doc/html/archive_read_set_options.3.html:1.11
--- pkgsrc/archivers/libarchive/files/doc/html/archive_read_set_options.3.html:1.10     Tue Apr 30 06:05:17 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_read_set_options.3.html  Sun Sep 15 07:02:18 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:46 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:05 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_write_blocksize.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_write_blocksize.3.html:1.10 pkgsrc/archivers/libarchive/files/doc/html/archive_write_blocksize.3.html:1.11
--- pkgsrc/archivers/libarchive/files/doc/html/archive_write_blocksize.3.html:1.10      Tue Apr 30 06:05:18 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_write_blocksize.3.html   Sun Sep 15 07:02:18 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:46 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:05 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_write_data.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_write_data.3.html:1.10 pkgsrc/archivers/libarchive/files/doc/html/archive_write_data.3.html:1.11
--- pkgsrc/archivers/libarchive/files/doc/html/archive_write_data.3.html:1.10   Tue Apr 30 06:05:18 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_write_data.3.html        Sun Sep 15 07:02:18 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:46 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:05 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_write_filter.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_write_filter.3.html:1.10 pkgsrc/archivers/libarchive/files/doc/html/archive_write_filter.3.html:1.11
--- pkgsrc/archivers/libarchive/files/doc/html/archive_write_filter.3.html:1.10 Tue Apr 30 06:05:18 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_write_filter.3.html      Sun Sep 15 07:02:18 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:46 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:05 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_write_finish_entry.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_write_finish_entry.3.html:1.10 pkgsrc/archivers/libarchive/files/doc/html/archive_write_finish_entry.3.html:1.11
--- pkgsrc/archivers/libarchive/files/doc/html/archive_write_finish_entry.3.html:1.10   Tue Apr 30 06:05:18 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_write_finish_entry.3.html        Sun Sep 15 07:02:19 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:47 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:06 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_write_format.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_write_format.3.html:1.10 pkgsrc/archivers/libarchive/files/doc/html/archive_write_format.3.html:1.11
--- pkgsrc/archivers/libarchive/files/doc/html/archive_write_format.3.html:1.10 Tue Apr 30 06:05:18 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_write_format.3.html      Sun Sep 15 07:02:19 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:47 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:06 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_write_free.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_write_free.3.html:1.10 pkgsrc/archivers/libarchive/files/doc/html/archive_write_free.3.html:1.11
--- pkgsrc/archivers/libarchive/files/doc/html/archive_write_free.3.html:1.10   Tue Apr 30 06:05:18 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_write_free.3.html        Sun Sep 15 07:02:19 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:47 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:06 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_write_header.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_write_header.3.html:1.10 pkgsrc/archivers/libarchive/files/doc/html/archive_write_header.3.html:1.11
--- pkgsrc/archivers/libarchive/files/doc/html/archive_write_header.3.html:1.10 Tue Apr 30 06:05:18 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_write_header.3.html      Sun Sep 15 07:02:19 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:47 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:06 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_write_new.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_write_new.3.html:1.10 pkgsrc/archivers/libarchive/files/doc/html/archive_write_new.3.html:1.11
--- pkgsrc/archivers/libarchive/files/doc/html/archive_write_new.3.html:1.10    Tue Apr 30 06:05:18 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_write_new.3.html Sun Sep 15 07:02:19 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:47 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:06 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_write_open.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_write_open.3.html:1.10 pkgsrc/archivers/libarchive/files/doc/html/archive_write_open.3.html:1.11
--- pkgsrc/archivers/libarchive/files/doc/html/archive_write_open.3.html:1.10   Tue Apr 30 06:05:18 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_write_open.3.html        Sun Sep 15 07:02:19 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:47 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:06 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_write_set_options.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_write_set_options.3.html:1.10 pkgsrc/archivers/libarchive/files/doc/html/archive_write_set_options.3.html:1.11
--- pkgsrc/archivers/libarchive/files/doc/html/archive_write_set_options.3.html:1.10    Tue Apr 30 06:05:18 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_write_set_options.3.html Sun Sep 15 07:02:19 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:47 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:06 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/libarchive_changes.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/libarchive_changes.3.html:1.10 pkgsrc/archivers/libarchive/files/doc/html/libarchive_changes.3.html:1.11
--- pkgsrc/archivers/libarchive/files/doc/html/libarchive_changes.3.html:1.10   Tue Apr 30 06:05:18 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/libarchive_changes.3.html        Sun Sep 15 07:02:19 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:47 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:06 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>

Index: pkgsrc/archivers/libarchive/files/doc/html/archive_entry_misc.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_entry_misc.3.html:1.5 pkgsrc/archivers/libarchive/files/doc/html/archive_entry_misc.3.html:1.6
--- pkgsrc/archivers/libarchive/files/doc/html/archive_entry_misc.3.html:1.5    Tue Apr 30 06:05:17 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_entry_misc.3.html        Sun Sep 15 07:02:18 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:45 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:04 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>

Index: pkgsrc/archivers/libarchive/files/doc/html/archive_read_add_passphrase.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_read_add_passphrase.3.html:1.7 pkgsrc/archivers/libarchive/files/doc/html/archive_read_add_passphrase.3.html:1.8
--- pkgsrc/archivers/libarchive/files/doc/html/archive_read_add_passphrase.3.html:1.7   Tue Apr 30 06:05:17 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_read_add_passphrase.3.html       Sun Sep 15 07:02:18 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:45 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:04 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>
Index: pkgsrc/archivers/libarchive/files/doc/html/archive_write_set_passphrase.3.html
diff -u pkgsrc/archivers/libarchive/files/doc/html/archive_write_set_passphrase.3.html:1.7 pkgsrc/archivers/libarchive/files/doc/html/archive_write_set_passphrase.3.html:1.8
--- pkgsrc/archivers/libarchive/files/doc/html/archive_write_set_passphrase.3.html:1.7  Tue Apr 30 06:05:18 2024
+++ pkgsrc/archivers/libarchive/files/doc/html/archive_write_set_passphrase.3.html      Sun Sep 15 07:02:19 2024
@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.4 -->
-<!-- CreationDate: Fri Apr 26 09:23:47 2024 -->
+<!-- CreationDate: Fri Sep 13 20:31:06 2024 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd";>
 <html>

Index: pkgsrc/archivers/libarchive/files/doc/man/archive_entry_perms.3
diff -u pkgsrc/archivers/libarchive/files/doc/man/archive_entry_perms.3:1.4 pkgsrc/archivers/libarchive/files/doc/man/archive_entry_perms.3:1.5
--- pkgsrc/archivers/libarchive/files/doc/man/archive_entry_perms.3:1.4 Tue May 26 09:16:41 2020
+++ pkgsrc/archivers/libarchive/files/doc/man/archive_entry_perms.3     Sun Sep 15 07:02:19 2024
@@ -170,6 +170,7 @@ character strings at the same time.
 \fB\%archive_entry_set_XXX\fP()
 is an alias for
 \fB\%archive_entry_copy_XXX\fP().
+The strings are copied, and don't need to outlive the call.
 .SS File Flags
 File flags are transparently converted between a bitmap
 representation and a textual format.

Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_entry.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_read.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_read_disk.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_util.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_write.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_write_disk.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/bsdcpio.1.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/bsdtar.1.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/cpio.5.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/libarchive-formats.5.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/libarchive.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/libarchive_internals.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/mtree.5.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/tar.5.pdf
Binary files are different

Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_entry_acl.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_entry_linkify.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_entry_paths.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_entry_perms.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_entry_stat.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_entry_time.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_read_data.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_read_extract.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_read_filter.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_read_format.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_read_free.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_read_header.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_read_new.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_read_open.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_read_set_options.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_write_blocksize.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_write_data.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_write_filter.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_write_finish_entry.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_write_format.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_write_free.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_write_header.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_write_new.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_write_open.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_write_set_options.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/libarchive_changes.3.pdf
Binary files are different

Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_entry_misc.3.pdf
Binary files are different

Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_read_add_passphrase.3.pdf
Binary files are different
Index: pkgsrc/archivers/libarchive/files/doc/pdf/archive_write_set_passphrase.3.pdf
Binary files are different

Index: pkgsrc/archivers/libarchive/files/doc/text/archive_entry_perms.3.txt
diff -u pkgsrc/archivers/libarchive/files/doc/text/archive_entry_perms.3.txt:1.7 pkgsrc/archivers/libarchive/files/doc/text/archive_entry_perms.3.txt:1.8
--- pkgsrc/archivers/libarchive/files/doc/text/archive_entry_perms.3.txt:1.7    Thu Jan 18 18:00:15 2024
+++ pkgsrc/archivers/libarchive/files/doc/text/archive_entry_perms.3.txt        Sun Sep 15 07:02:20 2024
@@ -123,7 +123,8 @@ DESCRIPTION
                tions to update both the multibyte and wide character strings
                at the same time.
 
-     archive_entry_set_XXX() is an alias for archive_entry_copy_XXX().
+     archive_entry_set_XXX() is an alias for archive_entry_copy_XXX(). The
+     strings are copied, and don't need to outlive the call.
 
    File Flags
      File flags are transparently converted between a bitmap representation

Index: pkgsrc/archivers/libarchive/files/doc/wiki/ManPageArchiveEntryPerms3.wiki
diff -u pkgsrc/archivers/libarchive/files/doc/wiki/ManPageArchiveEntryPerms3.wiki:1.7 pkgsrc/archivers/libarchive/files/doc/wiki/ManPageArchiveEntryPerms3.wiki:1.8
--- pkgsrc/archivers/libarchive/files/doc/wiki/ManPageArchiveEntryPerms3.wiki:1.7       Thu Jan 18 18:00:16 2024
+++ pkgsrc/archivers/libarchive/files/doc/wiki/ManPageArchiveEntryPerms3.wiki   Sun Sep 15 07:02:20 2024
@@ -163,6 +163,7 @@ character strings at the same time. 
 '''archive_entry_set_XXX'''() 
 is an alias for 
 '''archive_entry_copy_XXX'''(). 
+The strings are copied, and don't need to outlive the call. 
 === File Flags=== 
 File flags are transparently converted between a bitmap 
 representation and a textual format. 

Index: pkgsrc/archivers/libarchive/files/libarchive/CMakeLists.txt
diff -u pkgsrc/archivers/libarchive/files/libarchive/CMakeLists.txt:1.10 pkgsrc/archivers/libarchive/files/libarchive/CMakeLists.txt:1.11
--- pkgsrc/archivers/libarchive/files/libarchive/CMakeLists.txt:1.10    Fri Apr 12 15:39:50 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/CMakeLists.txt Sun Sep 15 07:02:20 2024
@@ -247,7 +247,11 @@ IF(BUILD_SHARED_LIBS)
   ADD_LIBRARY(archive SHARED ${libarchive_SOURCES} ${include_HEADERS})
   TARGET_INCLUDE_DIRECTORIES(archive PUBLIC .)
   TARGET_LINK_LIBRARIES(archive ${ADDITIONAL_LIBS})
-  SET_TARGET_PROPERTIES(archive PROPERTIES SOVERSION ${SOVERSION})
+  SET_TARGET_PROPERTIES(archive PROPERTIES 
+                        VERSION ${SOVERSION_FULL}
+                        SOVERSION ${SOVERSION}
+                        MACHO_COMPATIBILITY_VERSION ${MACHO_COMPATIBILITY_VERSION}
+                        MACHO_CURRENT_VERSION ${MACHO_CURRENT_VERSION})
 ENDIF(BUILD_SHARED_LIBS)
 
 # archive_static is a static library
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_rar.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_rar.c:1.10 pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_rar.c:1.11
--- pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_rar.c:1.10 Tue Apr 30 06:05:19 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_rar.c      Sun Sep 15 07:02:21 2024
@@ -432,7 +432,7 @@ static int make_table_recurse(struct arc
                               struct huffman_table_entry *, int, int);
 static int expand(struct archive_read *, int64_t *);
 static int copy_from_lzss_window_to_unp(struct archive_read *, const void **,
-                                        int64_t, int);
+                                        int64_t, size_t);
 static const void *rar_read_ahead(struct archive_read *, size_t, ssize_t *);
 static int parse_filter(struct archive_read *, const uint8_t *, uint16_t,
                         uint8_t);
@@ -1373,6 +1373,8 @@ read_header(struct archive_read *a, stru
   struct archive_string_conv *sconv, *fn_sconv;
   unsigned long crc32_val;
   int ret = (ARCHIVE_OK), ret2;
+  char *newptr;
+  size_t newsize;
 
   rar = (struct rar *)(a->format->data);
 
@@ -1469,6 +1471,11 @@ read_header(struct archive_read *a, stru
 
   if (rar->file_flags & FHD_LARGE)
   {
+    if (p + 8 > endp) {
+      archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+                        "Invalid header size");
+      return (ARCHIVE_FATAL);
+    }
     memcpy(packed_size, file_header.pack_size, 4);
     memcpy(packed_size + 4, p, 4); /* High pack size */
     p += 4;
@@ -1514,8 +1521,7 @@ read_header(struct archive_read *a, stru
     return (ARCHIVE_FATAL);
   }
   if (rar->filename_allocated < filename_size * 2 + 2) {
-    char *newptr;
-    size_t newsize = filename_size * 2 + 2;
+    newsize = filename_size * 2 + 2;
     newptr = realloc(rar->filename, newsize);
     if (newptr == NULL) {
       archive_set_error(&a->archive, ENOMEM,
@@ -1539,7 +1545,7 @@ read_header(struct archive_read *a, stru
       fn_end = filename_size * 2;
       filename_size = 0;
       offset = (unsigned)strlen(filename) + 1;
-      highbyte = *(p + offset++);
+      highbyte = offset >= end ? 0 : *(p + offset++);
       flagbits = 0;
       flagbyte = 0;
       while (offset < end && filename_size < fn_end)
@@ -1554,14 +1560,22 @@ read_header(struct archive_read *a, stru
         switch((flagbyte >> flagbits) & 3)
         {
           case 0:
+            if (offset >= end)
+              continue;
             filename[filename_size++] = '\0';
             filename[filename_size++] = *(p + offset++);
             break;
           case 1:
+            if (offset >= end)
+              continue;
             filename[filename_size++] = highbyte;
             filename[filename_size++] = *(p + offset++);
             break;
           case 2:
+            if (offset >= end - 1) {
+              offset = end;
+              continue;
+            }
             filename[filename_size++] = *(p + offset + 1);
             filename[filename_size++] = *(p + offset);
             offset += 2;
@@ -1569,9 +1583,15 @@ read_header(struct archive_read *a, stru
           case 3:
           {
             char extra, high;
-            uint8_t length = *(p + offset++);
+            uint8_t length;
+
+            if (offset >= end)
+              continue;
 
+            length = *(p + offset++);
             if (length & 0x80) {
+              if (offset >= end)
+                continue;
               extra = *(p + offset++);
               high = (char)highbyte;
             } else
@@ -1652,13 +1672,16 @@ read_header(struct archive_read *a, stru
     rar->cursor++;
     if (rar->cursor >= rar->nodes)
     {
-      rar->nodes++;
-      if ((rar->dbo =
-        realloc(rar->dbo, sizeof(*rar->dbo) * rar->nodes)) == NULL)
+      struct data_block_offsets *newdbo;
+
+      newsize = sizeof(*rar->dbo) * (rar->nodes + 1);
+      if ((newdbo = realloc(rar->dbo, newsize)) == NULL)
       {
         archive_set_error(&a->archive, ENOMEM, "Couldn't allocate memory.");
         return (ARCHIVE_FATAL);
       }
+      rar->dbo = newdbo;
+      rar->nodes++;
       rar->dbo[rar->cursor].header_size = header_size;
       rar->dbo[rar->cursor].start_offset = -1;
       rar->dbo[rar->cursor].end_offset = -1;
@@ -1678,9 +1701,14 @@ read_header(struct archive_read *a, stru
     return (ARCHIVE_FATAL);
   }
 
-  rar->filename_save = (char*)realloc(rar->filename_save,
-                                      filename_size + 1);
-  memcpy(rar->filename_save, rar->filename, filename_size + 1);
+  newsize = filename_size + 1;
+  if ((newptr = realloc(rar->filename_save, newsize)) == NULL)
+  {
+    archive_set_error(&a->archive, ENOMEM, "Couldn't allocate memory.");
+    return (ARCHIVE_FATAL);
+  }
+  rar->filename_save = newptr;
+  memcpy(rar->filename_save, rar->filename, newsize);
   rar->filename_save_size = filename_size;
 
   /* Set info for seeking */
@@ -2060,7 +2088,7 @@ read_data_compressed(struct archive_read
         bs = rar->unp_buffer_size - rar->unp_offset;
       else
         bs = (size_t)rar->bytes_uncopied;
-      ret = copy_from_lzss_window_to_unp(a, buff, rar->offset, (int)bs);
+      ret = copy_from_lzss_window_to_unp(a, buff, rar->offset, bs);
       if (ret != ARCHIVE_OK)
         return (ret);
       rar->offset += bs;
@@ -2213,7 +2241,7 @@ read_data_compressed(struct archive_read
       bs = rar->unp_buffer_size - rar->unp_offset;
     else
       bs = (size_t)rar->bytes_uncopied;
-    ret = copy_from_lzss_window_to_unp(a, buff, rar->offset, (int)bs);
+    ret = copy_from_lzss_window_to_unp(a, buff, rar->offset, bs);
     if (ret != ARCHIVE_OK)
       return (ret);
     rar->offset += bs;
@@ -2579,8 +2607,7 @@ read_next_symbol(struct archive_read *a,
   rar_br_consume(br, code->tablesize);
 
   node = value;
-  while (!(code->tree[node].branches[0] ==
-    code->tree[node].branches[1]))
+  while (code->tree[node].branches[0] != code->tree[node].branches[1])
   {
     if (!rar_br_read_ahead(a, br, 1)) {
       archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
@@ -2955,7 +2982,7 @@ expand(struct archive_read *a, int64_t *
 
       if ((lensymbol = read_next_symbol(a, &rar->lengthcode)) < 0)
         goto bad_data;
-      if (lensymbol > lengthb_min)
+      if (lensymbol >= lengthb_min)
         goto bad_data;
       len = lengthbases[lensymbol] + 2;
       if (lengthbits[lensymbol] > 0) {
@@ -2987,7 +3014,7 @@ expand(struct archive_read *a, int64_t *
     }
     else
     {
-      if (symbol-271 > lengthb_min)
+      if (symbol-271 >= lengthb_min)
         goto bad_data;
       len = lengthbases[symbol-271]+3;
       if(lengthbits[symbol-271] > 0) {
@@ -2999,7 +3026,7 @@ expand(struct archive_read *a, int64_t *
 
       if ((offssymbol = read_next_symbol(a, &rar->offsetcode)) < 0)
         goto bad_data;
-      if (offssymbol > offsetb_min)
+      if (offssymbol >= offsetb_min)
         goto bad_data;
       offs = offsetbases[offssymbol]+1;
       if(offsetbits[offssymbol] > 0)
@@ -3094,11 +3121,16 @@ copy_from_lzss_window(struct archive_rea
 
 static int
 copy_from_lzss_window_to_unp(struct archive_read *a, const void **buffer,
-                             int64_t startpos, int length)
+                             int64_t startpos, size_t length)
 {
   int windowoffs, firstpart;
   struct rar *rar = (struct rar *)(a->format->data);
 
+  if (length > rar->unp_buffer_size)
+  {
+    goto fatal;
+  }
+
   if (!rar->unp_buffer)
   {
     if ((rar->unp_buffer = malloc(rar->unp_buffer_size)) == NULL)
@@ -3110,17 +3142,17 @@ copy_from_lzss_window_to_unp(struct arch
   }
 
   windowoffs = lzss_offset_for_position(&rar->lzss, startpos);
-  if(windowoffs + length <= lzss_size(&rar->lzss)) {
+  if(windowoffs + length <= (size_t)lzss_size(&rar->lzss)) {
     memcpy(&rar->unp_buffer[rar->unp_offset], &rar->lzss.window[windowoffs],
            length);
-  } else if (length <= lzss_size(&rar->lzss)) {
+  } else if (length <= (size_t)lzss_size(&rar->lzss)) {
     firstpart = lzss_size(&rar->lzss) - windowoffs;
     if (firstpart < 0) {
       archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
                         "Bad RAR file data");
       return (ARCHIVE_FATAL);
     }
-    if (firstpart < length) {
+    if ((size_t)firstpart < length) {
       memcpy(&rar->unp_buffer[rar->unp_offset],
              &rar->lzss.window[windowoffs], firstpart);
       memcpy(&rar->unp_buffer[rar->unp_offset + firstpart],
@@ -3130,16 +3162,19 @@ copy_from_lzss_window_to_unp(struct arch
              &rar->lzss.window[windowoffs], length);
     }
   } else {
-      archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
-                        "Bad RAR file data");
-      return (ARCHIVE_FATAL);
+      goto fatal;
   }
-  rar->unp_offset += length;
+  rar->unp_offset += (unsigned int) length;
   if (rar->unp_offset >= rar->unp_buffer_size)
     *buffer = rar->unp_buffer;
   else
     *buffer = NULL;
   return (ARCHIVE_OK);
+
+fatal:
+  archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+                    "Bad RAR file data");
+  return (ARCHIVE_FATAL);
 }
 
 static const void *
@@ -3325,7 +3360,10 @@ create_filter(struct rar_program_code *p
   filter->globaldatalen = globaldatalen > PROGRAM_SYSTEM_GLOBAL_SIZE ? globaldatalen : PROGRAM_SYSTEM_GLOBAL_SIZE;
   filter->globaldata = calloc(1, filter->globaldatalen);
   if (!filter->globaldata)
+  {
+    free(filter);
     return NULL;
+  }
   if (globaldata)
     memcpy(filter->globaldata, globaldata, globaldatalen);
   if (registers)
@@ -3352,7 +3390,7 @@ run_filters(struct archive_read *a)
   if (filters == NULL || filter == NULL)
     return (0);
 
-  start = filters->filterstart;
+  start = (size_t)filters->filterstart;
   end = start + filter->blocklength;
 
   filters->filterstart = INT64_MAX;
@@ -3389,10 +3427,16 @@ run_filters(struct archive_read *a)
       return 0;
   }
 
+  if (filter->blocklength > VM_MEMORY_SIZE)
+  {
+    archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Bad RAR file data");
+    return 0;
+  }
+
   ret = copy_from_lzss_window(a, filters->vm->memory, start, filter->blocklength);
   if (ret != ARCHIVE_OK)
     return 0;
-  if (!execute_filter(a, filter, filters->vm, rar->offset))
+  if (!execute_filter(a, filter, filters->vm, (size_t)rar->offset))
     return 0;
 
   lastfilteraddress = filter->filteredblockaddress;
@@ -3404,7 +3448,7 @@ run_filters(struct archive_read *a)
   while ((filter = filters->stack) != NULL && (int64_t)filter->blockstartpos == filters->filterstart && filter->blocklength == lastfilterlength)
   {
     memmove(&filters->vm->memory[0], &filters->vm->memory[lastfilteraddress], lastfilterlength);
-    if (!execute_filter(a, filter, filters->vm, rar->offset))
+    if (!execute_filter(a, filter, filters->vm, (size_t)rar->offset))
       return 0;
 
     lastfilteraddress = filter->filteredblockaddress;
@@ -3612,7 +3656,15 @@ execute_filter_delta(struct rar_filter *
   {
     uint8_t lastbyte = 0;
     for (idx = i; idx < length; idx += numchannels)
+    {
+      /*
+       * The src block should not overlap with the dst block.
+       * If so it would be better to consider this archive is broken.
+       */
+      if (src >= dst)
+        return 0;
       lastbyte = dst[idx] = lastbyte - *src++;
+    }
   }
 
   filter->filteredblockaddress = length;
@@ -3637,7 +3689,7 @@ execute_filter_e8(struct rar_filter *fil
     {
       uint32_t currpos = (uint32_t)pos + i + 1;
       int32_t address = (int32_t)vm_read_32(vm, i + 1);
-      if (address < 0 && currpos >= (uint32_t)-address)
+      if (address < 0 && currpos >= (~(uint32_t)address + 1))
         vm_write_32(vm, i + 1, address + filesize);
       else if (address >= 0 && (uint32_t)address < filesize)
         vm_write_32(vm, i + 1, address - currpos);
@@ -3660,7 +3712,7 @@ execute_filter_rgb(struct rar_filter *fi
   uint8_t *src, *dst;
   uint32_t i, j;
 
-  if (blocklength > PROGRAM_WORK_SIZE / 2 || stride > blocklength)
+  if (blocklength > PROGRAM_WORK_SIZE / 2 || stride > blocklength || blocklength < 3 || byteoffset > 2)
     return 0;
 
   src = &vm->memory[0];
@@ -3670,6 +3722,13 @@ execute_filter_rgb(struct rar_filter *fi
     uint8_t *prev = dst + i - stride;
     for (j = i; j < blocklength; j += 3)
     {
+      /*
+       * The src block should not overlap with the dst block.
+       * If so it would be better to consider this archive is broken.
+       */
+      if (src >= dst)
+        return 0;
+
       if (prev >= dst)
       {
         uint32_t delta1 = abs(prev[3] - prev[0]);
@@ -3714,6 +3773,13 @@ execute_filter_audio(struct rar_filter *
     memset(&state, 0, sizeof(state));
     for (j = i; j < length; j += numchannels)
     {
+      /*
+       * The src block should not overlap with the dst block.
+       * If so it would be better to consider this archive is broken.
+       */
+      if (src >= dst)
+        return 0;
+
       int8_t delta = (int8_t)*src++;
       uint8_t predbyte, byte;
       int prederror;
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_xar.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_xar.c:1.10 pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_xar.c:1.11
--- pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_xar.c:1.10 Tue Apr 30 06:05:19 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_xar.c      Sun Sep 15 07:02:21 2024
@@ -416,7 +416,7 @@ static void unknowntag_end(struct xar *,
 static int     xml_start(struct archive_read *,
     const char *, struct xmlattr_list *);
 static void    xml_end(void *, const char *);
-static void    xml_data(void *, const char *, int);
+static void    xml_data(void *, const char *, size_t);
 static int     xml_parse_file_flags(struct xar *, const char *);
 static int     xml_parse_file_ext2(struct xar *, const char *);
 #if defined(HAVE_LIBXML_XMLREADER_H)
@@ -1242,7 +1242,7 @@ heap_add_entry(struct archive_read *a,
                        return (ARCHIVE_FATAL);
                }
                new_pending_files = (struct xar_file **)
-                   malloc(new_size * sizeof(new_pending_files[0]));
+                   calloc(new_size, sizeof(new_pending_files[0]));
                if (new_pending_files == NULL) {
                        archive_set_error(&a->archive,
                            ENOMEM, "Out of memory");
@@ -1616,9 +1616,9 @@ decompress(struct archive_read *a, const
        switch (xar->rd_encoding) {
        case GZIP:
                xar->stream.next_in = (Bytef *)(uintptr_t)b;
-               xar->stream.avail_in = avail_in;
+               xar->stream.avail_in = (uInt)avail_in;
                xar->stream.next_out = (unsigned char *)outbuff;
-               xar->stream.avail_out = avail_out;
+               xar->stream.avail_out = (uInt)avail_out;
                r = inflate(&(xar->stream), 0);
                switch (r) {
                case Z_OK: /* Decompressor made some progress.*/
@@ -1635,9 +1635,9 @@ decompress(struct archive_read *a, const
 #if defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR)
        case BZIP2:
                xar->bzstream.next_in = (char *)(uintptr_t)b;
-               xar->bzstream.avail_in = avail_in;
+               xar->bzstream.avail_in = (unsigned int)avail_in;
                xar->bzstream.next_out = (char *)outbuff;
-               xar->bzstream.avail_out = avail_out;
+               xar->bzstream.avail_out = (unsigned int)avail_out;
                r = BZ2_bzDecompress(&(xar->bzstream));
                switch (r) {
                case BZ_STREAM_END: /* Found end of stream. */
@@ -2055,9 +2055,10 @@ xml_start(struct archive_read *a, const 
                            attr = attr->next) {
                                if (strcmp(attr->name, "link") != 0)
                                        continue;
-                               if (xar->file->hdnext != NULL || xar->file->link != 0) {
+                               if (xar->file->hdnext != NULL || xar->file->link != 0 ||
+                                   xar->file == xar->hdlink_orgs) {
                                        archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
-                                           "File with multiple link targets");
+                                           "File with multiple link attributes");
                                        return (ARCHIVE_FATAL);
                                }
                                if (strcmp(attr->value, "original") == 0) {
@@ -2673,7 +2674,7 @@ is_string(const char *known, const char 
 }
 
 static void
-xml_data(void *userData, const char *s, int len)
+xml_data(void *userData, const char *s, size_t len)
 {
        struct archive_read *a;
        struct xar *xar;
@@ -2706,6 +2707,9 @@ xml_data(void *userData, const char *s, 
 
        switch (xar->xmlsts) {
        case FILE_NAME:
+               if (xar->file->has & HAS_PATHNAME)
+                       break;
+
                if (xar->file->parent != NULL) {
                        archive_string_concat(&(xar->file->pathname),
                            &(xar->file->parent->pathname));
@@ -3189,8 +3193,11 @@ xml2_read_toc(struct archive_read *a)
                        if (r == ARCHIVE_OK)
                                r = xml_start(a, name, &list);
                        xmlattr_cleanup(&list);
-                       if (r != ARCHIVE_OK)
+                       if (r != ARCHIVE_OK) {
+                               xmlFreeTextReader(reader);
+                               xmlCleanupParser();
                                return (r);
+                       }
                        if (empty)
                                xml_end(a, name);
                        break;
@@ -3256,6 +3263,9 @@ expat_start_cb(void *userData, const XML
        struct xmlattr_list list;
        int r;
 
+       if (ud->state != ARCHIVE_OK)
+               return;
+
        r = expat_xmlattr_setup(a, &list, atts);
        if (r == ARCHIVE_OK)
                r = xml_start(a, (const char *)name, &list);
@@ -3276,7 +3286,7 @@ expat_data_cb(void *userData, const XML_
 {
        struct expat_userData *ud = (struct expat_userData *)userData;
 
-       xml_data(ud->archive, s, len);
+       xml_data(ud->archive, s, (size_t)len);
 }
 
 static int
@@ -3312,14 +3322,16 @@ expat_read_toc(struct archive_read *a)
 
                d = NULL;
                r = rd_contents(a, &d, &outbytes, &used, xar->toc_remaining);
-               if (r != ARCHIVE_OK)
+               if (r != ARCHIVE_OK) {
+                       XML_ParserFree(parser);
                        return (r);
+               }
                xar->toc_remaining -= used;
                xar->offset += used;
                xar->toc_total += outbytes;
                PRINT_TOC(d, outbytes);
 
-               xr = XML_Parse(parser, d, outbytes, xar->toc_remaining == 0);
+               xr = XML_Parse(parser, d, (int)outbytes, xar->toc_remaining == 0);
                __archive_read_consume(a, used);
                if (xr == XML_STATUS_ERROR) {
                        XML_ParserFree(parser);
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_windows.h
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_windows.h:1.10 pkgsrc/archivers/libarchive/files/libarchive/archive_windows.h:1.11
--- pkgsrc/archivers/libarchive/files/libarchive/archive_windows.h:1.10 Fri Apr 12 15:39:52 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_windows.h      Sun Sep 15 07:02:21 2024
@@ -292,12 +292,17 @@ typedef int mbstate_t;
 size_t wcrtomb(char *, wchar_t, mbstate_t *);
 #endif
 
-#if defined(_MSC_VER) && _MSC_VER < 1300
+#if !WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) && NTDDI_VERSION < NTDDI_WIN10_VB
+// not supported in UWP SDK before 20H1
+#define GetVolumePathNameW(f, v, c)   (0)
+#elif defined(_MSC_VER) && _MSC_VER < 1300
 WINBASEAPI BOOL WINAPI GetVolumePathNameW(
        LPCWSTR lpszFileName,
        LPWSTR lpszVolumePathName,
        DWORD cchBufferLength
        );
+#endif
+#if defined(_MSC_VER) && _MSC_VER < 1300
 # if _WIN32_WINNT < 0x0500 /* windows.h not providing 0x500 API */
 typedef struct _FILE_ALLOCATED_RANGE_BUFFER {
        LARGE_INTEGER FileOffset;
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_write.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_write.c:1.10 pkgsrc/archivers/libarchive/files/libarchive/archive_write.c:1.11
--- pkgsrc/archivers/libarchive/files/libarchive/archive_write.c:1.10   Fri Apr 12 15:39:52 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_write.c        Sun Sep 15 07:02:21 2024
@@ -132,12 +132,17 @@ archive_write_set_bytes_per_block(struct
        struct archive_write *a = (struct archive_write *)_a;
        archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
            ARCHIVE_STATE_NEW, "archive_write_set_bytes_per_block");
+
+       if (bytes_per_block < 0) {
+               // Do nothing if the bytes_per_block is negative
+               return 0;
+       }
        a->bytes_per_block = bytes_per_block;
        return (ARCHIVE_OK);
 }
 
 /*
- * Get the current block size.  -1 if it has never been set.
+ * Get the current block size.
  */
 int
 archive_write_get_bytes_per_block(struct archive *_a)
@@ -145,6 +150,10 @@ archive_write_get_bytes_per_block(struct
        struct archive_write *a = (struct archive_write *)_a;
        archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
            ARCHIVE_STATE_ANY, "archive_write_get_bytes_per_block");
+       if (a->bytes_per_block < 0) {
+               // Don't return a negative value
+               return 1;
+       }
        return (a->bytes_per_block);
 }
 

Index: pkgsrc/archivers/libarchive/files/libarchive/archive.h
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive.h:1.17 pkgsrc/archivers/libarchive/files/libarchive/archive.h:1.18
--- pkgsrc/archivers/libarchive/files/libarchive/archive.h:1.17 Tue Apr 30 06:05:19 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive.h      Sun Sep 15 07:02:20 2024
@@ -34,7 +34,7 @@
  * assert that ARCHIVE_VERSION_NUMBER >= 2012108.
  */
 /* Note: Compiler will complain if this does not match archive_entry.h! */
-#define        ARCHIVE_VERSION_NUMBER 3007004
+#define        ARCHIVE_VERSION_NUMBER 3007005
 
 #include <sys/stat.h>
 #include <stddef.h>  /* for wchar_t */
@@ -155,7 +155,7 @@ __LA_DECL int               archive_version_number(vo
 /*
  * Textual name/version of the library, useful for version displays.
  */
-#define        ARCHIVE_VERSION_ONLY_STRING "3.7.4"
+#define        ARCHIVE_VERSION_ONLY_STRING "3.7.5"
 #define        ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING
 __LA_DECL const char * archive_version_string(void);
 

Index: pkgsrc/archivers/libarchive/files/libarchive/archive_acl.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_acl.c:1.6 pkgsrc/archivers/libarchive/files/libarchive/archive_acl.c:1.7
--- pkgsrc/archivers/libarchive/files/libarchive/archive_acl.c:1.6      Fri Apr 12 15:39:50 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_acl.c  Sun Sep 15 07:02:20 2024
@@ -76,7 +76,7 @@ static int    is_nfs4_flags(const char *sta
                    int *result);
 static int     is_nfs4_perms(const char *start, const char *end,
                    int *result);
-static void    next_field(const char **p, const char **start,
+static void    next_field(const char **p, size_t *l, const char **start,
                    const char **end, char *sep);
 static void    append_entry(char **p, const char *prefix, int type,
                    int tag, int flags, const char *name, int perm, int id);
@@ -1620,6 +1620,13 @@ int
 archive_acl_from_text_l(struct archive_acl *acl, const char *text,
     int want_type, struct archive_string_conv *sc)
 {
+       return archive_acl_from_text_nl(acl, text, strlen(text), want_type, sc);
+}
+
+int
+archive_acl_from_text_nl(struct archive_acl *acl, const char *text,
+    size_t length, int want_type, struct archive_string_conv *sc)
+{
        struct {
                const char *start;
                const char *end;
@@ -1649,7 +1656,7 @@ archive_acl_from_text_l(struct archive_a
        ret = ARCHIVE_OK;
        types = 0;
 
-       while (text != NULL &&  *text != '\0') {
+       while (text != NULL && length > 0 && *text != '\0') {
                /*
                 * Parse the fields out of the next entry,
                 * advance 'text' to start of next entry.
@@ -1657,7 +1664,7 @@ archive_acl_from_text_l(struct archive_a
                fields = 0;
                do {
                        const char *start, *end;
-                       next_field(&text, &start, &end, &sep);
+                       next_field(&text, &length, &start, &end, &sep);
                        if (fields < numfields) {
                                field[fields].start = start;
                                field[fields].end = end;
@@ -2047,7 +2054,7 @@ is_nfs4_flags(const char *start, const c
 }
 
 /*
- * Match "[:whitespace:]*(.*)[:whitespace:]*[:,\n]".  *wp is updated
+ * Match "[:whitespace:]*(.*)[:whitespace:]*[:,\n]".  *p is updated
  * to point to just after the separator.  *start points to the first
  * character of the matched text and *end just after the last
  * character of the matched identifier.  In particular *end - *start
@@ -2055,42 +2062,42 @@ is_nfs4_flags(const char *start, const c
  * whitespace.
  */
 static void
-next_field(const char **p, const char **start,
+next_field(const char **p, size_t *l, const char **start,
     const char **end, char *sep)
 {
        /* Skip leading whitespace to find start of field. */
-       while (**p == ' ' || **p == '\t' || **p == '\n') {
+       while (*l > 0 && (**p == ' ' || **p == '\t' || **p == '\n')) {
                (*p)++;
+               (*l)--;
        }
        *start = *p;
 
-       /* Scan for the separator. */
-       while (**p != '\0' && **p != ',' && **p != ':' && **p != '\n' &&
-           **p != '#') {
+       /* Locate end of field, trim trailing whitespace if necessary */
+       while (*l > 0 && **p != ' ' && **p != '\t' && **p != '\n' && **p != ',' && **p != ':' && **p != '#') {
                (*p)++;
+               (*l)--;
        }
-       *sep = **p;
+       *end = *p;
 
-       /* Locate end of field, trim trailing whitespace if necessary */
-       if (*p == *start) {
-               *end = *p;
-       } else {
-               *end = *p - 1;
-               while (**end == ' ' || **end == '\t' || **end == '\n') {
-                       (*end)--;
-               }
-               (*end)++;
+       /* Scan for the separator. */
+       while (*l > 0 && **p != ',' && **p != ':' && **p != '\n' && **p != '#') {
+               (*p)++;
+               (*l)--;
        }
+       *sep = **p;
 
        /* Handle in-field comments */
        if (*sep == '#') {
-               while (**p != '\0' && **p != ',' && **p != '\n') {
+               while (*l > 0 && **p != ',' && **p != '\n') {
                        (*p)++;
+                       (*l)--;
                }
                *sep = **p;
        }
 
-       /* Adjust scanner location. */
-       if (**p != '\0')
+       /* Skip separator. */
+       if (*l > 0) {
                (*p)++;
+               (*l)--;
+       }
 }
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_match.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_match.c:1.6 pkgsrc/archivers/libarchive/files/libarchive/archive_match.c:1.7
--- pkgsrc/archivers/libarchive/files/libarchive/archive_match.c:1.6    Fri Apr 12 15:39:50 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_match.c        Sun Sep 15 07:02:20 2024
@@ -46,7 +46,7 @@
 
 struct match {
        struct match            *next;
-       int                      matches;
+       int                      matched;
        struct archive_mstring   pattern;
 };
 
@@ -605,7 +605,8 @@ add_pattern_from_file(struct archive_mat
                return (ARCHIVE_FATAL);
        }
        r = archive_read_support_format_raw(ar);
-       r = archive_read_support_format_empty(ar);
+       if (r == ARCHIVE_OK)
+               r = archive_read_support_format_empty(ar);
        if (r != ARCHIVE_OK) {
                archive_copy_error(&(a->archive), ar);
                archive_read_free(ar);
@@ -724,12 +725,12 @@ path_excluded(struct archive_match *a, i
        matched = NULL;
        for (match = a->inclusions.first; match != NULL;
            match = match->next){
-               if (match->matches == 0 &&
+               if (!match->matched &&
                    (r = match_path_inclusion(a, match, mbs, pathname)) != 0) {
                        if (r < 0)
                                return (r);
                        a->inclusions.unmatched_count--;
-                       match->matches++;
+                       match->matched = 1;
                        matched = match;
                }
        }
@@ -752,11 +753,10 @@ path_excluded(struct archive_match *a, i
        for (match = a->inclusions.first; match != NULL;
            match = match->next){
                /* We looked at previously-unmatched inclusions already. */
-               if (match->matches > 0 &&
+               if (match->matched &&
                    (r = match_path_inclusion(a, match, mbs, pathname)) != 0) {
                        if (r < 0)
                                return (r);
-                       match->matches++;
                        return (0);
                }
        }
@@ -879,7 +879,7 @@ match_list_unmatched_inclusions_next(str
        for (m = list->unmatched_next; m != NULL; m = m->next) {
                int r;
 
-               if (m->matches)
+               if (m->matched)
                        continue;
                if (mbs) {
                        const char *p;
@@ -1793,7 +1793,7 @@ match_owner_name_mbs(struct archive_matc
                    < 0 && errno == ENOMEM)
                        return (error_nomem(a));
                if (p != NULL && strcmp(p, name) == 0) {
-                       m->matches++;
+                       m->matched = 1;
                        return (1);
                }
        }
@@ -1814,7 +1814,7 @@ match_owner_name_wcs(struct archive_matc
                    < 0 && errno == ENOMEM)
                        return (error_nomem(a));
                if (p != NULL && wcscmp(p, name) == 0) {
-                       m->matches++;
+                       m->matched = 1;
                        return (1);
                }
        }
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_read_append_filter.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_read_append_filter.c:1.6 pkgsrc/archivers/libarchive/files/libarchive/archive_read_append_filter.c:1.7
--- pkgsrc/archivers/libarchive/files/libarchive/archive_read_append_filter.c:1.6       Fri Apr 12 15:39:51 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_read_append_filter.c   Sun Sep 15 07:02:20 2024
@@ -111,7 +111,7 @@ archive_read_append_filter(struct archiv
     number_bidders = sizeof(a->bidders) / sizeof(a->bidders[0]);
 
     bidder = a->bidders;
-    for (i = 0; i < number_bidders; i++, bidder++)
+    for (i = 1; i < number_bidders; i++, bidder++)
     {
       if (!bidder->name || !strcmp(bidder->name, str))
         break;
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_filter_uu.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_filter_uu.c:1.6 pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_filter_uu.c:1.7
--- pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_filter_uu.c:1.6   Fri Apr 12 15:39:51 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_filter_uu.c       Sun Sep 15 07:02:21 2024
@@ -43,11 +43,13 @@
 /* Maximum lookahead during bid phase */
 #define UUENCODE_BID_MAX_READ 128*1024 /* in bytes */
 
+#define UUENCODE_MAX_LINE_LENGTH 34*1024 /* in bytes */
+
 struct uudecode {
        int64_t          total;
        unsigned char   *in_buff;
 #define IN_BUFF_SIZE   (1024)
-       int              in_cnt;
+       ssize_t          in_cnt;
        size_t           in_allocated;
        unsigned char   *out_buff;
 #define OUT_BUFF_SIZE  (64 * 1024)
@@ -484,6 +486,12 @@ read_more:
                goto finish;
        }
        if (uudecode->in_cnt) {
+               if (uudecode->in_cnt > UUENCODE_MAX_LINE_LENGTH) {
+                       archive_set_error(&self->archive->archive,
+                           ARCHIVE_ERRNO_FILE_FORMAT,
+                           "Invalid format data");
+                       return (ARCHIVE_FATAL);
+               }
                /*
                 * If there is remaining data which is saved by
                 * previous calling, use it first.
@@ -498,7 +506,7 @@ read_more:
                uudecode->in_cnt = 0;
        }
        for (;used < avail_in; d += llen, used += llen) {
-               int64_t l, body;
+               ssize_t l, body;
 
                b = d;
                len = get_line(b, avail_in - used, &nl);
@@ -533,7 +541,7 @@ read_more:
                                return (ARCHIVE_FATAL);
                        if (uudecode->in_buff != b)
                                memmove(uudecode->in_buff, b, len);
-                       uudecode->in_cnt = (int)len;
+                       uudecode->in_cnt = len;
                        if (total == 0) {
                                /* Do not return 0; it means end-of-file.
                                 * We should try to read bytes more. */
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_cab.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_cab.c:1.6 pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_cab.c:1.7
--- pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_cab.c:1.6  Thu Jan 18 18:00:18 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_cab.c      Sun Sep 15 07:02:21 2024
@@ -1682,7 +1682,7 @@ cab_read_ahead_cfdata_lzx(struct archive
                    cfdata->uncompressed_size - cab->xstrm.total_out;
 
                d = __archive_read_ahead(a, 1, &bytes_avail);
-               if (bytes_avail <= 0) {
+               if (d == NULL) {
                        archive_set_error(&a->archive,
                            ARCHIVE_ERRNO_FILE_FORMAT,
                            "Truncated CAB file data");
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_iso9660.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_iso9660.c:1.6 pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_iso9660.c:1.7
--- pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_iso9660.c:1.6 Thu Jan 18 18:00:19 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_iso9660.c     Sun Sep 15 07:02:21 2024
@@ -2237,7 +2237,7 @@ set_str_utf16be(struct archive_write *a,
        int onepad;
 
        if (s == NULL)
-               s = "";
+               s = "\0\0";
        if (l & 0x01) {
                onepad = 1;
                l &= ~1;

Index: pkgsrc/archivers/libarchive/files/libarchive/archive_acl_private.h
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_acl_private.h:1.4 pkgsrc/archivers/libarchive/files/libarchive/archive_acl_private.h:1.5
--- pkgsrc/archivers/libarchive/files/libarchive/archive_acl_private.h:1.4      Fri Apr 12 15:39:50 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_acl_private.h  Sun Sep 15 07:02:20 2024
@@ -77,5 +77,7 @@ int archive_acl_from_text_w(struct archi
     int /* type */);
 int archive_acl_from_text_l(struct archive_acl *, const char * /* text */,
     int /* type */, struct archive_string_conv *);
+int archive_acl_from_text_nl(struct archive_acl *, const char * /* text */,
+    size_t /* size of text */, int /* type */, struct archive_string_conv *);
 
 #endif /* ARCHIVE_ENTRY_PRIVATE_H_INCLUDED */
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_crc32.h
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_crc32.h:1.4 pkgsrc/archivers/libarchive/files/libarchive/archive_crc32.h:1.5
--- pkgsrc/archivers/libarchive/files/libarchive/archive_crc32.h:1.4    Fri Apr 12 15:39:50 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_crc32.h        Sun Sep 15 07:02:20 2024
@@ -30,6 +30,8 @@
 #error This header is only to be used internally to libarchive.
 #endif
 
+#include <stddef.h>
+
 /*
  * When zlib is unavailable, we should still be able to validate
  * uncompressed zip archives.  That requires us to be able to compute
@@ -46,6 +48,9 @@ crc32(unsigned long crc, const void *_p,
        static volatile int crc_tbl_inited = 0;
        static unsigned long crc_tbl[256];
 
+       if (_p == NULL)
+               return (0);
+
        if (!crc_tbl_inited) {
                for (b = 0; b < 256; ++b) {
                        crc2 = b;
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_entry_perms.3
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_entry_perms.3:1.4 pkgsrc/archivers/libarchive/files/libarchive/archive_entry_perms.3:1.5
--- pkgsrc/archivers/libarchive/files/libarchive/archive_entry_perms.3:1.4      Tue May 26 09:16:42 2020
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_entry_perms.3  Sun Sep 15 07:02:20 2024
@@ -150,6 +150,7 @@ character strings at the same time.
 .Fn archive_entry_set_XXX
 is an alias for
 .Fn archive_entry_copy_XXX .
+The strings are copied, and don't need to outlive the call.
 .Ss File Flags
 File flags are transparently converted between a bitmap
 representation and a textual format.
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_rar5.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_rar5.c:1.4 pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_rar5.c:1.5
--- pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_rar5.c:1.4 Fri Apr 12 15:39:51 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_rar5.c     Sun Sep 15 07:02:21 2024
@@ -220,7 +220,7 @@ struct comp_state {
                                        decompression. */
        uint8_t* filtered_buf;       /* Buffer used when applying filters. */
        const uint8_t* block_buf;    /* Buffer used when merging blocks. */
-       size_t window_mask;          /* Convenience field; window_size - 1. */
+       ssize_t window_mask;         /* Convenience field; window_size - 1. */
        int64_t write_ptr;           /* This amount of data has been unpacked
                                        in the window buffer. */
        int64_t last_write_ptr;      /* This amount of data has been stored in
@@ -361,6 +361,7 @@ static int verify_global_checksums(struc
 static int rar5_read_data_skip(struct archive_read *a);
 static int push_data_ready(struct archive_read* a, struct rar5* rar,
        const uint8_t* buf, size_t size, int64_t offset);
+static void clear_data_ready_stack(struct rar5* rar);
 
 /* CDE_xxx = Circular Double Ended (Queue) return values. */
 enum CDE_RETURN_VALUES {
@@ -505,7 +506,7 @@ static inline struct rar5* get_context(s
 }
 
 /* Convenience functions used by filter implementations. */
-static void circular_memcpy(uint8_t* dst, uint8_t* window, const uint64_t mask,
+static void circular_memcpy(uint8_t* dst, uint8_t* window, const ssize_t mask,
     int64_t start, int64_t end)
 {
        if((start & mask) > (end & mask)) {
@@ -652,6 +653,7 @@ static int run_filter(struct archive_rea
        int ret;
        struct rar5* rar = get_context(a);
 
+       clear_data_ready_stack(rar);
        free(rar->cstate.filtered_buf);
 
        rar->cstate.filtered_buf = malloc(flt->block_length);
@@ -709,7 +711,7 @@ static int run_filter(struct archive_rea
 static void push_data(struct archive_read* a, struct rar5* rar,
     const uint8_t* buf, int64_t idx_begin, int64_t idx_end)
 {
-       const uint64_t wmask = rar->cstate.window_mask;
+       const ssize_t wmask = rar->cstate.window_mask;
        const ssize_t solid_write_ptr = (rar->cstate.solid_offset +
            rar->cstate.last_write_ptr) & wmask;
 
@@ -1246,7 +1248,7 @@ static int process_main_locator_extra_bl
 }
 
 static int parse_file_extra_hash(struct archive_read* a, struct rar5* rar,
-    ssize_t* extra_data_size)
+    int64_t* extra_data_size)
 {
        size_t hash_type = 0;
        size_t value_len;
@@ -1296,7 +1298,7 @@ static uint64_t time_win_to_unix(uint64_
 }
 
 static int parse_htime_item(struct archive_read* a, char unix_time,
-    uint64_t* where, ssize_t* extra_data_size)
+    uint64_t* where, int64_t* extra_data_size)
 {
        if(unix_time) {
                uint32_t time_val;
@@ -1318,7 +1320,7 @@ static int parse_htime_item(struct archi
 }
 
 static int parse_file_extra_version(struct archive_read* a,
-    struct archive_entry* e, ssize_t* extra_data_size)
+    struct archive_entry* e, int64_t* extra_data_size)
 {
        size_t flags = 0;
        size_t version = 0;
@@ -1372,7 +1374,7 @@ static int parse_file_extra_version(stru
 }
 
 static int parse_file_extra_htime(struct archive_read* a,
-    struct archive_entry* e, struct rar5* rar, ssize_t* extra_data_size)
+    struct archive_entry* e, struct rar5* rar, int64_t* extra_data_size)
 {
        char unix_time = 0;
        size_t flags = 0;
@@ -1425,7 +1427,7 @@ static int parse_file_extra_htime(struct
 }
 
 static int parse_file_extra_redir(struct archive_read* a,
-    struct archive_entry* e, struct rar5* rar, ssize_t* extra_data_size)
+    struct archive_entry* e, struct rar5* rar, int64_t* extra_data_size)
 {
        uint64_t value_size = 0;
        size_t target_size = 0;
@@ -1448,9 +1450,6 @@ static int parse_file_extra_redir(struct
                return ARCHIVE_EOF;
        *extra_data_size -= target_size + 1;
 
-       if(!read_ahead(a, target_size, &p))
-               return ARCHIVE_EOF;
-
        if(target_size > (MAX_NAME_IN_CHARS - 1)) {
                archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
                    "Link target is too long");
@@ -1463,6 +1462,9 @@ static int parse_file_extra_redir(struct
                return ARCHIVE_FATAL;
        }
 
+       if(!read_ahead(a, target_size, &p))
+               return ARCHIVE_EOF;
+
        memcpy(target_utf8_buf, p, target_size);
        target_utf8_buf[target_size] = 0;
 
@@ -1496,7 +1498,7 @@ static int parse_file_extra_redir(struct
 }
 
 static int parse_file_extra_owner(struct archive_read* a,
-    struct archive_entry* e, ssize_t* extra_data_size)
+    struct archive_entry* e, int64_t* extra_data_size)
 {
        uint64_t flags = 0;
        uint64_t value_size = 0;
@@ -1576,15 +1578,15 @@ static int parse_file_extra_owner(struct
 }
 
 static int process_head_file_extra(struct archive_read* a,
-    struct archive_entry* e, struct rar5* rar, ssize_t extra_data_size)
+    struct archive_entry* e, struct rar5* rar, int64_t extra_data_size)
 {
-       size_t extra_field_size;
-       size_t extra_field_id = 0;
+       uint64_t extra_field_size;
+       uint64_t extra_field_id = 0;
        int ret = ARCHIVE_FATAL;
-       size_t var_size;
+       uint64_t var_size;
 
        while(extra_data_size > 0) {
-               if(!read_var_sized(a, &extra_field_size, &var_size))
+               if(!read_var(a, &extra_field_size, &var_size))
                        return ARCHIVE_EOF;
 
                extra_data_size -= var_size;
@@ -1592,7 +1594,7 @@ static int process_head_file_extra(struc
                        return ARCHIVE_EOF;
                }
 
-               if(!read_var_sized(a, &extra_field_id, &var_size))
+               if(!read_var(a, &extra_field_id, &var_size))
                        return ARCHIVE_EOF;
 
                extra_data_size -= var_size;
@@ -1642,7 +1644,7 @@ static int process_head_file_extra(struc
 static int process_head_file(struct archive_read* a, struct rar5* rar,
     struct archive_entry* entry, size_t block_flags)
 {
-       ssize_t extra_data_size = 0;
+       int64_t extra_data_size = 0;
        size_t data_size = 0;
        size_t file_flags = 0;
        size_t file_attr = 0;
@@ -1682,12 +1684,12 @@ static int process_head_file(struct arch
        }
 
        if(block_flags & HFL_EXTRA_DATA) {
-               size_t edata_size = 0;
-               if(!read_var_sized(a, &edata_size, NULL))
+               uint64_t edata_size = 0;
+               if(!read_var(a, &edata_size, NULL))
                        return ARCHIVE_EOF;
 
                /* Intentional type cast from unsigned to signed. */
-               extra_data_size = (ssize_t) edata_size;
+               extra_data_size = (int64_t) edata_size;
        }
 
        if(block_flags & HFL_DATA) {
@@ -1780,11 +1782,18 @@ static int process_head_file(struct arch
        if(rar->cstate.window_size < (ssize_t) window_size &&
            rar->cstate.window_buf)
        {
+               /* The `data_ready` stack contains pointers to the `window_buf` or
+                * `filtered_buf` buffers.  Since we're about to reallocate the first
+                * buffer, some of those pointers could become invalid. Therefore, we
+                * need to dispose of all entries from the stack before attempting the
+                * realloc. */
+               clear_data_ready_stack(rar);
+
                /* If window_buf has been allocated before, reallocate it, so
                 * that its size will match new window_size. */
 
                uint8_t* new_window_buf =
-                       realloc(rar->cstate.window_buf, window_size);
+                       realloc(rar->cstate.window_buf, (size_t) window_size);
 
                if(!new_window_buf) {
                        archive_set_error(&a->archive, ARCHIVE_ERRNO_PROGRAMMER,
@@ -1876,9 +1885,6 @@ static int process_head_file(struct arch
        if(!read_var_sized(a, &name_size, NULL))
                return ARCHIVE_EOF;
 
-       if(!read_ahead(a, name_size, &p))
-               return ARCHIVE_EOF;
-
        if(name_size > (MAX_NAME_IN_CHARS - 1)) {
                archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
                                "Filename is too long");
@@ -1893,6 +1899,9 @@ static int process_head_file(struct arch
                return ARCHIVE_FATAL;
        }
 
+       if(!read_ahead(a, name_size, &p))
+               return ARCHIVE_EOF;
+
        memcpy(name_utf8_buf, p, name_size);
        name_utf8_buf[name_size] = 0;
        if(ARCHIVE_OK != consume(a, name_size)) {
@@ -1980,7 +1989,7 @@ static int process_head_main(struct arch
     struct archive_entry* entry, size_t block_flags)
 {
        int ret;
-       size_t extra_data_size = 0;
+       uint64_t extra_data_size = 0;
        size_t extra_field_size = 0;
        size_t extra_field_id = 0;
        size_t archive_flags = 0;
@@ -2002,7 +2011,7 @@ static int process_head_main(struct arch
        (void) entry;
 
        if(block_flags & HFL_EXTRA_DATA) {
-               if(!read_var_sized(a, &extra_data_size, NULL))
+               if(!read_var(a, &extra_data_size, NULL))
                        return ARCHIVE_EOF;
        } else {
                extra_data_size = 0;
@@ -2229,10 +2238,12 @@ static int process_base_block(struct arc
        /* Verify the CRC32 of the header data. */
        computed_crc = (uint32_t) crc32(0, p, (int) hdr_size);
        if(computed_crc != hdr_crc) {
+#ifndef DONT_FAIL_ON_CRC_ERROR
                archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
                    "Header CRC error");
 
                return ARCHIVE_FATAL;
+#endif
        }
 
        /* If the checksum is OK, we proceed with parsing. */
@@ -2453,6 +2464,8 @@ static void init_unpack(struct rar5* rar
                rar->cstate.filtered_buf = NULL;
        }
 
+       clear_data_ready_stack(rar);
+
        rar->cstate.write_ptr = 0;
        rar->cstate.last_write_ptr = 0;
 
@@ -2983,7 +2996,7 @@ static int decode_code_length(struct arc
 
 static int copy_string(struct archive_read* a, int len, int dist) {
        struct rar5* rar = get_context(a);
-       const uint64_t cmask = rar->cstate.window_mask;
+       const ssize_t cmask = rar->cstate.window_mask;
        const uint64_t write_ptr = rar->cstate.write_ptr +
            rar->cstate.solid_offset;
        int i;
@@ -3627,6 +3640,10 @@ static int use_data(struct rar5* rar, co
        return ARCHIVE_RETRY;
 }
 
+static void clear_data_ready_stack(struct rar5* rar) {
+       memset(&rar->cstate.dready, 0, sizeof(rar->cstate.dready));
+}
+
 /* Pushes the `buf`, `size` and `offset` arguments to the rar->cstate.dready
  * FIFO stack. Those values will be popped from this stack by the `use_data`
  * function. */
@@ -4185,6 +4202,7 @@ static int rar5_cleanup(struct archive_r
 
        free(rar->cstate.window_buf);
        free(rar->cstate.filtered_buf);
+       clear_data_ready_stack(rar);
 
        free(rar->vol.push_buf);
 
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_write_add_filter_b64encode.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_write_add_filter_b64encode.c:1.4 pkgsrc/archivers/libarchive/files/libarchive/archive_write_add_filter_b64encode.c:1.5
--- pkgsrc/archivers/libarchive/files/libarchive/archive_write_add_filter_b64encode.c:1.4       Fri Apr 12 15:39:52 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_write_add_filter_b64encode.c   Sun Sep 15 07:02:21 2024
@@ -83,7 +83,7 @@ archive_write_add_filter_b64encode(struc
        struct private_b64encode *state;
 
        archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
-           ARCHIVE_STATE_NEW, "archive_write_add_filter_uu");
+           ARCHIVE_STATE_NEW, "archive_write_add_filter_b64encode");
 
        state = (struct private_b64encode *)calloc(1, sizeof(*state));
        if (state == NULL) {
@@ -149,7 +149,7 @@ archive_filter_b64encode_open(struct arc
        size_t bs = 65536, bpb;
 
        if (f->archive->magic == ARCHIVE_WRITE_MAGIC) {
-               /* Buffer size should be a multiple number of the of bytes
+               /* Buffer size should be a multiple number of the bytes
                 * per block for performance. */
                bpb = archive_write_get_bytes_per_block(f->archive);
                if (bpb > bs)
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_write_add_filter_compress.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_write_add_filter_compress.c:1.4 pkgsrc/archivers/libarchive/files/libarchive/archive_write_add_filter_compress.c:1.5
--- pkgsrc/archivers/libarchive/files/libarchive/archive_write_add_filter_compress.c:1.4        Fri Apr 12 15:39:52 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_write_add_filter_compress.c    Sun Sep 15 07:02:21 2024
@@ -158,7 +158,7 @@ archive_compressor_compress_open(struct 
        }
 
        if (f->archive->magic == ARCHIVE_WRITE_MAGIC) {
-               /* Buffer size should be a multiple number of the of bytes
+               /* Buffer size should be a multiple number of the bytes
                 * per block for performance. */
                bpb = archive_write_get_bytes_per_block(f->archive);
                if (bpb > bs)

Index: pkgsrc/archivers/libarchive/files/libarchive/archive_entry.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_entry.c:1.14 pkgsrc/archivers/libarchive/files/libarchive/archive_entry.c:1.15
--- pkgsrc/archivers/libarchive/files/libarchive/archive_entry.c:1.14   Fri Apr 12 15:39:50 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_entry.c        Sun Sep 15 07:02:20 2024
@@ -118,7 +118,7 @@
 static char *   ae_fflagstostr(unsigned long bitset, unsigned long bitclear);
 static const wchar_t   *ae_wcstofflags(const wchar_t *stringp,
                    unsigned long *setp, unsigned long *clrp);
-static const char      *ae_strtofflags(const char *stringp,
+static const char      *ae_strtofflags(const char *stringp, size_t length,
                    unsigned long *setp, unsigned long *clrp);
 
 #ifndef HAVE_WCSCPY
@@ -157,10 +157,9 @@ archive_entry_clear(struct archive_entry
                return (NULL);
        archive_mstring_clean(&entry->ae_fflags_text);
        archive_mstring_clean(&entry->ae_gname);
-       archive_mstring_clean(&entry->ae_hardlink);
+       archive_mstring_clean(&entry->ae_linkname);
        archive_mstring_clean(&entry->ae_pathname);
        archive_mstring_clean(&entry->ae_sourcepath);
-       archive_mstring_clean(&entry->ae_symlink);
        archive_mstring_clean(&entry->ae_uname);
        archive_entry_copy_mac_metadata(entry, NULL, 0);
        archive_acl_clear(&entry->acl);
@@ -195,10 +194,9 @@ archive_entry_clone(struct archive_entry
         * character sets are different? XXX */
        archive_mstring_copy(&entry2->ae_fflags_text, &entry->ae_fflags_text);
        archive_mstring_copy(&entry2->ae_gname, &entry->ae_gname);
-       archive_mstring_copy(&entry2->ae_hardlink, &entry->ae_hardlink);
+       archive_mstring_copy(&entry2->ae_linkname, &entry->ae_linkname);
        archive_mstring_copy(&entry2->ae_pathname, &entry->ae_pathname);
        archive_mstring_copy(&entry2->ae_sourcepath, &entry->ae_sourcepath);
-       archive_mstring_copy(&entry2->ae_symlink, &entry->ae_symlink);
        entry2->ae_set = entry->ae_set;
        archive_mstring_copy(&entry2->ae_uname, &entry->ae_uname);
 
@@ -477,6 +475,15 @@ _archive_entry_gname_l(struct archive_en
        return (archive_mstring_get_mbs_l(entry->archive, &entry->ae_gname, p, len, sc));
 }
 
+void
+archive_entry_set_link_to_hardlink(struct archive_entry *entry)
+{
+       if ((entry->ae_set & AE_SET_SYMLINK) != 0) {
+               entry->ae_set &= ~AE_SET_SYMLINK;
+       }
+       entry->ae_set |= AE_SET_HARDLINK;
+}
+
 const char *
 archive_entry_hardlink(struct archive_entry *entry)
 {
@@ -484,7 +491,7 @@ archive_entry_hardlink(struct archive_en
        if ((entry->ae_set & AE_SET_HARDLINK) == 0)
                return (NULL);
        if (archive_mstring_get_mbs(
-           entry->archive, &entry->ae_hardlink, &p) == 0)
+           entry->archive, &entry->ae_linkname, &p) == 0)
                return (p);
        if (errno == ENOMEM)
                __archive_errx(1, "No memory");
@@ -498,7 +505,7 @@ archive_entry_hardlink_utf8(struct archi
        if ((entry->ae_set & AE_SET_HARDLINK) == 0)
                return (NULL);
        if (archive_mstring_get_utf8(
-           entry->archive, &entry->ae_hardlink, &p) == 0)
+           entry->archive, &entry->ae_linkname, &p) == 0)
                return (p);
        if (errno == ENOMEM)
                __archive_errx(1, "No memory");
@@ -512,7 +519,7 @@ archive_entry_hardlink_w(struct archive_
        if ((entry->ae_set & AE_SET_HARDLINK) == 0)
                return (NULL);
        if (archive_mstring_get_wcs(
-           entry->archive, &entry->ae_hardlink, &p) == 0)
+           entry->archive, &entry->ae_linkname, &p) == 0)
                return (p);
        if (errno == ENOMEM)
                __archive_errx(1, "No memory");
@@ -520,6 +527,12 @@ archive_entry_hardlink_w(struct archive_
 }
 
 int
+archive_entry_hardlink_is_set(struct archive_entry *entry)
+{
+       return (entry->ae_set & AE_SET_HARDLINK) != 0;
+}
+
+int
 _archive_entry_hardlink_l(struct archive_entry *entry,
     const char **p, size_t *len, struct archive_string_conv *sc)
 {
@@ -528,7 +541,7 @@ _archive_entry_hardlink_l(struct archive
                *len = 0;
                return (0);
        }
-       return (archive_mstring_get_mbs_l(entry->archive, &entry->ae_hardlink, p, len, sc));
+       return (archive_mstring_get_mbs_l(entry->archive, &entry->ae_linkname, p, len, sc));
 }
 
 la_int64_t
@@ -648,32 +661,50 @@ archive_entry_perm_is_set(struct archive
        return (entry->ae_set & AE_SET_PERM);
 }
 
+int
+archive_entry_rdev_is_set(struct archive_entry *entry)
+{
+       return (entry->ae_set & AE_SET_RDEV);
+}
+
 dev_t
 archive_entry_rdev(struct archive_entry *entry)
 {
-       if (entry->ae_stat.aest_rdev_is_broken_down)
-               return ae_makedev(entry->ae_stat.aest_rdevmajor,
-                   entry->ae_stat.aest_rdevminor);
-       else
-               return (entry->ae_stat.aest_rdev);
+       if (archive_entry_rdev_is_set(entry)) {
+               if (entry->ae_stat.aest_rdev_is_broken_down)
+                       return ae_makedev(entry->ae_stat.aest_rdevmajor,
+                           entry->ae_stat.aest_rdevminor);
+               else
+                       return (entry->ae_stat.aest_rdev);
+       } else {
+               return 0;
+       }
 }
 
 dev_t
 archive_entry_rdevmajor(struct archive_entry *entry)
 {
-       if (entry->ae_stat.aest_rdev_is_broken_down)
-               return (entry->ae_stat.aest_rdevmajor);
-       else
-               return major(entry->ae_stat.aest_rdev);
+       if (archive_entry_rdev_is_set(entry)) {
+               if (entry->ae_stat.aest_rdev_is_broken_down)
+                       return (entry->ae_stat.aest_rdevmajor);
+               else
+                       return major(entry->ae_stat.aest_rdev);
+       } else {
+               return 0;
+       }
 }
 
 dev_t
 archive_entry_rdevminor(struct archive_entry *entry)
 {
-       if (entry->ae_stat.aest_rdev_is_broken_down)
-               return (entry->ae_stat.aest_rdevminor);
-       else
-               return minor(entry->ae_stat.aest_rdev);
+       if (archive_entry_rdev_is_set(entry)) {
+               if (entry->ae_stat.aest_rdev_is_broken_down)
+                       return (entry->ae_stat.aest_rdevminor);
+               else
+                       return minor(entry->ae_stat.aest_rdev);
+       } else {
+               return 0;
+       }
 }
 
 la_int64_t
@@ -717,13 +748,22 @@ archive_entry_symlink(struct archive_ent
        if ((entry->ae_set & AE_SET_SYMLINK) == 0)
                return (NULL);
        if (archive_mstring_get_mbs(
-           entry->archive, &entry->ae_symlink, &p) == 0)
+           entry->archive, &entry->ae_linkname, &p) == 0)
                return (p);
        if (errno == ENOMEM)
                __archive_errx(1, "No memory");
        return (NULL);
 }
 
+void
+archive_entry_set_link_to_symlink(struct archive_entry *entry)
+{
+       if ((entry->ae_set & AE_SET_HARDLINK) != 0) {
+               entry->ae_set &= ~AE_SET_HARDLINK;
+       }
+       entry->ae_set |= AE_SET_SYMLINK;
+}
+
 int
 archive_entry_symlink_type(struct archive_entry *entry)
 {
@@ -737,7 +777,7 @@ archive_entry_symlink_utf8(struct archiv
        if ((entry->ae_set & AE_SET_SYMLINK) == 0)
                return (NULL);
        if (archive_mstring_get_utf8(
-           entry->archive, &entry->ae_symlink, &p) == 0)
+           entry->archive, &entry->ae_linkname, &p) == 0)
                return (p);
        if (errno == ENOMEM)
                __archive_errx(1, "No memory");
@@ -751,7 +791,7 @@ archive_entry_symlink_w(struct archive_e
        if ((entry->ae_set & AE_SET_SYMLINK) == 0)
                return (NULL);
        if (archive_mstring_get_wcs(
-           entry->archive, &entry->ae_symlink, &p) == 0)
+           entry->archive, &entry->ae_linkname, &p) == 0)
                return (p);
        if (errno == ENOMEM)
                __archive_errx(1, "No memory");
@@ -767,7 +807,7 @@ _archive_entry_symlink_l(struct archive_
                *len = 0;
                return (0);
        }
-       return (archive_mstring_get_mbs_l(entry->archive, &entry->ae_symlink, p, len, sc));
+       return (archive_mstring_get_mbs_l(entry->archive, &entry->ae_linkname, p, len, sc));
 }
 
 la_int64_t
@@ -864,10 +904,17 @@ archive_entry_set_fflags(struct archive_
 
 const char *
 archive_entry_copy_fflags_text(struct archive_entry *entry,
-    const char *flags)
+       const char *flags)
+{
+       return archive_entry_copy_fflags_text_len(entry, flags, strlen(flags));
+}
+
+const char *
+archive_entry_copy_fflags_text_len(struct archive_entry *entry,
+    const char *flags, size_t flags_length)
 {
-       archive_mstring_copy_mbs(&entry->ae_fflags_text, flags);
-       return (ae_strtofflags(flags,
+       archive_mstring_copy_mbs_len(&entry->ae_fflags_text, flags, flags_length);
+       return (ae_strtofflags(flags, flags_length,
                    &entry->ae_fflags_set, &entry->ae_fflags_clear));
 }
 
@@ -883,6 +930,9 @@ archive_entry_copy_fflags_text_w(struct 
 void
 archive_entry_set_gid(struct archive_entry *entry, la_int64_t g)
 {
+       if (g < 0) {
+               g = 0;
+       }
        entry->stat_valid = 0;
        entry->ae_stat.aest_gid = g;
        entry->ae_set |= AE_SET_GID;
@@ -933,6 +983,9 @@ _archive_entry_copy_gname_l(struct archi
 void
 archive_entry_set_ino(struct archive_entry *entry, la_int64_t ino)
 {
+       if (ino < 0) {
+               ino = 0;
+       }
        entry->stat_valid = 0;
        entry->ae_set |= AE_SET_INO;
        entry->ae_stat.aest_ino = ino;
@@ -941,6 +994,9 @@ archive_entry_set_ino(struct archive_ent
 void
 archive_entry_set_ino64(struct archive_entry *entry, la_int64_t ino)
 {
+       if (ino < 0) {
+               ino = 0;
+       }
        entry->stat_valid = 0;
        entry->ae_set |= AE_SET_INO;
        entry->ae_stat.aest_ino = ino;
@@ -949,17 +1005,24 @@ archive_entry_set_ino64(struct archive_e
 void
 archive_entry_set_hardlink(struct archive_entry *entry, const char *target)
 {
-       archive_mstring_copy_mbs(&entry->ae_hardlink, target);
-       if (target != NULL)
-               entry->ae_set |= AE_SET_HARDLINK;
-       else
+       if (target == NULL) {
                entry->ae_set &= ~AE_SET_HARDLINK;
+               if (entry->ae_set & AE_SET_SYMLINK) {
+                       return;
+               }
+       } else {
+               entry->ae_set |= AE_SET_HARDLINK;
+       }
+       entry->ae_set &= ~AE_SET_SYMLINK;
+       archive_mstring_copy_mbs(&entry->ae_linkname, target);
 }
 
 void
 archive_entry_set_hardlink_utf8(struct archive_entry *entry, const char *target)
 {
-       archive_mstring_copy_utf8(&entry->ae_hardlink, target);
+       if (target == NULL && (entry->ae_set & AE_SET_SYMLINK))
+               return;
+       archive_mstring_copy_utf8(&entry->ae_linkname, target);
        if (target != NULL)
                entry->ae_set |= AE_SET_HARDLINK;
        else
@@ -969,7 +1032,9 @@ archive_entry_set_hardlink_utf8(struct a
 void
 archive_entry_copy_hardlink(struct archive_entry *entry, const char *target)
 {
-       archive_mstring_copy_mbs(&entry->ae_hardlink, target);
+       if (target == NULL && (entry->ae_set & AE_SET_SYMLINK))
+               return;
+       archive_mstring_copy_mbs(&entry->ae_linkname, target);
        if (target != NULL)
                entry->ae_set |= AE_SET_HARDLINK;
        else
@@ -979,7 +1044,9 @@ archive_entry_copy_hardlink(struct archi
 void
 archive_entry_copy_hardlink_w(struct archive_entry *entry, const wchar_t *target)
 {
-       archive_mstring_copy_wcs(&entry->ae_hardlink, target);
+       if (target == NULL && (entry->ae_set & AE_SET_SYMLINK))
+               return;
+       archive_mstring_copy_wcs(&entry->ae_linkname, target);
        if (target != NULL)
                entry->ae_set |= AE_SET_HARDLINK;
        else
@@ -989,12 +1056,14 @@ archive_entry_copy_hardlink_w(struct arc
 int
 archive_entry_update_hardlink_utf8(struct archive_entry *entry, const char *target)
 {
+       if (target == NULL && (entry->ae_set & AE_SET_SYMLINK))
+               return (0);
        if (target != NULL)
                entry->ae_set |= AE_SET_HARDLINK;
        else
                entry->ae_set &= ~AE_SET_HARDLINK;
        if (archive_mstring_update_utf8(entry->archive,
-           &entry->ae_hardlink, target) == 0)
+           &entry->ae_linkname, target) == 0)
                return (1);
        if (errno == ENOMEM)
                __archive_errx(1, "No memory");
@@ -1007,7 +1076,9 @@ _archive_entry_copy_hardlink_l(struct ar
 {
        int r;
 
-       r = archive_mstring_copy_mbs_len_l(&entry->ae_hardlink,
+       if (target == NULL && (entry->ae_set & AE_SET_SYMLINK))
+               return (0);
+       r = archive_mstring_copy_mbs_len_l(&entry->ae_linkname,
            target, len, sc);
        if (target != NULL && r == 0)
                entry->ae_set |= AE_SET_HARDLINK;
@@ -1098,51 +1169,50 @@ archive_entry_set_devminor(struct archiv
 void
 archive_entry_set_link(struct archive_entry *entry, const char *target)
 {
-       if (entry->ae_set & AE_SET_SYMLINK)
-               archive_mstring_copy_mbs(&entry->ae_symlink, target);
-       else
-               archive_mstring_copy_mbs(&entry->ae_hardlink, target);
+       archive_mstring_copy_mbs(&entry->ae_linkname, target);
+       if ((entry->ae_set & AE_SET_SYMLINK) == 0) {
+               entry->ae_set |= AE_SET_HARDLINK;
+       }
 }
 
 void
 archive_entry_set_link_utf8(struct archive_entry *entry, const char *target)
 {
-       if (entry->ae_set & AE_SET_SYMLINK)
-               archive_mstring_copy_utf8(&entry->ae_symlink, target);
-       else
-               archive_mstring_copy_utf8(&entry->ae_hardlink, target);
+       archive_mstring_copy_utf8(&entry->ae_linkname, target);
+       if ((entry->ae_set & AE_SET_SYMLINK) == 0) {
+               entry->ae_set |= AE_SET_HARDLINK;
+       }
 }
 
 /* Set symlink if symlink is already set, else set hardlink. */
 void
 archive_entry_copy_link(struct archive_entry *entry, const char *target)
 {
-       if (entry->ae_set & AE_SET_SYMLINK)
-               archive_mstring_copy_mbs(&entry->ae_symlink, target);
-       else
-               archive_mstring_copy_mbs(&entry->ae_hardlink, target);
+       archive_mstring_copy_mbs(&entry->ae_linkname, target);
+       if ((entry->ae_set & AE_SET_SYMLINK) == 0) {
+               entry->ae_set |= AE_SET_HARDLINK;
+       }
 }
 
 /* Set symlink if symlink is already set, else set hardlink. */
 void
 archive_entry_copy_link_w(struct archive_entry *entry, const wchar_t *target)
 {
-       if (entry->ae_set & AE_SET_SYMLINK)
-               archive_mstring_copy_wcs(&entry->ae_symlink, target);
-       else
-               archive_mstring_copy_wcs(&entry->ae_hardlink, target);
+       archive_mstring_copy_wcs(&entry->ae_linkname, target);
+       if ((entry->ae_set & AE_SET_SYMLINK) == 0) {
+               entry->ae_set |= AE_SET_HARDLINK;
+       }
 }
 
 int
 archive_entry_update_link_utf8(struct archive_entry *entry, const char *target)
 {
        int r;
-       if (entry->ae_set & AE_SET_SYMLINK)
-               r = archive_mstring_update_utf8(entry->archive,
-                   &entry->ae_symlink, target);
-       else
-               r = archive_mstring_update_utf8(entry->archive,
-                   &entry->ae_hardlink, target);
+       r = archive_mstring_update_utf8(entry->archive,
+                   &entry->ae_linkname, target);
+       if ((entry->ae_set & AE_SET_SYMLINK) == 0) {
+               entry->ae_set |= AE_SET_HARDLINK;
+       }
        if (r == 0)
                return (1);
        if (errno == ENOMEM)
@@ -1156,12 +1226,11 @@ _archive_entry_copy_link_l(struct archiv
 {
        int r;
 
-       if (entry->ae_set & AE_SET_SYMLINK)
-               r = archive_mstring_copy_mbs_len_l(&entry->ae_symlink,
-                   target, len, sc);
-       else
-               r = archive_mstring_copy_mbs_len_l(&entry->ae_hardlink,
+       r = archive_mstring_copy_mbs_len_l(&entry->ae_linkname,
                    target, len, sc);
+       if ((entry->ae_set & AE_SET_SYMLINK) == 0) {
+               entry->ae_set |= AE_SET_HARDLINK;
+       }
        return (r);
 }
 
@@ -1255,6 +1324,9 @@ archive_entry_set_rdev(struct archive_en
        entry->stat_valid = 0;
        entry->ae_stat.aest_rdev = m;
        entry->ae_stat.aest_rdev_is_broken_down = 0;
+       entry->ae_stat.aest_rdevmajor = 0;
+       entry->ae_stat.aest_rdevminor = 0;
+       entry->ae_set |= AE_SET_RDEV;
 }
 
 void
@@ -1262,7 +1334,9 @@ archive_entry_set_rdevmajor(struct archi
 {
        entry->stat_valid = 0;
        entry->ae_stat.aest_rdev_is_broken_down = 1;
+       entry->ae_stat.aest_rdev = 0;
        entry->ae_stat.aest_rdevmajor = m;
+       entry->ae_set |= AE_SET_RDEV;
 }
 
 void
@@ -1270,12 +1344,17 @@ archive_entry_set_rdevminor(struct archi
 {
        entry->stat_valid = 0;
        entry->ae_stat.aest_rdev_is_broken_down = 1;
+       entry->ae_stat.aest_rdev = 0;
        entry->ae_stat.aest_rdevminor = m;
+       entry->ae_set |= AE_SET_RDEV;
 }
 
 void
 archive_entry_set_size(struct archive_entry *entry, la_int64_t s)
 {
+       if (s < 0) {
+               s = 0;
+       }
        entry->stat_valid = 0;
        entry->ae_stat.aest_size = s;
        entry->ae_set |= AE_SET_SIZE;
@@ -1303,11 +1382,14 @@ archive_entry_copy_sourcepath_w(struct a
 void
 archive_entry_set_symlink(struct archive_entry *entry, const char *linkname)
 {
-       archive_mstring_copy_mbs(&entry->ae_symlink, linkname);
-       if (linkname != NULL)
-               entry->ae_set |= AE_SET_SYMLINK;
-       else
+       if (linkname == NULL && (entry->ae_set & AE_SET_HARDLINK))
+               return;
+       archive_mstring_copy_mbs(&entry->ae_linkname, linkname);
+       entry->ae_set &= ~AE_SET_HARDLINK;
+       if (linkname == NULL)
                entry->ae_set &= ~AE_SET_SYMLINK;
+       else
+               entry->ae_set |= AE_SET_SYMLINK;
 }
 
 void
@@ -1319,42 +1401,54 @@ archive_entry_set_symlink_type(struct ar
 void
 archive_entry_set_symlink_utf8(struct archive_entry *entry, const char *linkname)
 {
-       archive_mstring_copy_utf8(&entry->ae_symlink, linkname);
-       if (linkname != NULL)
-               entry->ae_set |= AE_SET_SYMLINK;
-       else
+       if (linkname == NULL && (entry->ae_set & AE_SET_HARDLINK))
+               return;
+       archive_mstring_copy_utf8(&entry->ae_linkname, linkname);
+       entry->ae_set &= ~AE_SET_HARDLINK;
+       if (linkname == NULL)
                entry->ae_set &= ~AE_SET_SYMLINK;
+       else
+               entry->ae_set |= AE_SET_SYMLINK;
 }
 
 void
 archive_entry_copy_symlink(struct archive_entry *entry, const char *linkname)
 {
-       archive_mstring_copy_mbs(&entry->ae_symlink, linkname);
-       if (linkname != NULL)
-               entry->ae_set |= AE_SET_SYMLINK;
-       else
+       if (linkname == NULL && (entry->ae_set & AE_SET_HARDLINK))
+               return;
+       archive_mstring_copy_mbs(&entry->ae_linkname, linkname);
+       entry->ae_set &= ~AE_SET_HARDLINK;
+       if (linkname == NULL)
                entry->ae_set &= ~AE_SET_SYMLINK;
+       else
+               entry->ae_set |= AE_SET_SYMLINK;
 }
 
 void
 archive_entry_copy_symlink_w(struct archive_entry *entry, const wchar_t *linkname)
 {
-       archive_mstring_copy_wcs(&entry->ae_symlink, linkname);
-       if (linkname != NULL)
-               entry->ae_set |= AE_SET_SYMLINK;
-       else
+       if (linkname == NULL && (entry->ae_set & AE_SET_HARDLINK))
+               return;
+       archive_mstring_copy_wcs(&entry->ae_linkname, linkname);
+       entry->ae_set &= ~AE_SET_HARDLINK;
+       if (linkname == NULL)
                entry->ae_set &= ~AE_SET_SYMLINK;
+       else
+               entry->ae_set |= AE_SET_SYMLINK;
 }
 
 int
 archive_entry_update_symlink_utf8(struct archive_entry *entry, const char *linkname)
 {
-       if (linkname != NULL)
-               entry->ae_set |= AE_SET_SYMLINK;
-       else
+       if (linkname == NULL && (entry->ae_set & AE_SET_HARDLINK))
+               return (0);
+       entry->ae_set &= ~AE_SET_HARDLINK;
+       if (linkname == NULL)
                entry->ae_set &= ~AE_SET_SYMLINK;
+       else
+               entry->ae_set |= AE_SET_SYMLINK;
        if (archive_mstring_update_utf8(entry->archive,
-           &entry->ae_symlink, linkname) == 0)
+           &entry->ae_linkname, linkname) == 0)
                return (1);
        if (errno == ENOMEM)
                __archive_errx(1, "No memory");
@@ -1367,18 +1461,24 @@ _archive_entry_copy_symlink_l(struct arc
 {
        int r;
 
-       r = archive_mstring_copy_mbs_len_l(&entry->ae_symlink,
+       if (linkname == NULL && (entry->ae_set & AE_SET_HARDLINK))
+               return (0);
+       entry->ae_set &= ~AE_SET_HARDLINK;
+       r = archive_mstring_copy_mbs_len_l(&entry->ae_linkname,
            linkname, len, sc);
-       if (linkname != NULL && r == 0)
-               entry->ae_set |= AE_SET_SYMLINK;
-       else
+       if (linkname == NULL || r != 0)
                entry->ae_set &= ~AE_SET_SYMLINK;
+       else
+               entry->ae_set |= AE_SET_SYMLINK;
        return (r);
 }
 
 void
 archive_entry_set_uid(struct archive_entry *entry, la_int64_t u)
 {
+       if (u < 0) {
+               u = 0;
+       }
        entry->stat_valid = 0;
        entry->ae_stat.aest_uid = u;
        entry->ae_set |= AE_SET_UID;
@@ -2031,7 +2131,7 @@ ae_fflagstostr(unsigned long bitset, uns
  *     provided string.
  */
 static const char *
-ae_strtofflags(const char *s, unsigned long *setp, unsigned long *clrp)
+ae_strtofflags(const char *s, size_t l, unsigned long *setp, unsigned long *clrp)
 {
        const char *start, *end;
        const struct flag *flag;
@@ -2042,15 +2142,19 @@ ae_strtofflags(const char *s, unsigned l
        start = s;
        failed = NULL;
        /* Find start of first token. */
-       while (*start == '\t'  ||  *start == ' '  ||  *start == ',')
+       while (l > 0 && (*start == '\t'  ||  *start == ' '  ||  *start == ',')) {
                start++;
-       while (*start != '\0') {
+               l--;
+       }
+       while (l > 0) {
                size_t length;
                /* Locate end of token. */
                end = start;
-               while (*end != '\0'  &&  *end != '\t'  &&
-                   *end != ' '  &&  *end != ',')
+               while (l > 0 && *end != '\t'  &&
+                   *end != ' '  &&  *end != ',') {
                        end++;
+                       l--;
+               }
                length = end - start;
                for (flag = fileflags; flag->name != NULL; flag++) {
                        size_t flag_length = strlen(flag->name);
@@ -2074,8 +2178,10 @@ ae_strtofflags(const char *s, unsigned l
 
                /* Find start of next token. */
                start = end;
-               while (*start == '\t'  ||  *start == ' '  ||  *start == ',')
+               while (l > 0 && (*start == '\t'  ||  *start == ' '  ||  *start == ',')) {
                        start++;
+                       l--;
+               }
 
        }
 
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_zip.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_zip.c:1.14 pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_zip.c:1.15
--- pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_zip.c:1.14 Tue Apr 30 06:05:19 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_zip.c      Sun Sep 15 07:02:21 2024
@@ -1924,7 +1924,7 @@ zip_read_data_zipx_xz(struct archive_rea
                return (ARCHIVE_FATAL);
        }
 
-       in_bytes = zipmin(zip->entry_bytes_remaining, bytes_avail);
+       in_bytes = (ssize_t)zipmin(zip->entry_bytes_remaining, bytes_avail);
        zip->zipx_lzma_stream.next_in = compressed_buf;
        zip->zipx_lzma_stream.avail_in = in_bytes;
        zip->zipx_lzma_stream.total_in = 0;
@@ -1966,14 +1966,14 @@ zip_read_data_zipx_xz(struct archive_rea
                        break;
        }
 
-       to_consume = zip->zipx_lzma_stream.total_in;
+       to_consume = (ssize_t)zip->zipx_lzma_stream.total_in;
 
        __archive_read_consume(a, to_consume);
        zip->entry_bytes_remaining -= to_consume;
        zip->entry_compressed_bytes_read += to_consume;
        zip->entry_uncompressed_bytes_read += zip->zipx_lzma_stream.total_out;
 
-       *size = zip->zipx_lzma_stream.total_out;
+       *size = (size_t)zip->zipx_lzma_stream.total_out;
        *buff = zip->uncompressed_buffer;
 
        return (ARCHIVE_OK);
@@ -2014,7 +2014,7 @@ zip_read_data_zipx_lzma_alone(struct arc
        }
 
        /* Set decompressor parameters. */
-       in_bytes = zipmin(zip->entry_bytes_remaining, bytes_avail);
+       in_bytes = (ssize_t)zipmin(zip->entry_bytes_remaining, bytes_avail);
 
        zip->zipx_lzma_stream.next_in = compressed_buf;
        zip->zipx_lzma_stream.avail_in = in_bytes;
@@ -2024,7 +2024,7 @@ zip_read_data_zipx_lzma_alone(struct arc
                /* These lzma_alone streams lack end of stream marker, so let's
                 * make sure the unpacker won't try to unpack more than it's
                 * supposed to. */
-               zipmin((int64_t) zip->uncompressed_buffer_size,
+               (size_t)zipmin((int64_t) zip->uncompressed_buffer_size,
                    zip->entry->uncompressed_size -
                    zip->entry_uncompressed_bytes_read);
        zip->zipx_lzma_stream.total_out = 0;
@@ -2061,7 +2061,7 @@ zip_read_data_zipx_lzma_alone(struct arc
                        return (ARCHIVE_FATAL);
        }
 
-       to_consume = zip->zipx_lzma_stream.total_in;
+       to_consume = (ssize_t)zip->zipx_lzma_stream.total_in;
 
        /* Update pointers. */
        __archive_read_consume(a, to_consume);
@@ -2082,7 +2082,7 @@ zip_read_data_zipx_lzma_alone(struct arc
        }
 
        /* Return values. */
-       *size = zip->zipx_lzma_stream.total_out;
+       *size = (size_t)zip->zipx_lzma_stream.total_out;
        *buff = zip->uncompressed_buffer;
 
        /* If we're here, then we're good! */
@@ -2331,7 +2331,7 @@ zip_read_data_zipx_bzip2(struct archive_
                return (ARCHIVE_FATAL);
        }
 
-       in_bytes = zipmin(zip->entry_bytes_remaining, bytes_avail);
+       in_bytes = (ssize_t)zipmin(zip->entry_bytes_remaining, bytes_avail);
        if(in_bytes < 1) {
                /* libbz2 doesn't complain when caller feeds avail_in == 0.
                 * It will actually return success in this case, which is
@@ -2394,7 +2394,7 @@ zip_read_data_zipx_bzip2(struct archive_
        zip->entry_uncompressed_bytes_read += total_out;
 
        /* Give libarchive its due. */
-       *size = total_out;
+       *size = (size_t)total_out;
        *buff = zip->uncompressed_buffer;
 
        return ARCHIVE_OK;
@@ -2478,7 +2478,7 @@ zip_read_data_zipx_zstd(struct archive_r
                return (ARCHIVE_FATAL);
        }
 
-       in_bytes = zipmin(zip->entry_bytes_remaining, bytes_avail);
+       in_bytes = (ssize_t)zipmin(zip->entry_bytes_remaining, bytes_avail);
        if(in_bytes < 1) {
                /* zstd doesn't complain when caller feeds avail_in == 0.
                 * It will actually return success in this case, which is
@@ -2524,7 +2524,7 @@ zip_read_data_zipx_zstd(struct archive_r
        zip->entry_uncompressed_bytes_read += total_out;
 
        /* Give libarchive its due. */
-       *size = total_out;
+       *size = (size_t)total_out;
        *buff = zip->uncompressed_buffer;
 
        return ARCHIVE_OK;
@@ -3680,7 +3680,7 @@ read_eocd(struct zip *zip, const char *p
        if (archive_le16dec(p + 10) != archive_le16dec(p + 8))
                return 0;
        /* Central directory can't extend beyond start of EOCD record. */
-       if (cd_offset + cd_size > current_offset)
+       if ((int64_t)cd_offset + cd_size > current_offset)
                return 0;
 
        /* Save the central directory location for later use. */

Index: pkgsrc/archivers/libarchive/files/libarchive/archive_entry.h
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_entry.h:1.13 pkgsrc/archivers/libarchive/files/libarchive/archive_entry.h:1.14
--- pkgsrc/archivers/libarchive/files/libarchive/archive_entry.h:1.13   Tue Apr 30 06:05:19 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_entry.h        Sun Sep 15 07:02:20 2024
@@ -28,7 +28,7 @@
 #define        ARCHIVE_ENTRY_H_INCLUDED
 
 /* Note: Compiler will complain if this does not match archive.h! */
-#define        ARCHIVE_VERSION_NUMBER 3007004
+#define        ARCHIVE_VERSION_NUMBER 3007005
 
 /*
  * Note: archive_entry.h is for use outside of libarchive; the
@@ -259,9 +259,11 @@ __LA_DECL int               archive_entry_gid_is_set
 __LA_DECL const char   *archive_entry_gname(struct archive_entry *);
 __LA_DECL const char   *archive_entry_gname_utf8(struct archive_entry *);
 __LA_DECL const wchar_t        *archive_entry_gname_w(struct archive_entry *);
+__LA_DECL void          archive_entry_set_link_to_hardlink(struct archive_entry *);
 __LA_DECL const char   *archive_entry_hardlink(struct archive_entry *);
 __LA_DECL const char   *archive_entry_hardlink_utf8(struct archive_entry *);
 __LA_DECL const wchar_t        *archive_entry_hardlink_w(struct archive_entry *);
+__LA_DECL int           archive_entry_hardlink_is_set(struct archive_entry *);
 __LA_DECL la_int64_t    archive_entry_ino(struct archive_entry *);
 __LA_DECL la_int64_t    archive_entry_ino64(struct archive_entry *);
 __LA_DECL int           archive_entry_ino_is_set(struct archive_entry *);
@@ -275,6 +277,7 @@ __LA_DECL const char        *archive_entry_path
 __LA_DECL const wchar_t        *archive_entry_pathname_w(struct archive_entry *);
 __LA_DECL __LA_MODE_T   archive_entry_perm(struct archive_entry *);
 __LA_DECL int           archive_entry_perm_is_set(struct archive_entry *);
+__LA_DECL int           archive_entry_rdev_is_set(struct archive_entry *);
 __LA_DECL dev_t                 archive_entry_rdev(struct archive_entry *);
 __LA_DECL dev_t                 archive_entry_rdevmajor(struct archive_entry *);
 __LA_DECL dev_t                 archive_entry_rdevminor(struct archive_entry *);
@@ -283,6 +286,7 @@ __LA_DECL const wchar_t     *archive_entry_s
 __LA_DECL la_int64_t    archive_entry_size(struct archive_entry *);
 __LA_DECL int           archive_entry_size_is_set(struct archive_entry *);
 __LA_DECL const char   *archive_entry_strmode(struct archive_entry *);
+__LA_DECL void          archive_entry_set_link_to_symlink(struct archive_entry *);
 __LA_DECL const char   *archive_entry_symlink(struct archive_entry *);
 __LA_DECL const char   *archive_entry_symlink_utf8(struct archive_entry *);
 __LA_DECL int           archive_entry_symlink_type(struct archive_entry *);
@@ -324,6 +328,8 @@ __LA_DECL void      archive_entry_set_fflags(
 /* Note that all recognized tokens are processed, regardless. */
 __LA_DECL const char *archive_entry_copy_fflags_text(struct archive_entry *,
            const char *);
+__LA_DECL const char *archive_entry_copy_fflags_text_len(struct archive_entry *,
+           const char *, size_t);
 __LA_DECL const wchar_t *archive_entry_copy_fflags_text_w(struct archive_entry *,
            const wchar_t *);
 __LA_DECL void archive_entry_set_gid(struct archive_entry *, la_int64_t);
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_read.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_read.c:1.13 pkgsrc/archivers/libarchive/files/libarchive/archive_read.c:1.14
--- pkgsrc/archivers/libarchive/files/libarchive/archive_read.c:1.13    Fri Apr 12 15:39:50 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_read.c Sun Sep 15 07:02:20 2024
@@ -1382,7 +1382,7 @@ __archive_read_filter_ahead(struct archi
                if (filter->client_avail <= 0) {
                        if (filter->end_of_file) {
                                if (avail != NULL)
-                                       *avail = 0;
+                                       *avail = filter->avail;
                                return (NULL);
                        }
                        bytes_read = (filter->vtable->read)(filter,
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_iso9660.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_iso9660.c:1.13 pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_iso9660.c:1.14
--- pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_iso9660.c:1.13     Fri Apr 12 15:39:51 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_iso9660.c  Sun Sep 15 07:02:21 2024
@@ -402,6 +402,9 @@ static int  isJolietSVD(struct iso9660 *,
 static int     isSVD(struct iso9660 *, const unsigned char *);
 static int     isEVD(struct iso9660 *, const unsigned char *);
 static int     isPVD(struct iso9660 *, const unsigned char *);
+static int     isRootDirectoryRecord(const unsigned char *);
+static int     isValid723Integer(const unsigned char *);
+static int     isValid733Integer(const unsigned char *);
 static int     next_cache_entry(struct archive_read *, struct iso9660 *,
                    struct file_info **);
 static int     next_entry_seek(struct archive_read *, struct iso9660 *,
@@ -773,8 +776,9 @@ isSVD(struct iso9660 *iso9660, const uns
 
        /* Read Root Directory Record in Volume Descriptor. */
        p = h + SVD_root_directory_record_offset;
-       if (p[DR_length_offset] != 34)
+       if (!isRootDirectoryRecord(p)) {
                return (0);
+       }
 
        return (48);
 }
@@ -851,8 +855,9 @@ isEVD(struct iso9660 *iso9660, const uns
 
        /* Read Root Directory Record in Volume Descriptor. */
        p = h + PVD_root_directory_record_offset;
-       if (p[DR_length_offset] != 34)
+       if (!isRootDirectoryRecord(p)) {
                return (0);
+       }
 
        return (48);
 }
@@ -882,21 +887,43 @@ isPVD(struct iso9660 *iso9660, const uns
        if (!isNull(iso9660, h, PVD_reserved2_offset, PVD_reserved2_size))
                return (0);
 
+       /* Volume space size must be encoded according to 7.3.3 */
+       if (!isValid733Integer(h + PVD_volume_space_size_offset)) {
+               return (0);
+       }
+       volume_block = archive_le32dec(h + PVD_volume_space_size_offset);
+       if (volume_block <= SYSTEM_AREA_BLOCK+4)
+               return (0);
+
        /* Reserved field must be 0. */
        if (!isNull(iso9660, h, PVD_reserved3_offset, PVD_reserved3_size))
                return (0);
 
+       /* Volume set size must be encoded according to 7.2.3 */
+       if (!isValid723Integer(h + PVD_volume_set_size_offset)) {
+               return (0);
+       }
+
+       /* Volume sequence number must be encoded according to 7.2.3 */
+       if (!isValid723Integer(h + PVD_volume_sequence_number_offset)) {
+               return (0);
+       }
+
        /* Logical block size must be > 0. */
        /* I've looked at Ecma 119 and can't find any stronger
         * restriction on this field. */
+       if (!isValid723Integer(h + PVD_logical_block_size_offset)) {
+               return (0);
+       }
        logical_block_size =
            archive_le16dec(h + PVD_logical_block_size_offset);
        if (logical_block_size <= 0)
                return (0);
 
-       volume_block = archive_le32dec(h + PVD_volume_space_size_offset);
-       if (volume_block <= SYSTEM_AREA_BLOCK+4)
+       /* Path Table size must be encoded according to 7.3.3 */
+       if (!isValid733Integer(h + PVD_path_table_size_offset)) {
                return (0);
+       }
 
        /* File structure version must be 1 for ISO9660/ECMA119. */
        if (h[PVD_file_structure_version_offset] != 1)
@@ -935,8 +962,9 @@ isPVD(struct iso9660 *iso9660, const uns
 
        /* Read Root Directory Record in Volume Descriptor. */
        p = h + PVD_root_directory_record_offset;
-       if (p[DR_length_offset] != 34)
+       if (!isRootDirectoryRecord(p)) {
                return (0);
+       }
 
        if (!iso9660->primary.location) {
                iso9660->logical_block_size = logical_block_size;
@@ -952,6 +980,51 @@ isPVD(struct iso9660 *iso9660, const uns
 }
 
 static int
+isRootDirectoryRecord(const unsigned char *p) {
+       int flags;
+
+       /* ECMA119/ISO9660 requires that the root directory record be _exactly_ 34 bytes.
+        * However, we've seen images that have root directory records up to 68 bytes. */
+       if (p[DR_length_offset] < 34 || p[DR_length_offset] > 68) {
+               return (0);
+       }
+
+       /* The root directory location must be a 7.3.3 32-bit integer. */
+       if (!isValid733Integer(p + DR_extent_offset)) {
+               return (0);
+       }
+
+       /* The root directory size must be a 7.3.3 integer. */
+       if (!isValid733Integer(p + DR_size_offset)) {
+               return (0);
+       }
+
+       /* According to the standard, certain bits must be one or zero:
+        * Bit 1: must be 1 (this is a directory)
+        * Bit 2: must be 0 (not an associated file)
+        * Bit 3: must be 0 (doesn't use extended attribute record)
+        * Bit 7: must be 0 (final directory record for this file)
+        */
+       flags = p[DR_flags_offset];
+       if ((flags & 0x8E) != 0x02) {
+               return (0);
+       }
+
+       /* Volume sequence number must be a 7.2.3 integer. */
+       if (!isValid723Integer(p + DR_volume_sequence_number_offset)) {
+               return (0);
+       }
+
+       /* Root directory name is a single zero byte... */
+       if (p[DR_name_len_offset] != 1 || p[DR_name_offset] != 0) {
+               return (0);
+       }
+
+       /* Nothing looked wrong, so let's accept it. */
+       return (1);
+}
+
+static int
 read_children(struct archive_read *a, struct file_info *parent)
 {
        struct iso9660 *iso9660;
@@ -1212,7 +1285,7 @@ archive_read_format_iso9660_read_header(
                        }
                }
                if (iso9660->utf16be_previous_path == NULL) {
-                       iso9660->utf16be_previous_path = malloc(UTF16_NAME_MAX);
+                       iso9660->utf16be_previous_path = calloc(1, UTF16_NAME_MAX);
                        if (iso9660->utf16be_previous_path == NULL) {
                                archive_set_error(&a->archive, ENOMEM,
                                    "No memory");
@@ -3033,7 +3106,7 @@ heap_add_entry(struct archive_read *a, s
                        return (ARCHIVE_FATAL);
                }
                new_pending_files = (struct file_info **)
-                   malloc(new_size * sizeof(new_pending_files[0]));
+                   calloc(new_size, sizeof(new_pending_files[0]));
                if (new_pending_files == NULL) {
                        archive_set_error(&a->archive,
                            ENOMEM, "Out of memory");
@@ -3127,6 +3200,32 @@ toi(const void *p, int n)
        return (0);
 }
 
+/*
+ * ECMA119/ISO9660 stores multi-byte integers in one of
+ * three different formats:
+ *  * Little-endian (specified in section 7.2.1 and 7.3.1)
+ *  * Big-endian (specified in section 7.2.2 and 7.3.2)
+ *  * Both (specified in section 7.2.3 and 7.3.3)
+ *
+ * For values that follow section 7.2.3 (16-bit) or 7.3.3 (32-bit), we
+ * can check that the little-endian and big-endian forms agree with
+ * each other.  This helps us avoid trying to decode files that are
+ * not really ISO images.
+ */
+static int
+isValid723Integer(const unsigned char *p) {
+       return (p[0] == p[3] && p[1] == p[2]);
+}
+
+static int
+isValid733Integer(const unsigned char *p)
+{
+       return (p[0] == p[7]
+               && p[1] == p[6]
+               && p[2] == p[5]
+               && p[3] == p[4]);
+}
+
 static time_t
 isodate7(const unsigned char *v)
 {
@@ -3164,7 +3263,7 @@ isodate17(const unsigned char *v)
        tm.tm_year = (v[0] - '0') * 1000 + (v[1] - '0') * 100
            + (v[2] - '0') * 10 + (v[3] - '0')
            - 1900;
-       tm.tm_mon = (v[4] - '0') * 10 + (v[5] - '0');
+       tm.tm_mon = (v[4] - '0') * 10 + (v[5] - '0') - 1;
        tm.tm_mday = (v[6] - '0') * 10 + (v[7] - '0');
        tm.tm_hour = (v[8] - '0') * 10 + (v[9] - '0');
        tm.tm_min = (v[10] - '0') * 10 + (v[11] - '0');
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_tar.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_tar.c:1.13 pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_tar.c:1.14
--- pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_tar.c:1.13 Fri Apr 12 15:39:51 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_tar.c      Sun Sep 15 07:02:21 2024
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003-2007 Tim Kientzle
+ * Copyright (c) 2003-2023 Tim Kientzle
  * Copyright (c) 2011-2012 Michihiro NAKAJIMA
  * Copyright (c) 2016 Martin Matuska
  * All rights reserved.
@@ -117,33 +117,29 @@ struct sparse_block {
 };
 
 struct tar {
-       struct archive_string    acl_text;
        struct archive_string    entry_pathname;
        /* For "GNU.sparse.name" and other similar path extensions. */
        struct archive_string    entry_pathname_override;
-       struct archive_string    entry_linkpath;
        struct archive_string    entry_uname;
        struct archive_string    entry_gname;
-       struct archive_string    longlink;
+       struct archive_string    entry_linkpath;
        struct archive_string    longname;
-       struct archive_string    pax_header;
        struct archive_string    pax_global;
        struct archive_string    line;
-       int                      pax_hdrcharset_binary;
-       int                      header_recursion_depth;
+       int                      pax_hdrcharset_utf8;
        int64_t                  entry_bytes_remaining;
        int64_t                  entry_offset;
        int64_t                  entry_padding;
        int64_t                  entry_bytes_unconsumed;
        int64_t                  realsize;
-       int                      sparse_allowed;
        struct sparse_block     *sparse_list;
        struct sparse_block     *sparse_last;
        int64_t                  sparse_offset;
        int64_t                  sparse_numbytes;
        int                      sparse_gnu_major;
        int                      sparse_gnu_minor;
-       char                     sparse_gnu_pending;
+       char                     sparse_gnu_attributes_seen;
+       char                     filetype;
 
        struct archive_string    localname;
        struct archive_string_conv *opt_sconv;
@@ -168,25 +164,26 @@ static int        gnu_sparse_old_read(struct ar
 static int     gnu_sparse_old_parse(struct archive_read *, struct tar *,
                    const struct gnu_sparse *sparse, int length);
 static int     gnu_sparse_01_parse(struct archive_read *, struct tar *,
-                   const char *);
+                   const char *, size_t);
 static ssize_t gnu_sparse_10_read(struct archive_read *, struct tar *,
-                       size_t *);
+                   size_t *);
 static int     header_Solaris_ACL(struct archive_read *,  struct tar *,
                    struct archive_entry *, const void *, size_t *);
 static int     header_common(struct archive_read *,  struct tar *,
                    struct archive_entry *, const void *);
 static int     header_old_tar(struct archive_read *, struct tar *,
                    struct archive_entry *, const void *);
-static int     header_pax_extensions(struct archive_read *, struct tar *,
+static int     header_pax_extension(struct archive_read *, struct tar *,
                    struct archive_entry *, const void *, size_t *);
 static int     header_pax_global(struct archive_read *, struct tar *,
                    struct archive_entry *, const void *h, size_t *);
-static int     header_longlink(struct archive_read *, struct tar *,
-                   struct archive_entry *, const void *h, size_t *);
-static int     header_longname(struct archive_read *, struct tar *,
+static int     header_gnu_longlink(struct archive_read *, struct tar *,
                    struct archive_entry *, const void *h, size_t *);
-static int     read_mac_metadata_blob(struct archive_read *, struct tar *,
+static int     header_gnu_longname(struct archive_read *, struct tar *,
                    struct archive_entry *, const void *h, size_t *);
+static int     is_mac_metadata_entry(struct archive_entry *entry);
+static int     read_mac_metadata_blob(struct archive_read *,
+                   struct archive_entry *, size_t *);
 static int     header_volume(struct archive_read *, struct tar *,
                    struct archive_entry *, const void *h, size_t *);
 static int     header_ustar(struct archive_read *, struct tar *,
@@ -204,21 +201,21 @@ static int        archive_read_format_tar_read_
                    struct archive_entry *);
 static int     checksum(struct archive_read *, const void *);
 static int     pax_attribute(struct archive_read *, struct tar *,
-                   struct archive_entry *, const char *key, const char *value,
-                   size_t value_length);
-static int     pax_attribute_acl(struct archive_read *, struct tar *,
-                   struct archive_entry *, const char *, int);
-static int     pax_attribute_xattr(struct archive_entry *, const char *,
-                   const char *);
-static int     pax_header(struct archive_read *, struct tar *,
-                   struct archive_entry *, struct archive_string *);
-static void    pax_time(const char *, int64_t *sec, long *nanos);
+                   struct archive_entry *, const char *key, size_t key_length,
+                   size_t value_length, size_t *unconsumed);
+static int     pax_attribute_LIBARCHIVE_xattr(struct archive_entry *,
+                   const char *, size_t, const char *, size_t);
+static int     pax_attribute_SCHILY_acl(struct archive_read *, struct tar *,
+                   struct archive_entry *, size_t, int);
+static int     pax_attribute_SUN_holesdata(struct archive_read *, struct tar *,
+                   struct archive_entry *, const char *, size_t);
+static void    pax_time(const char *, size_t, int64_t *sec, long *nanos);
 static ssize_t readline(struct archive_read *, struct tar *, const char **,
                    ssize_t limit, size_t *);
 static int     read_body_to_string(struct archive_read *, struct tar *,
                    struct archive_string *, const void *h, size_t *);
-static int     solaris_sparse_parse(struct archive_read *, struct tar *,
-                   struct archive_entry *, const char *);
+static int     read_bytes_to_string(struct archive_read *,
+                   struct archive_string *, size_t, size_t *);
 static int64_t tar_atol(const char *, size_t);
 static int64_t tar_atol10(const char *, size_t);
 static int64_t tar_atol256(const char *, size_t);
@@ -226,9 +223,21 @@ static int64_t     tar_atol8(const char *, s
 static int     tar_read_header(struct archive_read *, struct tar *,
                    struct archive_entry *, size_t *);
 static int     tohex(int c);
-static char    *url_decode(const char *);
+static char    *url_decode(const char *, size_t);
 static void    tar_flush_unconsumed(struct archive_read *, size_t *);
 
+/* Sanity limits:  These numbers should be low enough to
+ * prevent a maliciously-crafted archive from forcing us to
+ * allocate extreme amounts of memory.  But of course, they
+ * need to be high enough for any correct value.  These
+ * will likely need some adjustment as we get more experience. */
+static const size_t guname_limit = 65536; /* Longest uname or gname: 64kiB */
+static const size_t pathname_limit = 1048576; /* Longest path name: 1MiB */
+static const size_t sparse_map_limit = 8 * 1048576; /* Longest sparse map: 8MiB */
+static const size_t xattr_limit = 16 * 1048576; /* Longest xattr: 16MiB */
+static const size_t fflags_limit = 512; /* Longest fflags */
+static const size_t acl_limit = 131072; /* Longest textual ACL: 128kiB */
+static const int64_t entry_limit = 0xfffffffffffffffLL; /* 2^60 bytes = 1 ExbiByte */
 
 int
 archive_read_support_format_gnutar(struct archive *a)
@@ -283,17 +292,13 @@ archive_read_format_tar_cleanup(struct a
 
        tar = (struct tar *)(a->format->data);
        gnu_clear_sparse_list(tar);
-       archive_string_free(&tar->acl_text);
        archive_string_free(&tar->entry_pathname);
        archive_string_free(&tar->entry_pathname_override);
-       archive_string_free(&tar->entry_linkpath);
        archive_string_free(&tar->entry_uname);
        archive_string_free(&tar->entry_gname);
        archive_string_free(&tar->line);
        archive_string_free(&tar->pax_global);
-       archive_string_free(&tar->pax_header);
        archive_string_free(&tar->longname);
-       archive_string_free(&tar->longlink);
        archive_string_free(&tar->localname);
        free(tar);
        (a->format->data) = NULL;
@@ -505,6 +510,8 @@ archive_read_format_tar_read_header(stru
         * probably not worthwhile just to support the relatively
         * obscure tar->cpio conversion case.
         */
+       /* TODO: Move this into `struct tar` to avoid conflicts
+        * when reading multiple archives */
        static int default_inode;
        static int default_dev;
        struct tar *tar;
@@ -627,7 +634,8 @@ archive_read_format_tar_read_data(struct
                        return (ARCHIVE_FATAL);
                if (*buff == NULL) {
                        archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
-                           "Truncated tar archive");
+                           "Truncated tar archive"
+                           " detected while reading data");
                        return (ARCHIVE_FATAL);
                }
                if (bytes_read > tar->entry_bytes_remaining)
@@ -688,7 +696,7 @@ archive_read_format_tar_skip(struct arch
 }
 
 /*
- * This function recursively interprets all of the headers associated
+ * This function reads and interprets all of the headers associated
  * with a single entry.
  */
 static int
@@ -696,190 +704,259 @@ tar_read_header(struct archive_read *a, 
     struct archive_entry *entry, size_t *unconsumed)
 {
        ssize_t bytes;
-       int err, eof_vol_header;
+       int err = ARCHIVE_OK, err2;
+       int eof_fatal = 0; /* EOF is okay at some points... */
        const char *h;
        const struct archive_entry_header_ustar *header;
        const struct archive_entry_header_gnutar *gnuheader;
 
-       eof_vol_header = 0;
-
-       /* Loop until we find a workable header record. */
-       for (;;) {
-               tar_flush_unconsumed(a, unconsumed);
-
-               /* Read 512-byte header record */
-               h = __archive_read_ahead(a, 512, &bytes);
-               if (bytes < 0)
-                       return ((int)bytes);
-               if (bytes == 0) { /* EOF at a block boundary. */
-                       /* Some writers do omit the block of nulls. <sigh> */
-                       return (ARCHIVE_EOF);
-               }
-               if (bytes < 512) {  /* Short block at EOF; this is bad. */
-                       archive_set_error(&a->archive,
-                           ARCHIVE_ERRNO_FILE_FORMAT,
-                           "Truncated tar archive");
-                       return (ARCHIVE_FATAL);
-               }
-               *unconsumed = 512;
-
-               /* Header is workable if it's not an end-of-archive mark. */
-               if (h[0] != 0 || !archive_block_is_null(h))
-                       break;
-
-               /* Ensure format is set for archives with only null blocks. */
-               if (a->archive.archive_format_name == NULL) {
-                       a->archive.archive_format = ARCHIVE_FORMAT_TAR;
-                       a->archive.archive_format_name = "tar";
-               }
+       /* Bitmask of what header types we've seen. */
+       int32_t seen_headers = 0;
+       static const int32_t seen_A_header = 1;
+       static const int32_t seen_g_header = 2;
+       static const int32_t seen_K_header = 4;
+       static const int32_t seen_L_header = 8;
+       static const int32_t seen_V_header = 16;
+       static const int32_t seen_x_header = 32; /* Also X */
+       static const int32_t seen_mac_metadata = 512;
 
-               if (!tar->read_concatenated_archives) {
-                       /* Try to consume a second all-null record, as well. */
-                       tar_flush_unconsumed(a, unconsumed);
-                       h = __archive_read_ahead(a, 512, NULL);
-                       if (h != NULL && h[0] == 0 && archive_block_is_null(h))
-                               __archive_read_consume(a, 512);
-                       archive_clear_error(&a->archive);
-                       return (ARCHIVE_EOF);
-               }
+       tar->pax_hdrcharset_utf8 = 1;
+       tar->sparse_gnu_attributes_seen = 0;
+       archive_string_empty(&(tar->entry_gname));
+       archive_string_empty(&(tar->entry_pathname));
+       archive_string_empty(&(tar->entry_pathname_override));
+       archive_string_empty(&(tar->entry_uname));
 
-               /*
-                * We're reading concatenated archives, ignore this block and
-                * loop to get the next.
-                */
+       /* Ensure format is set. */
+       if (a->archive.archive_format_name == NULL) {
+               a->archive.archive_format = ARCHIVE_FORMAT_TAR;
+               a->archive.archive_format_name = "tar";
        }
 
        /*
-        * Note: If the checksum fails and we return ARCHIVE_RETRY,
-        * then the client is likely to just retry.  This is a very
-        * crude way to search for the next valid header!
-        *
-        * TODO: Improve this by implementing a real header scan.
+        * TODO: Write global/default pax options into
+        * 'entry' struct here before overwriting with
+        * file-specific options.
         */
-       if (!checksum(a, h)) {
-               tar_flush_unconsumed(a, unconsumed);
-               archive_set_error(&a->archive, EINVAL, "Damaged tar archive");
-               return (ARCHIVE_RETRY); /* Retryable: Invalid header */
-       }
 
-       if (++tar->header_recursion_depth > 32) {
-               tar_flush_unconsumed(a, unconsumed);
-               archive_set_error(&a->archive, EINVAL, "Too many special headers");
-               return (ARCHIVE_WARN);
-       }
+       /* Loop over all the headers needed for the next entry */
+       for (;;) {
 
-       /* Determine the format variant. */
-       header = (const struct archive_entry_header_ustar *)h;
+               /* Find the next valid header record. */
+               while (1) {
+                       tar_flush_unconsumed(a, unconsumed);
 
-       switch(header->typeflag[0]) {
-       case 'A': /* Solaris tar ACL */
-               a->archive.archive_format = ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE;
-               a->archive.archive_format_name = "Solaris tar";
-               err = header_Solaris_ACL(a, tar, entry, h, unconsumed);
-               break;
-       case 'g': /* POSIX-standard 'g' header. */
-               a->archive.archive_format = ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE;
-               a->archive.archive_format_name = "POSIX pax interchange format";
-               err = header_pax_global(a, tar, entry, h, unconsumed);
-               if (err == ARCHIVE_EOF)
-                       return (err);
-               break;
-       case 'K': /* Long link name (GNU tar, others) */
-               err = header_longlink(a, tar, entry, h, unconsumed);
-               break;
-       case 'L': /* Long filename (GNU tar, others) */
-               err = header_longname(a, tar, entry, h, unconsumed);
-               break;
-       case 'V': /* GNU volume header */
-               err = header_volume(a, tar, entry, h, unconsumed);
-               if (err == ARCHIVE_EOF)
-                       eof_vol_header = 1;
-               break;
-       case 'X': /* Used by SUN tar; same as 'x'. */
-               a->archive.archive_format = ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE;
-               a->archive.archive_format_name =
-                   "POSIX pax interchange format (Sun variant)";
-               err = header_pax_extensions(a, tar, entry, h, unconsumed);
-               break;
-       case 'x': /* POSIX-standard 'x' header. */
-               a->archive.archive_format = ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE;
-               a->archive.archive_format_name = "POSIX pax interchange format";
-               err = header_pax_extensions(a, tar, entry, h, unconsumed);
-               break;
-       default:
-               gnuheader = (const struct archive_entry_header_gnutar *)h;
-               if (memcmp(gnuheader->magic, "ustar  \0", 8) == 0) {
-                       a->archive.archive_format = ARCHIVE_FORMAT_TAR_GNUTAR;
-                       a->archive.archive_format_name = "GNU tar format";
-                       err = header_gnutar(a, tar, entry, h, unconsumed);
-               } else if (memcmp(header->magic, "ustar", 5) == 0) {
-                       if (a->archive.archive_format != ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE) {
-                               a->archive.archive_format = ARCHIVE_FORMAT_TAR_USTAR;
-                               a->archive.archive_format_name = "POSIX ustar format";
+                       /* Read 512-byte header record */
+                       h = __archive_read_ahead(a, 512, &bytes);
+                       if (bytes < 0)
+                               return ((int)bytes);
+                       if (bytes == 0) { /* EOF at a block boundary. */
+                               if (eof_fatal) {
+                                       /* We've read a special header already;
+                                        * if there's no regular header, then this is
+                                        * a premature EOF. */
+                                       archive_set_error(&a->archive, EINVAL,
+                                                         "Damaged tar archive");
+                                       return (ARCHIVE_FATAL);
+                               } else {
+                                       return (ARCHIVE_EOF);
+                               }
                        }
-                       err = header_ustar(a, tar, entry, h);
-               } else {
-                       a->archive.archive_format = ARCHIVE_FORMAT_TAR;
-                       a->archive.archive_format_name = "tar (non-POSIX)";
-                       err = header_old_tar(a, tar, entry, h);
-               }
-       }
-       if (err == ARCHIVE_FATAL)
-               return (err);
+                       if (bytes < 512) {  /* Short block at EOF; this is bad. */
+                               archive_set_error(&a->archive,
+                                   ARCHIVE_ERRNO_FILE_FORMAT,
+                                   "Truncated tar archive"
+                                   " detected while reading next heaader");
+                               return (ARCHIVE_FATAL);
+                       }
+                       *unconsumed += 512;
 
-       tar_flush_unconsumed(a, unconsumed);
+                       if (h[0] == 0 && archive_block_is_null(h)) {
+                               /* We found a NULL block which indicates end-of-archive */
 
-       h = NULL;
-       header = NULL;
+                               if (tar->read_concatenated_archives) {
+                                       /* We're ignoring NULL blocks, so keep going. */
+                                       continue;
+                               }
+
+                               /* Try to consume a second all-null record, as well. */
+                               /* If we can't, that's okay. */
+                               tar_flush_unconsumed(a, unconsumed);
+                               h = __archive_read_ahead(a, 512, NULL);
+                               if (h != NULL && h[0] == 0 && archive_block_is_null(h))
+                                               __archive_read_consume(a, 512);
+
+                               archive_clear_error(&a->archive);
+                               return (ARCHIVE_EOF);
+                       }
+
+                       /* This is NOT a null block, so it must be a valid header. */
+                       if (!checksum(a, h)) {
+                               tar_flush_unconsumed(a, unconsumed);
+                               archive_set_error(&a->archive, EINVAL, "Damaged tar archive");
+                               /* If we've read some critical information (pax headers, etc)
+                                * and _then_ see a bad header, we can't really recover. */
+                               if (eof_fatal) {
+                                       return (ARCHIVE_FATAL);
+                               } else {
+                                       return (ARCHIVE_RETRY);
+                               }
+                       }
+                       break;
+               }
 
-       --tar->header_recursion_depth;
-       /* Yuck.  Apple's design here ends up storing long pathname
-        * extensions for both the AppleDouble extension entry and the
-        * regular entry.
-        */
-       if ((err == ARCHIVE_WARN || err == ARCHIVE_OK) &&
-           tar->header_recursion_depth == 0 &&
-           tar->process_mac_extensions) {
-               int err2 = read_mac_metadata_blob(a, tar, entry, h, unconsumed);
-               if (err2 < err)
-                       err = err2;
-       }
-
-       /* We return warnings or success as-is.  Anything else is fatal. */
-       if (err == ARCHIVE_WARN || err == ARCHIVE_OK) {
-               if (tar->sparse_gnu_pending) {
-                       if (tar->sparse_gnu_major == 1 &&
-                           tar->sparse_gnu_minor == 0) {
-                               ssize_t bytes_read;
-
-                               tar->sparse_gnu_pending = 0;
-                               /* Read initial sparse map. */
-                               bytes_read = gnu_sparse_10_read(a, tar, unconsumed);
-                               if (bytes_read < 0)
-                                       return ((int)bytes_read);
-                               tar->entry_bytes_remaining -= bytes_read;
+               /* Determine the format variant. */
+               header = (const struct archive_entry_header_ustar *)h;
+               switch(header->typeflag[0]) {
+               case 'A': /* Solaris tar ACL */
+                       if (seen_headers & seen_A_header) {
+                               return (ARCHIVE_FATAL);
+                       }
+                       seen_headers |= seen_A_header;
+                       a->archive.archive_format = ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE;
+                       a->archive.archive_format_name = "Solaris tar";
+                       err2 = header_Solaris_ACL(a, tar, entry, h, unconsumed);
+                       break;
+               case 'g': /* POSIX-standard 'g' header. */
+                       if (seen_headers & seen_g_header) {
+                               return (ARCHIVE_FATAL);
+                       }
+                       seen_headers |= seen_g_header;
+                       a->archive.archive_format = ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE;
+                       a->archive.archive_format_name = "POSIX pax interchange format";
+                       err2 = header_pax_global(a, tar, entry, h, unconsumed);
+                       break;
+               case 'K': /* Long link name (GNU tar, others) */
+                       if (seen_headers & seen_K_header) {
+                               return (ARCHIVE_FATAL);
+                       }
+                       seen_headers |= seen_K_header;
+                       err2 = header_gnu_longlink(a, tar, entry, h, unconsumed);
+                       break;
+               case 'L': /* Long filename (GNU tar, others) */
+                       if (seen_headers & seen_L_header) {
+                               return (ARCHIVE_FATAL);
+                       }
+                       seen_headers |= seen_L_header;
+                       err2 = header_gnu_longname(a, tar, entry, h, unconsumed);
+                       break;
+               case 'V': /* GNU volume header */
+                       if (seen_headers & seen_V_header) {
+                               return (ARCHIVE_FATAL);
+                       }
+                       seen_headers |= seen_V_header;
+                       err2 = header_volume(a, tar, entry, h, unconsumed);
+                       break;
+               case 'X': /* Used by SUN tar; same as 'x'. */
+                       if (seen_headers & seen_x_header) {
+                               return (ARCHIVE_FATAL);
+                       }
+                       seen_headers |= seen_x_header;
+                       a->archive.archive_format = ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE;
+                       a->archive.archive_format_name =
+                               "POSIX pax interchange format (Sun variant)";
+                       err2 = header_pax_extension(a, tar, entry, h, unconsumed);
+                       break;
+               case 'x': /* POSIX-standard 'x' header. */
+                       if (seen_headers & seen_x_header) {
+                               return (ARCHIVE_FATAL);
+                       }
+                       seen_headers |= seen_x_header;
+                       a->archive.archive_format = ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE;
+                       a->archive.archive_format_name = "POSIX pax interchange format";
+                       err2 = header_pax_extension(a, tar, entry, h, unconsumed);
+                       break;
+               default: /* Regular header: Legacy tar, GNU tar, or ustar */
+                       gnuheader = (const struct archive_entry_header_gnutar *)h;
+                       if (memcmp(gnuheader->magic, "ustar  \0", 8) == 0) {
+                               a->archive.archive_format = ARCHIVE_FORMAT_TAR_GNUTAR;
+                               a->archive.archive_format_name = "GNU tar format";
+                               err2 = header_gnutar(a, tar, entry, h, unconsumed);
+                       } else if (memcmp(header->magic, "ustar", 5) == 0) {
+                               if (a->archive.archive_format != ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE) {
+                                       a->archive.archive_format = ARCHIVE_FORMAT_TAR_USTAR;
+                                       a->archive.archive_format_name = "POSIX ustar format";
+                               }
+                               err2 = header_ustar(a, tar, entry, h);
                        } else {
-                               archive_set_error(&a->archive,
-                                   ARCHIVE_ERRNO_MISC,
-                                   "Unrecognized GNU sparse file format");
-                               return (ARCHIVE_WARN);
+                               a->archive.archive_format = ARCHIVE_FORMAT_TAR;
+                               a->archive.archive_format_name = "tar (non-POSIX)";
+                               err2 = header_old_tar(a, tar, entry, h);
+                       }
+                       err = err_combine(err, err2);
+                       /* We return warnings or success as-is.  Anything else is fatal. */
+                       if (err < ARCHIVE_WARN) {
+                               return (ARCHIVE_FATAL);
+                       }
+                       /* Filename of the form `._filename` is an AppleDouble
+                        * extension entry.  The body is the macOS metadata blob;
+                        * this is followed by another entry with the actual
+                        * regular file data.
+                        * This design has two drawbacks:
+                        * = it's brittle; you might just have a file with such a name
+                        * = it duplicates any long pathname extensions
+                        *
+                        * TODO: This probably shouldn't be here at all.  Consider
+                        * just returning the contents as a regular entry here and
+                        * then dealing with it when we write data to disk.
+                        */
+                       if (tar->process_mac_extensions
+                           && ((seen_headers & seen_mac_metadata) == 0)
+                           && is_mac_metadata_entry(entry)) {
+                               err2 = read_mac_metadata_blob(a, entry, unconsumed);
+                               if (err2 < ARCHIVE_WARN) {
+                                       return (ARCHIVE_FATAL);
+                               }
+                               err = err_combine(err, err2);
+                               /* Note: Other headers can appear again. */
+                               seen_headers = seen_mac_metadata;
+                               break;
+                       }
+
+                       /* Reconcile GNU sparse attributes */
+                       if (tar->sparse_gnu_attributes_seen) {
+                               /* Only 'S' (GNU sparse) and ustar '0' regular files can be sparse */
+                               if (tar->filetype != 'S' && tar->filetype != '0') {
+                                       archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+                                                         "Non-regular file cannot be sparse");
+                                       return (ARCHIVE_WARN);
+                               } else if (tar->sparse_gnu_major == 0 &&
+                                   tar->sparse_gnu_minor == 0) {
+                                       /* Sparse map already parsed from 'x' header */
+                               } else if (tar->sparse_gnu_major == 0 &&
+                                   tar->sparse_gnu_minor == 1) {
+                                       /* Sparse map already parsed from 'x' header */
+                               } else if (tar->sparse_gnu_major == 1 &&
+                                   tar->sparse_gnu_minor == 0) {
+                                       /* Sparse map is prepended to file contents */
+                                       ssize_t bytes_read;
+                                       bytes_read = gnu_sparse_10_read(a, tar, unconsumed);
+                                       if (bytes_read < 0)
+                                               return ((int)bytes_read);
+                                       tar->entry_bytes_remaining -= bytes_read;
+                               } else {
+                                       archive_set_error(&a->archive,
+                                                         ARCHIVE_ERRNO_MISC,
+                                                         "Unrecognized GNU sparse file format");
+                                       return (ARCHIVE_WARN);
+                               }
                        }
-                       tar->sparse_gnu_pending = 0;
+                       return (err);
                }
-               return (err);
-       }
-       if (err == ARCHIVE_EOF) {
-               if (!eof_vol_header) {
-                       /* EOF when recursively reading a header is bad. */
-                       archive_set_error(&a->archive, EINVAL,
-                           "Damaged tar archive");
-               } else {
-                       /* If we encounter just a GNU volume header treat
-                        * this situation as an empty archive */
-                       return (ARCHIVE_EOF);
+
+               /* We're between headers ... */
+               err = err_combine(err, err2);
+               if (err == ARCHIVE_FATAL)
+                       return (err);
+
+               /* The GNU volume header and the pax `g` global header
+                * are both allowed to be the only header in an
+                * archive.  If we've seen any other header, a
+                * following EOF is fatal. */
+               if ((seen_headers & ~seen_V_header & ~seen_g_header) != 0) {
+                       eof_fatal = 1;
                }
        }
-       return (ARCHIVE_FATAL);
 }
 
 /*
@@ -959,6 +1036,7 @@ header_Solaris_ACL(struct archive_read *
     struct archive_entry *entry, const void *h, size_t *unconsumed)
 {
        const struct archive_entry_header_ustar *header;
+       struct archive_string    acl_text;
        size_t size;
        int err, acl_type;
        int64_t type;
@@ -970,27 +1048,24 @@ header_Solaris_ACL(struct archive_read *
         */
        header = (const struct archive_entry_header_ustar *)h;
        size = (size_t)tar_atol(header->size, sizeof(header->size));
-       err = read_body_to_string(a, tar, &(tar->acl_text), h, unconsumed);
+       archive_string_init(&acl_text);
+       err = read_body_to_string(a, tar, &acl_text, h, unconsumed);
        if (err != ARCHIVE_OK)
                return (err);
 
-       /* Recursively read next header */
-       err = tar_read_header(a, tar, entry, unconsumed);
-       if ((err != ARCHIVE_OK) && (err != ARCHIVE_WARN))
-               return (err);
-
        /* TODO: Examine the first characters to see if this
         * is an AIX ACL descriptor.  We'll likely never support
         * them, but it would be polite to recognize and warn when
         * we do see them. */
 
        /* Leading octal number indicates ACL type and number of entries. */
-       p = acl = tar->acl_text.s;
+       p = acl = acl_text.s;
        type = 0;
        while (*p != '\0' && p < acl + size) {
                if (*p < '0' || *p > '7') {
                        archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
                            "Malformed Solaris ACL attribute (invalid digit)");
+                       archive_string_free(&acl_text);
                        return(ARCHIVE_WARN);
                }
                type <<= 3;
@@ -998,6 +1073,7 @@ header_Solaris_ACL(struct archive_read *
                if (type > 077777777) {
                        archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
                            "Malformed Solaris ACL attribute (count too large)");
+                       archive_string_free(&acl_text);
                        return (ARCHIVE_WARN);
                }
                p++;
@@ -1015,6 +1091,7 @@ header_Solaris_ACL(struct archive_read *
                archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
                    "Malformed Solaris ACL attribute (unsupported type %o)",
                    (int)type);
+               archive_string_free(&acl_text);
                return (ARCHIVE_WARN);
        }
        p++;
@@ -1022,6 +1099,7 @@ header_Solaris_ACL(struct archive_read *
        if (p >= acl + size) {
                archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
                    "Malformed Solaris ACL attribute (body overflow)");
+               archive_string_free(&acl_text);
                return(ARCHIVE_WARN);
        }
 
@@ -1035,12 +1113,17 @@ header_Solaris_ACL(struct archive_read *
        if (tar->sconv_acl == NULL) {
                tar->sconv_acl = archive_string_conversion_from_charset(
                    &(a->archive), "UTF-8", 1);
-               if (tar->sconv_acl == NULL)
+               if (tar->sconv_acl == NULL) {
+                       archive_string_free(&acl_text);
                        return (ARCHIVE_FATAL);
+               }
        }
        archive_strncpy(&(tar->localname), acl, p - acl);
        err = archive_acl_from_text_l(archive_entry_acl(entry),
            tar->localname.s, acl_type, tar->sconv_acl);
+       /* Workaround: Force perm_is_set() to be correct */
+       /* If this bit were stored in the ACL, this wouldn't be needed */
+       archive_entry_set_perm(entry, archive_entry_perm(entry));
        if (err != ARCHIVE_OK) {
                if (errno == ENOMEM) {
                        archive_set_error(&a->archive, ENOMEM,
@@ -1049,6 +1132,7 @@ header_Solaris_ACL(struct archive_read *
                        archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
                            "Malformed Solaris ACL attribute (unparsable)");
        }
+       archive_string_free(&acl_text);
        return (err);
 }
 
@@ -1056,20 +1140,17 @@ header_Solaris_ACL(struct archive_read *
  * Interpret 'K' long linkname header.
  */
 static int
-header_longlink(struct archive_read *a, struct tar *tar,
+header_gnu_longlink(struct archive_read *a, struct tar *tar,
     struct archive_entry *entry, const void *h, size_t *unconsumed)
 {
        int err;
 
-       err = read_body_to_string(a, tar, &(tar->longlink), h, unconsumed);
-       if (err != ARCHIVE_OK)
-               return (err);
-       err = tar_read_header(a, tar, entry, unconsumed);
-       if ((err != ARCHIVE_OK) && (err != ARCHIVE_WARN))
-               return (err);
-       /* Set symlink if symlink already set, else hardlink. */
-       archive_entry_copy_link(entry, tar->longlink.s);
-       return (ARCHIVE_OK);
+       struct archive_string linkpath;
+       archive_string_init(&linkpath);
+       err = read_body_to_string(a, tar, &linkpath, h, unconsumed);
+       archive_entry_set_link(entry, linkpath.s);
+       archive_string_free(&linkpath);
+       return (err);
 }
 
 static int
@@ -1091,7 +1172,7 @@ set_conversion_failed_error(struct archi
  * Interpret 'L' long filename header.
  */
 static int
-header_longname(struct archive_read *a, struct tar *tar,
+header_gnu_longname(struct archive_read *a, struct tar *tar,
     struct archive_entry *entry, const void *h, size_t *unconsumed)
 {
        int err;
@@ -1099,17 +1180,12 @@ header_longname(struct archive_read *a, 
        err = read_body_to_string(a, tar, &(tar->longname), h, unconsumed);
        if (err != ARCHIVE_OK)
                return (err);
-       /* Read and parse "real" header, then override name. */
-       err = tar_read_header(a, tar, entry, unconsumed);
-       if ((err != ARCHIVE_OK) && (err != ARCHIVE_WARN))
-               return (err);
        if (archive_entry_copy_pathname_l(entry, tar->longname.s,
            archive_strlen(&(tar->longname)), tar->sconv) != 0)
                err = set_conversion_failed_error(a, tar->sconv, "Pathname");
        return (err);
 }
 
-
 /*
  * Interpret 'V' GNU tar volume header.
  */
@@ -1117,32 +1193,33 @@ static int
 header_volume(struct archive_read *a, struct tar *tar,
     struct archive_entry *entry, const void *h, size_t *unconsumed)
 {
-       (void)h;
+       const struct archive_entry_header_ustar *header;
+       int64_t size, to_consume;
+
+       (void)a; /* UNUSED */
+       (void)tar; /* UNUSED */
+       (void)entry; /* UNUSED */
 
-       /* Just skip this and read the next header. */
-       return (tar_read_header(a, tar, entry, unconsumed));
+       header = (const struct archive_entry_header_ustar *)h;
+       size = tar_atol(header->size, sizeof(header->size));
+       if (size > (int64_t)pathname_limit) {
+               return (ARCHIVE_FATAL);
+       }
+       to_consume = ((size + 511) & ~511);
+       *unconsumed += to_consume;
+       return (ARCHIVE_OK);
 }
 
 /*
- * Read body of an archive entry into an archive_string object.
+ * Read the next `size` bytes into the provided string.
+ * Null-terminate the string.
  */
 static int
-read_body_to_string(struct archive_read *a, struct tar *tar,
-    struct archive_string *as, const void *h, size_t *unconsumed)
-{
-       int64_t size;
-       const struct archive_entry_header_ustar *header;
+read_bytes_to_string(struct archive_read *a,
+                    struct archive_string *as, size_t size,
+                    size_t *unconsumed) {
        const void *src;
 
-       (void)tar; /* UNUSED */
-       header = (const struct archive_entry_header_ustar *)h;
-       size  = tar_atol(header->size, sizeof(header->size));
-       if ((size > 1048576) || (size < 0)) {
-               archive_set_error(&a->archive, EINVAL,
-                   "Special header too large");
-               return (ARCHIVE_FATAL);
-       }
-
        /* Fail if we can't make our buffer big enough. */
        if (archive_string_ensure(as, (size_t)size+1) == NULL) {
                archive_set_error(&a->archive, ENOMEM,
@@ -1153,19 +1230,55 @@ read_body_to_string(struct archive_read 
        tar_flush_unconsumed(a, unconsumed);
 
        /* Read the body into the string. */
-       *unconsumed = (size_t)((size + 511) & ~ 511);
-       src = __archive_read_ahead(a, *unconsumed, NULL);
+       src = __archive_read_ahead(a, size, NULL);
        if (src == NULL) {
+               archive_set_error(&a->archive, EINVAL,
+                   "Truncated archive"
+                   " detected while reading metadata");
                *unconsumed = 0;
                return (ARCHIVE_FATAL);
        }
        memcpy(as->s, src, (size_t)size);
        as->s[size] = '\0';
        as->length = (size_t)size;
+       *unconsumed += size;
        return (ARCHIVE_OK);
 }
 
 /*
+ * Read body of an archive entry into an archive_string object.
+ */
+static int
+read_body_to_string(struct archive_read *a, struct tar *tar,
+    struct archive_string *as, const void *h, size_t *unconsumed)
+{
+       int64_t size;
+       const struct archive_entry_header_ustar *header;
+       int r;
+
+       (void)tar; /* UNUSED */
+       header = (const struct archive_entry_header_ustar *)h;
+       size  = tar_atol(header->size, sizeof(header->size));
+       if (size > entry_limit) {
+               return (ARCHIVE_FATAL);
+       }
+       if ((size > (int64_t)pathname_limit) || (size < 0)) {
+               archive_string_empty(as);
+               int64_t to_consume = ((size + 511) & ~511);
+               if (to_consume != __archive_read_consume(a, to_consume)) {
+                       return (ARCHIVE_FATAL);
+               }
+               archive_set_error(&a->archive, EINVAL,
+                   "Special header too large: %d > 1MiB",
+                   (int)size);
+               return (ARCHIVE_WARN);
+       }
+       r = read_bytes_to_string(a, as, size, unconsumed);
+       *unconsumed += 0x1ff & (-size);
+       return(r);
+}
+
+/*
  * Parse out common header elements.
  *
  * This would be the same as header_old_tar, except that the
@@ -1180,21 +1293,28 @@ header_common(struct archive_read *a, st
     struct archive_entry *entry, const void *h)
 {
        const struct archive_entry_header_ustar *header;
-       char    tartype;
+       const char *existing_linkpath;
+       const wchar_t *existing_wcs_linkpath;
        int     err = ARCHIVE_OK;
 
        header = (const struct archive_entry_header_ustar *)h;
-       if (header->linkname[0])
-               archive_strncpy(&(tar->entry_linkpath),
-                   header->linkname, sizeof(header->linkname));
-       else
-               archive_string_empty(&(tar->entry_linkpath));
 
        /* Parse out the numeric fields (all are octal) */
-       archive_entry_set_mode(entry,
-               (mode_t)tar_atol(header->mode, sizeof(header->mode)));
-       archive_entry_set_uid(entry, tar_atol(header->uid, sizeof(header->uid)));
-       archive_entry_set_gid(entry, tar_atol(header->gid, sizeof(header->gid)));
+
+       /* Split mode handling: Set filetype always, perm only if not already set */
+       archive_entry_set_filetype(entry,
+           (mode_t)tar_atol(header->mode, sizeof(header->mode)));
+       if (!archive_entry_perm_is_set(entry)) {
+               archive_entry_set_perm(entry,
+                       (mode_t)tar_atol(header->mode, sizeof(header->mode)));
+       }
+       if (!archive_entry_uid_is_set(entry)) {
+               archive_entry_set_uid(entry, tar_atol(header->uid, sizeof(header->uid)));
+       }
+       if (!archive_entry_gid_is_set(entry)) {
+               archive_entry_set_gid(entry, tar_atol(header->gid, sizeof(header->gid)));
+       }
+
        tar->entry_bytes_remaining = tar_atol(header->size, sizeof(header->size));
        if (tar->entry_bytes_remaining < 0) {
                tar->entry_bytes_remaining = 0;
@@ -1202,28 +1322,49 @@ header_common(struct archive_read *a, st
                    "Tar entry has negative size");
                return (ARCHIVE_FATAL);
        }
-       if (tar->entry_bytes_remaining == INT64_MAX) {
-               /* Note: tar_atol returns INT64_MAX on overflow */
+       if (tar->entry_bytes_remaining > entry_limit) {
                tar->entry_bytes_remaining = 0;
                archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
                    "Tar entry size overflow");
                return (ARCHIVE_FATAL);
        }
-       tar->realsize = tar->entry_bytes_remaining;
-       archive_entry_set_size(entry, tar->entry_bytes_remaining);
-       archive_entry_set_mtime(entry, tar_atol(header->mtime, sizeof(header->mtime)), 0);
+       if (!tar->realsize_override) {
+               tar->realsize = tar->entry_bytes_remaining;
+       }
+       archive_entry_set_size(entry, tar->realsize);
+
+       if (!archive_entry_mtime_is_set(entry)) {
+               archive_entry_set_mtime(entry, tar_atol(header->mtime, sizeof(header->mtime)), 0);
+       }
 
        /* Handle the tar type flag appropriately. */
-       tartype = header->typeflag[0];
+       tar->filetype = header->typeflag[0];
 
-       switch (tartype) {
+       /*
+        * TODO: If the linkpath came from Pax extension header, then
+        * we should obey the hdrcharset_utf8 flag when converting these.
+        */
+       switch (tar->filetype) {
        case '1': /* Hard link */
-               if (archive_entry_copy_hardlink_l(entry, tar->entry_linkpath.s,
-                   archive_strlen(&(tar->entry_linkpath)), tar->sconv) != 0) {
-                       err = set_conversion_failed_error(a, tar->sconv,
-                           "Linkname");
-                       if (err == ARCHIVE_FATAL)
-                               return (err);
+               archive_entry_set_link_to_hardlink(entry);
+               existing_wcs_linkpath = archive_entry_hardlink_w(entry);
+               existing_linkpath = archive_entry_hardlink(entry);
+               if ((existing_linkpath == NULL || existing_linkpath[0] == '\0')
+                   && (existing_wcs_linkpath == NULL || existing_wcs_linkpath[0] == '\0')) {
+                       struct archive_string linkpath;
+                       archive_string_init(&linkpath);
+                       archive_strncpy(&linkpath,
+                                       header->linkname, sizeof(header->linkname));
+                       if (archive_entry_copy_hardlink_l(entry, linkpath.s,
+                                                         archive_strlen(&linkpath), tar->sconv) != 0) {
+                               err = set_conversion_failed_error(a, tar->sconv,
+                                                                 "Linkname");
+                               if (err == ARCHIVE_FATAL) {
+                                       archive_string_free(&linkpath);
+                                       return (err);
+                               }
+                       }
+                       archive_string_free(&linkpath);
                }
                /*
                 * The following may seem odd, but: Technically, tar
@@ -1283,16 +1424,29 @@ header_common(struct archive_read *a, st
                 */
                break;
        case '2': /* Symlink */
+               archive_entry_set_link_to_symlink(entry);
+               existing_wcs_linkpath = archive_entry_symlink_w(entry);
+               existing_linkpath = archive_entry_symlink(entry);
+               if ((existing_linkpath == NULL || existing_linkpath[0] == '\0')
+                   && (existing_wcs_linkpath == NULL || existing_wcs_linkpath[0] == '\0')) {
+                       struct archive_string linkpath;
+                       archive_string_init(&linkpath);
+                       archive_strncpy(&linkpath,
+                                       header->linkname, sizeof(header->linkname));
+                       if (archive_entry_copy_symlink_l(entry, linkpath.s,
+                           archive_strlen(&linkpath), tar->sconv) != 0) {
+                               err = set_conversion_failed_error(a, tar->sconv,
+                                   "Linkname");
+                               if (err == ARCHIVE_FATAL) {
+                                       archive_string_free(&linkpath);
+                                       return (err);
+                               }
+                       }
+                       archive_string_free(&linkpath);
+               }
                archive_entry_set_filetype(entry, AE_IFLNK);
                archive_entry_set_size(entry, 0);
                tar->entry_bytes_remaining = 0;
-               if (archive_entry_copy_symlink_l(entry, tar->entry_linkpath.s,
-                   archive_strlen(&(tar->entry_linkpath)), tar->sconv) != 0) {
-                       err = set_conversion_failed_error(a, tar->sconv,
-                           "Linkname");
-                       if (err == ARCHIVE_FATAL)
-                               return (err);
-               }
                break;
        case '3': /* Character device */
                archive_entry_set_filetype(entry, AE_IFCHR);
@@ -1342,15 +1496,9 @@ header_common(struct archive_read *a, st
                 * sparse information in the extended area.
                 */
                /* FALLTHROUGH */
-       case '0':
-               /*
-                * Enable sparse file "read" support only for regular
-                * files and explicit GNU sparse files.  However, we
-                * don't allow non-standard file types to be sparse.
-                */
-               tar->sparse_allowed = 1;
+       case '0': /* ustar "regular" file */
                /* FALLTHROUGH */
-       default: /* Regular file  and non-standard types */
+       default: /* Non-standard file types */
                /*
                 * Per POSIX: non-recognized types should always be
                 * treated as regular files.
@@ -1390,21 +1538,13 @@ header_old_tar(struct archive_read *a, s
 }
 
 /*
- * Read a Mac AppleDouble-encoded blob of file metadata,
- * if there is one.
+ * Is this likely an AppleDouble extension?
  */
 static int
-read_mac_metadata_blob(struct archive_read *a, struct tar *tar,
-    struct archive_entry *entry, const void *h, size_t *unconsumed)
-{
-       int64_t size;
-       size_t msize;
-       const void *data;
+is_mac_metadata_entry(struct archive_entry *entry) {
        const char *p, *name;
        const wchar_t *wp, *wname;
 
-       (void)h; /* UNUSED */
-
        wname = wp = archive_entry_pathname_w(entry);
        if (wp != NULL) {
                /* Find the last path element. */
@@ -1416,8 +1556,8 @@ read_mac_metadata_blob(struct archive_re
                 * If last path element starts with "._", then
                 * this is a Mac extension.
                 */
-               if (wname[0] != L'.' || wname[1] != L'_' || wname[2] == L'\0')
-                       return ARCHIVE_OK;
+               if (wname[0] == L'.' && wname[1] == L'_' && wname[2] != L'\0')
+                       return 1;
        } else {
                /* Find the last path element. */
                name = p = archive_entry_pathname(entry);
@@ -1431,9 +1571,29 @@ read_mac_metadata_blob(struct archive_re
                 * If last path element starts with "._", then
                 * this is a Mac extension.
                 */
-               if (name[0] != '.' || name[1] != '_' || name[2] == '\0')
-                       return ARCHIVE_OK;
+               if (name[0] == '.' && name[1] == '_' && name[2] != '\0')
+                       return 1;
        }
+       /* Not a mac extension */
+       return 0;
+}
+
+/*
+ * Read a Mac AppleDouble-encoded blob of file metadata,
+ * if there is one.
+ *
+ * TODO: In Libarchive 4, we should consider ripping this
+ * out -- instead, return a file starting with `._` as
+ * a regular file and let the client (or archive_write logic)
+ * handle it.
+ */
+static int
+read_mac_metadata_blob(struct archive_read *a,
+    struct archive_entry *entry, size_t *unconsumed)
+{
+       int64_t size;
+       size_t msize;
+       const void *data;
 
        /* Read the body as a Mac OS metadata blob. */
        size = archive_entry_size(entry);
@@ -1443,6 +1603,17 @@ read_mac_metadata_blob(struct archive_re
                return (ARCHIVE_FATAL);
        }
 
+       /* TODO: Should this merely skip the overlarge entry and
+        * WARN?  Or is xattr_limit sufficiently large that we can
+        * safely assume anything larger is malicious? */
+       if (size > (int64_t)xattr_limit) {
+               archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+                   "Oversized AppleDouble extension has size %llu > %llu",
+                   (unsigned long long)size,
+                   (unsigned long long)xattr_limit);
+               return (ARCHIVE_FATAL);
+       }
+
        /*
         * TODO: Look beyond the body here to peek at the next header.
         * If it's a regular header (not an extension header)
@@ -1455,15 +1626,16 @@ read_mac_metadata_blob(struct archive_re
         * Q: Is the above idea really possible?  Even
         * when there are GNU or pax extension entries?
         */
+       tar_flush_unconsumed(a, unconsumed);
        data = __archive_read_ahead(a, msize, NULL);
        if (data == NULL) {
                *unconsumed = 0;
                return (ARCHIVE_FATAL);
        }
+       archive_entry_clear(entry);
        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));
+       return (ARCHIVE_OK);
 }
 
 /*
@@ -1473,76 +1645,62 @@ static int
 header_pax_global(struct archive_read *a, struct tar *tar,
     struct archive_entry *entry, const void *h, size_t *unconsumed)
 {
-       int err;
-
-       err = read_body_to_string(a, tar, &(tar->pax_global), h, unconsumed);
-       if (err != ARCHIVE_OK)
-               return (err);
-       err = tar_read_header(a, tar, entry, unconsumed);
-       return (err);
-}
-
-static int
-header_pax_extensions(struct archive_read *a, struct tar *tar,
-    struct archive_entry *entry, const void *h, size_t *unconsumed)
-{
-       int err, err2;
-
-       err = read_body_to_string(a, tar, &(tar->pax_header), h, unconsumed);
-       if (err != ARCHIVE_OK)
-               return (err);
+       const struct archive_entry_header_ustar *header;
+       int64_t size, to_consume;
 
-       /* Parse the next header. */
-       err = tar_read_header(a, tar, entry, unconsumed);
-       if ((err != ARCHIVE_OK) && (err != ARCHIVE_WARN))
-               return (err);
+       (void)a; /* UNUSED */
+       (void)tar; /* UNUSED */
+       (void)entry; /* UNUSED */
 
-       /*
-        * TODO: Parse global/default options into 'entry' struct here
-        * before handling file-specific options.
-        *
-        * This design (parse standard header, then overwrite with pax
-        * extended attribute data) usually works well, but isn't ideal;
-        * it would be better to parse the pax extended attributes first
-        * and then skip any fields in the standard header that were
-        * defined in the pax header.
-        */
-       err2 = pax_header(a, tar, entry, &tar->pax_header);
-       err =  err_combine(err, err2);
-       tar->entry_padding = 0x1ff & (-tar->entry_bytes_remaining);
-       return (err);
+       header = (const struct archive_entry_header_ustar *)h;
+       size = tar_atol(header->size, sizeof(header->size));
+       if (size > entry_limit) {
+               return (ARCHIVE_FATAL);
+       }
+       to_consume = ((size + 511) & ~511);
+       *unconsumed += to_consume;
+       return (ARCHIVE_OK);
 }
 
-
 /*
  * Parse a file header for a Posix "ustar" archive entry.  This also
  * handles "pax" or "extended ustar" entries.
+ *
+ * In order to correctly handle pax attributes (which precede this),
+ * we have to skip parsing any field for which the entry already has
+ * contents.
  */
 static int
 header_ustar(struct archive_read *a, struct tar *tar,
     struct archive_entry *entry, const void *h)
 {
        const struct archive_entry_header_ustar *header;
-       struct archive_string *as;
+       struct archive_string as;
        int err = ARCHIVE_OK, r;
 
        header = (const struct archive_entry_header_ustar *)h;
 
        /* Copy name into an internal buffer to ensure null-termination. */
-       as = &(tar->entry_pathname);
-       if (header->prefix[0]) {
-               archive_strncpy(as, header->prefix, sizeof(header->prefix));
-               if (as->s[archive_strlen(as) - 1] != '/')
-                       archive_strappend_char(as, '/');
-               archive_strncat(as, header->name, sizeof(header->name));
-       } else {
-               archive_strncpy(as, header->name, sizeof(header->name));
-       }
-       if (archive_entry_copy_pathname_l(entry, as->s, archive_strlen(as),
-           tar->sconv) != 0) {
-               err = set_conversion_failed_error(a, tar->sconv, "Pathname");
-               if (err == ARCHIVE_FATAL)
-                       return (err);
+       const char *existing_pathname = archive_entry_pathname(entry);
+       const wchar_t *existing_wcs_pathname = archive_entry_pathname_w(entry);
+       if ((existing_pathname == NULL || existing_pathname[0] == '\0')
+           && (existing_wcs_pathname == NULL || existing_wcs_pathname[0] == '\0')) {
+               archive_string_init(&as);
+               if (header->prefix[0]) {
+                       archive_strncpy(&as, header->prefix, sizeof(header->prefix));
+                       if (as.s[archive_strlen(&as) - 1] != '/')
+                               archive_strappend_char(&as, '/');
+                       archive_strncat(&as, header->name, sizeof(header->name));
+               } else {
+                       archive_strncpy(&as, header->name, sizeof(header->name));
+               }
+               if (archive_entry_copy_pathname_l(entry, as.s, archive_strlen(&as),
+                   tar->sconv) != 0) {
+                       err = set_conversion_failed_error(a, tar->sconv, "Pathname");
+                       if (err == ARCHIVE_FATAL)
+                               return (err);
+               }
+               archive_string_free(&as);
        }
 
        /* Handle rest of common fields. */
@@ -1553,26 +1711,36 @@ header_ustar(struct archive_read *a, str
                err = r;
 
        /* Handle POSIX ustar fields. */
-       if (archive_entry_copy_uname_l(entry,
-           header->uname, sizeof(header->uname), tar->sconv) != 0) {
-               err = set_conversion_failed_error(a, tar->sconv, "Uname");
-               if (err == ARCHIVE_FATAL)
-                       return (err);
+       const char *existing_uname = archive_entry_uname(entry);
+       if (existing_uname == NULL || existing_uname[0] == '\0') {
+               if (archive_entry_copy_uname_l(entry,
+                   header->uname, sizeof(header->uname), tar->sconv) != 0) {
+                       err = set_conversion_failed_error(a, tar->sconv, "Uname");
+                       if (err == ARCHIVE_FATAL)
+                               return (err);
+               }
        }
 
-       if (archive_entry_copy_gname_l(entry,
-           header->gname, sizeof(header->gname), tar->sconv) != 0) {
-               err = set_conversion_failed_error(a, tar->sconv, "Gname");
-               if (err == ARCHIVE_FATAL)
-                       return (err);
+       const char *existing_gname = archive_entry_gname(entry);
+       if (existing_gname == NULL || existing_gname[0] == '\0') {
+               if (archive_entry_copy_gname_l(entry,
+                   header->gname, sizeof(header->gname), tar->sconv) != 0) {
+                       err = set_conversion_failed_error(a, tar->sconv, "Gname");
+                       if (err == ARCHIVE_FATAL)
+                               return (err);
+               }
        }
 
        /* Parse out device numbers only for char and block specials. */
        if (header->typeflag[0] == '3' || header->typeflag[0] == '4') {
-               archive_entry_set_rdevmajor(entry, (dev_t)
-                   tar_atol(header->rdevmajor, sizeof(header->rdevmajor)));
-               archive_entry_set_rdevminor(entry, (dev_t)
-                   tar_atol(header->rdevminor, sizeof(header->rdevminor)));
+               if (!archive_entry_rdev_is_set(entry)) {
+                       archive_entry_set_rdevmajor(entry, (dev_t)
+                           tar_atol(header->rdevmajor, sizeof(header->rdevmajor)));
+                       archive_entry_set_rdevminor(entry, (dev_t)
+                           tar_atol(header->rdevminor, sizeof(header->rdevminor)));
+               }
+       } else {
+               archive_entry_set_rdev(entry, 0);
        }
 
        tar->entry_padding = 0x1ff & (-tar->entry_bytes_remaining);
@@ -1580,117 +1748,205 @@ header_ustar(struct archive_read *a, str
        return (err);
 }
 
-
-/*
- * Parse the pax extended attributes record.
- *
- * Returns non-zero if there's an error in the data.
- */
 static int
-pax_header(struct archive_read *a, struct tar *tar,
-    struct archive_entry *entry, struct archive_string *in_as)
+header_pax_extension(struct archive_read *a, struct tar *tar,
+    struct archive_entry *entry, const void *h, size_t *unconsumed)
 {
-       size_t attr_length, l, line_length, value_length;
-       char *p;
-       char *key, *value;
-       struct archive_string *as;
+       /* Sanity checks: The largest `x` body I've ever heard of was
+        * a little over 4MB.  So I doubt there has ever been a
+        * well-formed archive with an `x` body over 1GiB.  Similarly,
+        * it seems plausible that no single attribute has ever been
+        * larger than 100MB.  So if we see a larger value here, it's
+        * almost certainly a sign of a corrupted/malicious archive. */
+
+       /* Maximum sane size for extension body: 1 GiB */
+       /* This cannot be raised to larger than 8GiB without
+        * exceeding the maximum size for a standard ustar
+        * entry. */
+       const int64_t ext_size_limit = 1024 * 1024 * (int64_t)1024;
+       /* Maximum size for a single line/attr: 100 million characters */
+       /* This cannot be raised to more than 2GiB without exceeding
+        * a `size_t` on 32-bit platforms. */
+       const size_t max_parsed_line_length = 99999999ULL;
+       /* Largest attribute prolog:  size + name. */
+       const size_t max_size_name = 512;
+
+       /* Size and padding of the full extension body */
+       int64_t ext_size, ext_padding;
+       size_t line_length, value_length, name_length;
+       ssize_t to_read, did_read;
+       const struct archive_entry_header_ustar *header;
+       const char *p, *attr_start, *name_start;
        struct archive_string_conv *sconv;
-       int err, err2;
-       char *attr = in_as->s;
+       struct archive_string *pas = NULL;
+       struct archive_string attr_name;
+       int err = ARCHIVE_OK, r;
 
-       attr_length = in_as->length;
-       tar->pax_hdrcharset_binary = 0;
-       archive_string_empty(&(tar->entry_gname));
-       archive_string_empty(&(tar->entry_linkpath));
-       archive_string_empty(&(tar->entry_pathname));
-       archive_string_empty(&(tar->entry_pathname_override));
-       archive_string_empty(&(tar->entry_uname));
-       err = ARCHIVE_OK;
-       while (attr_length > 0) {
-               /* Parse decimal length field at start of line. */
+       header = (const struct archive_entry_header_ustar *)h;
+       ext_size  = tar_atol(header->size, sizeof(header->size));
+       if (ext_size > entry_limit) {
+               return (ARCHIVE_FATAL);
+       }
+       if (ext_size < 0) {
+         archive_set_error(&a->archive, EINVAL,
+                           "pax extension header has invalid size: %lld",
+                           (long long)ext_size);
+         return (ARCHIVE_FATAL);
+       }
+
+       ext_padding = 0x1ff & (-ext_size);
+       if (ext_size > ext_size_limit) {
+               /* Consume the pax extension body and return an error */
+               if (ext_size + ext_padding != __archive_read_consume(a, ext_size + ext_padding)) {
+                       return (ARCHIVE_FATAL);
+               }
+               archive_set_error(&a->archive, EINVAL,
+                   "Ignoring oversized pax extensions: %d > %d",
+                   (int)ext_size, (int)ext_size_limit);
+               return (ARCHIVE_WARN);
+       }
+       tar_flush_unconsumed(a, unconsumed);
+
+       /* Parse the size/name of each pax attribute in the body */
+       archive_string_init(&attr_name);
+       while (ext_size > 0) {
+               /* Read enough bytes to parse the size/name of the next attribute */
+               to_read = max_size_name;
+               if (to_read > ext_size) {
+                       to_read = ext_size;
+               }
+               p = __archive_read_ahead(a, to_read, &did_read);
+               if (did_read < 0) {
+                       return ((int)did_read);
+               }
+               if (did_read == 0) { /* EOF */
+                       archive_set_error(&a->archive, EINVAL,
+                                         "Truncated tar archive"
+                                         " detected while reading pax attribute name");
+                       return (ARCHIVE_FATAL);
+               }
+               if (did_read > ext_size) {
+                       did_read = ext_size;
+               }
+
+               /* Parse size of attribute */
                line_length = 0;
-               l = attr_length;
-               p = attr; /* Record start of line. */
-               while (l>0) {
+               attr_start = p;
+               while (1) {
+                       if (p >= attr_start + did_read) {
+                               archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+                                                 "Ignoring malformed pax attributes: overlarge attribute size field");
+                               *unconsumed += ext_size + ext_padding;
+                               return (ARCHIVE_WARN);
+                       }
                        if (*p == ' ') {
                                p++;
-                               l--;
                                break;
                        }
                        if (*p < '0' || *p > '9') {
                                archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
-                                   "Ignoring malformed pax extended attributes");
+                                                 "Ignoring malformed pax attributes: malformed attribute size field");
+                               *unconsumed += ext_size + ext_padding;
                                return (ARCHIVE_WARN);
                        }
                        line_length *= 10;
                        line_length += *p - '0';
-                       if (line_length > 999999) {
+                       if (line_length > max_parsed_line_length) {
                                archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
-                                   "Rejecting pax extended attribute > 1MB");
+                                                 "Ignoring malformed pax attribute: size > %lld",
+                                                 (long long)max_parsed_line_length);
+                               *unconsumed += ext_size + ext_padding;
                                return (ARCHIVE_WARN);
                        }
                        p++;
-                       l--;
                }
 
-               /*
-                * Parsed length must be no bigger than available data,
-                * at least 1, and the last character of the line must
-                * be '\n'.
-                */
-               if (line_length > attr_length
-                   || line_length < 1
-                   || attr[line_length - 1] != '\n')
-               {
-                       archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
-                           "Ignoring malformed pax extended attribute");
-                       return (ARCHIVE_WARN);
+               if ((int64_t)line_length > ext_size) {
+                               archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+                                                 "Ignoring malformed pax attribute:  %lld > %lld",
+                                                 (long long)line_length, (long long)ext_size);
+                               *unconsumed += ext_size + ext_padding;
+                               return (ARCHIVE_WARN);
                }
 
-               /* Null-terminate the line. */
-               attr[line_length - 1] = '\0';
-
-               /* Find end of key and null terminate it. */
-               key = p;
-               if (key[0] == '=')
-                       return (-1);
-               while (*p && *p != '=')
-                       ++p;
-               if (*p == '\0') {
+               /* Parse name of attribute */
+               if (p >= attr_start + did_read
+                   || p >= attr_start + line_length
+                   || *p == '=') {
                        archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
-                           "Invalid pax extended attributes");
+                                         "Ignoring malformed pax attributes: empty name found");
+                       *unconsumed += ext_size + ext_padding;
                        return (ARCHIVE_WARN);
                }
-               *p = '\0';
+               name_start = p;
+               while (1) {
+                       if (p >= attr_start + did_read || p >= attr_start + line_length) {
+                               archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+                                                 "Ignoring malformed pax attributes: overlarge attribute name");
+                               *unconsumed += ext_size + ext_padding;
+                               return (ARCHIVE_WARN);
+                       }
+                       if (*p == '=') {
+                               break;
+                       }
+                       p++;
+               }
+               name_length = p - name_start;
+               p++; // Skip '='
 
-               value = p + 1;
+               archive_strncpy(&attr_name, name_start, name_length);
 
-               /* Some values may be binary data */
-               value_length = attr + line_length - 1 - value;
+               ext_size -= p - attr_start;
+               value_length = line_length - (p - attr_start);
 
-               /* Identify this attribute and set it in the entry. */
-               err2 = pax_attribute(a, tar, entry, key, value, value_length);
-               if (err2 == ARCHIVE_FATAL)
-                       return (err2);
-               err = err_combine(err, err2);
+               /* Consume size, name, and `=` */
+               *unconsumed += p - attr_start;
+               tar_flush_unconsumed(a, unconsumed);
+
+               /* pax_attribute will consume value_length - 1 */
+               r = pax_attribute(a, tar, entry, attr_name.s, archive_strlen(&attr_name), value_length - 1, unconsumed);
+               ext_size -= value_length - 1;
 
-               /* Skip to next line */
-               attr += line_length;
-               attr_length -= line_length;
+               if (r < ARCHIVE_WARN) {
+                       *unconsumed += ext_size + ext_padding;
+                       return (r);
+               }
+               err = err_combine(err, r);
+
+               /* Consume the `\n` that follows the pax attribute value. */
+               tar_flush_unconsumed(a, unconsumed);
+               p = __archive_read_ahead(a, 1, &did_read);
+               if (did_read < 0) {
+                       return ((int)did_read);
+               }
+               if (did_read == 0) {
+                       archive_set_error(&a->archive, EINVAL,
+                                         "Truncated tar archive"
+                                         " detected while completing pax attribute");
+                       return (ARCHIVE_FATAL);
+               }
+               if (p[0] != '\n') {
+                       archive_set_error(&a->archive, EINVAL,
+                                         "Malformed pax attributes");
+                       *unconsumed += ext_size + ext_padding;
+                       return (ARCHIVE_WARN);
+               }
+               ext_size -= 1;
+               *unconsumed += 1;
+               tar_flush_unconsumed(a, unconsumed);
        }
+       *unconsumed += ext_size + ext_padding;
 
        /*
-        * PAX format uses UTF-8 as default charset for its metadata
-        * unless hdrcharset=BINARY is present in its header.
-        * We apply the charset specified by the hdrcharset option only
-        * when the hdrcharset attribute(in PAX header) is BINARY because
-        * we respect the charset described in PAX header and BINARY also
-        * means that metadata(filename,uname and gname) character-set
-        * is unknown.
+        * Some PAX values -- pathname, linkpath, uname, gname --
+        * can't be copied into the entry until we know the character
+        * set to use:
         */
-       if (tar->pax_hdrcharset_binary)
+       if (!tar->pax_hdrcharset_utf8)
+               /* PAX specified "BINARY", so use the default charset */
                sconv = tar->opt_sconv;
        else {
+               /* PAX default UTF-8 */
                sconv = archive_string_conversion_from_charset(
                    &(a->archive), "UTF-8", 1);
                if (sconv == NULL)
@@ -1700,83 +1956,85 @@ pax_header(struct archive_read *a, struc
                            SCONV_SET_OPT_UTF8_LIBARCHIVE2X);
        }
 
+       /* Pathname */
+       pas = NULL;
+       if (archive_strlen(&(tar->entry_pathname_override)) > 0) {
+               /* Prefer GNU.sparse.name attribute if present */
+               /* GNU sparse files store a fake name under the standard
+                * "pathname" key. */
+               pas = &(tar->entry_pathname_override);
+       } else if (archive_strlen(&(tar->entry_pathname)) > 0) {
+               /* Use standard "pathname" PAX extension */
+               pas = &(tar->entry_pathname);
+       }
+       if (pas != NULL) {
+               if (archive_entry_copy_pathname_l(entry, pas->s,
+                   archive_strlen(pas), sconv) != 0) {
+                       err = set_conversion_failed_error(a, sconv, "Pathname");
+                       if (err == ARCHIVE_FATAL)
+                               return (err);
+                       /* Use raw name without conversion */
+                       archive_entry_copy_pathname(entry, pas->s);
+               }
+       }
+       /* Uname */
+       if (archive_strlen(&(tar->entry_uname)) > 0) {
+               if (archive_entry_copy_uname_l(entry, tar->entry_uname.s,
+                   archive_strlen(&(tar->entry_uname)), sconv) != 0) {
+                       err = set_conversion_failed_error(a, sconv, "Uname");
+                       if (err == ARCHIVE_FATAL)
+                               return (err);
+                       /* Use raw name without conversion */
+                       archive_entry_copy_uname(entry, tar->entry_uname.s);
+               }
+       }
+       /* Gname */
        if (archive_strlen(&(tar->entry_gname)) > 0) {
                if (archive_entry_copy_gname_l(entry, tar->entry_gname.s,
                    archive_strlen(&(tar->entry_gname)), sconv) != 0) {
                        err = set_conversion_failed_error(a, sconv, "Gname");
                        if (err == ARCHIVE_FATAL)
                                return (err);
-                       /* Use a converted an original name. */
+                       /* Use raw name without conversion */
                        archive_entry_copy_gname(entry, tar->entry_gname.s);
                }
        }
+       /* Linkpath */
        if (archive_strlen(&(tar->entry_linkpath)) > 0) {
                if (archive_entry_copy_link_l(entry, tar->entry_linkpath.s,
                    archive_strlen(&(tar->entry_linkpath)), sconv) != 0) {
-                       err = set_conversion_failed_error(a, sconv, "Linkname");
+                       err = set_conversion_failed_error(a, sconv, "Linkpath");
                        if (err == ARCHIVE_FATAL)
                                return (err);
-                       /* Use a converted an original name. */
+                       /* Use raw name without conversion */
                        archive_entry_copy_link(entry, tar->entry_linkpath.s);
                }
        }
-       /*
-        * Some extensions (such as the GNU sparse file extensions)
-        * deliberately store a synthetic name under the regular 'path'
-        * attribute and the real file name under a different attribute.
-        * Since we're supposed to not care about the order, we
-        * have no choice but to store all of the various filenames
-        * we find and figure it all out afterwards.  This is the
-        * figuring out part.
-        */
-       as = NULL;
-       if (archive_strlen(&(tar->entry_pathname_override)) > 0)
-               as = &(tar->entry_pathname_override);
-       else if (archive_strlen(&(tar->entry_pathname)) > 0)
-               as = &(tar->entry_pathname);
-       if (as != NULL) {
-               if (archive_entry_copy_pathname_l(entry, as->s,
-                   archive_strlen(as), sconv) != 0) {
-                       err = set_conversion_failed_error(a, sconv, "Pathname");
-                       if (err == ARCHIVE_FATAL)
-                               return (err);
-                       /* Use a converted an original name. */
-                       archive_entry_copy_pathname(entry, as->s);
-               }
-       }
-       if (archive_strlen(&(tar->entry_uname)) > 0) {
-               if (archive_entry_copy_uname_l(entry, tar->entry_uname.s,
-                   archive_strlen(&(tar->entry_uname)), sconv) != 0) {
-                       err = set_conversion_failed_error(a, sconv, "Uname");
-                       if (err == ARCHIVE_FATAL)
-                               return (err);
-                       /* Use a converted an original name. */
-                       archive_entry_copy_uname(entry, tar->entry_uname.s);
-               }
-       }
+
+       /* Extension may have given us a corrected `entry_bytes_remaining` for
+        * the main entry; update the padding appropriately. */
+       tar->entry_padding = 0x1ff & (-tar->entry_bytes_remaining);
        return (err);
 }
 
 static int
-pax_attribute_xattr(struct archive_entry *entry,
-       const char *name, const char *value)
+pax_attribute_LIBARCHIVE_xattr(struct archive_entry *entry,
+       const char *name, size_t name_length, const char *value, size_t value_length)
 {
        char *name_decoded;
        void *value_decoded;
        size_t value_len;
 
-       if (strlen(name) < 18 || (memcmp(name, "LIBARCHIVE.xattr.", 17)) != 0)
+       if (name_length < 1)
                return 3;
 
-       name += 17;
-
        /* URL-decode name */
-       name_decoded = url_decode(name);
+       name_decoded = url_decode(name, name_length);
        if (name_decoded == NULL)
                return 2;
 
        /* Base-64 decode value */
-       value_decoded = base64_decode(value, strlen(value), &value_len);
+       value_decoded = base64_decode(value, value_length, &value_len);
        if (value_decoded == NULL) {
                free(name_decoded);
                return 1;
@@ -1791,21 +2049,26 @@ pax_attribute_xattr(struct archive_entry
 }
 
 static int
-pax_attribute_schily_xattr(struct archive_entry *entry,
-       const char *name, const char *value, size_t value_length)
+pax_attribute_SCHILY_xattr(struct archive_entry *entry,
+       const char *name, size_t name_length, const char *value, size_t value_length)
 {
-       if (strlen(name) < 14 || (memcmp(name, "SCHILY.xattr.", 13)) != 0)
+       if (name_length < 1 || name_length > 128) {
                return 1;
+       }
 
-       name += 13;
-
-       archive_entry_xattr_add_entry(entry, name, value, value_length);
+       char * null_terminated_name = malloc(name_length + 1);
+       if (null_terminated_name != NULL) {
+               memcpy(null_terminated_name, name, name_length);
+               null_terminated_name[name_length] = '\0';
+               archive_entry_xattr_add_entry(entry, null_terminated_name, value, value_length);
+               free(null_terminated_name);
+       }
 
        return 0;
 }
 
 static int
-pax_attribute_rht_security_selinux(struct archive_entry *entry,
+pax_attribute_RHT_security_selinux(struct archive_entry *entry,
        const char *value, size_t value_length)
 {
        archive_entry_xattr_add_entry(entry, "security.selinux",
@@ -1815,10 +2078,11 @@ pax_attribute_rht_security_selinux(struc
 }
 
 static int
-pax_attribute_acl(struct archive_read *a, struct tar *tar,
-    struct archive_entry *entry, const char *value, int type)
+pax_attribute_SCHILY_acl(struct archive_read *a, struct tar *tar,
+       struct archive_entry *entry, size_t value_length, int type)
 {
        int r;
+       const char *p;
        const char* errstr;
 
        switch (type) {
@@ -1845,8 +2109,28 @@ pax_attribute_acl(struct archive_read *a
                        return (ARCHIVE_FATAL);
        }
 
-       r = archive_acl_from_text_l(archive_entry_acl(entry), value, type,
-           tar->sconv_acl);
+       if (value_length > acl_limit) {
+               __archive_read_consume(a, value_length);
+               archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+                                 "Unreasonably large ACL: %d > %d",
+                                 (int)value_length, (int)acl_limit);
+               return (ARCHIVE_WARN);
+       }
+
+       p = __archive_read_ahead(a, value_length, NULL);
+       if (p == NULL) {
+               archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+                                 "Truncated tar archive "
+                                 "detected while reading ACL data");
+               return (ARCHIVE_FATAL);
+       }
+
+       r = archive_acl_from_text_nl(archive_entry_acl(entry), p, value_length,
+           type, tar->sconv_acl);
+       __archive_read_consume(a, value_length);
+       /* Workaround: Force perm_is_set() to be correct */
+       /* If this bit were stored in the ACL, this wouldn't be needed */
+       archive_entry_set_perm(entry, archive_entry_perm(entry));
        if (r != ARCHIVE_OK) {
                if (r == ARCHIVE_FATAL) {
                        archive_set_error(&a->archive, ENOMEM,
@@ -1860,240 +2144,540 @@ pax_attribute_acl(struct archive_read *a
        return (r);
 }
 
+static int
+pax_attribute_read_time(struct archive_read *a, size_t value_length, int64_t *ps, long *pn, size_t *unconsumed) {
+       struct archive_string as;
+       int r;
+
+       if (value_length > 128) {
+               __archive_read_consume(a, value_length);
+               *ps = 0;
+               *pn = 0;
+               return (ARCHIVE_FATAL);
+       }
+
+       archive_string_init(&as);
+       r = read_bytes_to_string(a, &as, value_length, unconsumed);
+       if (r < ARCHIVE_OK) {
+               archive_string_free(&as);
+               return (r);
+       }
+
+       pax_time(as.s, archive_strlen(&as), ps, pn);
+       archive_string_free(&as);
+       if (*ps < 0 || *ps == INT64_MAX) {
+               return (ARCHIVE_WARN);
+       }
+       return (ARCHIVE_OK);
+}
+
+static int
+pax_attribute_read_number(struct archive_read *a, size_t value_length, int64_t *result) {
+       struct archive_string as;
+       size_t unconsumed = 0;
+       int r;
+
+       if (value_length > 64) {
+               __archive_read_consume(a, value_length);
+               *result = 0;
+               return (ARCHIVE_FATAL);
+       }
+
+       archive_string_init(&as);
+       r = read_bytes_to_string(a, &as, value_length, &unconsumed);
+       tar_flush_unconsumed(a, &unconsumed);
+       if (r < ARCHIVE_OK) {
+               archive_string_free(&as);
+               return (r);
+       }
+
+       *result = tar_atol10(as.s, archive_strlen(&as));
+       archive_string_free(&as);
+       if (*result < 0 || *result == INT64_MAX) {
+               *result = INT64_MAX;
+               return (ARCHIVE_WARN);
+       }
+       return (ARCHIVE_OK);
+}
+
 /*
- * Parse a single key=value attribute.  key/value pointers are
- * assumed to point into reasonably long-lived storage.
+ * Parse a single key=value attribute.
  *
- * Note that POSIX reserves all-lowercase keywords.  Vendor-specific
- * extensions should always have keywords of the form "VENDOR.attribute"
- * In particular, it's quite feasible to support many different
- * vendor extensions here.  I'm using "LIBARCHIVE" for extensions
- * unique to this library.
+ * POSIX reserves all-lowercase keywords.  Vendor-specific extensions
+ * should always have keywords of the form "VENDOR.attribute" In
+ * particular, it's quite feasible to support many different vendor
+ * extensions here.  I'm using "LIBARCHIVE" for extensions unique to
+ * this library.
  *
- * Investigate other vendor-specific extensions and see if
+ * TODO: Investigate other vendor-specific extensions and see if
  * any of them look useful.
  */
 static int
-pax_attribute(struct archive_read *a, struct tar *tar,
-    struct archive_entry *entry, const char *key, const char *value, size_t value_length)
+pax_attribute(struct archive_read *a, struct tar *tar, struct archive_entry *entry,
+             const char *key, size_t key_length, size_t value_length, size_t *unconsumed)
 {
-       int64_t s;
+       int64_t t;
        long n;
-       int err = ARCHIVE_OK, r;
+       const char *p;
+       ssize_t bytes_read;
+       int err = ARCHIVE_OK;
 
-       if (value == NULL)
-               value = "";     /* Disable compiler warning; do not pass
-                                * NULL pointer to strlen().  */
        switch (key[0]) {
        case 'G':
-               /* Reject GNU.sparse.* headers on non-regular files. */
-               if (strncmp(key, "GNU.sparse", 10) == 0 &&
-                   !tar->sparse_allowed) {
-                       archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
-                           "Non-regular file cannot be sparse");
-                       return (ARCHIVE_FATAL);
-               }
-
-               /* GNU "0.0" sparse pax format. */
-               if (strcmp(key, "GNU.sparse.numblocks") == 0) {
-                       tar->sparse_offset = -1;
-                       tar->sparse_numbytes = -1;
-                       tar->sparse_gnu_major = 0;
-                       tar->sparse_gnu_minor = 0;
-               }
-               if (strcmp(key, "GNU.sparse.offset") == 0) {
-                       tar->sparse_offset = tar_atol10(value, strlen(value));
-                       if (tar->sparse_numbytes != -1) {
-                               if (gnu_add_sparse_entry(a, tar,
-                                   tar->sparse_offset, tar->sparse_numbytes)
-                                   != ARCHIVE_OK)
-                                       return (ARCHIVE_FATAL);
-                               tar->sparse_offset = -1;
-                               tar->sparse_numbytes = -1;
+               /* GNU.* extensions */
+               if (key_length > 4 && memcmp(key, "GNU.", 4) == 0) {
+                       key += 4;
+                       key_length -= 4;
+
+                       /* GNU.sparse marks the existence of GNU sparse information */
+                       if (key_length == 6 && memcmp(key, "sparse", 6) == 0) {
+                               tar->sparse_gnu_attributes_seen = 1;
+                       }
+
+                       /* GNU.sparse.* extensions */
+                       else if (key_length > 7 && memcmp(key, "sparse.", 7) == 0) {
+                               tar->sparse_gnu_attributes_seen = 1;
+                               key += 7;
+                               key_length -= 7;
+
+                               /* GNU "0.0" sparse pax format. */
+                               if (key_length == 9 && memcmp(key, "numblocks", 9) == 0) {
+                                       /* GNU.sparse.numblocks */
+                                       tar->sparse_offset = -1;
+                                       tar->sparse_numbytes = -1;
+                                       tar->sparse_gnu_major = 0;
+                                       tar->sparse_gnu_minor = 0;
+                               }
+                               else if (key_length == 6 && memcmp(key, "offset", 6) == 0) {
+                                       /* GNU.sparse.offset */
+                                       if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
+                                               tar->sparse_offset = t;
+                                               if (tar->sparse_numbytes != -1) {
+                                                       if (gnu_add_sparse_entry(a, tar,
+                                                                        tar->sparse_offset, tar->sparse_numbytes)
+                                                           != ARCHIVE_OK)
+                                                               return (ARCHIVE_FATAL);
+                                                       tar->sparse_offset = -1;
+                                                       tar->sparse_numbytes = -1;
+                                               }
+                                       }
+                                       return (err);
+                               }
+                               else if (key_length == 8 && memcmp(key, "numbytes", 8) == 0) {
+                                       /* GNU.sparse.numbytes */
+                                       if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
+                                               tar->sparse_numbytes = t;
+                                               if (tar->sparse_offset != -1) {
+                                                       if (gnu_add_sparse_entry(a, tar,
+                                                                        tar->sparse_offset, tar->sparse_numbytes)
+                                                           != ARCHIVE_OK)
+                                                               return (ARCHIVE_FATAL);
+                                                       tar->sparse_offset = -1;
+                                                       tar->sparse_numbytes = -1;
+                                               }
+                                       }
+                                       return (err);
+                               }
+                               else if (key_length == 4 && memcmp(key, "size", 4) == 0) {
+                                       /* GNU.sparse.size */
+                                       if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
+                                               tar->realsize = t;
+                                               archive_entry_set_size(entry, tar->realsize);
+                                               tar->realsize_override = 1;
+                                       }
+                                       return (err);
+                               }
+
+                               /* GNU "0.1" sparse pax format. */
+                               else if (key_length == 3 && memcmp(key, "map", 3) == 0) {
+                                       /* GNU.sparse.map */
+                                       tar->sparse_gnu_major = 0;
+                                       tar->sparse_gnu_minor = 1;
+                                       if (value_length > sparse_map_limit) {
+                                               archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+                                                                 "Unreasonably large sparse map: %d > %d",
+                                                                 (int)value_length, (int)sparse_map_limit);
+                                               err = ARCHIVE_FAILED;
+                                       } else {
+                                               p = __archive_read_ahead(a, value_length, &bytes_read);
+                                               if (p != NULL) {
+                                                       if (gnu_sparse_01_parse(a, tar, p, value_length) != ARCHIVE_OK) {
+                                                               err = ARCHIVE_WARN;
+                                                       }
+                                               } else {
+                                                       return (ARCHIVE_FATAL);
+                                               }
+                                       }
+                                       __archive_read_consume(a, value_length);
+                                       return (err);
+                               }
+
+                               /* GNU "1.0" sparse pax format */
+                               else if (key_length == 5 && memcmp(key, "major", 5) == 0) {
+                                       /* GNU.sparse.major */
+                                       if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK
+                                           && t >= 0
+                                           && t <= 10) {
+                                               tar->sparse_gnu_major = (int)t;
+                                       }
+                                       return (err);
+                               }
+                               else if (key_length == 5 && memcmp(key, "minor", 5) == 0) {
+                                       /* GNU.sparse.minor */
+                                       if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK
+                                           && t >= 0
+                                           && t <= 10) {
+                                               tar->sparse_gnu_minor = (int)t;
+                                       }
+                                       return (err);
+                               }
+                               else if (key_length == 4 && memcmp(key, "name", 4) == 0) {
+                                       /* GNU.sparse.name */
+                                       /*
+                                        * The real filename; when storing sparse
+                                        * files, GNU tar puts a synthesized name into
+                                        * the regular 'path' attribute in an attempt
+                                        * to limit confusion. ;-)
+                                        */
+                                       if (value_length > pathname_limit) {
+                                               *unconsumed += value_length;
+                                               err = ARCHIVE_WARN;
+                                       } else {
+                                               err = read_bytes_to_string(a, &(tar->entry_pathname_override),
+                                                                          value_length, unconsumed);
+                                       }
+                                       return (err);
+                               }
+                               else if (key_length == 8 && memcmp(key, "realsize", 8) == 0) {
+                                       /* GNU.sparse.realsize */
+                                       if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
+                                               tar->realsize = t;
+                                               archive_entry_set_size(entry, tar->realsize);
+                                               tar->realsize_override = 1;
+                                       }
+                                       return (err);
+                               }
                        }
                }
-               if (strcmp(key, "GNU.sparse.numbytes") == 0) {
-                       tar->sparse_numbytes = tar_atol10(value, strlen(value));
-                       if (tar->sparse_offset != -1) {
-                               if (gnu_add_sparse_entry(a, tar,
-                                   tar->sparse_offset, tar->sparse_numbytes)
-                                   != ARCHIVE_OK)
-                                       return (ARCHIVE_FATAL);
-                               tar->sparse_offset = -1;
-                               tar->sparse_numbytes = -1;
-                       }
-               }
-               if (strcmp(key, "GNU.sparse.size") == 0) {
-                       tar->realsize = tar_atol10(value, strlen(value));
-                       archive_entry_set_size(entry, tar->realsize);
-                       tar->realsize_override = 1;
-               }
-
-               /* GNU "0.1" sparse pax format. */
-               if (strcmp(key, "GNU.sparse.map") == 0) {
-                       tar->sparse_gnu_major = 0;
-                       tar->sparse_gnu_minor = 1;
-                       if (gnu_sparse_01_parse(a, tar, value) != ARCHIVE_OK)
-                               return (ARCHIVE_WARN);
-               }
-
-               /* GNU "1.0" sparse pax format */
-               if (strcmp(key, "GNU.sparse.major") == 0) {
-                       tar->sparse_gnu_major = (int)tar_atol10(value, strlen(value));
-                       tar->sparse_gnu_pending = 1;
-               }
-               if (strcmp(key, "GNU.sparse.minor") == 0) {
-                       tar->sparse_gnu_minor = (int)tar_atol10(value, strlen(value));
-                       tar->sparse_gnu_pending = 1;
-               }
-               if (strcmp(key, "GNU.sparse.name") == 0) {
-                       /*
-                        * The real filename; when storing sparse
-                        * files, GNU tar puts a synthesized name into
-                        * the regular 'path' attribute in an attempt
-                        * to limit confusion. ;-)
-                        */
-                       archive_strcpy(&(tar->entry_pathname_override), value);
-               }
-               if (strcmp(key, "GNU.sparse.realsize") == 0) {
-                       tar->realsize = tar_atol10(value, strlen(value));
-                       archive_entry_set_size(entry, tar->realsize);
-                       tar->realsize_override = 1;
-               }
                break;
        case 'L':
-               /* Our extensions */
-/* TODO: Handle arbitrary extended attributes... */
-/*
-               if (strcmp(key, "LIBARCHIVE.xxxxxxx") == 0)
-                       archive_entry_set_xxxxxx(entry, value);
-*/
-               if (strcmp(key, "LIBARCHIVE.creationtime") == 0) {
-                       pax_time(value, &s, &n);
-                       archive_entry_set_birthtime(entry, s, n);
-               }
-               if (strcmp(key, "LIBARCHIVE.symlinktype") == 0) {
-                       if (strcmp(value, "file") == 0) {
-                               archive_entry_set_symlink_type(entry,
-                                   AE_SYMLINK_TYPE_FILE);
-                       } else if (strcmp(value, "dir") == 0) {
-                               archive_entry_set_symlink_type(entry,
-                                   AE_SYMLINK_TYPE_DIRECTORY);
+               /* LIBARCHIVE extensions */
+               if (key_length > 11 && memcmp(key, "LIBARCHIVE.", 11) == 0) {
+                       key_length -= 11;
+                       key += 11;
+
+                       /* TODO: Handle arbitrary extended attributes... */
+                       /*
+                         if (strcmp(key, "LIBARCHIVE.xxxxxxx") == 0)
+                                 archive_entry_set_xxxxxx(entry, value);
+                       */
+                       if (key_length == 12 && memcmp(key, "creationtime", 12) == 0) {
+                               /* LIBARCHIVE.creationtime */
+                               if ((err = pax_attribute_read_time(a, value_length, &t, &n, unconsumed)) == ARCHIVE_OK) {
+                                       archive_entry_set_birthtime(entry, t, n);
+                               }
+                               return (err);
+                       }
+                       else if (key_length == 11 && memcmp(key, "symlinktype", 11) == 0) {
+                               /* LIBARCHIVE.symlinktype */
+                               if (value_length < 16) {
+                                       p = __archive_read_ahead(a, value_length, &bytes_read);
+                                       if (p != NULL) {
+                                               if (value_length == 4 && memcmp(p, "file", 4) == 0) {
+                                                       archive_entry_set_symlink_type(entry,
+                                                                      AE_SYMLINK_TYPE_FILE);
+                                               } else if (value_length == 3 && memcmp(p, "dir", 3) == 0) {
+                                                       archive_entry_set_symlink_type(entry,
+                                                                      AE_SYMLINK_TYPE_DIRECTORY);
+                                               } else {
+                                                       archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+                                                                         "Unrecognized symlink type");
+                                                       err = ARCHIVE_WARN;
+                                               }
+                                       } else {
+                                               archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+                                                                 "Truncated tar archive "
+                                                                 "detected while reading `symlinktype` attribute");
+                                               return (ARCHIVE_FATAL);
+                                       }
+                               } else {
+                                       archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+                                                         "symlink type is very long"
+                                                         "(longest recognized value is 4 bytes, this is %d)",
+                                                         (int)value_length);
+                                       err = ARCHIVE_WARN;
+                               }
+                               __archive_read_consume(a, value_length);
+                               return (err);
+                       }
+                       else if (key_length > 6 && memcmp(key, "xattr.", 6) == 0) {
+                               key_length -= 6;
+                               key += 6;
+                               if (value_length > xattr_limit) {
+                                       err = ARCHIVE_WARN;
+                               } else {
+                                       p = __archive_read_ahead(a, value_length, &bytes_read);
+                                       if (p == NULL
+                                           || pax_attribute_LIBARCHIVE_xattr(entry, key, key_length, p, value_length)) {
+                                               /* TODO: Unable to parse xattr */
+                                               err = ARCHIVE_WARN;
+                                       }
+                               }
+                               __archive_read_consume(a, value_length);
+                               return (err);
                        }
                }
-               if (memcmp(key, "LIBARCHIVE.xattr.", 17) == 0)
-                       pax_attribute_xattr(entry, key, value);
                break;
        case 'R':
                /* GNU tar uses RHT.security header to store SELinux xattrs
                 * SCHILY.xattr.security.selinux == RHT.security.selinux */
-               if (strcmp(key, "RHT.security.selinux") == 0) {
-                       pax_attribute_rht_security_selinux(entry, value,
-                           value_length);
+               if (key_length == 20 && memcmp(key, "RHT.security.selinux", 20) == 0) {
+                       if (value_length > xattr_limit) {
+                               archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+                                                 "Ignoring unreasonably large security.selinux attribute:"
+                                                 " %d > %d",
+                                                 (int)value_length, (int)xattr_limit);
+                               /* TODO: Should this be FAILED instead? */
+                               err = ARCHIVE_WARN;
+                       } else {
+                               p = __archive_read_ahead(a, value_length, &bytes_read);
+                               if (p == NULL
+                                   || pax_attribute_RHT_security_selinux(entry, p, value_length)) {
+                                       /* TODO: Unable to parse xattr */
+                                       err = ARCHIVE_WARN;
+                               }
                        }
+                       __archive_read_consume(a, value_length);
+                       return (err);
+               }
                break;
        case 'S':
-               /* We support some keys used by the "star" archiver */
-               if (strcmp(key, "SCHILY.acl.access") == 0) {
-                       r = pax_attribute_acl(a, tar, entry, value,
-                           ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
-                       if (r == ARCHIVE_FATAL)
-                               return (r);
-               } else if (strcmp(key, "SCHILY.acl.default") == 0) {
-                       r = pax_attribute_acl(a, tar, entry, value,
-                           ARCHIVE_ENTRY_ACL_TYPE_DEFAULT);
-                       if (r == ARCHIVE_FATAL)
-                               return (r);
-               } else if (strcmp(key, "SCHILY.acl.ace") == 0) {
-                       r = pax_attribute_acl(a, tar, entry, value,
-                           ARCHIVE_ENTRY_ACL_TYPE_NFS4);
-                       if (r == ARCHIVE_FATAL)
-                               return (r);
-               } else if (strcmp(key, "SCHILY.devmajor") == 0) {
-                       archive_entry_set_rdevmajor(entry,
-                           (dev_t)tar_atol10(value, strlen(value)));
-               } else if (strcmp(key, "SCHILY.devminor") == 0) {
-                       archive_entry_set_rdevminor(entry,
-                           (dev_t)tar_atol10(value, strlen(value)));
-               } else if (strcmp(key, "SCHILY.fflags") == 0) {
-                       archive_entry_copy_fflags_text(entry, value);
-               } else if (strcmp(key, "SCHILY.dev") == 0) {
-                       archive_entry_set_dev(entry,
-                           (dev_t)tar_atol10(value, strlen(value)));
-               } else if (strcmp(key, "SCHILY.ino") == 0) {
-                       archive_entry_set_ino(entry,
-                           tar_atol10(value, strlen(value)));
-               } else if (strcmp(key, "SCHILY.nlink") == 0) {
-                       archive_entry_set_nlink(entry, (unsigned)
-                           tar_atol10(value, strlen(value)));
-               } else if (strcmp(key, "SCHILY.realsize") == 0) {
-                       tar->realsize = tar_atol10(value, strlen(value));
-                       tar->realsize_override = 1;
-                       archive_entry_set_size(entry, tar->realsize);
-               } else if (strncmp(key, "SCHILY.xattr.", 13) == 0) {
-                       pax_attribute_schily_xattr(entry, key, value,
-                           value_length);
-               } else if (strcmp(key, "SUN.holesdata") == 0) {
-                       /* A Solaris extension for sparse. */
-                       r = solaris_sparse_parse(a, tar, entry, value);
-                       if (r < err) {
-                               if (r == ARCHIVE_FATAL)
-                                       return (r);
-                               err = r;
-                               archive_set_error(&a->archive,
-                                   ARCHIVE_ERRNO_MISC,
-                                   "Parse error: SUN.holesdata");
+               /* SCHILY.* extensions used by "star" archiver */
+               if (key_length > 7 && memcmp(key, "SCHILY.", 7) == 0) {
+                       key_length -= 7;
+                       key += 7;
+
+                       if (key_length == 10 && memcmp(key, "acl.access", 10) == 0) {
+                               err = pax_attribute_SCHILY_acl(a, tar, entry, value_length,
+                                                     ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
+                               // TODO: Mark mode as set
+                               return (err);
+                       }
+                       else if (key_length == 11 && memcmp(key, "acl.default", 11) == 0) {
+                               err = pax_attribute_SCHILY_acl(a, tar, entry, value_length,
+                                                     ARCHIVE_ENTRY_ACL_TYPE_DEFAULT);
+                               return (err);
+                       }
+                       else if (key_length == 7 && memcmp(key, "acl.ace", 7) == 0) {
+                               err = pax_attribute_SCHILY_acl(a, tar, entry, value_length,
+                                                     ARCHIVE_ENTRY_ACL_TYPE_NFS4);
+                               // TODO: Mark mode as set
+                               return (err);
+                       }
+                       else if (key_length == 8 && memcmp(key, "devmajor", 8) == 0) {
+                               if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
+                                       archive_entry_set_rdevmajor(entry, (dev_t)t);
+                               }
+                               return (err);
+                       }
+                       else if (key_length == 8 && memcmp(key, "devminor", 8) == 0) {
+                               if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
+                                       archive_entry_set_rdevminor(entry, (dev_t)t);
+                               }
+                               return (err);
+                       }
+                       else if (key_length == 6 && memcmp(key, "fflags", 6) == 0) {
+                               if (value_length < fflags_limit) {
+                                       p = __archive_read_ahead(a, value_length, &bytes_read);
+                                       if (p != NULL) {
+                                               archive_entry_copy_fflags_text_len(entry, p, value_length);
+                                               err = ARCHIVE_OK;
+                                       } else {
+                                               /* Truncated archive */
+                                               err = ARCHIVE_FATAL;
+                                       }
+                               } else {
+                                       /* Overlong fflags field */
+                                       err = ARCHIVE_WARN;
+                               }
+                               __archive_read_consume(a, value_length);
+                               return (err);
+                       }
+                       else if (key_length == 3 && memcmp(key, "dev", 3) == 0) {
+                               if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
+                                       archive_entry_set_dev(entry, (dev_t)t);
+                               }
+                               return (err);
+                       }
+                       else if (key_length == 3 && memcmp(key, "ino", 3) == 0) {
+                               if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
+                                       archive_entry_set_ino(entry, t);
+                               }
+                               return (err);
+                       }
+                       else if (key_length == 5 && memcmp(key, "nlink", 5) == 0) {
+                               if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
+                                       archive_entry_set_nlink(entry, (unsigned int)t);
+                               }
+                               return (err);
+                       }
+                       else if (key_length == 8 && memcmp(key, "realsize", 8) == 0) {
+                               if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
+                                       tar->realsize = t;
+                                       tar->realsize_override = 1;
+                                       archive_entry_set_size(entry, tar->realsize);
+                               }
+                               return (err);
+                       }
+                       else if (key_length > 6 && memcmp(key, "xattr.", 6) == 0) {
+                               key_length -= 6;
+                               key += 6;
+                               if (value_length < xattr_limit) {
+                                       p = __archive_read_ahead(a, value_length, &bytes_read);
+                                       if (p == NULL
+                                           || pax_attribute_SCHILY_xattr(entry, key, key_length, p, value_length)) {
+                                               /* TODO: Unable to parse xattr */
+                                               err = ARCHIVE_WARN;
+                                       }
+                               } else {
+                                       archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+                                                         "Unreasonably large xattr: %d > %d",
+                                                         (int)value_length, (int)xattr_limit);
+                                       err = ARCHIVE_WARN;
+                               }
+                               __archive_read_consume(a, value_length);
+                               return (err);
+                       }
+               }
+               /* SUN.* extensions from Solaris tar */
+               if (key_length > 4 && memcmp(key, "SUN.", 4) == 0) {
+                       key_length -= 4;
+                       key += 4;
+
+                       if (key_length == 9 && memcmp(key, "holesdata", 9) == 0) {
+                               /* SUN.holesdata */
+                               if (value_length < sparse_map_limit) {
+                                       p = __archive_read_ahead(a, value_length, &bytes_read);
+                                       if (p != NULL) {
+                                               err = pax_attribute_SUN_holesdata(a, tar, entry, p, value_length);
+                                               if (err < ARCHIVE_OK) {
+                                                       archive_set_error(&a->archive,
+                                                                         ARCHIVE_ERRNO_MISC,
+                                                                         "Parse error: SUN.holesdata");
+                                               }
+                                       } else {
+                                               return (ARCHIVE_FATAL);
+                                       }
+                               } else {
+                                       archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+                                                         "Unreasonably large sparse map: %d > %d",
+                                                         (int)value_length, (int)sparse_map_limit);
+                                       err = ARCHIVE_FAILED;
+                               }
+                               __archive_read_consume(a, value_length);
+                               return (err);
                        }
                }
                break;
        case 'a':
-               if (strcmp(key, "atime") == 0) {
-                       pax_time(value, &s, &n);
-                       archive_entry_set_atime(entry, s, n);
+               if (key_length == 5 && memcmp(key, "atime", 5) == 0) {
+                       if ((err = pax_attribute_read_time(a, value_length, &t, &n, unconsumed)) == ARCHIVE_OK) {
+                               archive_entry_set_atime(entry, t, n);
+                       }
+                       return (err);
                }
                break;
        case 'c':
-               if (strcmp(key, "ctime") == 0) {
-                       pax_time(value, &s, &n);
-                       archive_entry_set_ctime(entry, s, n);
-               } else if (strcmp(key, "charset") == 0) {
+               if (key_length == 5 && memcmp(key, "ctime", 5) == 0) {
+                       if ((err = pax_attribute_read_time(a, value_length, &t, &n, unconsumed)) == ARCHIVE_OK) {
+                               archive_entry_set_ctime(entry, t, n);
+                       }
+                       return (err);
+               } else if (key_length == 7 && memcmp(key, "charset", 7) == 0) {
                        /* TODO: Publish charset information in entry. */
-               } else if (strcmp(key, "comment") == 0) {
+               } else if (key_length == 7 && memcmp(key, "comment", 7) == 0) {
                        /* TODO: Publish comment in entry. */
                }
                break;
        case 'g':
-               if (strcmp(key, "gid") == 0) {
-                       archive_entry_set_gid(entry,
-                           tar_atol10(value, strlen(value)));
-               } else if (strcmp(key, "gname") == 0) {
-                       archive_strcpy(&(tar->entry_gname), value);
+               if (key_length == 3 && memcmp(key, "gid", 3) == 0) {
+                       if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
+                               archive_entry_set_gid(entry, t);
+                       }
+                       return (err);
+               } else if (key_length == 5 && memcmp(key, "gname", 5) == 0) {
+                       if (value_length > guname_limit) {
+                               *unconsumed += value_length;
+                               err = ARCHIVE_WARN;
+                       } else {
+                               err = read_bytes_to_string(a, &(tar->entry_gname), value_length, unconsumed);
+                       }
+                       return (err);
                }
                break;
        case 'h':
-               if (strcmp(key, "hdrcharset") == 0) {
-                       if (strcmp(value, "BINARY") == 0)
-                               /* Binary  mode. */
-                               tar->pax_hdrcharset_binary = 1;
-                       else if (strcmp(value, "ISO-IR 10646 2000 UTF-8") == 0)
-                               tar->pax_hdrcharset_binary = 0;
+               if (key_length == 10 && memcmp(key, "hdrcharset", 10) == 0) {
+                       if (value_length < 64) {
+                               p = __archive_read_ahead(a, value_length, &bytes_read);
+                               if (p != NULL) {
+                                       if (value_length == 6
+                                           && memcmp(p, "BINARY", 6) == 0) {
+                                               /* Binary  mode. */
+                                               tar->pax_hdrcharset_utf8 = 0;
+                                               err = ARCHIVE_OK;
+                                       } else if (value_length == 23
+                                                  && memcmp(p, "ISO-IR 10646 2000 UTF-8", 23) == 0) {
+                                               tar->pax_hdrcharset_utf8 = 1;
+                                               err = ARCHIVE_OK;
+                                       } else {
+                                               /* TODO: Unrecognized character set */
+                                               err  = ARCHIVE_WARN;
+                                       }
+                               } else {
+                                       archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+                                                         "Truncated tar archive "
+                                                         "detected while reading hdrcharset attribute");
+                                       return (ARCHIVE_FATAL);
+                               }
+                       } else {
+                               archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+                                                 "hdrcharset attribute is unreasonably large (%d bytes)",
+                                                 (int)value_length);
+                               err = ARCHIVE_WARN;
+                       }
+                       __archive_read_consume(a, value_length);
+                       return (err);
                }
                break;
        case 'l':
                /* pax interchange doesn't distinguish hardlink vs. symlink. */
-               if (strcmp(key, "linkpath") == 0) {
-                       archive_strcpy(&(tar->entry_linkpath), value);
+               if (key_length == 8 && memcmp(key, "linkpath", 8) == 0) {
+                       if (value_length > pathname_limit) {
+                               *unconsumed += value_length;
+                               err = ARCHIVE_WARN;
+                       } else {
+                               err = read_bytes_to_string(a, &tar->entry_linkpath, value_length, unconsumed);
+                       }
+                       return (err);
                }
                break;
        case 'm':
-               if (strcmp(key, "mtime") == 0) {
-                       pax_time(value, &s, &n);
-                       archive_entry_set_mtime(entry, s, n);
+               if (key_length == 5 && memcmp(key, "mtime", 5) == 0) {
+                       if ((err = pax_attribute_read_time(a, value_length, &t, &n, unconsumed)) == ARCHIVE_OK) {
+                               archive_entry_set_mtime(entry, t, n);
+                       }
+                       return (err);
                }
                break;
        case 'p':
-               if (strcmp(key, "path") == 0) {
-                       archive_strcpy(&(tar->entry_pathname), value);
+               if (key_length == 4 && memcmp(key, "path", 4) == 0) {
+                       if (value_length > pathname_limit) {
+                               *unconsumed += value_length;
+                               err = ARCHIVE_WARN;
+                       } else {
+                               err = read_bytes_to_string(a, &(tar->entry_pathname), value_length, unconsumed);
+                       }
+                       return (err);
                }
                break;
        case 'r':
@@ -2102,48 +2686,54 @@ pax_attribute(struct archive_read *a, st
        case 's':
                /* POSIX has reserved 'security.*' */
                /* Someday: if (strcmp(key, "security.acl") == 0) { ... } */
-               if (strcmp(key, "size") == 0) {
+               if (key_length == 4 && memcmp(key, "size", 4) == 0) {
                        /* "size" is the size of the data in the entry. */
-                       tar->entry_bytes_remaining
-                           = tar_atol10(value, strlen(value));
-                       if (tar->entry_bytes_remaining < 0) {
-                               tar->entry_bytes_remaining = 0;
-                               archive_set_error(&a->archive,
-                                   ARCHIVE_ERRNO_MISC,
-                                   "Tar size attribute is negative");
-                               return (ARCHIVE_FATAL);
+                       if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
+                               tar->entry_bytes_remaining = t;
+                               /*
+                                * The "size" pax header keyword always overrides the
+                                * "size" field in the tar header.
+                                * GNU.sparse.realsize, GNU.sparse.size and
+                                * SCHILY.realsize override this value.
+                                */
+                               if (!tar->realsize_override) {
+                                       archive_entry_set_size(entry,
+                                                              tar->entry_bytes_remaining);
+                                       tar->realsize
+                                               = tar->entry_bytes_remaining;
+                               }
                        }
-                       if (tar->entry_bytes_remaining == INT64_MAX) {
-                               /* Note: tar_atol returns INT64_MAX on overflow */
+                       else if (t == INT64_MAX) {
+                               /* Note: pax_attr_read_number returns INT64_MAX on overflow or < 0 */
                                tar->entry_bytes_remaining = 0;
                                archive_set_error(&a->archive,
                                    ARCHIVE_ERRNO_MISC,
                                    "Tar size attribute overflow");
                                return (ARCHIVE_FATAL);
                        }
-                       /*
-                        * The "size" pax header keyword always overrides the
-                        * "size" field in the tar header.
-                        * GNU.sparse.realsize, GNU.sparse.size and
-                        * SCHILY.realsize override this value.
-                        */
-                       if (!tar->realsize_override) {
-                               archive_entry_set_size(entry,
-                                   tar->entry_bytes_remaining);
-                               tar->realsize
-                                   = tar->entry_bytes_remaining;
-                       }
+                       return (err);
                }
                break;
        case 'u':
-               if (strcmp(key, "uid") == 0) {
-                       archive_entry_set_uid(entry,
-                           tar_atol10(value, strlen(value)));
-               } else if (strcmp(key, "uname") == 0) {
-                       archive_strcpy(&(tar->entry_uname), value);
+               if (key_length == 3 && memcmp(key, "uid", 3) == 0) {
+                       if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
+                               archive_entry_set_uid(entry, t);
+                       }
+                       return (err);
+               } else if (key_length == 5 && memcmp(key, "uname", 5) == 0) {
+                       if (value_length > guname_limit) {
+                               *unconsumed += value_length;
+                               err = ARCHIVE_WARN;
+                       } else {
+                               err = read_bytes_to_string(a, &(tar->entry_uname), value_length, unconsumed);
+                       }
+                       return (err);
                }
                break;
        }
+
+       /* Unrecognized key, just skip the entire value. */
+       __archive_read_consume(a, value_length);
        return (err);
 }
 
@@ -2153,7 +2743,7 @@ pax_attribute(struct archive_read *a, st
  * parse a decimal time value, which may include a fractional portion
  */
 static void
-pax_time(const char *p, int64_t *ps, long *pn)
+pax_time(const char *p, size_t length, int64_t *ps, long *pn)
 {
        char digit;
        int64_t s;
@@ -2164,13 +2754,18 @@ pax_time(const char *p, int64_t *ps, lon
        limit = INT64_MAX / 10;
        last_digit_limit = INT64_MAX % 10;
 
+       if (length <= 0) {
+               *ps = 0;
+               return;
+       }
        s = 0;
        sign = 1;
        if (*p == '-') {
                sign = -1;
                p++;
+               length--;
        }
-       while (*p >= '0' && *p <= '9') {
+       while (length > 0 && *p >= '0' && *p <= '9') {
                digit = *p - '0';
                if (s > limit ||
                    (s == limit && digit > last_digit_limit)) {
@@ -2179,6 +2774,7 @@ pax_time(const char *p, int64_t *ps, lon
                }
                s = (s * 10) + digit;
                ++p;
+               --length;
        }
 
        *ps = s * sign;
@@ -2186,13 +2782,14 @@ pax_time(const char *p, int64_t *ps, lon
        /* Calculate nanoseconds. */
        *pn = 0;
 
-       if (*p != '.')
+       if (length <= 0 || *p != '.')
                return;
 
        l = 100000000UL;
        do {
                ++p;
-               if (*p >= '0' && *p <= '9')
+               --length;
+               if (length > 0 && *p >= '0' && *p <= '9')
                        *pn += (*p - '0') * l;
                else
                        break;
@@ -2223,49 +2820,65 @@ header_gnutar(struct archive_read *a, st
 
        /* Copy filename over (to ensure null termination). */
        header = (const struct archive_entry_header_gnutar *)h;
-       if (archive_entry_copy_pathname_l(entry,
-           header->name, sizeof(header->name), tar->sconv) != 0) {
-               err = set_conversion_failed_error(a, tar->sconv, "Pathname");
-               if (err == ARCHIVE_FATAL)
-                       return (err);
+       const char *existing_pathname = archive_entry_pathname(entry);
+       if (existing_pathname == NULL || existing_pathname[0] == '\0') {
+               if (archive_entry_copy_pathname_l(entry,
+                   header->name, sizeof(header->name), tar->sconv) != 0) {
+                       err = set_conversion_failed_error(a, tar->sconv, "Pathname");
+                       if (err == ARCHIVE_FATAL)
+                               return (err);
+               }
        }
 
        /* Fields common to ustar and GNU */
        /* XXX Can the following be factored out since it's common
         * to ustar and gnu tar?  Is it okay to move it down into
         * header_common, perhaps?  */
-       if (archive_entry_copy_uname_l(entry,
-           header->uname, sizeof(header->uname), tar->sconv) != 0) {
-               err = set_conversion_failed_error(a, tar->sconv, "Uname");
-               if (err == ARCHIVE_FATAL)
-                       return (err);
+       const char *existing_uname = archive_entry_uname(entry);
+       if (existing_uname == NULL || existing_uname[0] == '\0') {
+               if (archive_entry_copy_uname_l(entry,
+                   header->uname, sizeof(header->uname), tar->sconv) != 0) {
+                       err = set_conversion_failed_error(a, tar->sconv, "Uname");
+                       if (err == ARCHIVE_FATAL)
+                               return (err);
+               }
        }
 
-       if (archive_entry_copy_gname_l(entry,
-           header->gname, sizeof(header->gname), tar->sconv) != 0) {
-               err = set_conversion_failed_error(a, tar->sconv, "Gname");
-               if (err == ARCHIVE_FATAL)
-                       return (err);
+       const char *existing_gname = archive_entry_gname(entry);
+       if (existing_gname == NULL || existing_gname[0] == '\0') {
+               if (archive_entry_copy_gname_l(entry,
+                   header->gname, sizeof(header->gname), tar->sconv) != 0) {
+                       err = set_conversion_failed_error(a, tar->sconv, "Gname");
+                       if (err == ARCHIVE_FATAL)
+                               return (err);
+               }
        }
 
        /* Parse out device numbers only for char and block specials */
        if (header->typeflag[0] == '3' || header->typeflag[0] == '4') {
-               archive_entry_set_rdevmajor(entry, (dev_t)
-                   tar_atol(header->rdevmajor, sizeof(header->rdevmajor)));
-               archive_entry_set_rdevminor(entry, (dev_t)
-                   tar_atol(header->rdevminor, sizeof(header->rdevminor)));
-       } else
+               if (!archive_entry_rdev_is_set(entry)) {
+                       archive_entry_set_rdevmajor(entry, (dev_t)
+                           tar_atol(header->rdevmajor, sizeof(header->rdevmajor)));
+                       archive_entry_set_rdevminor(entry, (dev_t)
+                           tar_atol(header->rdevminor, sizeof(header->rdevminor)));
+               }
+       } else {
                archive_entry_set_rdev(entry, 0);
+       }
 
        tar->entry_padding = 0x1ff & (-tar->entry_bytes_remaining);
 
        /* Grab GNU-specific fields. */
-       t = tar_atol(header->atime, sizeof(header->atime));
-       if (t > 0)
-               archive_entry_set_atime(entry, t, 0);
-       t = tar_atol(header->ctime, sizeof(header->ctime));
-       if (t > 0)
-               archive_entry_set_ctime(entry, t, 0);
+       if (!archive_entry_atime_is_set(entry)) {
+               t = tar_atol(header->atime, sizeof(header->atime));
+               if (t > 0)
+                       archive_entry_set_atime(entry, t, 0);
+       }
+       if (!archive_entry_ctime_is_set(entry)) {
+               t = tar_atol(header->ctime, sizeof(header->ctime));
+               if (t > 0)
+                       archive_entry_set_ctime(entry, t, 0);
+       }
 
        if (header->realsize[0] != 0) {
                tar->realsize
@@ -2417,19 +3030,19 @@ gnu_sparse_old_parse(struct archive_read
  * importantly, the sparse data was lost when extracted by archivers
  * that didn't recognize this extension.
  */
-
 static int
-gnu_sparse_01_parse(struct archive_read *a, struct tar *tar, const char *p)
+gnu_sparse_01_parse(struct archive_read *a, struct tar *tar, const char *p, size_t length)
 {
        const char *e;
        int64_t offset = -1, size = -1;
 
        for (;;) {
                e = p;
-               while (*e != '\0' && *e != ',') {
+               while (length > 0 && *e != ',') {
                        if (*e < '0' || *e > '9')
                                return (ARCHIVE_WARN);
                        e++;
+                       length--;
                }
                if (offset < 0) {
                        offset = tar_atol10(p, e - p);
@@ -2444,9 +3057,10 @@ gnu_sparse_01_parse(struct archive_read 
                                return (ARCHIVE_FATAL);
                        offset = -1;
                }
-               if (*e == '\0')
+               if (length == 0)
                        return (ARCHIVE_OK);
                p = e + 1;
+               length--;
        }
 }
 
@@ -2568,8 +3182,8 @@ gnu_sparse_10_read(struct archive_read *
  * consist of both data and hole.
  */
 static int
-solaris_sparse_parse(struct archive_read *a, struct tar *tar,
-    struct archive_entry *entry, const char *p)
+pax_attribute_SUN_holesdata(struct archive_read *a, struct tar *tar,
+       struct archive_entry *entry, const char *p, size_t length)
 {
        const char *e;
        int64_t start, end;
@@ -2578,16 +3192,21 @@ solaris_sparse_parse(struct archive_read
        (void)entry; /* UNUSED */
 
        end = 0;
-       if (*p == ' ')
+       if (length <= 0)
+               return (ARCHIVE_WARN);
+       if (*p == ' ') {
                p++;
-       else
+               length--;
+       } else {
                return (ARCHIVE_WARN);
+       }
        for (;;) {
                e = p;
-               while (*e != '\0' && *e != ' ') {
+               while (length > 0 && *e != ' ') {
                        if (*e < '0' || *e > '9')
                                return (ARCHIVE_WARN);
                        e++;
+                       length--;
                }
                start = end;
                end = tar_atol10(p, e - p);
@@ -2599,9 +3218,15 @@ solaris_sparse_parse(struct archive_read
                                return (ARCHIVE_FATAL);
                        tar->sparse_last->hole = hole;
                }
-               if (*e == '\0')
-                       return (ARCHIVE_OK);
+               if (length == 0 || *e == '\n') {
+                       if (length == 0 && *e == '\n') {
+                               return (ARCHIVE_OK);
+                       } else {
+                               return (ARCHIVE_WARN);
+                       }
+               }
                p = e + 1;
+               length--;
                hole = hole == 0;
        }
 }
@@ -2903,22 +3528,23 @@ base64_decode(const char *s, size_t len,
 }
 
 static char *
-url_decode(const char *in)
+url_decode(const char *in, size_t length)
 {
        char *out, *d;
        const char *s;
 
-       out = (char *)malloc(strlen(in) + 1);
+       out = (char *)malloc(length + 1);
        if (out == NULL)
                return (NULL);
-       for (s = in, d = out; *s != '\0'; ) {
-               if (s[0] == '%' && s[1] != '\0' && s[2] != '\0') {
+       for (s = in, d = out; length > 0 && *s != '\0'; ) {
+               if (s[0] == '%' && length > 2) {
                        /* Try to convert % escape */
                        int digit1 = tohex(s[1]);
                        int digit2 = tohex(s[2]);
                        if (digit1 >= 0 && digit2 >= 0) {
                                /* Looks good, consume three chars */
                                s += 3;
+                               length -= 3;
                                /* Convert output */
                                *d++ = ((digit1 << 4) | digit2);
                                continue;
@@ -2926,6 +3552,7 @@ url_decode(const char *in)
                        /* Else fall through and treat '%' as normal char */
                }
                *d++ = *s++;
+               --length;
        }
        *d = '\0';
        return (out);
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_util.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_util.c:1.13 pkgsrc/archivers/libarchive/files/libarchive/archive_util.c:1.14
--- pkgsrc/archivers/libarchive/files/libarchive/archive_util.c:1.13    Tue Apr 30 06:05:19 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_util.c Sun Sep 15 07:02:21 2024
@@ -280,7 +280,8 @@ __archive_mktempx(const char *tmpdir, wc
                        if (archive_wstring_append_from_mbs(&temp_name, tmpdir,
                            strlen(tmpdir)) < 0)
                                goto exit_tmpfile;
-                       if (temp_name.s[temp_name.length-1] != L'/')
+                       if (temp_name.length == 0 ||
+                           temp_name.s[temp_name.length-1] != L'/')
                                archive_wstrappend_wchar(&temp_name, L'/');
                }
 
@@ -454,7 +455,7 @@ get_tempdir(struct archive_string *tempp
                 tmp = "/tmp";
 #endif
        archive_strcpy(temppath, tmp);
-       if (temppath->s[temppath->length-1] != '/')
+       if (temppath->length == 0 || temppath->s[temppath->length-1] != '/')
                archive_strappend_char(temppath, '/');
        return (ARCHIVE_OK);
 }
@@ -477,7 +478,8 @@ __archive_mktemp(const char *tmpdir)
                        goto exit_tmpfile;
        } else {
                archive_strcpy(&temp_name, tmpdir);
-               if (temp_name.s[temp_name.length-1] != '/')
+               if (temp_name.length == 0 ||
+                   temp_name.s[temp_name.length-1] != '/')
                        archive_strappend_char(&temp_name, '/');
        }
 #ifdef O_TMPFILE
@@ -538,7 +540,7 @@ __archive_mktempx(const char *tmpdir, ch
                                goto exit_tmpfile;
                } else
                        archive_strcpy(&temp_name, tmpdir);
-               if (temp_name.s[temp_name.length-1] == '/') {
+               if (temp_name.length > 0 && temp_name.s[temp_name.length-1] == '/') {
                        temp_name.s[temp_name.length-1] = '\0';
                        temp_name.length --;
                }

Index: pkgsrc/archivers/libarchive/files/libarchive/archive_entry_link_resolver.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_entry_link_resolver.c:1.8 pkgsrc/archivers/libarchive/files/libarchive/archive_entry_link_resolver.c:1.9
--- pkgsrc/archivers/libarchive/files/libarchive/archive_entry_link_resolver.c:1.8      Fri Apr 12 15:39:50 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_entry_link_resolver.c  Sun Sep 15 07:02:20 2024
@@ -201,16 +201,26 @@ archive_entry_linkify(struct archive_ent
                le = find_entry(res, *e);
                if (le != NULL) {
                        archive_entry_unset_size(*e);
+#if defined(_WIN32) && !defined(__CYGWIN__)
+                       archive_entry_copy_hardlink_w(*e,
+                           archive_entry_pathname_w(le->canonical));
+#else
                        archive_entry_copy_hardlink(*e,
                            archive_entry_pathname(le->canonical));
+#endif
                } else
                        insert_entry(res, *e);
                return;
        case ARCHIVE_ENTRY_LINKIFY_LIKE_MTREE:
                le = find_entry(res, *e);
                if (le != NULL) {
+#if defined(_WIN32) && !defined(__CYGWIN__)
+                       archive_entry_copy_hardlink_w(*e,
+                           archive_entry_pathname_w(le->canonical));
+#else
                        archive_entry_copy_hardlink(*e,
                            archive_entry_pathname(le->canonical));
+#endif
                } else
                        insert_entry(res, *e);
                return;
@@ -229,8 +239,13 @@ archive_entry_linkify(struct archive_ent
                        le->entry = t;
                        /* Make the old entry into a hardlink. */
                        archive_entry_unset_size(*e);
+#if defined(_WIN32) && !defined(__CYGWIN__)
+                       archive_entry_copy_hardlink_w(*e,
+                           archive_entry_pathname_w(le->canonical));
+#else
                        archive_entry_copy_hardlink(*e,
                            archive_entry_pathname(le->canonical));
+#endif
                        /* If we ran out of links, return the
                         * final entry as well. */
                        if (le->links == 0) {
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_private.h
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_private.h:1.8 pkgsrc/archivers/libarchive/files/libarchive/archive_private.h:1.9
--- pkgsrc/archivers/libarchive/files/libarchive/archive_private.h:1.8  Fri Apr 12 15:39:50 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_private.h      Sun Sep 15 07:02:20 2024
@@ -27,8 +27,10 @@
 #define ARCHIVE_PRIVATE_H_INCLUDED
 
 #ifndef __LIBARCHIVE_BUILD
+#ifndef __LIBARCHIVE_TEST
 #error This header is only to be used internally to libarchive.
 #endif
+#endif
 
 #if HAVE_ICONV_H
 #include <iconv.h>
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_read_disk_windows.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_read_disk_windows.c:1.8 pkgsrc/archivers/libarchive/files/libarchive/archive_read_disk_windows.c:1.9
--- pkgsrc/archivers/libarchive/files/libarchive/archive_read_disk_windows.c:1.8        Fri Apr 12 15:39:51 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_read_disk_windows.c    Sun Sep 15 07:02:21 2024
@@ -1955,6 +1955,8 @@ tree_dir_next_windows(struct tree *t, co
                                t->visit_type = r != 0 ? r : TREE_ERROR_DIR;
                                return (t->visit_type);
                        }
+                       /* Top stack item needs a regular visit. */
+                       t->current = t->stack;
                        t->findData = &t->_findData;
                        pattern = NULL;
                } else if (!FindNextFileW(t->d, &t->_findData)) {
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_ustar.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_ustar.c:1.8 pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_ustar.c:1.9
--- pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_ustar.c:1.8   Fri Apr 12 15:39:52 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_ustar.c       Sun Sep 15 07:02:21 2024
@@ -254,7 +254,11 @@ archive_write_ustar_header(struct archiv
                sconv = ustar->opt_sconv;
 
        /* Sanity check. */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+       if (archive_entry_pathname_w(entry) == NULL) {
+#else
        if (archive_entry_pathname(entry) == NULL) {
+#endif
                archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
                    "Can't record entry in tar file without pathname");
                return (ARCHIVE_FAILED);
@@ -263,7 +267,7 @@ archive_write_ustar_header(struct archiv
        /* Only regular files (not hardlinks) have data. */
        if (archive_entry_hardlink(entry) != NULL ||
            archive_entry_symlink(entry) != NULL ||
-           !(archive_entry_filetype(entry) == AE_IFREG))
+           archive_entry_filetype(entry) != AE_IFREG)
                archive_entry_set_size(entry, 0);
 
        if (AE_IFDIR == archive_entry_filetype(entry)) {
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_zip.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_zip.c:1.8 pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_zip.c:1.9
--- pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_zip.c:1.8     Fri Apr 12 15:39:52 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_zip.c Sun Sep 15 07:02:21 2024
@@ -609,7 +609,7 @@ archive_write_zip_header(struct archive_
                const char *p;
                size_t len;
 
-               if (archive_entry_pathname_l(entry, &p, &len, sconv) != 0) {
+               if (archive_entry_pathname_l(zip->entry, &p, &len, sconv) != 0) {
                        if (errno == ENOMEM) {
                                archive_set_error(&a->archive, ENOMEM,
                                    "Can't allocate memory for Pathname");
@@ -618,7 +618,7 @@ archive_write_zip_header(struct archive_
                        archive_set_error(&a->archive,
                            ARCHIVE_ERRNO_FILE_FORMAT,
                            "Can't translate Pathname '%s' to %s",
-                           archive_entry_pathname(entry),
+                           archive_entry_pathname(zip->entry),
                            archive_string_conversion_charset_name(sconv));
                        ret2 = ARCHIVE_WARN;
                }
@@ -631,7 +631,7 @@ archive_write_zip_header(struct archive_
                 * for filename.
                 */
                if (type == AE_IFLNK) {
-                       if (archive_entry_symlink_l(entry, &p, &len, sconv)) {
+                       if (archive_entry_symlink_l(zip->entry, &p, &len, sconv)) {
                                if (errno == ENOMEM) {
                                        archive_set_error(&a->archive, ENOMEM,
                                            "Can't allocate memory "
@@ -906,7 +906,7 @@ archive_write_zip_header(struct archive_
                        archive_le32enc(e, (uint32_t)archive_entry_ctime(entry));
                        e += 4;
                }
-               archive_le16enc(ut + 2, e - ut - 4);
+               archive_le16enc(ut + 2, (uint16_t)(e - ut - 4));
        }
 
        /*

Index: pkgsrc/archivers/libarchive/files/libarchive/archive_entry_private.h
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_entry_private.h:1.9 pkgsrc/archivers/libarchive/files/libarchive/archive_entry_private.h:1.10
--- pkgsrc/archivers/libarchive/files/libarchive/archive_entry_private.h:1.9    Fri Apr 12 15:39:50 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_entry_private.h        Sun Sep 15 07:02:20 2024
@@ -149,6 +149,7 @@ struct archive_entry {
 #define        AE_SET_FILETYPE 1024
 #define        AE_SET_UID      2048
 #define        AE_SET_GID      4096
+#define        AE_SET_RDEV     8192
 
        /*
         * Use aes here so that we get transparent mbs<->wcs conversions.
@@ -157,9 +158,8 @@ struct archive_entry {
        unsigned long ae_fflags_set;            /* Bitmap fflags */
        unsigned long ae_fflags_clear;
        struct archive_mstring ae_gname;                /* Name of owning group */
-       struct archive_mstring ae_hardlink;     /* Name of target for hardlink */
+       struct archive_mstring ae_linkname;     /* Name of target for hardlink or symlink */
        struct archive_mstring ae_pathname;     /* Name of entry */
-       struct archive_mstring ae_symlink;              /* symlink contents */
        struct archive_mstring ae_uname;                /* Name of owner */
 
        /* Not used within libarchive; useful for some clients. */
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_7zip.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_7zip.c:1.9 pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_7zip.c:1.10
--- pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_7zip.c:1.9 Tue Apr 30 06:05:19 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_7zip.c     Sun Sep 15 07:02:21 2024
@@ -877,10 +877,9 @@ archive_read_format_7zip_read_data(struc
        if (zip->end_of_entry)
                return (ARCHIVE_EOF);
 
-       const uint64_t max_read_size = 16 * 1024 * 1024;  // Don't try to read more than 16 MB at a time
-       size_t bytes_to_read = max_read_size;
+       size_t bytes_to_read = 16 * 1024 * 1024;  // Don't try to read more than 16 MB at a time
        if ((uint64_t)bytes_to_read > zip->entry_bytes_remaining) {
-               bytes_to_read = zip->entry_bytes_remaining;
+               bytes_to_read = (size_t)zip->entry_bytes_remaining;
        }
        bytes = read_stream(a, buff, bytes_to_read, 0);
        if (bytes < 0)
@@ -1063,8 +1062,8 @@ ppmd_read(void *p)
                 */
                ssize_t bytes_avail = 0;
                const uint8_t* data = __archive_read_ahead(a,
-                   zip->ppstream.stream_in+1, &bytes_avail);
-               if(bytes_avail < zip->ppstream.stream_in+1) {
+                   (size_t)zip->ppstream.stream_in+1, &bytes_avail);
+               if(data == NULL || bytes_avail < zip->ppstream.stream_in+1) {
                        archive_set_error(&a->archive,
                            ARCHIVE_ERRNO_FILE_FORMAT,
                            "Truncated 7z file data");
@@ -1767,6 +1766,10 @@ free_decompression(struct archive_read *
                zip->stream_valid = 0;
        }
 #endif
+#ifdef HAVE_ZSTD_H
+       if (zip->zstdstream_valid)
+               ZSTD_freeDStream(zip->zstd_dstream);
+#endif
        if (zip->ppmd7_valid) {
                __archive_ppmd7_functions.Ppmd7_Free(
                        &zip->ppmd7_context);
@@ -2308,7 +2311,7 @@ read_SubStreamsInfo(struct archive_read 
        usizes = ss->unpackSizes;
        for (i = 0; i < numFolders; i++) {
                unsigned pack;
-               uint64_t sum;
+               uint64_t size, sum;
 
                if (f[i].numUnpackStreams == 0)
                        continue;
@@ -2318,10 +2321,15 @@ read_SubStreamsInfo(struct archive_read 
                        for (pack = 1; pack < f[i].numUnpackStreams; pack++) {
                                if (parse_7zip_uint64(a, usizes) < 0)
                                        return (-1);
+                               if (*usizes > UINT64_MAX - sum)
+                                       return (-1);
                                sum += *usizes++;
                        }
                }
-               *usizes++ = folder_uncompressed_size(&f[i]) - sum;
+               size = folder_uncompressed_size(&f[i]);
+               if (size < sum)
+                       return (-1);
+               *usizes++ = size - sum;
        }
 
        if (type == kSize) {
@@ -2415,6 +2423,8 @@ read_StreamsInfo(struct archive_read *a,
                packPos = si->pi.pos;
                for (i = 0; i < si->pi.numPackStreams; i++) {
                        si->pi.positions[i] = packPos;
+                       if (packPos > UINT64_MAX - si->pi.sizes[i])
+                               return (-1);
                        packPos += si->pi.sizes[i];
                        if (packPos > zip->header_offset)
                                return (-1);
@@ -2436,6 +2446,10 @@ read_StreamsInfo(struct archive_read *a,
                f = si->ci.folders;
                for (i = 0; i < si->ci.numFolders; i++) {
                        f[i].packIndex = packIndex;
+                       if (f[i].numPackedStreams > UINT32_MAX)
+                               return (-1);
+                       if (packIndex > UINT32_MAX - (uint32_t)f[i].numPackedStreams)
+                               return (-1);
                        packIndex += (uint32_t)f[i].numPackedStreams;
                        if (packIndex > si->pi.numPackStreams)
                                return (-1);
@@ -3000,7 +3014,7 @@ slurp_central_directory(struct archive_r
        /* CRC check. */
        if (crc32(0, (const unsigned char *)p + 12, 20)
            != archive_le32dec(p + 8)) {
-#ifdef DONT_FAIL_ON_CRC_ERROR
+#ifndef DONT_FAIL_ON_CRC_ERROR
                archive_set_error(&a->archive, -1, "Header CRC error");
                return (ARCHIVE_FATAL);
 #endif
@@ -3142,7 +3156,7 @@ get_uncompressed_data(struct archive_rea
                /* Copy mode. */
 
                *buff = __archive_read_ahead(a, minimum, &bytes_avail);
-               if (bytes_avail <= 0) {
+               if (*buff == NULL) {
                        archive_set_error(&a->archive,
                            ARCHIVE_ERRNO_FILE_FORMAT,
                            "Truncated 7-Zip file data");
@@ -3448,7 +3462,7 @@ read_stream(struct archive_read *a, cons
        /*
         * Skip the bytes we already has skipped in skip_stream().
         */
-       while (skip_bytes) {
+       while (1) {
                ssize_t skipped;
 
                if (zip->uncompressed_buffer_bytes_remaining == 0) {
@@ -3468,6 +3482,10 @@ read_stream(struct archive_read *a, cons
                                return (ARCHIVE_FATAL);
                        }
                }
+
+               if (!skip_bytes)
+                       break;
+
                skipped = get_uncompressed_data(
                        a, buff, (size_t)skip_bytes, 0);
                if (skipped < 0)
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_ar.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_ar.c:1.9 pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_ar.c:1.10
--- pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_ar.c:1.9   Tue Apr 30 06:05:19 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_ar.c       Sun Sep 15 07:02:21 2024
@@ -439,9 +439,9 @@ archive_read_format_ar_read_header(struc
        if ((header_data = __archive_read_ahead(a, 60, NULL)) == NULL)
                /* Broken header. */
                return (ARCHIVE_EOF);
-       
+
        unconsumed = 60;
-       
+
        ret = _ar_read_header(a, entry, ar, (const char *)header_data, &unconsumed);
 
        if (unconsumed)
@@ -458,7 +458,6 @@ ar_parse_common_header(struct ar *ar, st
        uint64_t n;
 
        /* Copy remaining header */
-       archive_entry_set_filetype(entry, AE_IFREG);
        archive_entry_set_mtime(entry,
            (time_t)ar_atol10(h + AR_date_offset, AR_date_size), 0L);
        archive_entry_set_uid(entry,
@@ -467,6 +466,7 @@ ar_parse_common_header(struct ar *ar, st
            (gid_t)ar_atol10(h + AR_gid_offset, AR_gid_size));
        archive_entry_set_mode(entry,
            (mode_t)ar_atol8(h + AR_mode_offset, AR_mode_size));
+       archive_entry_set_filetype(entry, AE_IFREG);
        n = ar_atol10(h + AR_size_offset, AR_size_size);
 
        ar->entry_offset = 0;
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_lha.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_lha.c:1.9 pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_lha.c:1.10
--- pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_lha.c:1.9  Tue Apr 30 06:05:19 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_lha.c      Sun Sep 15 07:02:21 2024
@@ -227,7 +227,7 @@ static int  lha_read_file_header_1(struct
 static int     lha_read_file_header_2(struct archive_read *, struct lha *);
 static int     lha_read_file_header_3(struct archive_read *, struct lha *);
 static int     lha_read_file_extended_header(struct archive_read *,
-                   struct lha *, uint16_t *, int, size_t, size_t *);
+                   struct lha *, uint16_t *, int, uint64_t, size_t *);
 static size_t  lha_check_header_format(const void *);
 static int     lha_skip_sfx(struct archive_read *);
 static time_t  lha_dos_time(const unsigned char *);
@@ -945,7 +945,7 @@ lha_read_file_header_1(struct archive_re
 
        /* Read extended headers */
        err2 = lha_read_file_extended_header(a, lha, NULL, 2,
-           (size_t)(lha->compsize + 2), &extdsize);
+           (uint64_t)(lha->compsize + 2), &extdsize);
        if (err2 < ARCHIVE_WARN)
                return (err2);
        if (err2 < err)
@@ -1138,7 +1138,7 @@ invalid:
  */
 static int
 lha_read_file_extended_header(struct archive_read *a, struct lha *lha,
-    uint16_t *crc, int sizefield_length, size_t limitsize, size_t *total_size)
+    uint16_t *crc, int sizefield_length, uint64_t limitsize, size_t *total_size)
 {
        const void *h;
        const unsigned char *extdheader;
@@ -1187,8 +1187,7 @@ lha_read_file_extended_header(struct arc
                }
 
                /* Sanity check to the extended header size. */
-               if (((uint64_t)*total_size + extdsize) >
-                                   (uint64_t)limitsize ||
+               if (((uint64_t)*total_size + extdsize) > limitsize ||
                    extdsize <= (size_t)sizefield_length)
                        goto invalid;
 
@@ -1347,6 +1346,8 @@ lha_read_file_extended_header(struct arc
                                lha->compsize = archive_le64dec(extdheader);
                                extdheader += sizeof(uint64_t);
                                lha->origsize = archive_le64dec(extdheader);
+                               if (lha->compsize < 0 || lha->origsize < 0)
+                                       goto invalid;
                        }
                        break;
                case EXT_CODEPAGE:
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_shar.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_shar.c:1.9 pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_shar.c:1.10
--- pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_shar.c:1.9    Fri Apr 12 15:39:52 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_shar.c        Sun Sep 15 07:02:21 2024
@@ -209,6 +209,10 @@ archive_write_shar_header(struct archive
        if (archive_entry_filetype(entry) != AE_IFDIR) {
                /* Try to create the dir. */
                p = strdup(name);
+               if (p == NULL) {
+                       archive_set_error(&a->archive, ENOMEM, "Out of memory");
+                       return (ARCHIVE_FATAL);
+               }
                pp = strrchr(p, '/');
                /* If there is a / character, try to create the dir. */
                if (pp != NULL) {
@@ -291,6 +295,10 @@ archive_write_shar_header(struct archive
                        free(shar->last_dir);
 
                        shar->last_dir = strdup(name);
+                       if (shar->last_dir == NULL) {
+                               archive_set_error(&a->archive, ENOMEM, "Out of memory");
+                               return (ARCHIVE_FATAL);
+                       }
                        /* Trim a trailing '/'. */
                        pp = strrchr(shar->last_dir, '/');
                        if (pp != NULL && pp[1] == '\0')
Index: pkgsrc/archivers/libarchive/files/libarchive/config_freebsd.h
diff -u pkgsrc/archivers/libarchive/files/libarchive/config_freebsd.h:1.9 pkgsrc/archivers/libarchive/files/libarchive/config_freebsd.h:1.10
--- pkgsrc/archivers/libarchive/files/libarchive/config_freebsd.h:1.9   Fri Apr 12 15:39:52 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/config_freebsd.h       Sun Sep 15 07:02:21 2024
@@ -203,7 +203,6 @@
 #define HAVE_SYS_MOUNT_H 1
 #define HAVE_SYS_PARAM_H 1
 #define HAVE_SYS_POLL_H 1
-#define HAVE_SYS_QUEUE_H 1
 #define HAVE_SYS_SELECT_H 1
 #define HAVE_SYS_STATVFS_H 1
 #define HAVE_SYS_STAT_H 1

Index: pkgsrc/archivers/libarchive/files/libarchive/archive_read_disk_entry_from_file.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_read_disk_entry_from_file.c:1.16 pkgsrc/archivers/libarchive/files/libarchive/archive_read_disk_entry_from_file.c:1.17
--- pkgsrc/archivers/libarchive/files/libarchive/archive_read_disk_entry_from_file.c:1.16       Fri Apr 12 15:39:51 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_read_disk_entry_from_file.c    Sun Sep 15 07:02:21 2024
@@ -520,6 +520,7 @@ setup_xattr(struct archive_read_disk *a,
        if (size == -1) {
                archive_set_error(&a->archive, errno,
                    "Couldn't read extended attribute");
+               free(value);
                return (ARCHIVE_WARN);
        }
 

Index: pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_filter_lzop.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_filter_lzop.c:1.5 pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_filter_lzop.c:1.6
--- pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_filter_lzop.c:1.5 Fri Apr 12 15:39:51 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_filter_lzop.c     Sun Sep 15 07:02:21 2024
@@ -291,7 +291,8 @@ consume_header(struct archive_read_filte
                if (p == NULL)
                        goto truncated;
                len = archive_be32dec(p);
-               __archive_read_filter_consume(self->upstream, len + 4 + 4);
+               __archive_read_filter_consume(self->upstream,
+                   (int64_t)len + 4 + 4);
        }
        state->flags = flags;
        state->in_stream = 1;
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_write_add_filter_bzip2.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_write_add_filter_bzip2.c:1.5 pkgsrc/archivers/libarchive/files/libarchive/archive_write_add_filter_bzip2.c:1.6
--- pkgsrc/archivers/libarchive/files/libarchive/archive_write_add_filter_bzip2.c:1.5   Fri Apr 12 15:39:52 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_write_add_filter_bzip2.c       Sun Sep 15 07:02:21 2024
@@ -168,7 +168,7 @@ archive_compressor_bzip2_open(struct arc
        if (data->compressed == NULL) {
                size_t bs = 65536, bpb;
                if (f->archive->magic == ARCHIVE_WRITE_MAGIC) {
-                       /* Buffer size should be a multiple number of the of bytes
+                       /* Buffer size should be a multiple number of the bytes
                         * per block for performance. */
                        bpb = archive_write_get_bytes_per_block(f->archive);
                        if (bpb > bs)
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_v7tar.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_v7tar.c:1.5 pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_v7tar.c:1.6
--- pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_v7tar.c:1.5   Fri Apr 12 15:39:52 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_v7tar.c       Sun Sep 15 07:02:21 2024
@@ -241,7 +241,7 @@ archive_write_v7tar_header(struct archiv
        /* Only regular files (not hardlinks) have data. */
        if (archive_entry_hardlink(entry) != NULL ||
            archive_entry_symlink(entry) != NULL ||
-           !(archive_entry_filetype(entry) == AE_IFREG))
+           archive_entry_filetype(entry) != AE_IFREG)
                archive_entry_set_size(entry, 0);
 
        if (AE_IFDIR == archive_entry_filetype(entry)) {

Index: pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_filter_rpm.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_filter_rpm.c:1.3 pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_filter_rpm.c:1.4
--- pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_filter_rpm.c:1.3  Fri Apr 12 15:39:51 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_filter_rpm.c      Sun Sep 15 07:02:21 2024
@@ -39,8 +39,8 @@
 
 struct rpm {
        int64_t          total_in;
-       size_t           hpos;
-       size_t           hlen;
+       uint64_t         hpos;
+       uint64_t         hlen;
        unsigned char    header[16];
        enum {
                ST_LEAD,        /* Skipping 'Lead' section. */
@@ -53,7 +53,8 @@ struct rpm {
        }                state;
        int              first_header;
 };
-#define RPM_LEAD_SIZE  96      /* Size of 'Lead' section. */
+#define RPM_LEAD_SIZE          96      /* Size of 'Lead' section. */
+#define RPM_MIN_HEAD_SIZE      16      /* Minimum size of 'Head'. */
 
 static int     rpm_bidder_bid(struct archive_read_filter_bidder *,
                    struct archive_read_filter *);
@@ -63,6 +64,8 @@ static ssize_t        rpm_filter_read(struct ar
                    const void **);
 static int     rpm_filter_close(struct archive_read_filter *);
 
+static inline size_t rpm_limit_bytes(uint64_t, size_t);
+
 #if ARCHIVE_VERSION_NUMBER < 4000000
 /* Deprecated; remove in libarchive 4.0 */
 int
@@ -155,15 +158,21 @@ rpm_bidder_init(struct archive_read_filt
        return (ARCHIVE_OK);
 }
 
+static inline size_t
+rpm_limit_bytes(uint64_t bytes, size_t max)
+{
+       return (bytes > max ? max : (size_t)bytes);
+}
+
 static ssize_t
 rpm_filter_read(struct archive_read_filter *self, const void **buff)
 {
        struct rpm *rpm;
        const unsigned char *b;
-       ssize_t avail_in, total;
-       size_t used, n;
-       uint32_t section;
-       uint32_t bytes;
+       ssize_t avail_in, total, used;
+       size_t n;
+       uint64_t section;
+       uint64_t bytes;
 
        rpm = (struct rpm *)self->data;
        *buff = NULL;
@@ -197,15 +206,14 @@ rpm_filter_read(struct archive_read_filt
                        }
                        break;
                case ST_HEADER:
-                       n = 16 - rpm->hpos;
-                       if (n > avail_in - used)
-                               n = avail_in - used;
+                       n = rpm_limit_bytes(RPM_MIN_HEAD_SIZE - rpm->hpos,
+                           avail_in - used);
                        memcpy(rpm->header+rpm->hpos, b, n);
                        b += n;
                        used += n;
                        rpm->hpos += n;
 
-                       if (rpm->hpos == 16) {
+                       if (rpm->hpos == RPM_MIN_HEAD_SIZE) {
                                if (rpm->header[0] != 0x8e ||
                                    rpm->header[1] != 0xad ||
                                    rpm->header[2] != 0xe8 ||
@@ -219,21 +227,20 @@ rpm_filter_read(struct archive_read_filt
                                        }
                                        rpm->state = ST_ARCHIVE;
                                        *buff = rpm->header;
-                                       total = rpm->hpos;
+                                       total = RPM_MIN_HEAD_SIZE;
                                        break;
                                }
                                /* Calculate 'Header' length. */
                                section = archive_be32dec(rpm->header+8);
                                bytes = archive_be32dec(rpm->header+12);
-                               rpm->hlen = 16 + section * 16 + bytes;
+                               rpm->hlen = rpm->hpos + section * 16 + bytes;
                                rpm->state = ST_HEADER_DATA;
                                rpm->first_header = 0;
                        }
                        break;
                case ST_HEADER_DATA:
-                       n = rpm->hlen - rpm->hpos;
-                       if (n > avail_in - used)
-                               n = avail_in - used;
+                       n = rpm_limit_bytes(rpm->hlen - rpm->hpos,
+                           avail_in - used);
                        b += n;
                        used += n;
                        rpm->hpos += n;
@@ -241,7 +248,7 @@ rpm_filter_read(struct archive_read_filt
                                rpm->state = ST_PADDING;
                        break;
                case ST_PADDING:
-                       while (used < (size_t)avail_in) {
+                       while (used < avail_in) {
                                if (*b != 0) {
                                        /* Read next header. */
                                        rpm->state = ST_HEADER;
@@ -259,7 +266,7 @@ rpm_filter_read(struct archive_read_filt
                        used = avail_in;
                        break;
                }
-               if (used == (size_t)avail_in) {
+               if (used == avail_in) {
                        rpm->total_in += used;
                        __archive_read_filter_consume(self->upstream, used);
                        b = NULL;

Index: pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_cpio.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_cpio.c:1.11 pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_cpio.c:1.12
--- pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_cpio.c:1.11        Fri Apr 12 15:39:51 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_read_support_format_cpio.c     Sun Sep 15 07:02:21 2024
@@ -834,6 +834,7 @@ static int
 header_afiol(struct archive_read *a, struct cpio *cpio,
     struct archive_entry *entry, size_t *namelength, size_t *name_pad)
 {
+       int64_t t;
        const void *h;
        const char *header;
 
@@ -850,7 +851,12 @@ header_afiol(struct archive_read *a, str
 
        archive_entry_set_dev(entry, 
                (dev_t)atol16(header + afiol_dev_offset, afiol_dev_size));
-       archive_entry_set_ino(entry, atol16(header + afiol_ino_offset, afiol_ino_size));
+       t = atol16(header + afiol_ino_offset, afiol_ino_size);
+       if (t < 0) {
+               archive_set_error(&a->archive, 0, "Nonsensical ino value");
+               return (ARCHIVE_FATAL);
+       }
+       archive_entry_set_ino(entry, t);
        archive_entry_set_mode(entry,
                (mode_t)atol8(header + afiol_mode_offset, afiol_mode_size));
        archive_entry_set_uid(entry, atol16(header + afiol_uid_offset, afiol_uid_size));
@@ -863,8 +869,12 @@ header_afiol(struct archive_read *a, str
        *namelength = (size_t)atol16(header + afiol_namesize_offset, afiol_namesize_size);
        *name_pad = 0; /* No padding of filename. */
 
-       cpio->entry_bytes_remaining =
-           atol16(header + afiol_filesize_offset, afiol_filesize_size);
+       t = atol16(header + afiol_filesize_offset, afiol_filesize_size);
+       if (t < 0) {
+               archive_set_error(&a->archive, 0, "Nonsensical file size");
+               return (ARCHIVE_FATAL);
+       }
+       cpio->entry_bytes_remaining = t;
        archive_entry_set_size(entry, cpio->entry_bytes_remaining);
        cpio->entry_padding = 0;
        __archive_read_consume(a, afiol_header_size);
@@ -1002,7 +1012,7 @@ be4(const unsigned char *p)
 static int64_t
 atol8(const char *p, unsigned char_cnt)
 {
-       int64_t l;
+       uint64_t l;
        int digit;
 
        l = 0;
@@ -1010,18 +1020,18 @@ atol8(const char *p, unsigned char_cnt)
                if (*p >= '0' && *p <= '7')
                        digit = *p - '0';
                else
-                       return (l);
+                       return ((int64_t)l);
                p++;
                l <<= 3;
                l |= digit;
        }
-       return (l);
+       return ((int64_t)l);
 }
 
 static int64_t
 atol16(const char *p, unsigned char_cnt)
 {
-       int64_t l;
+       uint64_t l;
        int digit;
 
        l = 0;
@@ -1033,12 +1043,12 @@ atol16(const char *p, unsigned char_cnt)
                else if (*p >= '0' && *p <= '9')
                        digit = *p - '0';
                else
-                       return (l);
+                       return ((int64_t)l);
                p++;
                l <<= 4;
                l |= digit;
        }
-       return (l);
+       return ((int64_t)l);
 }
 
 static int
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_string.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_string.c:1.11 pkgsrc/archivers/libarchive/files/libarchive/archive_string.c:1.12
--- pkgsrc/archivers/libarchive/files/libarchive/archive_string.c:1.11  Fri Apr 12 15:39:51 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_string.c       Sun Sep 15 07:02:21 2024
@@ -2640,81 +2640,69 @@ unicode_to_utf16le(char *p, size_t remai
 }
 
 /*
- * Copy UTF-8 string in checking surrogate pair.
- * If any surrogate pair are found, it would be canonicalized.
+ * Append new UTF-8 string to existing UTF-8 string.
+ * Existing string is assumed to already be in proper form;
+ * the new string will have invalid sequences replaced and
+ * surrogate pairs canonicalized.
  */
 static int
-strncat_from_utf8_to_utf8(struct archive_string *as, const void *_p,
+strncat_from_utf8_to_utf8(struct archive_string *as, const void *_src,
     size_t len, struct archive_string_conv *sc)
 {
-       const char *s;
-       char *p, *endp;
-       int n, ret = 0;
-
+       int ret = 0;
+       const char *src = _src;
        (void)sc; /* UNUSED */
 
+       /* Pre-extend the destination */
        if (archive_string_ensure(as, as->length + len + 1) == NULL)
                return (-1);
 
-       s = (const char *)_p;
-       p = as->s + as->length;
-       endp = as->s + as->buffer_length -1;
-       do {
+       /* Invariant: src points to the first UTF8 byte that hasn't
+        * been copied to the destination `as`. */
+       for (;;) {
+               int n;
                uint32_t uc;
-               const char *ss = s;
-               size_t w;
+               const char *e = src;
 
-               /*
-                * Forward byte sequence until a conversion of that is needed.
-                */
-               while ((n = utf8_to_unicode(&uc, s, len)) > 0) {
-                       s += n;
+               /* Skip UTF-8 sequences until we reach end-of-string or
+                * a code point that needs conversion. */
+               while ((n = utf8_to_unicode(&uc, e, len)) > 0) {
+                       e += n;
                        len -= n;
                }
-               if (ss < s) {
-                       if (p + (s - ss) > endp) {
-                               as->length = p - as->s;
-                               if (archive_string_ensure(as,
-                                   as->buffer_length + len + 1) == NULL)
-                                       return (-1);
-                               p = as->s + as->length;
-                               endp = as->s + as->buffer_length -1;
-                       }
-
-                       memcpy(p, ss, s - ss);
-                       p += s - ss;
+               /* Copy the part that doesn't need conversion */
+               if (e > src) {
+                       if (archive_string_append(as, src, e - src) == NULL)
+                               return (-1);
+                       src = e;
                }
 
-               /*
-                * If n is negative, current byte sequence needs a replacement.
-                */
-               if (n < 0) {
+               if (n == 0) {
+                       /* We reached end-of-string */
+                       return (ret);
+               } else {
+                       /* Next code point needs conversion */
+                       char t[4];
+                       size_t w;
+
+                       /* Try decoding a surrogate pair */
                        if (n == -3 && IS_SURROGATE_PAIR_LA(uc)) {
-                               /* Current byte sequence may be CESU-8. */
-                               n = cesu8_to_unicode(&uc, s, len);
+                               n = cesu8_to_unicode(&uc, src, len);
                        }
+                       /* Not a (valid) surrogate, so use a replacement char */
                        if (n < 0) {
-                               ret = -1;
-                               n *= -1;/* Use a replaced unicode character. */
-                       }
-
-                       /* Rebuild UTF-8 byte sequence. */
-                       while ((w = unicode_to_utf8(p, endp - p, uc)) == 0) {
-                               as->length = p - as->s;
-                               if (archive_string_ensure(as,
-                                   as->buffer_length + len + 1) == NULL)
-                                       return (-1);
-                               p = as->s + as->length;
-                               endp = as->s + as->buffer_length -1;
+                               ret = -1; /* Return -1 if we used any replacement */
+                               n *= -1;
                        }
-                       p += w;
-                       s += n;
+                       /* Consume converted code point */
+                       src += n;
                        len -= n;
+                       /* Convert and append new UTF-8 sequence. */
+                       w = unicode_to_utf8(t, sizeof(t), uc);
+                       if (archive_string_append(as, t, w) == NULL)
+                               return (-1);
                }
-       } while (n > 0);
-       as->length = p - as->s;
-       as->s[as->length] = '\0';
-       return (ret);
+       }
 }
 
 static int
@@ -3886,6 +3874,30 @@ archive_mstring_get_utf8(struct archive 
        }
 
        *p = NULL;
+#if defined(_WIN32) && !defined(__CYGWIN__)
+       /*
+        * On Windows, first try converting from WCS because (1) there's no
+        * guarantee that the conversion to MBS will succeed, e.g. when using
+        * CP_ACP, and (2) that's more efficient than converting to MBS, just to
+        * convert back to WCS again before finally converting to UTF-8
+        */
+       if ((aes->aes_set & AES_SET_WCS) != 0) {
+               sc = archive_string_conversion_to_charset(a, "UTF-8", 1);
+               if (sc == NULL)
+                       return (-1);/* Couldn't allocate memory for sc. */
+               archive_string_empty(&(aes->aes_utf8));
+               r = archive_string_append_from_wcs_in_codepage(&(aes->aes_utf8),
+                       aes->aes_wcs.s, aes->aes_wcs.length, sc);
+               if (a == NULL)
+                       free_sconv_object(sc);
+               if (r == 0) {
+                       aes->aes_set |= AES_SET_UTF8;
+                       *p = aes->aes_utf8.s;
+                       return (0);/* success. */
+               } else
+                       return (-1);/* failure. */
+       }
+#endif
        /* Try converting WCS to MBS first if MBS does not exist yet. */
        if ((aes->aes_set & AES_SET_MBS) == 0) {
                const char *pm; /* unused */
@@ -3970,6 +3982,32 @@ archive_mstring_get_wcs(struct archive *
        }
 
        *wp = NULL;
+#if defined(_WIN32) && !defined(__CYGWIN__)
+       /*
+        * On Windows, prefer converting from UTF-8 directly to WCS because:
+        * (1) there's no guarantee that the string can be represented in MBS (e.g.
+        * with CP_ACP), and (2) in order to convert from UTF-8 to MBS, we're going
+        * to need to convert from UTF-8 to WCS anyway and its wasteful to throw
+        * away that intermediate result
+        */
+       if (aes->aes_set & AES_SET_UTF8) {
+               struct archive_string_conv *sc;
+
+               sc = archive_string_conversion_from_charset(a, "UTF-8", 1);
+               if (sc != NULL) {
+                       archive_wstring_empty((&aes->aes_wcs));
+                       r = archive_wstring_append_from_mbs_in_codepage(&(aes->aes_wcs),
+                           aes->aes_utf8.s, aes->aes_utf8.length, sc);
+                       if (a == NULL)
+                               free_sconv_object(sc);
+                       if (r == 0) {
+                               aes->aes_set |= AES_SET_WCS;
+                               *wp = aes->aes_wcs.s;
+                               return (0);
+                       }
+               }
+       }
+#endif
        /* Try converting UTF8 to MBS first if MBS does not exist yet. */
        if ((aes->aes_set & AES_SET_MBS) == 0) {
                const char *p; /* unused */
@@ -4223,21 +4261,31 @@ archive_mstring_update_utf8(struct archi
 
        aes->aes_set = AES_SET_UTF8;    /* Only UTF8 is set now. */
 
-       /* Try converting UTF-8 to MBS, return false on failure. */
        sc = archive_string_conversion_from_charset(a, "UTF-8", 1);
        if (sc == NULL)
                return (-1);/* Couldn't allocate memory for sc. */
-       r = archive_strcpy_l(&(aes->aes_mbs), utf8, sc);
 
 #if defined(_WIN32) && !defined(__CYGWIN__)
-       /* On failure, make an effort to convert UTF8 to WCS as the active code page
-        * may not be able to represent all characters in the string */
-       if (r != 0) {
-               if (archive_wstring_append_from_mbs_in_codepage(&(aes->aes_wcs),
-                       aes->aes_utf8.s, aes->aes_utf8.length, sc) == 0)
-                       aes->aes_set = AES_SET_UTF8 | AES_SET_WCS;
-       }
-#endif
+       /* On Windows, there's no good way to convert from UTF8 -> MBS directly, so
+        * prefer to first convert to WCS as (1) it's wasteful to throw away the
+        * intermediate result, and (2) WCS will still be set even if we fail to
+        * convert to MBS (e.g. with ACP that can't represent the characters) */
+       r = archive_wstring_append_from_mbs_in_codepage(&(aes->aes_wcs),
+               aes->aes_utf8.s, aes->aes_utf8.length, sc);
+
+       if (a == NULL)
+               free_sconv_object(sc);
+       if (r != 0)
+               return (-1); /* This will guarantee we can't convert to MBS */
+       aes->aes_set = AES_SET_UTF8 | AES_SET_WCS; /* Both UTF8 and WCS set. */
+
+       /* Try converting WCS to MBS, return false on failure. */
+       if (archive_string_append_from_wcs(&(aes->aes_mbs), aes->aes_wcs.s,
+           aes->aes_wcs.length))
+               return (-1);
+#else
+       /* Try converting UTF-8 to MBS, return false on failure. */
+       r = archive_strcpy_l(&(aes->aes_mbs), utf8, sc);
 
        if (a == NULL)
                free_sconv_object(sc);
@@ -4249,8 +4297,10 @@ archive_mstring_update_utf8(struct archi
        if (archive_wstring_append_from_mbs(&(aes->aes_wcs), aes->aes_mbs.s,
            aes->aes_mbs.length))
                return (-1);
-       aes->aes_set = AES_SET_UTF8 | AES_SET_WCS | AES_SET_MBS;
+#endif
 
        /* All conversions succeeded. */
+       aes->aes_set = AES_SET_UTF8 | AES_SET_WCS | AES_SET_MBS;
+
        return (0);
 }
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_write_disk_posix.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_write_disk_posix.c:1.11 pkgsrc/archivers/libarchive/files/libarchive/archive_write_disk_posix.c:1.12
--- pkgsrc/archivers/libarchive/files/libarchive/archive_write_disk_posix.c:1.11        Tue Apr 30 06:05:20 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_write_disk_posix.c     Sun Sep 15 07:02:21 2024
@@ -4196,7 +4196,7 @@ copy_xattrs(struct archive_write_disk *a
        }
        for (xattr_i = 0; xattr_i < xattr_size;
            xattr_i += strlen(xattr_names + xattr_i) + 1) {
-               char *xattr_val_saved;
+               char *p;
                ssize_t s;
                int f;
 
@@ -4207,15 +4207,14 @@ copy_xattrs(struct archive_write_disk *a
                        ret = ARCHIVE_WARN;
                        goto exit_xattr;
                }
-               xattr_val_saved = xattr_val;
-               xattr_val = realloc(xattr_val, s);
-               if (xattr_val == NULL) {
+               p = realloc(xattr_val, s);
+               if (p == NULL) {
                        archive_set_error(&a->archive, ENOMEM,
                            "Failed to get metadata(xattr)");
                        ret = ARCHIVE_WARN;
-                       free(xattr_val_saved);
                        goto exit_xattr;
                }
+               xattr_val = p;
                s = fgetxattr(tmpfd, xattr_names + xattr_i, xattr_val, s, 0, 0);
                if (s == -1) {
                        archive_set_error(&a->archive, errno,
@@ -4361,8 +4360,7 @@ set_mac_metadata(struct archive_write_di
         * silly dance of writing the data to disk just so that
         * copyfile() can read it back in again. */
        archive_string_init(&tmp);
-       archive_strcpy(&tmp, pathname);
-       archive_strcat(&tmp, ".XXXXXX");
+       archive_strcpy(&tmp, "tar.mmd.XXXXXX");
        fd = mkstemp(tmp.s);
 
        if (fd < 0) {

Index: pkgsrc/archivers/libarchive/files/libarchive/archive_write_add_filter_xz.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_write_add_filter_xz.c:1.7 pkgsrc/archivers/libarchive/files/libarchive/archive_write_add_filter_xz.c:1.8
--- pkgsrc/archivers/libarchive/files/libarchive/archive_write_add_filter_xz.c:1.7      Fri Apr 12 15:39:52 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_write_add_filter_xz.c  Sun Sep 15 07:02:21 2024
@@ -310,7 +310,7 @@ archive_compressor_xz_open(struct archiv
        if (data->compressed == NULL) {
                size_t bs = 65536, bpb;
                if (f->archive->magic == ARCHIVE_WRITE_MAGIC) {
-                       /* Buffer size should be a multiple number of the of bytes
+                       /* Buffer size should be a multiple number of the bytes
                         * per block for performance. */
                        bpb = archive_write_get_bytes_per_block(f->archive);
                        if (bpb > bs)
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_gnutar.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_gnutar.c:1.7 pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_gnutar.c:1.8
--- pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_gnutar.c:1.7  Tue Apr 30 06:05:20 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_gnutar.c      Sun Sep 15 07:02:21 2024
@@ -296,7 +296,7 @@ archive_write_gnutar_header(struct archi
        /* Only regular files (not hardlinks) have data. */
        if (archive_entry_hardlink(entry) != NULL ||
            archive_entry_symlink(entry) != NULL ||
-           !(archive_entry_filetype(entry) == AE_IFREG))
+           archive_entry_filetype(entry) != AE_IFREG)
                archive_entry_set_size(entry, 0);
 
        if (AE_IFDIR == archive_entry_filetype(entry)) {
@@ -523,7 +523,7 @@ archive_write_gnutar_header(struct archi
                        goto exit_write_header;
        }
 
-       if (archive_entry_hardlink(entry) != NULL) {
+       if (archive_entry_hardlink_is_set(entry)) {
                tartype = '1';
        } else
                switch (archive_entry_filetype(entry)) {
Index: pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_xar.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_xar.c:1.7 pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_xar.c:1.8
--- pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_xar.c:1.7     Fri Apr 12 15:39:52 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_xar.c Sun Sep 15 07:02:21 2024
@@ -796,7 +796,7 @@ xar_finish_entry(struct archive_write *a
                if (w > 0)
                        xar->bytes_remaining -= w;
                else
-                       return (w);
+                       return ((int)w);
        }
        file = xar->cur_file;
        checksum_final(&(xar->e_sumwrk), &(file->data.e_sum));
@@ -1163,7 +1163,7 @@ make_file_entry(struct archive_write *a,
        /*
         * Make a file name entry, "<name>".
         */
-       l = ll = archive_strlen(&(file->basename));
+       l = ll = (int)archive_strlen(&(file->basename));
        tmp = malloc(l);
        if (tmp == NULL) {
                archive_set_error(&a->archive, ENOMEM,
@@ -1189,7 +1189,7 @@ make_file_entry(struct archive_write *a,
                        return (ARCHIVE_FATAL);
                }
                r = xmlTextWriterWriteBase64(writer, file->basename.s,
-                   0, archive_strlen(&(file->basename)));
+                   0, (int)archive_strlen(&(file->basename)));
                if (r < 0) {
                        archive_set_error(&a->archive,
                            ARCHIVE_ERRNO_MISC,
@@ -2231,10 +2231,10 @@ get_path_component(char *name, int n, co
 
        p = strchr(fn, '/');
        if (p == NULL) {
-               if ((l = strlen(fn)) == 0)
+               if ((l = (int)strlen(fn)) == 0)
                        return (0);
        } else
-               l = p - fn;
+               l = (int)(p - fn);
        if (l > n -1)
                return (-1);
        memcpy(name, fn, l);
@@ -2651,10 +2651,10 @@ compression_init_encoder_gzip(struct arc
         * of ugly hackery to convert a const * pointer to
         * a non-const pointer. */
        strm->next_in = (Bytef *)(uintptr_t)(const void *)lastrm->next_in;
-       strm->avail_in = lastrm->avail_in;
+       strm->avail_in = (uInt)lastrm->avail_in;
        strm->total_in = (uLong)lastrm->total_in;
        strm->next_out = lastrm->next_out;
-       strm->avail_out = lastrm->avail_out;
+       strm->avail_out = (uInt)lastrm->avail_out;
        strm->total_out = (uLong)lastrm->total_out;
        if (deflateInit2(strm, level, Z_DEFLATED,
            (withheader)?15:-15,
@@ -2684,10 +2684,10 @@ compression_code_gzip(struct archive *a,
         * of ugly hackery to convert a const * pointer to
         * a non-const pointer. */
        strm->next_in = (Bytef *)(uintptr_t)(const void *)lastrm->next_in;
-       strm->avail_in = lastrm->avail_in;
+       strm->avail_in = (uInt)lastrm->avail_in;
        strm->total_in = (uLong)lastrm->total_in;
        strm->next_out = lastrm->next_out;
-       strm->avail_out = lastrm->avail_out;
+       strm->avail_out = (uInt)lastrm->avail_out;
        strm->total_out = (uLong)lastrm->total_out;
        r = deflate(strm,
            (action == ARCHIVE_Z_FINISH)? Z_FINISH: Z_NO_FLUSH);
@@ -2748,11 +2748,11 @@ compression_init_encoder_bzip2(struct ar
         * of ugly hackery to convert a const * pointer to
         * a non-const pointer. */
        strm->next_in = (char *)(uintptr_t)(const void *)lastrm->next_in;
-       strm->avail_in = lastrm->avail_in;
+       strm->avail_in = (unsigned int)lastrm->avail_in;
        strm->total_in_lo32 = (uint32_t)(lastrm->total_in & 0xffffffff);
        strm->total_in_hi32 = (uint32_t)(lastrm->total_in >> 32);
        strm->next_out = (char *)lastrm->next_out;
-       strm->avail_out = lastrm->avail_out;
+       strm->avail_out = (unsigned int)lastrm->avail_out;
        strm->total_out_lo32 = (uint32_t)(lastrm->total_out & 0xffffffff);
        strm->total_out_hi32 = (uint32_t)(lastrm->total_out >> 32);
        if (BZ2_bzCompressInit(strm, level, 0, 30) != BZ_OK) {
@@ -2781,11 +2781,11 @@ compression_code_bzip2(struct archive *a
         * of ugly hackery to convert a const * pointer to
         * a non-const pointer. */
        strm->next_in = (char *)(uintptr_t)(const void *)lastrm->next_in;
-       strm->avail_in = lastrm->avail_in;
+       strm->avail_in = (unsigned int)lastrm->avail_in;
        strm->total_in_lo32 = (uint32_t)(lastrm->total_in & 0xffffffff);
        strm->total_in_hi32 = (uint32_t)(lastrm->total_in >> 32);
        strm->next_out = (char *)lastrm->next_out;
-       strm->avail_out = lastrm->avail_out;
+       strm->avail_out = (unsigned int)lastrm->avail_out;
        strm->total_out_lo32 = (uint32_t)(lastrm->total_out & 0xffffffff);
        strm->total_out_hi32 = (uint32_t)(lastrm->total_out >> 32);
        r = BZ2_bzCompress(strm,

Index: pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_pax.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_pax.c:1.12 pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_pax.c:1.13
--- pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_pax.c:1.12    Fri Apr 12 15:39:52 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/archive_write_set_format_pax.c Sun Sep 15 07:02:21 2024
@@ -608,7 +608,15 @@ archive_write_pax_header(struct archive_
        const time_t ustar_max_mtime = get_ustar_max_mtime();
 
        /* Sanity check. */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+       /* NOTE: If the caller supplied a pathname that fails WCS conversion (e.g.
+        * if it is invalid UTF-8), we are expected to return ARCHIVE_WARN later on
+        * in execution, hence the check for both pointers */
+       if ((archive_entry_pathname_w(entry_original) == NULL) &&
+           (archive_entry_pathname(entry_original) == NULL)) {
+#else
        if (archive_entry_pathname(entry_original) == NULL) {
+#endif
                archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
                          "Can't record entry in tar file without pathname");
                return (ARCHIVE_FAILED);
@@ -1032,6 +1040,14 @@ archive_write_pax_header(struct archive_
                                        archive_entry_set_symlink(entry_main,
                                            "././@LongSymLink");
                        }
+                       else {
+                               /* Otherwise, has non-ASCII characters; update the paths to
+                                * however they got decoded above */
+                               if (hardlink != NULL) 
+                                       archive_entry_set_hardlink(entry_main, linkpath);
+                               else
+                                       archive_entry_set_symlink(entry_main, linkpath);
+                       }
                        need_extension = 1;
                }
        }

Index: pkgsrc/archivers/libarchive/files/libarchive/test/CMakeLists.txt
diff -u pkgsrc/archivers/libarchive/files/libarchive/test/CMakeLists.txt:1.11 pkgsrc/archivers/libarchive/files/libarchive/test/CMakeLists.txt:1.12
--- pkgsrc/archivers/libarchive/files/libarchive/test/CMakeLists.txt:1.11       Tue Apr 30 06:05:20 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/test/CMakeLists.txt    Sun Sep 15 07:02:21 2024
@@ -15,6 +15,7 @@ IF(ENABLE_TEST)
     test_acl_platform_posix1e.c
     test_acl_posix1e.c
     test_acl_text.c
+    test_ar_mode.c
     test_archive_api_feature.c
     test_archive_clear_error.c
     test_archive_cmdline.c
@@ -24,6 +25,7 @@ IF(ENABLE_TEST)
     test_archive_match_path.c
     test_archive_match_time.c
     test_archive_pathmatch.c
+    test_archive_read.c
     test_archive_read_add_passphrase.c
     test_archive_read_close_twice.c
     test_archive_read_close_twice_open_fd.c
@@ -130,6 +132,7 @@ IF(ENABLE_TEST)
     test_read_format_gtar_lzma.c
     test_read_format_gtar_sparse.c
     test_read_format_gtar_sparse_skip_entry.c
+    test_read_format_huge_rpm.c
     test_read_format_iso_Z.c
     test_read_format_iso_multi_extent.c
     test_read_format_iso_xorriso.c
@@ -164,6 +167,7 @@ IF(ENABLE_TEST)
     test_read_format_tar_empty_pax.c
     test_read_format_tar_filename.c
     test_read_format_tar_invalid_pax_size.c
+    test_read_format_tar_pax_large_attr.c
     test_read_format_tbz.c
     test_read_format_tgz.c
     test_read_format_tlz.c
@@ -287,6 +291,7 @@ IF(ENABLE_TEST)
     test_write_format_zip_file_zip64.c
     test_write_format_zip_large.c
     test_write_format_zip_stream.c
+    test_write_format_zip_windows_path.c
     test_write_format_zip_zip64.c
     test_write_open_memory.c
     test_write_read_format_zip.c

Index: pkgsrc/archivers/libarchive/files/libarchive/test/list.h
diff -u pkgsrc/archivers/libarchive/files/libarchive/test/list.h:1.13 pkgsrc/archivers/libarchive/files/libarchive/test/list.h:1.14
--- pkgsrc/archivers/libarchive/files/libarchive/test/list.h:1.13       Tue Apr 30 06:05:20 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/test/list.h    Sun Sep 15 07:02:21 2024
@@ -7,6 +7,7 @@ DEFINE_TEST(test_acl_platform_posix1e_re
 DEFINE_TEST(test_acl_posix1e)
 DEFINE_TEST(test_acl_from_text)
 DEFINE_TEST(test_acl_to_text)
+DEFINE_TEST(test_ar_mode)
 DEFINE_TEST(test_archive_api_feature)
 DEFINE_TEST(test_archive_clear_error)
 DEFINE_TEST(test_archive_cmdline)
@@ -21,6 +22,7 @@ DEFINE_TEST(test_archive_match_owner)
 DEFINE_TEST(test_archive_match_path)
 DEFINE_TEST(test_archive_match_time)
 DEFINE_TEST(test_archive_pathmatch)
+DEFINE_TEST(test_archive_read_ahead_eof)
 DEFINE_TEST(test_archive_read_add_passphrase)
 DEFINE_TEST(test_archive_read_add_passphrase_incorrect_sequance)
 DEFINE_TEST(test_archive_read_add_passphrase_single)
@@ -46,6 +48,11 @@ DEFINE_TEST(test_archive_set_error)
 DEFINE_TEST(test_archive_string)
 DEFINE_TEST(test_archive_string_sort)
 DEFINE_TEST(test_archive_string_conversion)
+DEFINE_TEST(test_archive_string_conversion_utf16_utf8)
+DEFINE_TEST(test_archive_string_conversion_utf8_utf16)
+DEFINE_TEST(test_archive_string_update_utf8_win)
+DEFINE_TEST(test_archive_string_update_utf8_utf8)
+DEFINE_TEST(test_archive_string_update_utf8_koi8)
 DEFINE_TEST(test_archive_write_add_filter_by_name_b64encode)
 DEFINE_TEST(test_archive_write_add_filter_by_name_bzip2)
 DEFINE_TEST(test_archive_write_add_filter_by_name_compress)
@@ -159,7 +166,9 @@ DEFINE_TEST(test_gnutar_filename_encodin
 DEFINE_TEST(test_gnutar_filename_encoding_EUCJP_UTF8)
 DEFINE_TEST(test_gnutar_filename_encoding_EUCJP_CP932)
 DEFINE_TEST(test_gnutar_filename_encoding_CP932_UTF8)
+DEFINE_TEST(test_gnutar_filename_encoding_UTF16_win)
 DEFINE_TEST(test_link_resolver)
+DEFINE_TEST(test_link_resolver_unicode_win)
 DEFINE_TEST(test_open_failure)
 DEFINE_TEST(test_open_fd)
 DEFINE_TEST(test_open_file)
@@ -170,6 +179,7 @@ DEFINE_TEST(test_pax_filename_encoding_E
 DEFINE_TEST(test_pax_filename_encoding_CP932)
 DEFINE_TEST(test_pax_filename_encoding_KOI8R_BINARY)
 DEFINE_TEST(test_pax_filename_encoding_KOI8R_CP1251)
+DEFINE_TEST(test_pax_filename_encoding_UTF16_win)
 DEFINE_TEST(test_pax_filename_encoding)
 DEFINE_TEST(test_pax_xattr_header)
 DEFINE_TEST(test_read_data_large)
@@ -209,6 +219,7 @@ DEFINE_TEST(test_read_format_7zip_ppmd)
 DEFINE_TEST(test_read_format_7zip_lzma2_arm64)
 DEFINE_TEST(test_read_format_7zip_deflate_arm64)
 DEFINE_TEST(test_read_format_7zip_win_attrib)
+DEFINE_TEST(test_read_format_7zip_extract_second)
 DEFINE_TEST(test_read_format_7zip_encryption_data)
 DEFINE_TEST(test_read_format_7zip_encryption_header)
 DEFINE_TEST(test_read_format_7zip_encryption_partially)
@@ -218,6 +229,7 @@ DEFINE_TEST(test_read_format_ar)
 DEFINE_TEST(test_read_format_cab)
 DEFINE_TEST(test_read_format_cab_filename)
 DEFINE_TEST(test_read_format_cpio_afio)
+DEFINE_TEST(test_read_format_cpio_afio_broken)
 DEFINE_TEST(test_read_format_cpio_bin)
 DEFINE_TEST(test_read_format_cpio_bin_Z)
 DEFINE_TEST(test_read_format_cpio_bin_be)
@@ -262,6 +274,7 @@ DEFINE_TEST(test_read_format_gtar_gz)
 DEFINE_TEST(test_read_format_gtar_lzma)
 DEFINE_TEST(test_read_format_gtar_sparse)
 DEFINE_TEST(test_read_format_gtar_sparse_skip_entry)
+DEFINE_TEST(test_read_format_huge_rpm)
 DEFINE_TEST(test_read_format_iso_Z)
 DEFINE_TEST(test_read_format_iso_multi_extent)
 DEFINE_TEST(test_read_format_iso_xorriso)
@@ -361,6 +374,7 @@ DEFINE_TEST(test_read_format_rar5_sfx)
 DEFINE_TEST(test_read_format_rar5_decode_number_out_of_bounds_read)
 DEFINE_TEST(test_read_format_rar5_bad_window_size_in_multiarchive_file)
 DEFINE_TEST(test_read_format_rar5_read_data_block_uninitialized_offset)
+DEFINE_TEST(test_read_format_rar5_data_ready_pointer_leak)
 DEFINE_TEST(test_read_format_rar_encryption_data)
 DEFINE_TEST(test_read_format_rar_encryption_header)
 DEFINE_TEST(test_read_format_rar_encryption_partially)
@@ -374,6 +388,7 @@ DEFINE_TEST(test_read_format_tar_empty_p
 DEFINE_TEST(test_read_format_tar_empty_with_gnulabel)
 DEFINE_TEST(test_read_format_tar_filename)
 DEFINE_TEST(test_read_format_tar_invalid_pax_size)
+DEFINE_TEST(test_read_format_tar_pax_large_attr)
 DEFINE_TEST(test_read_format_tbz)
 DEFINE_TEST(test_read_format_tgz)
 DEFINE_TEST(test_read_format_tlz)
@@ -382,6 +397,7 @@ DEFINE_TEST(test_read_format_tz)
 DEFINE_TEST(test_read_format_ustar_filename)
 DEFINE_TEST(test_read_format_warc)
 DEFINE_TEST(test_read_format_xar)
+DEFINE_TEST(test_read_format_xar_duplicate_filename_node)
 DEFINE_TEST(test_read_format_xar_doublelink)
 DEFINE_TEST(test_read_format_zip)
 DEFINE_TEST(test_read_format_zip_ppmd_one_file)
@@ -488,6 +504,7 @@ DEFINE_TEST(test_ustar_filename_encoding
 DEFINE_TEST(test_ustar_filename_encoding_EUCJP_UTF8)
 DEFINE_TEST(test_ustar_filename_encoding_EUCJP_CP932)
 DEFINE_TEST(test_ustar_filename_encoding_CP932_UTF8)
+DEFINE_TEST(test_ustar_filename_encoding_UTF16_win)
 DEFINE_TEST(test_ustar_filenames)
 DEFINE_TEST(test_warn_missing_hardlink_target)
 DEFINE_TEST(test_write_disk)
@@ -592,6 +609,7 @@ DEFINE_TEST(test_write_format_zip_file)
 DEFINE_TEST(test_write_format_zip_file_zip64)
 DEFINE_TEST(test_write_format_zip_large)
 DEFINE_TEST(test_write_format_zip_stream)
+DEFINE_TEST(test_write_format_zip_windows_path)
 DEFINE_TEST(test_write_format_zip_zip64_oversize)
 DEFINE_TEST(test_write_open_memory)
 DEFINE_TEST(test_write_read_format_zip)
@@ -605,3 +623,4 @@ DEFINE_TEST(test_zip_filename_encoding_r
 DEFINE_TEST(test_zip_filename_encoding_Russian_Russia)
 DEFINE_TEST(test_zip_filename_encoding_EUCJP)
 DEFINE_TEST(test_zip_filename_encoding_CP932)
+DEFINE_TEST(test_zip_filename_encoding_UTF16_win)

Index: pkgsrc/archivers/libarchive/files/libarchive/test/test_archive_match_time.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/test/test_archive_match_time.c:1.4 pkgsrc/archivers/libarchive/files/libarchive/test/test_archive_match_time.c:1.5
--- pkgsrc/archivers/libarchive/files/libarchive/test/test_archive_match_time.c:1.4     Fri Apr 12 15:39:53 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/test/test_archive_match_time.c Sun Sep 15 07:02:21 2024
@@ -316,15 +316,14 @@ test_newer_mtime_than_file_mbs(void)
 static void
 test_newer_ctime_than_file_mbs(void)
 {
+#if defined(_WIN32) && !defined(__CYGWIN__)
+       skipping("Can't set ctime on Windows");
+       return;
+#else
        struct archive *a;
        struct archive_entry *ae;
        struct archive *m;
 
-#if defined(_WIN32) && !defined(__CYGWIN__)
-        skipping("Can't set ctime on Windows");
-        return;
-#endif
-
        if (!assert((m = archive_match_new()) != NULL))
                return;
        if (!assert((ae = archive_entry_new()) != NULL)) {
@@ -373,6 +372,7 @@ test_newer_ctime_than_file_mbs(void)
        archive_read_free(a);
        archive_entry_free(ae);
        archive_match_free(m);
+#endif
 }
 
 static void
@@ -435,15 +435,14 @@ test_newer_mtime_than_file_wcs(void)
 static void
 test_newer_ctime_than_file_wcs(void)
 {
+#if defined(_WIN32) && !defined(__CYGWIN__)
+       skipping("Can't set ctime on Windows");
+       return;
+#else
        struct archive *a;
        struct archive_entry *ae;
        struct archive *m;
 
-#if defined(_WIN32) && !defined(__CYGWIN__)
-        skipping("Can't set ctime on Windows");
-        return;
-#endif
-
        if (!assert((m = archive_match_new()) != NULL))
                return;
        if (!assert((ae = archive_entry_new()) != NULL)) {
@@ -493,6 +492,7 @@ test_newer_ctime_than_file_wcs(void)
        archive_read_free(a);
        archive_entry_free(ae);
        archive_match_free(m);
+#endif
 }
 
 static void
@@ -787,15 +787,14 @@ test_older_mtime_than_file_mbs(void)
 static void
 test_older_ctime_than_file_mbs(void)
 {
+#if defined(_WIN32) && !defined(__CYGWIN__)
+       skipping("Can't set ctime on Windows");
+       return;
+#else
        struct archive *a;
        struct archive_entry *ae;
        struct archive *m;
 
-#if defined(_WIN32) && !defined(__CYGWIN__)
-        skipping("Can't set ctime on Windows");
-        return;
-#endif
-
        if (!assert((m = archive_match_new()) != NULL))
                return;
        if (!assert((ae = archive_entry_new()) != NULL)) {
@@ -845,6 +844,7 @@ test_older_ctime_than_file_mbs(void)
        archive_read_free(a);
        archive_entry_free(ae);
        archive_match_free(m);
+#endif
 }
 
 static void
@@ -907,15 +907,14 @@ test_older_mtime_than_file_wcs(void)
 static void
 test_older_ctime_than_file_wcs(void)
 {
+#if defined(_WIN32) && !defined(__CYGWIN__)
+       skipping("Can't set ctime on Windows");
+       return;
+#else
        struct archive *a;
        struct archive_entry *ae;
        struct archive *m;
 
-#if defined(_WIN32) && !defined(__CYGWIN__)
-        skipping("Can't set ctime on Windows");
-        return;
-#endif
-
        if (!assert((m = archive_match_new()) != NULL))
                return;
        if (!assert((ae = archive_entry_new()) != NULL)) {
@@ -965,6 +964,7 @@ test_older_ctime_than_file_wcs(void)
        archive_read_free(a);
        archive_entry_free(ae);
        archive_match_free(m);
+#endif
 }
 
 static void
@@ -1088,15 +1088,14 @@ test_mtime_between_files_wcs(void)
 static void
 test_ctime_between_files_mbs(void)
 {
+#if defined(_WIN32) && !defined(__CYGWIN__)
+       skipping("Can't set ctime on Windows");
+       return;
+#else
        struct archive *a;
        struct archive_entry *ae;
        struct archive *m;
 
-#if defined(_WIN32) && !defined(__CYGWIN__)
-        skipping("Can't set ctime on Windows");
-        return;
-#endif
-
        if (!assert((m = archive_match_new()) != NULL))
                return;
        if (!assert((ae = archive_entry_new()) != NULL)) {
@@ -1147,20 +1146,20 @@ test_ctime_between_files_mbs(void)
        archive_read_free(a);
        archive_entry_free(ae);
        archive_match_free(m);
+#endif
 }
 
 static void
 test_ctime_between_files_wcs(void)
 {
+#if defined(_WIN32) && !defined(__CYGWIN__)
+       skipping("Can't set ctime on Windows");
+       return;
+#else
        struct archive *a;
        struct archive_entry *ae;
        struct archive *m;
 
-#if defined(_WIN32) && !defined(__CYGWIN__)
-        skipping("Can't set ctime on Windows");
-        return;
-#endif
-
        if (!assert((m = archive_match_new()) != NULL))
                return;
        if (!assert((ae = archive_entry_new()) != NULL)) {
@@ -1211,6 +1210,7 @@ test_ctime_between_files_wcs(void)
        archive_read_free(a);
        archive_entry_free(ae);
        archive_match_free(m);
+#endif
 }
 
 static void
Index: pkgsrc/archivers/libarchive/files/libarchive/test/test_archive_string_conversion.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/test/test_archive_string_conversion.c:1.4 pkgsrc/archivers/libarchive/files/libarchive/test/test_archive_string_conversion.c:1.5
--- pkgsrc/archivers/libarchive/files/libarchive/test/test_archive_string_conversion.c:1.4      Fri Apr 12 15:39:53 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/test/test_archive_string_conversion.c  Sun Sep 15 07:02:21 2024
@@ -882,3 +882,138 @@ DEFINE_TEST(test_archive_string_conversi
        test_archive_string_canonicalization();
        test_archive_string_set_get();
 }
+
+DEFINE_TEST(test_archive_string_conversion_utf16_utf8)
+{
+#if !defined(_WIN32) || defined(__CYGWIN__)
+       skipping("This test is meant to verify unicode string handling on Windows");
+#else
+       struct archive_mstring mstr;
+       const char* utf8_string;
+
+       memset(&mstr, 0, sizeof(mstr));
+
+       assertEqualInt(ARCHIVE_OK,
+           archive_mstring_copy_wcs(&mstr, L"\U0000043f\U00000440\U00000438"));
+
+       /* Conversion from WCS to UTF-8 should always succeed */
+       assertEqualInt(ARCHIVE_OK,
+           archive_mstring_get_utf8(NULL, &mstr, &utf8_string));
+       assertEqualString("\xD0\xBF\xD1\x80\xD0\xB8", utf8_string);
+
+       archive_mstring_clean(&mstr);
+#endif
+}
+
+DEFINE_TEST(test_archive_string_conversion_utf8_utf16)
+{
+#if !defined(_WIN32) || defined(__CYGWIN__)
+       skipping("This test is meant to verify unicode string handling on Windows");
+#else
+       struct archive_mstring mstr;
+       const wchar_t* wcs_string;
+
+       memset(&mstr, 0, sizeof(mstr));
+
+       assertEqualInt(6,
+           archive_mstring_copy_utf8(&mstr, "\xD0\xBF\xD1\x80\xD0\xB8"));
+
+       /* Conversion from UTF-8 to WCS should always succeed */
+       assertEqualInt(ARCHIVE_OK,
+           archive_mstring_get_wcs(NULL, &mstr, &wcs_string));
+       assertEqualWString(L"\U0000043f\U00000440\U00000438", wcs_string);
+
+       archive_mstring_clean(&mstr);
+#endif
+}
+
+DEFINE_TEST(test_archive_string_update_utf8_win)
+{
+#if !defined(_WIN32) || defined(__CYGWIN__)
+       skipping("This test is meant to verify unicode string handling on Windows"
+           " with the C locale");
+#else
+       static const char utf8_string[] = "\xD0\xBF\xD1\x80\xD0\xB8";
+       static const wchar_t wcs_string[] = L"\U0000043f\U00000440\U00000438";
+       struct archive_mstring mstr;
+       int r;
+
+       memset(&mstr, 0, sizeof(mstr));
+
+       r = archive_mstring_update_utf8(NULL, &mstr, utf8_string);
+
+       /* On Windows, this should reliably fail with the C locale */
+       assertEqualInt(-1, r);
+       assertEqualInt(0, mstr.aes_set & AES_SET_MBS);
+
+       /* NOTE: We access the internals to validate that they were set by the
+        *       'archive_mstring_update_utf8' function */
+       /* UTF-8 should always be set */
+       assertEqualInt(AES_SET_UTF8, mstr.aes_set & AES_SET_UTF8);
+       assertEqualString(utf8_string, mstr.aes_utf8.s);
+       /* WCS should always be set as well */
+       assertEqualInt(AES_SET_WCS, mstr.aes_set & AES_SET_WCS);
+       assertEqualWString(wcs_string, mstr.aes_wcs.s);
+
+       archive_mstring_clean(&mstr);
+#endif
+}
+
+DEFINE_TEST(test_archive_string_update_utf8_utf8)
+{
+       static const char utf8_string[] = "\xD0\xBF\xD1\x80\xD0\xB8";
+       static const wchar_t wcs_string[] = L"\U0000043f\U00000440\U00000438";
+       struct archive_mstring mstr;
+       int r;
+
+       memset(&mstr, 0, sizeof(mstr));
+
+       if (setlocale(LC_ALL, "en_US.UTF-8") == NULL) {
+               skipping("UTF-8 not supported on this system.");
+               return;
+       }
+
+       r = archive_mstring_update_utf8(NULL, &mstr, utf8_string);
+
+       /* All conversions should have succeeded */
+       assertEqualInt(0, r);
+       assertEqualInt(AES_SET_MBS | AES_SET_WCS | AES_SET_UTF8, mstr.aes_set);
+       assertEqualString(utf8_string, mstr.aes_utf8.s);
+       assertEqualString(utf8_string, mstr.aes_mbs.s);
+       assertEqualWString(wcs_string, mstr.aes_wcs.s);
+
+       archive_mstring_clean(&mstr);
+}
+
+DEFINE_TEST(test_archive_string_update_utf8_koi8)
+{
+       static const char utf8_string[] = "\xD0\xBF\xD1\x80\xD0\xB8";
+       static const char koi8_string[] = "\xD0\xD2\xC9";
+       static const wchar_t wcs_string[] = L"\U0000043f\U00000440\U00000438";
+       struct archive_mstring mstr;
+       int r;
+
+       memset(&mstr, 0, sizeof(mstr));
+
+       if (setlocale(LC_ALL, "ru_RU.KOI8-R") == NULL) {
+               skipping("KOI8-R locale not available on this system.");
+               return;
+       }
+
+       r = archive_mstring_update_utf8(NULL, &mstr, utf8_string);
+
+       /* All conversions should have succeeded */
+       assertEqualInt(0, r);
+       assertEqualInt(AES_SET_MBS | AES_SET_WCS | AES_SET_UTF8, mstr.aes_set);
+       assertEqualString(utf8_string, mstr.aes_utf8.s);
+       assertEqualString(koi8_string, mstr.aes_mbs.s);
+#if defined(_WIN32) && !defined(__CYGWIN__)
+       assertEqualWString(wcs_string, mstr.aes_wcs.s);
+#else
+       /* No guarantee of how WCS strings behave, however this test test is
+        * primarily meant for Windows */
+       (void)wcs_string;
+#endif
+
+       archive_mstring_clean(&mstr);
+}
Index: pkgsrc/archivers/libarchive/files/libarchive/test/test_link_resolver.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/test/test_link_resolver.c:1.4 pkgsrc/archivers/libarchive/files/libarchive/test/test_link_resolver.c:1.5
--- pkgsrc/archivers/libarchive/files/libarchive/test/test_link_resolver.c:1.4  Fri Apr 12 15:39:54 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/test/test_link_resolver.c      Sun Sep 15 07:02:21 2024
@@ -202,3 +202,48 @@ DEFINE_TEST(test_link_resolver)
        test_linkify_old_cpio();
        test_linkify_new_cpio();
 }
+
+DEFINE_TEST(test_link_resolver_unicode_win)
+{
+#if !defined(_WIN32) || defined(__CYGWIN__)
+       skipping("This test is meant to verify unicode string handling"
+           " on Windows with UTF-16 names");
+       return;
+#else
+       struct archive_entry *entry, *e2;
+       struct archive_entry_linkresolver *resolver;
+
+       /* Initialize the resolver. */
+       assert(NULL != (resolver = archive_entry_linkresolver_new()));
+       archive_entry_linkresolver_set_strategy(resolver,
+           ARCHIVE_FORMAT_TAR_USTAR);
+
+       /* Create an entry with a unicode filename and 2 links. */
+       assert(NULL != (entry = archive_entry_new()));
+       archive_entry_copy_pathname_w(entry, L"\u4f60\u597d.txt");
+       archive_entry_set_ino(entry, 1);
+       archive_entry_set_dev(entry, 2);
+       archive_entry_set_nlink(entry, 2);
+       archive_entry_set_size(entry, 10);
+       archive_entry_linkify(resolver, &entry, &e2);
+
+       /* Shouldn't be altered, since it wasn't seen before. */
+       assert(e2 == NULL);
+       assertEqualWString(L"\u4f60\u597d.txt", archive_entry_pathname_w(entry));
+       assertEqualWString(NULL, archive_entry_hardlink_w(entry));
+       assertEqualInt(10, archive_entry_size(entry));
+
+       /* Link to the same file contents, but a new unicode name. */
+       archive_entry_copy_pathname_w(entry, L"\u518d\u89c1.txt");
+       archive_entry_linkify(resolver, &entry, &e2);
+
+       /* Size & link path should have changed. */
+       assert(e2 == NULL);
+       assertEqualWString(L"\u518d\u89c1.txt", archive_entry_pathname_w(entry));
+       assertEqualWString(L"\u4f60\u597d.txt", archive_entry_hardlink_w(entry));
+       assertEqualInt(0, archive_entry_size(entry));
+
+       archive_entry_free(entry);
+       archive_entry_linkresolver_free(resolver);
+#endif
+}
Index: pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_cpio_afio.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_cpio_afio.c:1.4 pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_cpio_afio.c:1.5
--- pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_cpio_afio.c:1.4  Fri Apr 12 15:39:54 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_cpio_afio.c      Sun Sep 15 07:02:21 2024
@@ -65,15 +65,6 @@ static unsigned char archive[] = {
 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 };
 
-/*
- * XXX This must be removed when we use int64_t for uid.
- */
-static int
-uid_size(void)
-{
-       return (sizeof(uid_t));
-}
-
 DEFINE_TEST(test_read_format_cpio_afio)
 {
        unsigned char *p;
@@ -106,8 +97,7 @@ DEFINE_TEST(test_read_format_cpio_afio)
         */
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualInt(17, archive_entry_size(ae));
-       if (uid_size() > 4)
-               assertEqualInt(65536, archive_entry_uid(ae));
+       assertEqualInt(65536, archive_entry_uid(ae));
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
        assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
        assertA(archive_filter_code(a, 0) == ARCHIVE_FILTER_NONE);
@@ -117,3 +107,21 @@ DEFINE_TEST(test_read_format_cpio_afio)
 
        free(p);
 }
+
+// From OSS Fuzz Issue 70019:
+static unsigned char archive2[] = "070727bbbBbbbBabbbbbbcbcbbbbbbm726f777f777ffffffff518402ffffbbbabDDDDDDDDD7c7Ddd7DDDDnDDDdDDDB7777s77777777777C7727:";
+
+DEFINE_TEST(test_read_format_cpio_afio_broken)
+{
+       struct archive *a;
+       struct archive_entry *ae;
+
+       assert((a = archive_read_new()) != NULL);
+       assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
+       assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
+       assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, archive2, sizeof(archive2)));
+       assertEqualIntA(a, ARCHIVE_FATAL, archive_read_next_header(a, &ae));
+       assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_NONE);
+       assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_AFIO_LARGE);
+       archive_read_free(a);
+}
Index: pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_rar5.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_rar5.c:1.4 pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_rar5.c:1.5
--- pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_rar5.c:1.4       Fri Apr 12 15:39:55 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_rar5.c   Sun Sep 15 07:02:22 2024
@@ -843,7 +843,7 @@ DEFINE_TEST(test_read_format_rar5_block_
        struct archive_entry *ae;
        struct archive *a;
        uint8_t buf[173];
-       int bytes_read;
+       ssize_t bytes_read;
        uint32_t computed_crc = 0;
 
        extract_reference_file("test_read_format_rar5_compressed.rar");
@@ -932,19 +932,22 @@ DEFINE_TEST(test_read_format_rar5_symlin
        assertEqualInt(AE_IFLNK, archive_entry_filetype(ae));
        assertEqualString("file.txt", archive_entry_symlink(ae));
        assertEqualInt(AE_SYMLINK_TYPE_FILE, archive_entry_symlink_type(ae));
-       assertA(0 == archive_read_data(a, NULL, archive_entry_size(ae)));
+       assertEqualInt(0, archive_entry_size(ae));
+       assertA(0 == archive_read_data(a, NULL, (size_t)archive_entry_size(ae)));
 
        assertA(0 == archive_read_next_header(a, &ae));
        assertEqualString("dirlink", archive_entry_pathname(ae));
        assertEqualInt(AE_IFLNK, archive_entry_filetype(ae));
        assertEqualString("dir", archive_entry_symlink(ae));
        assertEqualInt(AE_SYMLINK_TYPE_DIRECTORY, archive_entry_symlink_type(ae));
-       assertA(0 == archive_read_data(a, NULL, archive_entry_size(ae)));
+       assertEqualInt(0, archive_entry_size(ae));
+       assertA(0 == archive_read_data(a, NULL, (size_t)archive_entry_size(ae)));
 
        assertA(0 == archive_read_next_header(a, &ae));
        assertEqualString("dir", archive_entry_pathname(ae));
        assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
-       assertA(0 == archive_read_data(a, NULL, archive_entry_size(ae)));
+       assertEqualInt(0, archive_entry_size(ae));
+       assertA(0 == archive_read_data(a, NULL, (size_t)archive_entry_size(ae)));
 
        assertA(ARCHIVE_EOF == archive_read_next_header(a, &ae));
 
@@ -969,7 +972,8 @@ DEFINE_TEST(test_read_format_rar5_hardli
        assertEqualString("hardlink.txt", archive_entry_pathname(ae));
        assertEqualInt(AE_IFREG, archive_entry_filetype(ae));
        assertEqualString("file.txt", archive_entry_hardlink(ae));
-       assertA(0 == archive_read_data(a, NULL, archive_entry_size(ae)));
+       assertEqualInt(0, archive_entry_size(ae));
+       assertA(0 == archive_read_data(a, NULL, (size_t)archive_entry_size(ae)));
 
        assertA(ARCHIVE_EOF == archive_read_next_header(a, &ae));
 
@@ -1340,7 +1344,7 @@ DEFINE_TEST(test_read_format_rar5_sfx)
 
        assertA(size == archive_read_data(a, buff, size));
        assertEqualMem(buff, test_txt, size);
-       
+
        EPILOGUE();
 }
 
@@ -1402,3 +1406,26 @@ DEFINE_TEST(test_read_format_rar5_read_d
 
        EPILOGUE();
 }
+
+DEFINE_TEST(test_read_format_rar5_data_ready_pointer_leak)
+{
+       /* oss fuzz 70024 */
+
+       char buf[4096];
+       PROLOGUE("test_read_format_rar5_data_ready_pointer_leak.rar");
+
+       /* Return codes of those calls are ignored, because this sample file
+        * is invalid. However, the unpacker shouldn't produce any SIGSEGV
+        * errors during processing. */
+
+       (void) archive_read_next_header(a, &ae);
+       (void) archive_read_data(a, buf, sizeof(buf));
+       (void) archive_read_next_header(a, &ae);
+       (void) archive_read_data(a, buf, sizeof(buf));
+       (void) archive_read_data(a, buf, sizeof(buf));
+       (void) archive_read_next_header(a, &ae);
+       /* This call shouldn't produce SIGSEGV. */
+       (void) archive_read_data(a, buf, sizeof(buf));
+
+       EPILOGUE();
+}
Index: pkgsrc/archivers/libarchive/files/libarchive/test/test_write_filter_zstd.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/test/test_write_filter_zstd.c:1.4 pkgsrc/archivers/libarchive/files/libarchive/test/test_write_filter_zstd.c:1.5
--- pkgsrc/archivers/libarchive/files/libarchive/test/test_write_filter_zstd.c:1.4      Fri Apr 12 15:39:56 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/test/test_write_filter_zstd.c  Sun Sep 15 07:02:22 2024
@@ -230,12 +230,8 @@ DEFINE_TEST(test_write_filter_zstd)
            archive_write_set_filter_option(a, NULL, "max-frame-out", "1GB"));
 #endif
 #if ZSTD_VERSION_NUMBER >= MINVER_LONG
-       if ((int)(sizeof(size_t) == 4))
-               assertEqualIntA(a, ARCHIVE_OK,
-                   archive_write_set_filter_option(a, NULL, "long", "26"));
-       else
-               assertEqualIntA(a, ARCHIVE_OK,
-                   archive_write_set_filter_option(a, NULL, "long", "27"));
+       assertEqualIntA(a, ARCHIVE_OK,
+           archive_write_set_filter_option(a, NULL, "long", "23"));
        assertEqualIntA(a, ARCHIVE_FAILED,
            archive_write_set_filter_option(a, NULL, "long", "-1")); /* negative */
 #endif
Index: pkgsrc/archivers/libarchive/files/libarchive/test/test_write_format_zip.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/test/test_write_format_zip.c:1.4 pkgsrc/archivers/libarchive/files/libarchive/test/test_write_format_zip.c:1.5
--- pkgsrc/archivers/libarchive/files/libarchive/test/test_write_format_zip.c:1.4       Fri Apr 12 15:39:56 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/test/test_write_format_zip.c   Sun Sep 15 07:02:22 2024
@@ -699,7 +699,7 @@ DEFINE_TEST(test_write_format_zip_tradit
        assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a));
        if (ARCHIVE_OK != archive_write_set_options(a,
                    "zip:encryption=zipcrypt")) {
-               skipping("This system does not have cryptographic liberary");
+               skipping("This system does not have cryptographic library");
                archive_write_free(a);
                free(buff);
                return;
@@ -779,7 +779,7 @@ DEFINE_TEST(test_write_format_zip_winzip
        assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a));
        if (ARCHIVE_OK != archive_write_set_options(a, "zip:encryption=aes128"))
        {
-               skipping("This system does not have cryptographic liberary");
+               skipping("This system does not have cryptographic library");
                archive_write_free(a);
                free(buff);
                return;
@@ -859,7 +859,7 @@ DEFINE_TEST(test_write_format_zip_winzip
        assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a));
        if (ARCHIVE_OK != archive_write_set_options(a, "zip:encryption=aes256"))
        {
-               skipping("This system does not have cryptographic liberary");
+               skipping("This system does not have cryptographic library");
                archive_write_free(a);
                free(buff);
                return;

Index: pkgsrc/archivers/libarchive/files/libarchive/test/test_compat_lzip.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/test/test_compat_lzip.c:1.3 pkgsrc/archivers/libarchive/files/libarchive/test/test_compat_lzip.c:1.4
--- pkgsrc/archivers/libarchive/files/libarchive/test/test_compat_lzip.c:1.3    Tue Apr 30 06:05:20 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/test/test_compat_lzip.c        Sun Sep 15 07:02:21 2024
@@ -47,7 +47,7 @@ echo "f3" > $dir/d1/f3
 rm -r $dir
 }
 #
-# Make a lzip file from splitted tar file.
+# Make a lzip file from split tar file.
 #
 name=test_compat_lzip_1
 dir="$name`date +%Y%m%d%H%M%S`.$USER"
Index: pkgsrc/archivers/libarchive/files/libarchive/test/test_gnutar_filename_encoding.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/test/test_gnutar_filename_encoding.c:1.3 pkgsrc/archivers/libarchive/files/libarchive/test/test_gnutar_filename_encoding.c:1.4
--- pkgsrc/archivers/libarchive/files/libarchive/test/test_gnutar_filename_encoding.c:1.3       Fri Apr 12 15:39:54 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/test/test_gnutar_filename_encoding.c   Sun Sep 15 07:02:21 2024
@@ -389,3 +389,105 @@ DEFINE_TEST(test_gnutar_filename_encodin
        assertEqualMem(buff, "\xE8\xA1\xA8.txt", 7);
 }
 
+DEFINE_TEST(test_gnutar_filename_encoding_UTF16_win)
+{
+#if !defined(_WIN32) || defined(__CYGWIN__)
+       skipping("This test is meant to verify unicode string handling"
+               " on Windows with UTF-16 names");
+       return;
+#else
+       struct archive *a;
+       struct archive_entry *entry;
+       char buff[4096];
+       size_t used;
+
+       /*
+        * Don't call setlocale because we're verifying that the '_w' functions
+        * work as expected when 'hdrcharset' is UTF-8
+        */
+
+       /* Part 1: file */
+       a = archive_write_new();
+       assertEqualInt(ARCHIVE_OK, archive_write_set_format_gnutar(a));
+       if (archive_write_set_options(a, "hdrcharset=UTF-8") != ARCHIVE_OK) {
+               skipping("This system cannot convert character-set"
+                   " from UTF-16 to UTF-8.");
+               archive_write_free(a);
+               return;
+       }
+       assertEqualInt(ARCHIVE_OK,
+           archive_write_open_memory(a, buff, sizeof(buff), &used));
+
+       entry = archive_entry_new2(a);
+       /* Set the filename using a UTF-16 string */
+       archive_entry_copy_pathname_w(entry, L"\u8868.txt");
+       archive_entry_set_filetype(entry, AE_IFREG);
+       archive_entry_set_size(entry, 0);
+       assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
+       archive_entry_free(entry);
+       assertEqualInt(ARCHIVE_OK, archive_write_free(a));
+
+       /* Check UTF-8 version. */
+       assertEqualMem(buff, "\xE8\xA1\xA8.txt", 7);
+
+       /* Part 2: directory */
+       a = archive_write_new();
+       assertEqualInt(ARCHIVE_OK, archive_write_set_format_gnutar(a));
+       assertEqualInt(ARCHIVE_OK, archive_write_set_options(a, "hdrcharset=UTF-8"));
+       assertEqualInt(ARCHIVE_OK,
+           archive_write_open_memory(a, buff, sizeof(buff), &used));
+
+       entry = archive_entry_new2(a);
+       /* Set the directory name using a UTF-16 string */
+       /* NOTE: Explicitly not adding trailing slash to test that code path */
+       archive_entry_copy_pathname_w(entry, L"\u8868");
+       archive_entry_set_filetype(entry, AE_IFDIR);
+       archive_entry_set_size(entry, 0);
+       assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
+       archive_entry_free(entry);
+       assertEqualInt(ARCHIVE_OK, archive_write_free(a));
+
+       /* Check UTF-8 version. */
+       assertEqualMem(buff, "\xE8\xA1\xA8/", 4);
+
+       /* Part 3: symlink */
+       a = archive_write_new();
+       assertEqualInt(ARCHIVE_OK, archive_write_set_format_gnutar(a));
+       assertEqualInt(ARCHIVE_OK, archive_write_set_options(a, "hdrcharset=UTF-8"));
+       assertEqualInt(ARCHIVE_OK,
+           archive_write_open_memory(a, buff, sizeof(buff), &used));
+
+       entry = archive_entry_new2(a);
+       /* Set the symlink target using a UTF-16 string */
+       archive_entry_set_pathname(entry, "link.txt");
+       archive_entry_copy_symlink_w(entry, L"\u8868.txt");
+       archive_entry_set_filetype(entry, AE_IFLNK);
+       archive_entry_set_symlink_type(entry, AE_SYMLINK_TYPE_FILE);
+       archive_entry_set_size(entry, 0);
+       assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
+       archive_entry_free(entry);
+       assertEqualInt(ARCHIVE_OK, archive_write_free(a));
+
+       /* Check UTF-8 version. */
+       assertEqualMem(buff + 157, "\xE8\xA1\xA8.txt", 7);
+
+       /* Part 4: hardlink */
+       a = archive_write_new();
+       assertEqualInt(ARCHIVE_OK, archive_write_set_format_gnutar(a));
+       assertEqualInt(ARCHIVE_OK, archive_write_set_options(a, "hdrcharset=UTF-8"));
+       assertEqualInt(ARCHIVE_OK,
+           archive_write_open_memory(a, buff, sizeof(buff), &used));
+
+       entry = archive_entry_new2(a);
+       /* Set the symlink target using a UTF-16 string */
+       archive_entry_set_pathname(entry, "link.txt");
+       archive_entry_copy_hardlink_w(entry, L"\u8868.txt");
+       archive_entry_set_size(entry, 0);
+       assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
+       archive_entry_free(entry);
+       assertEqualInt(ARCHIVE_OK, archive_write_free(a));
+
+       /* Check UTF-8 version. */
+       assertEqualMem(buff + 157, "\xE8\xA1\xA8.txt", 7);
+#endif
+}
Index: pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_iso_Z.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_iso_Z.c:1.3 pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_iso_Z.c:1.4
--- pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_iso_Z.c:1.3      Fri Apr 12 15:39:54 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_iso_Z.c  Sun Sep 15 07:02:22 2024
@@ -40,8 +40,29 @@ test1(void)
            archive_read_support_format_all(a));
        assertEqualIntA(a, ARCHIVE_OK,
            archive_read_open_filename(a, name, 512));
+
+       /* Root directory */
        assertEqualIntA(a, ARCHIVE_OK,
            archive_read_next_header(a, &ae));
+       assertEqualIntA(a, 1131434684, archive_entry_atime(ae));
+       assertEqualIntA(a, 0, archive_entry_birthtime(ae));
+       assertEqualIntA(a, 1131434684, archive_entry_ctime(ae));
+       assertEqualIntA(a, 0, archive_entry_dev(ae));
+       assertEqualIntA(a, AE_IFDIR, archive_entry_filetype(ae));
+       assertEqualIntA(a, 0, archive_entry_gid(ae));
+       assertEqualStringA(a, NULL, archive_entry_gname(ae));
+       assertEqualIntA(a, 0, archive_entry_ino(ae));
+       assertEqualIntA(a, AE_IFDIR | 0700, archive_entry_mode(ae));
+       assertEqualIntA(a, 1131434684, archive_entry_mtime(ae));
+       assertEqualIntA(a, 2, archive_entry_nlink(ae));
+       assertEqualStringA(a, ".", archive_entry_pathname(ae));
+       assertEqualIntA(a, 0700, archive_entry_perm(ae));
+       assertEqualIntA(a, 2048, archive_entry_size(ae));
+       assertEqualIntA(a, 0, archive_entry_uid(ae));
+       assertEqualStringA(a, NULL, archive_entry_uname(ae));
+
+       assertEqualIntA(a, ARCHIVE_EOF,
+           archive_read_next_header(a, &ae));
        assertEqualInt(1, archive_file_count(a));
        assertEqualInt(archive_filter_code(a, 0),
            ARCHIVE_FILTER_COMPRESS);
@@ -53,11 +74,10 @@ test1(void)
 }
 
 static void
-test2(void)
+test_small(const char *name)
 {
        struct archive_entry *ae;
        struct archive *a;
-       const char *name = "test_read_format_iso_2.iso.Z";
 
        extract_reference_file(name);
 
@@ -68,21 +88,110 @@ test2(void)
            archive_read_support_format_all(a));
        assertEqualIntA(a, ARCHIVE_OK,
            archive_read_open_filename(a, name, 512));
+
+       /* Root directory */
        assertEqualIntA(a, ARCHIVE_OK,
            archive_read_next_header(a, &ae));
        assertEqualString(".", archive_entry_pathname(ae));
+       assertEqualIntA(a, 3443989665, archive_entry_atime(ae));
+       assertEqualIntA(a, 0, archive_entry_birthtime(ae));
+       assertEqualIntA(a, 3443989665, archive_entry_ctime(ae));
+       assertEqualIntA(a, 0, archive_entry_dev(ae));
+       assertEqualIntA(a, AE_IFDIR, archive_entry_filetype(ae));
+       assertEqualIntA(a, 0, archive_entry_gid(ae));
+       assertEqualStringA(a, NULL, archive_entry_gname(ae));
+       assertEqualIntA(a, 0, archive_entry_ino(ae));
+       assertEqualIntA(a, AE_IFDIR | 0700, archive_entry_mode(ae));
+       assertEqualIntA(a, 3443989665, archive_entry_mtime(ae));
+       assertEqualIntA(a, 4, archive_entry_nlink(ae));
+       assertEqualIntA(a, 0700, archive_entry_perm(ae));
+       assertEqualIntA(a, 2048, archive_entry_size(ae));
+       assertEqualIntA(a, 0, archive_entry_uid(ae));
+       assertEqualStringA(a, NULL, archive_entry_uname(ae));
+
+       /* Directory "A" */
        assertEqualIntA(a, ARCHIVE_OK,
            archive_read_next_header(a, &ae));
        assertEqualString("A", archive_entry_pathname(ae));
+       assertEqualIntA(a, 1313381406, archive_entry_atime(ae));
+       assertEqualIntA(a, 0, archive_entry_birthtime(ae));
+       assertEqualIntA(a, 1313381406, archive_entry_ctime(ae));
+       assertEqualIntA(a, 0, archive_entry_dev(ae));
+       assertEqualIntA(a, AE_IFDIR, archive_entry_filetype(ae));
+       assertEqualIntA(a, 0, archive_entry_gid(ae));
+       assertEqualStringA(a, NULL, archive_entry_gname(ae));
+       assertEqualIntA(a, 0, archive_entry_ino(ae));
+       assertEqualIntA(a, AE_IFDIR | 0700, archive_entry_mode(ae));
+       assertEqualIntA(a, 1313381406, archive_entry_mtime(ae));
+       assertEqualIntA(a, 2, archive_entry_nlink(ae));
+       assertEqualIntA(a, 0700, archive_entry_perm(ae));
+       assertEqualIntA(a, 2048, archive_entry_size(ae));
+       assertEqualIntA(a, 0, archive_entry_uid(ae));
+       assertEqualStringA(a, NULL, archive_entry_uname(ae));
+
+       /* File "A/B" */
        assertEqualIntA(a, ARCHIVE_OK,
            archive_read_next_header(a, &ae));
        assertEqualString("A/B", archive_entry_pathname(ae));
+       assertEqualIntA(a, 1313381406, archive_entry_atime(ae));
+       assertEqualIntA(a, 0, archive_entry_birthtime(ae));
+       assertEqualIntA(a, 1313381406, archive_entry_ctime(ae));
+       assertEqualIntA(a, 0, archive_entry_dev(ae));
+       assertEqualIntA(a, AE_IFREG, archive_entry_filetype(ae));
+       assertEqualIntA(a, 0, archive_entry_gid(ae));
+       assertEqualStringA(a, NULL, archive_entry_gname(ae));
+       assertEqualIntA(a, 0, archive_entry_ino(ae));
+       assertEqualIntA(a, AE_IFREG | 0400, archive_entry_mode(ae));
+       assertEqualIntA(a, 1313381406, archive_entry_mtime(ae));
+       assertEqualIntA(a, 1, archive_entry_nlink(ae));
+       assertEqualIntA(a, 0400, archive_entry_perm(ae));
+       assertEqualIntA(a, 6, archive_entry_size(ae));
+       assertEqualIntA(a, 0, archive_entry_uid(ae));
+       assertEqualStringA(a, NULL, archive_entry_uname(ae));
+       /* TODO: Verify that file contents are "hello\n" */
+
+       /* Directory "C" */
        assertEqualIntA(a, ARCHIVE_OK,
            archive_read_next_header(a, &ae));
        assertEqualString("C", archive_entry_pathname(ae));
+       assertEqualIntA(a, 1313381411, archive_entry_atime(ae));
+       assertEqualIntA(a, 0, archive_entry_birthtime(ae));
+       assertEqualIntA(a, 1313381411, archive_entry_ctime(ae));
+       assertEqualIntA(a, 0, archive_entry_dev(ae));
+       assertEqualIntA(a, AE_IFDIR, archive_entry_filetype(ae));
+       assertEqualIntA(a, 0, archive_entry_gid(ae));
+       assertEqualStringA(a, NULL, archive_entry_gname(ae));
+       assertEqualIntA(a, 0, archive_entry_ino(ae));
+       assertEqualIntA(a, AE_IFDIR | 0700, archive_entry_mode(ae));
+       assertEqualIntA(a, 1313381411, archive_entry_mtime(ae));
+       assertEqualIntA(a, 2, archive_entry_nlink(ae));
+       assertEqualIntA(a, 0700, archive_entry_perm(ae));
+       assertEqualIntA(a, 2048, archive_entry_size(ae));
+       assertEqualIntA(a, 0, archive_entry_uid(ae));
+       assertEqualStringA(a, NULL, archive_entry_uname(ae));
+
+       /* File "C/D" */
        assertEqualIntA(a, ARCHIVE_OK,
            archive_read_next_header(a, &ae));
        assertEqualString("C/D", archive_entry_pathname(ae));
+       assertEqualIntA(a, 1313381411, archive_entry_atime(ae));
+       assertEqualIntA(a, 0, archive_entry_birthtime(ae));
+       assertEqualIntA(a, 1313381411, archive_entry_ctime(ae));
+       assertEqualIntA(a, 0, archive_entry_dev(ae));
+       assertEqualIntA(a, AE_IFREG, archive_entry_filetype(ae));
+       assertEqualIntA(a, 0, archive_entry_gid(ae));
+       assertEqualStringA(a, NULL, archive_entry_gname(ae));
+       assertEqualIntA(a, 0, archive_entry_ino(ae));
+       assertEqualIntA(a, AE_IFREG | 0400, archive_entry_mode(ae));
+       assertEqualIntA(a, 1313381411, archive_entry_mtime(ae));
+       assertEqualIntA(a, 1, archive_entry_nlink(ae));
+       assertEqualIntA(a, 0400, archive_entry_perm(ae));
+       assertEqualIntA(a, 6, archive_entry_size(ae));
+       assertEqualIntA(a, 0, archive_entry_uid(ae));
+       assertEqualStringA(a, NULL, archive_entry_uname(ae));
+       /* TODO: Verify that file contents are "hello\n" */
+
+       /* Final statistics */
        assertEqualIntA(a, ARCHIVE_EOF,
            archive_read_next_header(a, &ae));
        assertEqualInt(5, archive_file_count(a));
@@ -98,5 +207,8 @@ test2(void)
 DEFINE_TEST(test_read_format_iso_Z)
 {
        test1();
-       test2();
+       /* A very small ISO image with a variety of contents. */
+       test_small("test_read_format_iso_2.iso.Z");
+       /* As above, but with a non-standard 68-byte root directory in the PVD */
+       test_small("test_read_format_iso_3.iso.Z");
 }
Index: pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_zip_traditional_encryption_data.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_zip_traditional_encryption_data.c:1.3 
pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_zip_traditional_encryption_data.c:1.4
--- pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_zip_traditional_encryption_data.c:1.3    Fri Apr 12 15:39:55 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_zip_traditional_encryption_data.c        Sun Sep 15 07:02:22 2024
@@ -41,7 +41,7 @@ DEFINE_TEST(test_read_format_zip_traditi
        assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a));
        if (ARCHIVE_OK != archive_write_set_options(a,
                                "zip:encryption=traditional")) {
-               skipping("This system does not have cryptographic liberary");
+               skipping("This system does not have cryptographic library");
                archive_write_free(a);
                return;
        }
Index: pkgsrc/archivers/libarchive/files/libarchive/test/test_ustar_filename_encoding.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/test/test_ustar_filename_encoding.c:1.3 pkgsrc/archivers/libarchive/files/libarchive/test/test_ustar_filename_encoding.c:1.4
--- pkgsrc/archivers/libarchive/files/libarchive/test/test_ustar_filename_encoding.c:1.3        Fri Apr 12 15:39:56 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/test/test_ustar_filename_encoding.c    Sun Sep 15 07:02:22 2024
@@ -390,3 +390,105 @@ DEFINE_TEST(test_ustar_filename_encoding
        assertEqualMem(buff, "\xE8\xA1\xA8.txt", 7);
 }
 
+DEFINE_TEST(test_ustar_filename_encoding_UTF16_win)
+{
+#if !defined(_WIN32) || defined(__CYGWIN__)
+       skipping("This test is meant to verify unicode string handling"
+               " on Windows with UTF-16 names");
+       return;
+#else
+       struct archive *a;
+       struct archive_entry *entry;
+       char buff[4096];
+       size_t used;
+
+       /*
+        * Don't call setlocale because we're verifying that the '_w' functions
+        * work as expected when 'hdrcharset' is UTF-8
+        */
+
+       /* Part 1: file */
+       a = archive_write_new();
+       assertEqualInt(ARCHIVE_OK, archive_write_set_format_ustar(a));
+       if (archive_write_set_options(a, "hdrcharset=UTF-8") != ARCHIVE_OK) {
+               skipping("This system cannot convert character-set"
+                   " from UTF-16 to UTF-8.");
+               archive_write_free(a);
+               return;
+       }
+       assertEqualInt(ARCHIVE_OK,
+           archive_write_open_memory(a, buff, sizeof(buff), &used));
+
+       entry = archive_entry_new2(a);
+       /* Set the filename using a UTF-16 string */
+       archive_entry_copy_pathname_w(entry, L"\u8868.txt");
+       archive_entry_set_filetype(entry, AE_IFREG);
+       archive_entry_set_size(entry, 0);
+       assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
+       archive_entry_free(entry);
+       assertEqualInt(ARCHIVE_OK, archive_write_free(a));
+
+       /* Check UTF-8 version. */
+       assertEqualMem(buff, "\xE8\xA1\xA8.txt", 7);
+
+       /* Part 2: directory */
+       a = archive_write_new();
+       assertEqualInt(ARCHIVE_OK, archive_write_set_format_ustar(a));
+       assertEqualInt(ARCHIVE_OK, archive_write_set_options(a, "hdrcharset=UTF-8"));
+       assertEqualInt(ARCHIVE_OK,
+           archive_write_open_memory(a, buff, sizeof(buff), &used));
+
+       entry = archive_entry_new2(a);
+       /* Set the directory name using a UTF-16 string */
+       /* NOTE: Explicitly not adding trailing slash to test that code path */
+       archive_entry_copy_pathname_w(entry, L"\u8868");
+       archive_entry_set_filetype(entry, AE_IFDIR);
+       archive_entry_set_size(entry, 0);
+       assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
+       archive_entry_free(entry);
+       assertEqualInt(ARCHIVE_OK, archive_write_free(a));
+
+       /* Check UTF-8 version. */
+       assertEqualMem(buff, "\xE8\xA1\xA8/", 4);
+
+       /* Part 3: symlink */
+       a = archive_write_new();
+       assertEqualInt(ARCHIVE_OK, archive_write_set_format_ustar(a));
+       assertEqualInt(ARCHIVE_OK, archive_write_set_options(a, "hdrcharset=UTF-8"));
+       assertEqualInt(ARCHIVE_OK,
+           archive_write_open_memory(a, buff, sizeof(buff), &used));
+
+       entry = archive_entry_new2(a);
+       /* Set the symlink target using a UTF-16 string */
+       archive_entry_set_pathname(entry, "link.txt");
+       archive_entry_copy_symlink_w(entry, L"\u8868.txt");
+       archive_entry_set_filetype(entry, AE_IFLNK);
+       archive_entry_set_symlink_type(entry, AE_SYMLINK_TYPE_FILE);
+       archive_entry_set_size(entry, 0);
+       assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
+       archive_entry_free(entry);
+       assertEqualInt(ARCHIVE_OK, archive_write_free(a));
+
+       /* Check UTF-8 version. */
+       assertEqualMem(buff + 157, "\xE8\xA1\xA8.txt", 7);
+
+       /* Part 4: hardlink */
+       a = archive_write_new();
+       assertEqualInt(ARCHIVE_OK, archive_write_set_format_ustar(a));
+       assertEqualInt(ARCHIVE_OK, archive_write_set_options(a, "hdrcharset=UTF-8"));
+       assertEqualInt(ARCHIVE_OK,
+           archive_write_open_memory(a, buff, sizeof(buff), &used));
+
+       entry = archive_entry_new2(a);
+       /* Set the symlink target using a UTF-16 string */
+       archive_entry_set_pathname(entry, "link.txt");
+       archive_entry_copy_hardlink_w(entry, L"\u8868.txt");
+       archive_entry_set_size(entry, 0);
+       assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
+       archive_entry_free(entry);
+       assertEqualInt(ARCHIVE_OK, archive_write_free(a));
+
+       /* Check UTF-8 version. */
+       assertEqualMem(buff + 157, "\xE8\xA1\xA8.txt", 7);
+#endif
+}
Index: pkgsrc/archivers/libarchive/files/libarchive/test/test_zip_filename_encoding.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/test/test_zip_filename_encoding.c:1.3 pkgsrc/archivers/libarchive/files/libarchive/test/test_zip_filename_encoding.c:1.4
--- pkgsrc/archivers/libarchive/files/libarchive/test/test_zip_filename_encoding.c:1.3  Fri Apr 12 15:39:56 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/test/test_zip_filename_encoding.c      Sun Sep 15 07:02:22 2024
@@ -527,3 +527,98 @@ DEFINE_TEST(test_zip_filename_encoding_C
        assertEqualInt(0, buff[7]);
        assertEqualMem(buff + 30, "abcABC", 6);
 }
+
+DEFINE_TEST(test_zip_filename_encoding_UTF16_win)
+{
+#if !defined(_WIN32) || defined(__CYGWIN__)
+       skipping("This test is meant to verify unicode string handling"
+               " on Windows with UTF-16 names");
+       return;
+#else
+       struct archive *a;
+       struct archive_entry *entry;
+       char buff[4096];
+       size_t used;
+
+       /*
+        * Don't call setlocale because we're verifying that the '_w' functions
+        * work as expected when 'hdrcharset' is UTF-8
+        */
+
+       /* Part 1: file */
+       a = archive_write_new();
+       assertEqualInt(ARCHIVE_OK, archive_write_set_format_zip(a));
+       if (archive_write_set_options(a, "hdrcharset=UTF-8") != ARCHIVE_OK) {
+               skipping("This system cannot convert character-set"
+                   " from UTF-16 to UTF-8.");
+               archive_write_free(a);
+               return;
+       }
+       assertEqualInt(ARCHIVE_OK,
+           archive_write_open_memory(a, buff, sizeof(buff), &used));
+
+       entry = archive_entry_new2(a);
+       /* Set the filename using a UTF-16 string */
+       archive_entry_copy_pathname_w(entry, L"\u8868.txt");
+       archive_entry_set_filetype(entry, AE_IFREG);
+       archive_entry_set_size(entry, 0);
+       assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
+       archive_entry_free(entry);
+       assertEqualInt(ARCHIVE_OK, archive_write_free(a));
+
+       /* A bit 11 of general purpose flag should be 1,
+        * which indicates the filename charset is UTF-8. */
+       assertEqualInt(0x08, buff[7]);
+       /* Check UTF-8 version. */
+       assertEqualMem(buff + 30, "\xE8\xA1\xA8.txt", 7);
+
+       /* Part 2: directory */
+       a = archive_write_new();
+       assertEqualInt(ARCHIVE_OK, archive_write_set_format_zip(a));
+       assertEqualInt(ARCHIVE_OK, archive_write_set_options(a, "hdrcharset=UTF-8"));
+       assertEqualInt(ARCHIVE_OK,
+           archive_write_open_memory(a, buff, sizeof(buff), &used));
+
+       entry = archive_entry_new2(a);
+       /* Set the directory name using a UTF-16 string */
+       /* NOTE: Explicitly not adding trailing slash to test that code path */
+       archive_entry_copy_pathname_w(entry, L"\u8868");
+       archive_entry_set_filetype(entry, AE_IFDIR);
+       archive_entry_set_size(entry, 0);
+       assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
+       archive_entry_free(entry);
+       assertEqualInt(ARCHIVE_OK, archive_write_free(a));
+
+       /* A bit 11 of general purpose flag should be 1,
+        * which indicates the filename charset is UTF-8. */
+       assertEqualInt(0x08, buff[7]);
+       /* Check UTF-8 version. */
+       assertEqualMem(buff+ 30, "\xE8\xA1\xA8/", 4);
+
+       /* Part 3: symlink */
+       a = archive_write_new();
+       assertEqualInt(ARCHIVE_OK, archive_write_set_format_zip(a));
+       assertEqualInt(ARCHIVE_OK, archive_write_set_options(a, "hdrcharset=UTF-8"));
+       assertEqualInt(ARCHIVE_OK,
+           archive_write_open_memory(a, buff, sizeof(buff), &used));
+
+       entry = archive_entry_new2(a);
+       /* Set the symlink target using a UTF-16 string */
+       archive_entry_set_pathname(entry, "link.txt");
+       archive_entry_copy_symlink_w(entry, L"\u8868.txt");
+       archive_entry_set_filetype(entry, AE_IFLNK);
+       archive_entry_set_symlink_type(entry, AE_SYMLINK_TYPE_FILE);
+       archive_entry_set_size(entry, 0);
+       assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
+       archive_entry_free(entry);
+       assertEqualInt(ARCHIVE_OK, archive_write_free(a));
+
+       /* A bit 11 of general purpose flag should be 0,
+        * because the file name is ASCII. */
+       assertEqualInt(0, buff[7]);
+       /* Check UTF-8 version. */
+       assertEqualMem(buff + 38, "\xE8\xA1\xA8.txt", 7);
+
+       /* NOTE: ZIP does not support hardlinks */
+#endif
+}

Index: pkgsrc/archivers/libarchive/files/libarchive/test/test_compat_solaris_pax_sparse.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/test/test_compat_solaris_pax_sparse.c:1.2 pkgsrc/archivers/libarchive/files/libarchive/test/test_compat_solaris_pax_sparse.c:1.3
--- pkgsrc/archivers/libarchive/files/libarchive/test/test_compat_solaris_pax_sparse.c:1.2      Fri Apr 12 15:39:53 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/test/test_compat_solaris_pax_sparse.c  Sun Sep 15 07:02:21 2024
@@ -60,7 +60,7 @@ test_compat_solaris_pax_sparse_1(void)
        assertEqualInt(0100644, archive_entry_mode(ae));
 
        /* Verify the sparse information. */
-       failure("This sparse file should have tree data blocks");
+       failure("This sparse file should have three data blocks");
        assertEqualInt(3, archive_entry_sparse_reset(ae));
        assertEqualInt(ARCHIVE_OK,
            archive_entry_sparse_next(ae, &offset, &length));

Index: pkgsrc/archivers/libarchive/files/libarchive/test/test_entry.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/test/test_entry.c:1.8 pkgsrc/archivers/libarchive/files/libarchive/test/test_entry.c:1.9
--- pkgsrc/archivers/libarchive/files/libarchive/test/test_entry.c:1.8  Fri Apr 12 15:39:53 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/test/test_entry.c      Sun Sep 15 07:02:21 2024
@@ -269,7 +269,7 @@ DEFINE_TEST(test_entry)
        archive_entry_set_hardlink(e, "hardlink");
        archive_entry_set_symlink(e, "symlink");
        archive_entry_set_link(e, "link");
-       assertEqualString(archive_entry_hardlink(e), "hardlink");
+       assertEqualString(archive_entry_hardlink(e), NULL);
        assertEqualString(archive_entry_symlink(e), "link");
 
        /* mode */
@@ -513,7 +513,6 @@ DEFINE_TEST(test_entry)
        archive_entry_set_rdev(e, 532);
        archive_entry_set_size(e, 987654321);
        archive_entry_copy_sourcepath(e, "source");
-       archive_entry_set_symlink(e, "symlinkname");
        archive_entry_set_uid(e, 83);
        archive_entry_set_uname(e, "user");
        /* Add an ACL entry. */
@@ -548,7 +547,7 @@ DEFINE_TEST(test_entry)
        assertEqualInt(archive_entry_rdev(e2), 532);
        assertEqualInt(archive_entry_size(e2), 987654321);
        assertEqualString(archive_entry_sourcepath(e2), "source");
-       assertEqualString(archive_entry_symlink(e2), "symlinkname");
+       assertEqualString(archive_entry_symlink(e2), NULL);
        assertEqualInt(archive_entry_uid(e2), 83);
        assertEqualString(archive_entry_uname(e2), "user");
 
@@ -649,7 +648,7 @@ DEFINE_TEST(test_entry)
        assertEqualInt(archive_entry_rdev(e2), 532);
        assertEqualInt(archive_entry_size(e2), 987654321);
        assertEqualString(archive_entry_sourcepath(e2), "source");
-       assertEqualString(archive_entry_symlink(e2), "symlinkname");
+       assertEqualString(archive_entry_symlink(e2), NULL);
        assertEqualInt(archive_entry_uid(e2), 83);
        assertEqualString(archive_entry_uname(e2), "user");
 
@@ -705,6 +704,13 @@ DEFINE_TEST(test_entry)
        /* Release clone. */
        archive_entry_free(e2);
 
+       /* Verify that symlink is copied over by `clone` */
+       archive_entry_set_symlink(e, "symlinkpath");
+       e2 = archive_entry_clone(e);
+       assertEqualString(archive_entry_hardlink(e2), NULL);
+       assertEqualString(archive_entry_symlink(e2), "symlinkpath");
+       archive_entry_free(e2);
+
        /*
         * Test clear() implementation.
         */

Index: pkgsrc/archivers/libarchive/files/libarchive/test/test_pax_filename_encoding.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/test/test_pax_filename_encoding.c:1.7 pkgsrc/archivers/libarchive/files/libarchive/test/test_pax_filename_encoding.c:1.8
--- pkgsrc/archivers/libarchive/files/libarchive/test/test_pax_filename_encoding.c:1.7  Fri Apr 12 15:39:54 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/test/test_pax_filename_encoding.c      Sun Sep 15 07:02:21 2024
@@ -579,6 +579,158 @@ DEFINE_TEST(test_pax_filename_encoding_K
        assertEqualInt(ARCHIVE_OK, archive_write_free(a));
 }
 
+/*
+ * Verify that unicode filenames are correctly preserved on Windows
+ */
+DEFINE_TEST(test_pax_filename_encoding_UTF16_win)
+{
+#if !defined(_WIN32) || defined(__CYGWIN__)
+       skipping("This test is meant to verify unicode string handling"
+               " on Windows with UTF-16 names");
+       return;
+#else
+       struct archive *a;
+       struct archive_entry *entry;
+       char buff[0x2000];
+       char *p;
+       size_t used;
+
+       /*
+        * Don't call setlocale because we're verifying that the '_w' functions
+        * work as expected when 'hdrcharset' is UTF-8
+        */
+
+       /* Check if the platform completely supports the string conversion. */
+       a = archive_write_new();
+       assertEqualInt(ARCHIVE_OK, archive_write_set_format_pax(a));
+       if (archive_write_set_options(a, "hdrcharset=UTF-8") != ARCHIVE_OK) {
+               skipping("This system cannot convert character-set"
+                   " from UTF-16 to UTF-8.");
+               archive_write_free(a);
+               return;
+       }
+       archive_write_free(a);
+
+       /*
+        * Create a new archive handle with default charset handling
+        */
+       a = archive_write_new();
+       assertEqualInt(ARCHIVE_OK, archive_write_set_format_pax(a));
+       assertEqualInt(ARCHIVE_OK,
+           archive_write_open_memory(a, buff, sizeof(buff), &used));
+
+       /* Part 1: file */
+       entry = archive_entry_new2(a);
+       archive_entry_copy_pathname_w(entry, L"\u4f60\u597d.txt");
+       archive_entry_set_filetype(entry, AE_IFREG);
+       archive_entry_set_size(entry, 0);
+       assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
+
+       /* Part 2: directory */
+       /* NOTE: Explicitly not adding trailing slash to test that code path */
+       archive_entry_copy_pathname_w(entry, L"\u043f\u0440\u0438");
+       archive_entry_set_filetype(entry, AE_IFDIR);
+       archive_entry_set_size(entry, 0);
+       assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
+
+       /* Part 3: symlink */
+       archive_entry_copy_pathname_w(entry, L"\u518d\u89c1.txt");
+       archive_entry_copy_symlink_w(entry, L"\u4f60\u597d.txt");
+       archive_entry_set_filetype(entry, AE_IFLNK);
+       archive_entry_set_symlink_type(entry, AE_SYMLINK_TYPE_FILE);
+       archive_entry_set_size(entry, 0);
+       assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
+
+       /* Part 4: hardlink */
+       archive_entry_copy_pathname_w(entry, L"\u665a\u5b89.txt");
+       archive_entry_copy_hardlink_w(entry, L"\u4f60\u597d.txt");
+       archive_entry_set_filetype(entry, AE_IFREG);
+       archive_entry_set_size(entry, 0);
+       assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
+
+       archive_entry_free(entry);
+       assertEqualInt(ARCHIVE_OK, archive_write_free(a));
+
+       /*
+        * Examine the bytes to ensure the filenames ended up UTF-8
+        * encoded as we expect.
+        */
+
+       /* Part 1: file */
+       p = buff + 0;
+       assertEqualString(p + 0, "PaxHeader/\xE4\xBD\xA0\xE5\xA5\xBD.txt"); /* File name */
+       assertEqualInt(p[156], 'x'); /* Pax extension header */
+       p += 512; /* Pax extension body */
+       assertEqualString(p + 0, "19 path=\xE4\xBD\xA0\xE5\xA5\xBD.txt\n");
+       p += 512; /* Ustar header */
+       assertEqualString(p + 0, "\xE4\xBD\xA0\xE5\xA5\xBD.txt"); /* File name */
+       assertEqualInt(p[156], '0');
+
+       /* Part 2: directory */
+       p += 512; /* Pax extension header */
+       assertEqualString(p + 0, "PaxHeader/\xD0\xBF\xD1\x80\xD0\xB8"); /* File name */
+       assertEqualInt(p[156], 'x');
+       p += 512; /* Pax extension body */
+       assertEqualString(p + 0, "16 path=\xD0\xBF\xD1\x80\xD0\xB8/\n");
+       p += 512; /* Ustar header */
+       assertEqualString(p + 0, "\xD0\xBF\xD1\x80\xD0\xB8/"); /* File name */
+       assertEqualInt(p[156], '5'); /* directory */
+
+       /* Part 3: symlink */
+       p += 512; /* Pax Extension Header */
+       assertEqualString(p + 0, "PaxHeader/\xE5\x86\x8D\xE8\xA7\x81.txt"); /* File name */
+       p += 512; /* Pax extension body */
+       assertEqualString(p + 0,
+                         "19 path=\xE5\x86\x8D\xE8\xA7\x81.txt\n"
+                         "23 linkpath=\xE4\xBD\xA0\xE5\xA5\xBD.txt\n"
+                         "31 LIBARCHIVE.symlinktype=file\n");
+       p += 512; /* Ustar header */
+       assertEqualString(p + 0, "\xE5\x86\x8D\xE8\xA7\x81.txt"); /* File name */
+       assertEqualInt(p[156], '2'); /* symlink */
+       assertEqualString(p + 157, "\xE4\xBD\xA0\xE5\xA5\xBD.txt"); /* link name */
+
+       /* Part 4: hardlink */
+       p += 512; /* Pax extension header */
+       assertEqualString(p + 0, "PaxHeader/\xE6\x99\x9A\xE5\xAE\x89.txt"); /* File name */
+       p += 512; /* Pax extension body */
+       assertEqualString(p + 0,
+                         "19 path=\xE6\x99\x9A\xE5\xAE\x89.txt\n"
+                         "23 linkpath=\xE4\xBD\xA0\xE5\xA5\xBD.txt\n"
+                         "31 LIBARCHIVE.symlinktype=file\n");
+       p += 512; /* Ustar header */
+       assertEqualString(p + 0, "\xE6\x99\x9A\xE5\xAE\x89.txt"); /* File name */
+       assertEqualInt(p[156], '1'); /* hard link */
+       assertEqualString(p + 157, "\xE4\xBD\xA0\xE5\xA5\xBD.txt"); /* link name */
+
+       /*
+        * Read back the archive to see if we get the original names
+        */
+       a = archive_read_new();
+       archive_read_support_format_all(a);
+       archive_read_support_filter_all(a);
+       assertEqualInt(0, archive_read_open_memory(a, buff, used));
+
+       /* Read part 1: file */
+       assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &entry));
+       assertEqualWString(L"\u4f60\u597d.txt", archive_entry_pathname_w(entry));
+
+       /* Read part 2: directory */
+       assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &entry));
+       assertEqualWString(L"\u043f\u0440\u0438/", archive_entry_pathname_w(entry));
+
+       /* Read part 3: symlink */
+       assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &entry));
+       assertEqualWString(L"\u518d\u89c1.txt", archive_entry_pathname_w(entry));
+       assertEqualWString(L"\u4f60\u597d.txt", archive_entry_symlink_w(entry));
+
+       /* Read part 4: hardlink */
+       assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &entry));
+       assertEqualWString(L"\u665a\u5b89.txt", archive_entry_pathname_w(entry));
+       assertEqualWString(L"\u4f60\u597d.txt", archive_entry_hardlink_w(entry));
+
+       archive_free(a);
+#endif
+}
 
 DEFINE_TEST(test_pax_filename_encoding)
 {

Index: pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_7zip.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_7zip.c:1.6 pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_7zip.c:1.7
--- pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_7zip.c:1.6       Fri Apr 12 15:39:54 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_7zip.c   Sun Sep 15 07:02:21 2024
@@ -1050,6 +1050,7 @@ test_arm_filter(const char *refname)
 
        extract_reference_file(refname);
 
+       assertEqualInt(ARCHIVE_OK, archive_read_free(a));
        assert((a = archive_read_new()) != NULL);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
        assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
@@ -1123,6 +1124,7 @@ test_arm64_filter(const char *refname)
 
        extract_reference_file(refname);
 
+       assertEqualInt(ARCHIVE_OK, archive_read_free(a));
        assert((a = archive_read_new()) != NULL);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
        assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
@@ -1257,3 +1259,45 @@ DEFINE_TEST(test_read_format_7zip_win_at
 
        assertEqualInt(ARCHIVE_OK, archive_read_free(a));
 }
+
+DEFINE_TEST(test_read_format_7zip_extract_second)
+{
+       struct archive *a;
+       char buffer[256];
+
+       assert((a = archive_read_new()) != NULL);
+
+       if (ARCHIVE_OK != archive_read_support_filter_lzma(a)) {
+               skipping(
+                   "7zip:lzma decoding is not supported on this platform");
+               assertEqualInt(ARCHIVE_OK, archive_read_free(a));
+               return;
+       }
+
+       assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
+
+       /*
+        * The test archive has two files: first.txt which is a 65,536 file (the
+        * size of the uncompressed buffer), and second.txt which has contents
+        * we will validate. This test ensures we can skip first.txt and still
+        * be able to read the contents of second.txt
+        */
+       const char *refname = "test_read_format_7zip_extract_second.7z";
+       extract_reference_file(refname);
+
+       assertEqualIntA(a, ARCHIVE_OK,
+               archive_read_open_filename(a, refname, 10240));
+
+       struct archive_entry *ae;
+
+       assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+       assertEqualString("first.txt", archive_entry_pathname(ae));
+
+       assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+       assertEqualString("second.txt", archive_entry_pathname(ae));
+
+       assertEqualInt(23, archive_read_data(a, buffer, sizeof(buffer)));
+       assertEqualMem("This is from second.txt", buffer, 23);
+
+       assertEqualInt(ARCHIVE_OK, archive_read_free(a));
+}
Index: pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_tar.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_tar.c:1.6 pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_tar.c:1.7
--- pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_tar.c:1.6        Fri Apr 12 15:39:55 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_tar.c    Sun Sep 15 07:02:22 2024
@@ -437,7 +437,7 @@ static void verify(unsigned char *d, siz
        assertA(0 == archive_read_support_filter_all(a));
        assertA(0 == archive_read_support_format_all(a));
        assertA(0 == archive_read_open_memory(a, buff, s + 1024));
-       assertA(0 == archive_read_next_header(a, &ae));
+       assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualInt(archive_filter_code(a, 0), compression);
        assertEqualInt(archive_format(a), format);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);

Index: pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_mtree.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_mtree.c:1.9 pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_mtree.c:1.10
--- pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_mtree.c:1.9      Fri Apr 12 15:39:55 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_mtree.c  Sun Sep 15 07:02:22 2024
@@ -158,7 +158,7 @@ test_read_format_mtree1(void)
        /* TODO: Mtree reader should probably return ARCHIVE_WARN for this. */
        assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
        assertEqualString(archive_entry_pathname(ae), "dir2/toosmallfile");
-       assertEqualInt(archive_entry_size(ae), -1);
+       assertEqualInt(archive_entry_size(ae), 0);
        assertEqualInt(archive_entry_is_encrypted(ae), 0);
        assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
 

Index: pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_xar.c
diff -u pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_xar.c:1.5 pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_xar.c:1.6
--- pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_xar.c:1.5        Fri Apr 12 15:39:55 2024
+++ pkgsrc/archivers/libarchive/files/libarchive/test/test_read_format_xar.c    Sun Sep 15 07:02:22 2024
@@ -860,3 +860,34 @@ DEFINE_TEST(test_read_format_xar)
         verify(archive12, sizeof(archive12), verify12, NULL, GZIP);
        verifyB(archive13, sizeof(archive13));
 }
+
+DEFINE_TEST(test_read_format_xar_duplicate_filename_node)
+{
+       static const char *reffiles[] =
+       {
+               "test_read_format_xar_duplicate_filename_node.xar",
+               NULL
+       };
+       struct archive_entry *ae;
+       struct archive *a;
+       int r;
+
+       extract_reference_files(reffiles);
+       assert((a = archive_read_new()) != NULL);
+       assertA(0 == archive_read_support_filter_all(a));
+
+       r = archive_read_support_format_xar(a);
+       if (r == ARCHIVE_WARN) {
+               skipping("xar reading not fully supported on this platform");
+               assertEqualInt(ARCHIVE_OK, archive_read_free(a));
+               return;
+       }
+
+       assertA(0 == archive_read_open_filenames(a, reffiles, 10240));
+
+       assertA(0 == archive_read_next_header(a, &ae));
+       assertEqualString("File", archive_entry_pathname(ae));
+
+       assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
+       assertEqualInt(ARCHIVE_OK, archive_read_free(a));
+}

Index: pkgsrc/archivers/libarchive/files/tar/util.c
diff -u pkgsrc/archivers/libarchive/files/tar/util.c:1.9 pkgsrc/archivers/libarchive/files/tar/util.c:1.10
--- pkgsrc/archivers/libarchive/files/tar/util.c:1.9    Fri Apr 12 15:39:57 2024
+++ pkgsrc/archivers/libarchive/files/tar/util.c        Sun Sep 15 07:02:22 2024
@@ -234,6 +234,7 @@ yes(const char *fmt, ...)
        char buff[32];
        char *p;
        ssize_t l;
+       int read_fd = 2; /* stderr */
 
        va_list ap;
        va_start(ap, fmt);
@@ -242,7 +243,24 @@ yes(const char *fmt, ...)
        fprintf(stderr, " (y/N)? ");
        fflush(stderr);
 
-       l = read(2, buff, sizeof(buff) - 1);
+#if defined(_WIN32) && !defined(__CYGWIN__)
+       /* To be resilient when stdin is a pipe, bsdtar prefers to read from
+        * stderr.  On Windows, stderr cannot be read. The nearest "piping
+        * resilient" equivalent is reopening the console input handle.
+        */
+       read_fd = _open("CONIN$", O_RDONLY);
+       if (read_fd < 0) {
+         fprintf(stderr, "Keyboard read failed\n");
+         exit(1);
+       }
+#endif
+
+       l = read(read_fd, buff, sizeof(buff) - 1);
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+       _close(read_fd);
+#endif
+
        if (l < 0) {
          fprintf(stderr, "Keyboard read failed\n");
          exit(1);

Index: pkgsrc/archivers/libarchive/files/tar/write.c
diff -u pkgsrc/archivers/libarchive/files/tar/write.c:1.13 pkgsrc/archivers/libarchive/files/tar/write.c:1.14
--- pkgsrc/archivers/libarchive/files/tar/write.c:1.13  Fri Apr 12 15:39:57 2024
+++ pkgsrc/archivers/libarchive/files/tar/write.c       Sun Sep 15 07:02:22 2024
@@ -942,7 +942,9 @@ write_hierarchy(struct bsdtar *bsdtar, s
 
                while (entry != NULL) {
                        write_file(bsdtar, a, entry);
-                       archive_entry_free(entry);
+                       if (entry != spare_entry) {
+                               archive_entry_free(entry);
+                       }
                        entry = spare_entry;
                        spare_entry = NULL;
                }

Index: pkgsrc/archivers/libarchive/files/tar/test/test_option_H_upper.c
diff -u pkgsrc/archivers/libarchive/files/tar/test/test_option_H_upper.c:1.4 pkgsrc/archivers/libarchive/files/tar/test/test_option_H_upper.c:1.5
--- pkgsrc/archivers/libarchive/files/tar/test/test_option_H_upper.c:1.4        Fri Apr 12 15:39:57 2024
+++ pkgsrc/archivers/libarchive/files/tar/test/test_option_H_upper.c    Sun Sep 15 07:02:22 2024
@@ -78,7 +78,7 @@ DEFINE_TEST(test_option_H_upper)
        /* Test 3: With -H, some symlinks on command line. */
        assertMakeDir("test3", 0755);
        assertEqualInt(0,
-           systemf("%s -cf test3/archive.tar -H -C in ld1 d1 link2 linkY >test2/c.out 2>test2/c.err", testprog));
+           systemf("%s -cf test3/archive.tar -H -C in ld1 d1 link2 linkY >test3/c.out 2>test3/c.err", testprog));
        assertChdir("test3");
        assertEqualInt(0,
            systemf("%s -xf archive.tar >c.out 2>c.err", testprog));
@@ -88,4 +88,20 @@ DEFINE_TEST(test_option_H_upper)
        assertIsReg("link2", umasked(0644));
        assertIsSymlink("linkY", "d1/fileY", 0);
        assertChdir("..");
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+       /* Test 4: With -H, using wildcards with some symlinks on command line. (wildcards are supported only in Windows) */
+       assertMakeDir("test4", 0755);
+       assertEqualInt(0,
+           systemf("%s -cf test4/archive.tar -H -C in * >test4/c.out 2>test4/c.err", testprog));
+       assertChdir("test4");
+       assertEqualInt(0,
+           systemf("%s -xf archive.tar >c.out 2>c.err", testprog));
+       assertIsDir("ld1", umasked(0755));
+       assertIsSymlink("d1/linkX", "fileX", 0);
+       assertIsSymlink("d1/link1", "file1", 0);
+       assertIsReg("link2", umasked(0644));
+       assertIsSymlink("linkY", "d1/fileY", 0);
+       assertChdir("..");
+#endif
 }
Index: pkgsrc/archivers/libarchive/files/tar/test/test_option_L_upper.c
diff -u pkgsrc/archivers/libarchive/files/tar/test/test_option_L_upper.c:1.4 pkgsrc/archivers/libarchive/files/tar/test/test_option_L_upper.c:1.5
--- pkgsrc/archivers/libarchive/files/tar/test/test_option_L_upper.c:1.4        Fri Apr 12 15:39:57 2024
+++ pkgsrc/archivers/libarchive/files/tar/test/test_option_L_upper.c    Sun Sep 15 07:02:22 2024
@@ -78,7 +78,7 @@ DEFINE_TEST(test_option_L_upper)
        /* Test 3: With -L, some symlinks on command line. */
        assertMakeDir("test3", 0755);
        assertEqualInt(0,
-           systemf("%s -cf test3/archive.tar -L -C in ld1 d1 link2 linkY >test2/c.out 2>test2/c.err", testprog));
+           systemf("%s -cf test3/archive.tar -L -C in ld1 d1 link2 linkY >test3/c.out 2>test3/c.err", testprog));
        assertChdir("test3");
        assertEqualInt(0,
            systemf("%s -xf archive.tar >c.out 2>c.err", testprog));
@@ -88,4 +88,20 @@ DEFINE_TEST(test_option_L_upper)
        assertIsReg("link2", umasked(0644));
        assertIsSymlink("linkY", "d1/fileY", 0);
        assertChdir("..");
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+       /* Test 4: With -L, using wildcards with some symlinks on command line. (wildcards are supported only in Windows) */
+       assertMakeDir("test4", 0755);
+       assertEqualInt(0,
+           systemf("%s -cf test4/archive.tar -L -C in * >test4/c.out 2>test4/c.err", testprog));
+       assertChdir("test4");
+       assertEqualInt(0,
+           systemf("%s -xf archive.tar >c.out 2>c.err", testprog));
+       assertIsDir("ld1", umasked(0755));
+       assertIsReg("d1/link1", umasked(0644));
+       assertIsSymlink("d1/linkX", "fileX", 0);
+       assertIsReg("link2", umasked(0644));
+       assertIsSymlink("linkY", "d1/fileY", 0);
+       assertChdir("..");
+#endif
 }

Index: pkgsrc/archivers/libarchive/files/test_utils/test_main.c
diff -u pkgsrc/archivers/libarchive/files/test_utils/test_main.c:1.6 pkgsrc/archivers/libarchive/files/test_utils/test_main.c:1.7
--- pkgsrc/archivers/libarchive/files/test_utils/test_main.c:1.6        Fri Apr 12 15:39:58 2024
+++ pkgsrc/archivers/libarchive/files/test_utils/test_main.c    Sun Sep 15 07:02:22 2024
@@ -121,6 +121,8 @@
 #define access _access
 #undef chdir
 #define chdir _chdir
+#undef chmod
+#define chmod _chmod
 #endif
 #ifndef fileno
 #define fileno _fileno
@@ -217,7 +219,8 @@ my_CreateSymbolicLinkA(const char *linkn
        static BOOLEAN (WINAPI *f)(LPCSTR, LPCSTR, DWORD);
        DWORD attrs;
        static int set;
-       int ret, tmpflags, llen, tlen;
+       int ret, tmpflags;
+       size_t llen, tlen;
        int flags = 0;
        char *src, *tgt, *p;
        if (!set) {
@@ -3877,9 +3880,9 @@ main(int argc, char **argv)
        static const int limit = sizeof(tests) / sizeof(tests[0]);
        int test_set[sizeof(tests) / sizeof(tests[0])];
        int i = 0, j = 0, tests_run = 0, tests_failed = 0, option;
-       int testprogdir_len;
+       size_t testprogdir_len;
 #ifdef PROGRAM
-       int tmp2_len;
+       size_t tmp2_len;
 #endif
        time_t now;
        struct tm *tmptr;
@@ -4083,7 +4086,7 @@ main(int argc, char **argv)
 
        {
                char *testprg;
-               int testprg_len;
+               size_t testprg_len;
 #if defined(_WIN32) && !defined(__CYGWIN__)
                /* Command.com sometimes rejects '/' separators. */
                testprg = strdup(testprogfile);

Index: pkgsrc/archivers/libarchive/files/unzip/bsdunzip.c
diff -u pkgsrc/archivers/libarchive/files/unzip/bsdunzip.c:1.4 pkgsrc/archivers/libarchive/files/unzip/bsdunzip.c:1.5
--- pkgsrc/archivers/libarchive/files/unzip/bsdunzip.c:1.4      Fri Apr 12 15:39:58 2024
+++ pkgsrc/archivers/libarchive/files/unzip/bsdunzip.c  Sun Sep 15 07:02:22 2024
@@ -36,11 +36,7 @@
 
 #include "bsdunzip_platform.h"
 
-#ifdef HAVE_SYS_QUEUE_H
-#include <sys/queue.h>
-#else
 #include "la_queue.h"
-#endif
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif
@@ -484,13 +480,8 @@ handle_existing_file(char **path)
                fprintf(stderr,
                    "replace %s? [y]es, [n]o, [A]ll, [N]one, [r]ename: ",
                    *path);
-               if (fgets(buf, sizeof(buf), stdin) == NULL) {
-                       clearerr(stdin);
-                       printf("NULL\n(EOF or read error, "
-                           "treating as \"[N]one\"...)\n");
-                       n_opt = 1;
-                       return -1;
-               }
+               if (fgets(buf, sizeof(buf), stdin) == NULL)
+                       goto stdin_err;
                switch (*buf) {
                case 'A':
                        o_opt = 1;
@@ -512,6 +503,8 @@ handle_existing_file(char **path)
                        *path = NULL;
                        alen = 0;
                        len = getline(path, &alen, stdin);
+                       if (len < 1)
+                               goto stdin_err;
                        if ((*path)[len - 1] == '\n')
                                (*path)[len - 1] = '\0';
                        return 0;
@@ -519,6 +512,12 @@ handle_existing_file(char **path)
                        break;
                }
        }
+stdin_err:
+       clearerr(stdin);
+       printf("NULL\n(EOF or read error, "
+               "treating as \"[N]one\"...)\n");
+       n_opt = 1;
+       return -1;
 }
 
 /*



Home | Main Index | Thread Index | Old Index