Commit 9aa54761 authored by Martin Matuska's avatar Martin Matuska
Browse files

Update vendor/libarchive/dist to libarchive/libarchive@1b2c437b9

Libarchive 3.5.2

New features:
  PR #1502: Support for PWB and v7 binary cpio formats
  PR #1509: Support of deflate algorithm in symbolic link decompression
            for ZIP archives

Important bugfixes:
  IS #1044: fix extraction of hardlinks to symlinks
  PR #1480: Fix truncation of size values during 7zip archive
            extraction on 32bit architectures
  PR #1504: fix rar header skiming
  PR #1514: ZIP excessive disk read - fix location of central directory
  PR #1520: fix double-free in CAB reader
  PR #1521: Fixed leak of rar before ending with error
  PR #1530: Handle short writes from archive_write_callback
  PR #1532: 7zip: Use compression settings from file also for file header
  IS #1566: do not follow symlinks when processing the fixup list

Obtained from:		libarchive
Libarchive commit:	1b2c437b99b361c7692538fa373e99955e9b93ae
Libarchive tag:		v3.5.2
parent 8be2bb3d
......@@ -9,6 +9,8 @@ FreeBSD_task:
env:
BS: cmake
matrix:
freebsd_instance:
image_family: freebsd-13-0
freebsd_instance:
image_family: freebsd-12-2
freebsd_instance:
......@@ -21,7 +23,7 @@ FreeBSD_task:
build_script:
- ./build/ci/build.sh -a build
test_script:
- ./build/ci/build.sh -a test
- env SKIP_TEST_RESTORE_ATIME=1 ./build/ci/build.sh -a test
- ./build/ci/cirrus_ci/ci.sh test
install_script:
- ./build/ci/build.sh -a install
......
......@@ -77,7 +77,7 @@ math(EXPR INTERFACE_VERSION "13 + ${_minor}")
# ?? Should there be more here ??
SET(SOVERSION "${INTERFACE_VERSION}")
# Enalbe CMAKE_PUSH_CHECK_STATE() and CMAKE_POP_CHECK_STATE() macros
# Enable CMAKE_PUSH_CHECK_STATE() and CMAKE_POP_CHECK_STATE() macros
# saving and restoring the state of the variables.
INCLUDE(CMakePushCheckState)
......@@ -378,7 +378,7 @@ IF(WIN32 AND NOT CMAKE_CL_64 AND NOT CYGWIN)
SET(__GNUWIN32PATH "C:/Program Files/GnuWin32")
ENDIF(WIN32 AND NOT CMAKE_CL_64 AND NOT CYGWIN)
IF(DEFINED __GNUWIN32PATH AND EXISTS "${__GNUWIN32PATH}")
# You have to add a path availabel DLL file into PATH environment variable.
# You have to add a path available DLL file into PATH environment variable.
# Maybe DLL path is "C:/Program Files/GnuWin32/bin".
# The zlib and the bzip2 Setup program have installed programs and DLLs into
# "C:/Program Files/GnuWin32" by default.
......@@ -1015,7 +1015,7 @@ MACRO(CHECK_ICONV LIB TRY_ICONV_CONST)
CMAKE_C_COMPILER_ID MATCHES "^Clang$")
#
# During checking iconv proto type, we should use -Werror to avoid the
# success of iconv detection with a warnig which success is a miss
# success of iconv detection with a warning which success is a miss
# detection. So this needs for all build mode(even it's a release mode).
#
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror")
......@@ -1352,6 +1352,7 @@ CHECK_FUNCTION_EXISTS_GLIBC(lchflags HAVE_LCHFLAGS)
CHECK_FUNCTION_EXISTS_GLIBC(lchmod HAVE_LCHMOD)
CHECK_FUNCTION_EXISTS_GLIBC(lchown HAVE_LCHOWN)
CHECK_FUNCTION_EXISTS_GLIBC(link HAVE_LINK)
CHECK_FUNCTION_EXISTS_GLIBC(linkat HAVE_LINKAT)
CHECK_FUNCTION_EXISTS_GLIBC(localtime_r HAVE_LOCALTIME_R)
CHECK_FUNCTION_EXISTS_GLIBC(lstat HAVE_LSTAT)
CHECK_FUNCTION_EXISTS_GLIBC(lutimes HAVE_LUTIMES)
......@@ -1421,6 +1422,10 @@ CHECK_C_SOURCE_COMPILES(
"#include <sys/types.h>\n#include <sys/mount.h>\nint main(void) { struct xvfsconf v; return sizeof(v);}"
HAVE_STRUCT_XVFSCONF)
CHECK_C_SOURCE_COMPILES(
"#include <sys/types.h>\n#include <sys/mount.h>\nint main(void) { struct statfs s; return sizeof(s);}"
HAVE_STRUCT_STATFS)
# Make sure we have the POSIX version of readdir_r, not the
# older 2-argument version.
CHECK_C_SOURCE_COMPILES(
......@@ -1496,9 +1501,14 @@ CHECK_STRUCT_HAS_MEMBER("struct tm" tm_gmtoff
CHECK_STRUCT_HAS_MEMBER("struct tm" __tm_gmtoff
"time.h" HAVE_STRUCT_TM___TM_GMTOFF)
IF(HAVE_STRUCT_STATFS)
# Check for f_namemax in struct statfs
CHECK_STRUCT_HAS_MEMBER("struct statfs" f_namemax
"sys/param.h;sys/mount.h" HAVE_STRUCT_STATFS_F_NAMEMAX)
# Check for f_iosize in struct statfs
CHECK_STRUCT_HAS_MEMBER("struct statfs" f_iosize
"sys/param.h;sys/mount.h" HAVE_STRUCT_STATFS_F_IOSIZE)
ENDIF(HAVE_STRUCT_STATFS)
# Check for birthtime in struct stat
CHECK_STRUCT_HAS_MEMBER("struct stat" st_birthtime
......
......@@ -224,7 +224,9 @@ libarchive_la_SOURCES= \
libarchive/archive_write_set_format_ar.c \
libarchive/archive_write_set_format_by_name.c \
libarchive/archive_write_set_format_cpio.c \
libarchive/archive_write_set_format_cpio_binary.c \
libarchive/archive_write_set_format_cpio_newc.c \
libarchive/archive_write_set_format_cpio_odc.c \
libarchive/archive_write_set_format_filter_by_ext.c \
libarchive/archive_write_set_format_iso9660.c \
libarchive/archive_write_set_format_mtree.c \
......@@ -548,6 +550,7 @@ libarchive_test_SOURCES= \
libarchive/test/test_read_too_many_filters.c \
libarchive/test/test_read_truncated.c \
libarchive/test/test_read_truncated_filter.c \
libarchive/test/test_short_writes.c \
libarchive/test/test_sparse_basic.c \
libarchive/test/test_tar_filenames.c \
libarchive/test/test_tar_large.c \
......@@ -557,6 +560,7 @@ libarchive_test_SOURCES= \
libarchive/test/test_write_disk.c \
libarchive/test/test_write_disk_appledouble.c \
libarchive/test/test_write_disk_failures.c \
libarchive/test/test_write_disk_fixup.c \
libarchive/test/test_write_disk_hardlink.c \
libarchive/test/test_write_disk_hfs_compression.c \
libarchive/test/test_write_disk_lookup.c \
......@@ -898,6 +902,7 @@ libarchive_test_EXTRA_DIST=\
libarchive/test/test_read_format_warc.warc.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 \
libarchive/test/test_read_format_zip_7z_lzma.zip.uu \
libarchive/test/test_read_format_zip_bz2_hang.zip.uu \
libarchive/test/test_read_format_zip_bzip2.zipx.uu \
......
Aug 22, 2021: libarchive 3.5.2 released
Dec 26, 2020: libarchive 3.5.1 released
Dec 01, 2020: libarchive 3.5.0 released
......
......@@ -79,6 +79,7 @@ Currently, the library automatically detects and reads the following formats:
* POSIX octet-oriented cpio
* SVR4 ASCII cpio
* Binary cpio (big-endian or little-endian)
* PWB binary cpio
* ISO9660 CD-ROM images (with optional Rockridge or Joliet extensions)
* ZIP archives (with uncompressed or "deflate" compressed entries, including support for encrypted Zip archives)
* ZIPX archives (with support for bzip2, ppmd8, lzma and xz compressed entries)
......@@ -110,6 +111,8 @@ The library can create archives in any of the following formats:
* Old V7 tar format
* POSIX octet-oriented cpio
* SVR4 "newc" cpio
* Binary cpio (little-endian)
* PWB binary cpio
* shar archives
* ZIP archives (with uncompressed or "deflate" compressed entries)
* GNU and BSD 'ar' archives
......
......@@ -744,6 +744,9 @@ typedef uint64_t uintmax_t;
/* Define to 1 if you have the `link' function. */
#cmakedefine HAVE_LINK 1
/* Define to 1 if you have the `linkat' function. */
#cmakedefine HAVE_LINKAT 1
/* Define to 1 if you have the <linux/fiemap.h> header file. */
#cmakedefine HAVE_LINUX_FIEMAP_H 1
......
......@@ -246,7 +246,7 @@ function hextoi(hex)
# Exclusion code points specified by
# http://unicode.org/Public/6.0.0/ucd/CompositionExclusions.txt
##
# 1. Script Specifices
# 1. Script Specifics
##
\$1 ~/^095[89ABCDEF]\$/ {
next
......
......@@ -22,7 +22,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
* $FreeBSD: src/usr.bin/tar/bsdtar_platform.h,v 1.26 2008/12/06 07:37:14 kientzle Exp $
*/
/*
......
......@@ -4,8 +4,8 @@ dnl First, define all of the version numbers up front.
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.5.1])
m4_define([LIBARCHIVE_VERSION_N],[3005001])
m4_define([LIBARCHIVE_VERSION_S],[3.5.2])
m4_define([LIBARCHIVE_VERSION_N],[3005002])
dnl bsdtar and bsdcpio versioning tracks libarchive
m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S())
......@@ -107,6 +107,7 @@ AC_SUBST(PLATFORMCPPFLAGS)
AC_PROG_CC
AC_PROG_CC_C99
AM_PROG_CC_C_O
AC_PROG_CPP
AC_USE_SYSTEM_EXTENSIONS
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
......@@ -380,7 +381,7 @@ if test "x$with_iconv" != "xno"; then
AC_CHECK_FUNCS([locale_charset])
LIBS="${am_save_LIBS}"
if test "x$ac_cv_func_locale_charset" != "xyes"; then
# If locale_charset() is not in libiconv, we have to find libcharset.
# If locale_charset() is not in libiconv, we have to find libcharset.
AC_CHECK_LIB(charset,locale_charset)
fi
fi
......@@ -565,6 +566,13 @@ AC_CHECK_MEMBERS([struct statfs.f_namemax],,,
#include <sys/mount.h>
])
# Check for f_iosize in struct statfs
AC_CHECK_MEMBERS([struct statfs.f_iosize],,,
[
#include <sys/param.h>
#include <sys/mount.h>
])
# Check for f_iosize in struct statvfs
AC_CHECK_MEMBERS([struct statvfs.f_iosize],,,
[
......@@ -648,7 +656,7 @@ AC_CHECK_FUNCS([fstat fstatat fstatfs fstatvfs ftruncate])
AC_CHECK_FUNCS([futimens futimes futimesat])
AC_CHECK_FUNCS([geteuid getpid getgrgid_r getgrnam_r])
AC_CHECK_FUNCS([getpwnam_r getpwuid_r getvfsbyname gmtime_r])
AC_CHECK_FUNCS([lchflags lchmod lchown link localtime_r lstat lutimes])
AC_CHECK_FUNCS([lchflags lchmod lchown link linkat localtime_r lstat lutimes])
AC_CHECK_FUNCS([mbrtowc memmove memset])
AC_CHECK_FUNCS([mkdir mkfifo mknod mkstemp])
AC_CHECK_FUNCS([nl_langinfo openat pipe poll posix_spawnp readlink readlinkat])
......@@ -677,6 +685,13 @@ AC_CHECK_TYPES(struct xvfsconf,,,
#include <sys/mount.h>
])
AC_CHECK_TYPES(struct statfs,,,
[#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <sys/mount.h>
])
# There are several variants of readdir_r around; we only
# accept the POSIX-compliant version.
AC_COMPILE_IFELSE(
......
/*
* Macros for file64 functions
*
* Android does not support the macro _FILE_OFFSET_BITS=64
* As of android-21 it does however support many file64 functions
*/
#ifndef ARCHIVE_ANDROID_LF_H_INCLUDED
#define ARCHIVE_ANDROID_LF_H_INCLUDED
#if __ANDROID_API__ > 20
#include <dirent.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/statvfs.h>
#include <sys/types.h>
#include <sys/vfs.h>
//dirent.h
#define readdir_r readdir64_r
#define readdir readdir64
#define dirent dirent64
//fcntl.h
#define openat openat64
#define open open64
#define mkstemp mkstemp64
//unistd.h
#define lseek lseek64
#define ftruncate ftruncate64
//sys/stat.h
#define fstatat fstatat64
#define fstat fstat64
#define lstat lstat64
#define stat stat64
//sys/statvfs.h
#define fstatvfs fstatvfs64
#define statvfs statvfs64
//sys/types.h
#define off_t off64_t
//sys/vfs.h
#define fstatfs fstatfs64
#define statfs statfs64
#endif
#endif /* ARCHIVE_ANDROID_LF_H_INCLUDED */
/*
* Macros for file64 functions
*
* Android does not support the macro _FILE_OFFSET_BITS=64
* As of android-21 it does however support many file64 functions
*/
#ifndef ARCHIVE_ANDROID_LF_H_INCLUDED
#define ARCHIVE_ANDROID_LF_H_INCLUDED
#if __ANDROID_API__ > 20
#include <dirent.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/statvfs.h>
#include <sys/types.h>
#include <sys/vfs.h>
//dirent.h
#define readdir_r readdir64_r
#define readdir readdir64
#define dirent dirent64
//fcntl.h
#define openat openat64
#define open open64
#define mkstemp mkstemp64
//unistd.h
#define lseek lseek64
#define ftruncate ftruncate64
//sys/stat.h
#define fstatat fstatat64
#define fstat fstat64
#define lstat lstat64
#define stat stat64
//sys/statvfs.h
#define fstatvfs fstatvfs64
#define statvfs statvfs64
//sys/types.h
#define off_t off64_t
//sys/vfs.h
#define fstatfs fstatfs64
#define statfs statfs64
#endif
#endif /* ARCHIVE_ANDROID_LF_H_INCLUDED */
......@@ -99,7 +99,7 @@ replace ()
print \".Dt ${binary^^} 1\";
next;
}
# replace the first occurence of \"$pattern\" by \"$binary\"
# replace the first occurrence of \"$pattern\" by \"$binary\"
!stop && /^.Nm $pattern/ {
print \".Nm $binary\" ;
stop = 1 ;
......
......@@ -170,7 +170,7 @@ shar_write_entry(struct archive *a, const char *pathname, const char *accpath,
}
/*
* Write singe path to the archive. The path can be a regular file, directory
* Write single path to the archive. The path can be a regular file, directory
* or device. Symbolic links are followed.
*/
static int
......
......@@ -82,6 +82,13 @@ all operating modes.
.It Fl 0 , Fl Fl null
Read filenames separated by NUL characters instead of newlines.
This is necessary if any of the filenames being read might contain newlines.
.It Fl 6 , Fl Fl pwb
When reading a binary format archive, assume it's the earlier one,
from the PWB variant of 6th Edition UNIX.
When writing a cpio archive, use the PWB format.
.It Fl 7 , Fl Fl binary
(o mode only)
When writing a cpio archive, use the (newer, non-PWB) binary format.
.It Fl A
(o mode only)
Append to the specified archive.
......
......@@ -51,7 +51,7 @@ __FBSDID("$FreeBSD: src/usr.bin/cpio/cmdline.c,v 1.5 2008/12/06 07:30:40 kientzl
/*
* Short options for cpio. Please keep this sorted.
*/
static const char *short_options = "0AaBC:cdE:F:f:H:hI:iJjLlmnO:opR:rtuVvW:yZz";
static const char *short_options = "067AaBC:cdE:F:f:H:hI:iJjLlmnO:opR:rtuVvW:yZz";
/*
* Long options for cpio. Please keep this sorted.
......@@ -62,6 +62,7 @@ static const struct option {
int equivalent; /* Equivalent short option. */
} cpio_longopts[] = {
{ "b64encode", 0, OPTION_B64ENCODE },
{ "binary", 0, '7' },
{ "create", 0, 'o' },
{ "dereference", 0, 'L' },
{ "dot", 0, 'V' },
......@@ -86,6 +87,7 @@ static const struct option {
{ "pass-through", 0, 'p' },
{ "preserve-modification-time", 0, 'm' },
{ "preserve-owner", 0, OPTION_PRESERVE_OWNER },
{ "pwb", 0, '6' },
{ "quiet", 0, OPTION_QUIET },
{ "unconditional", 0, 'u' },
{ "uuencode", 0, OPTION_UUENCODE },
......
......@@ -22,7 +22,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
* $FreeBSD: src/usr.bin/cpio/config_freebsd.h,v 1.3 2008/12/06 07:30:40 kientzle Exp $
*/
/* A hand-tooled configuration for FreeBSD. */
......
......@@ -192,6 +192,12 @@ main(int argc, char *argv[])
case '0': /* GNU convention: --null, -0 */
cpio->option_null = 1;
break;
case '6': /* in/out: assume/create 6th edition (PWB) format */
cpio->option_pwb = 1;
break;
case '7': /* out: create archive using 7th Edition binary format */
cpio->format = "bin";
break;
case 'A': /* NetBSD/OpenBSD */
cpio->option_append = 1;
break;
......@@ -400,11 +406,12 @@ main(int argc, char *argv[])
switch (cpio->mode) {
case 'o':
/* TODO: Implement old binary format in libarchive,
use that here. */
if (cpio->format == NULL)
cpio->format = "odc"; /* Default format */
if (cpio->format == NULL) {
if (cpio->option_pwb)
cpio->format = "pwb";
else
cpio->format = "cpio";
}
mode_out(cpio);
break;
case 'i':
......@@ -462,7 +469,7 @@ static const char *long_help_msg =
" -v Verbose filenames -V one dot per file\n"
"Create: %p -o [options] < [list of files] > [archive]\n"
" -J,-y,-z,--lzma Compress archive with xz/bzip2/gzip/lzma\n"
" --format {odc|newc|ustar} Select archive format\n"
" --format {pwb|bin|odc|newc|ustar} Select archive format\n"
"List: %p -it < [archive]\n"
"Extract: %p -i [options] < [archive]\n";
......@@ -970,6 +977,8 @@ mode_in(struct cpio *cpio)
lafe_errc(1, 0, "Couldn't allocate archive object");
archive_read_support_filter_all(a);
archive_read_support_format_all(a);
if (cpio->option_pwb)
archive_read_set_options(a, "pwb");
if (cpio->passphrase != NULL)
r = archive_read_add_passphrase(a, cpio->passphrase);
else
......@@ -1080,6 +1089,8 @@ mode_list(struct cpio *cpio)
lafe_errc(1, 0, "Couldn't allocate archive object");
archive_read_support_filter_all(a);
archive_read_support_format_all(a);
if (cpio->option_pwb)
archive_read_set_options(a, "pwb");
if (cpio->passphrase != NULL)
r = archive_read_add_passphrase(a, cpio->passphrase);
else
......
......@@ -62,6 +62,7 @@ struct cpio {
int option_list; /* -t */
char option_null; /* --null */
int option_numeric_uid_gid; /* -n */
int option_pwb; /* -6 */
int option_rename; /* -r */
char *destdir;
size_t destdir_len;
......
......@@ -13,17 +13,17 @@ IF(ENABLE_CPIO AND ENABLE_TEST)
test_0.c
test_basic.c
test_cmdline.c
test_extract_cpio_Z
test_extract_cpio_bz2
test_extract_cpio_grz
test_extract_cpio_gz
test_extract_cpio_lrz
test_extract_cpio_lz
test_extract_cpio_lz4
test_extract_cpio_lzma
test_extract_cpio_lzo
test_extract_cpio_xz
test_extract_cpio_zstd
test_extract_cpio_Z.c
test_extract_cpio_bz2.c
test_extract_cpio_grz.c
test_extract_cpio_gz.c
test_extract_cpio_lrz.c
test_extract_cpio_lz.c
test_extract_cpio_lz4.c
test_extract_cpio_lzma.c
test_extract_cpio_lzo.c
test_extract_cpio_xz.c
test_extract_cpio_zstd.c
test_format_newc.c
test_gcpio_compat.c
test_missing_file.c
......
......@@ -230,6 +230,8 @@ DEFINE_TEST(test_basic)
basic_cpio("copy_odc", "--format=odc", "", msg, msg);
basic_cpio("copy_newc", "-H newc", "", result, "2 blocks\n");
basic_cpio("copy_cpio", "-H odc", "", msg, msg);
msg = "1 block\n";
basic_cpio("copy_bin", "-H bin", "", msg, msg);
msg = canSymlink() ? "9 blocks\n" : "8 blocks\n";
basic_cpio("copy_ustar", "-H ustar", "", msg, msg);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment