]> git.ipfire.org Git - thirdparty/libarchive.git/log
thirdparty/libarchive.git
8 months ago7zip reader: translate windows permissions to unix permissions (#1943)
Mostyn Bramley-Moore [Mon, 21 Aug 2023 11:07:11 +0000 (13:07 +0200)] 
7zip reader: translate windows permissions to unix permissions (#1943)

7z archives created on windows 7zip can lack unix permission info. In
this case, we need to translate the windows permissions into reasonable
unix equivalents.

8 months agopax writer: fix multiple security vulnerabilities
Martin Matuska [Thu, 17 Aug 2023 22:28:39 +0000 (00:28 +0200)] 
pax writer: fix multiple security vulnerabilities

Security vulnerabilities:
1. Heap overflow in url_encode() in archive_write_set_format_pax.c
2. NULL dereference in archive_write_pax_header_xattrs()
3. Another NULL dereference in archive_write_pax_header_xattrs()
4. NULL dereference in archive_write_pax_header_xattr()

The vulnerabilities can be triggered when writing pax archives
with extended attributes (SCHILY or LIBARCHIVE) by feeding attribute
names longer than INT_MAX or attribute names that fail to be encoded
properly.

Reported-by: Bahaa Naamneh of Crosspoint Labs
9 months agoCI: update Windows build dependencies
Martin Matuska [Tue, 15 Aug 2023 07:56:09 +0000 (09:56 +0200)] 
CI: update Windows build dependencies

Update zlib to 1.2.13, xz to 1.4.4 and zstd to 1.5.5

9 months agounzip: correctly handle arguments following an -x after zipfile
Martin Matuska [Thu, 3 Aug 2023 22:13:51 +0000 (00:13 +0200)] 
unzip: correctly handle arguments following an -x after zipfile

9 months agobuild: add missing HAVE_STRUCT_STATFS to build/cmake/config.h.in
Martin Matuska [Wed, 2 Aug 2023 22:31:38 +0000 (00:31 +0200)] 
build: add missing HAVE_STRUCT_STATFS to build/cmake/config.h.in

Fixes #1937

9 months agounzip: correctly define bsdunzip_optind
Martin Matuska [Mon, 31 Jul 2023 11:29:25 +0000 (13:29 +0200)] 
unzip: correctly define bsdunzip_optind

9 months agounzip: use libarchive-style getopt() implementation
Martin Matuska [Mon, 31 Jul 2023 09:51:35 +0000 (11:51 +0200)] 
unzip: use libarchive-style getopt() implementation

9 months agounzip: support --version argument
Martin Matuska [Sun, 30 Jul 2023 22:45:57 +0000 (00:45 +0200)] 
unzip: support --version argument

9 months agocat: fix references and variable names in cmdline.c
Martin Matuska [Sun, 30 Jul 2023 21:25:05 +0000 (23:25 +0200)] 
cat: fix references and variable names in cmdline.c

9 months agoLibarchive 3.7.2dev
Martin Matuska [Sat, 29 Jul 2023 17:30:12 +0000 (19:30 +0200)] 
Libarchive 3.7.2dev

9 months agoRelease 3.7.1 v3.7.1
Martin Matuska [Sat, 29 Jul 2023 16:58:59 +0000 (18:58 +0200)] 
Release 3.7.1

9 months agocontrib/unter: use vendor-dependent number format for size_t (#1613)
Samuel Marks [Wed, 26 Jul 2023 07:04:06 +0000 (03:04 -0400)] 
contrib/unter: use vendor-dependent number format for size_t (#1613)

Use BUF_SIZE constant instead of explicit number

9 months agotar: respect --strip-components and -s patterns in cru modes on read (#1731)
Luke Rewega [Wed, 26 Jul 2023 06:58:57 +0000 (02:58 -0400)] 
tar: respect --strip-components and -s patterns in cru modes on read (#1731)

9 months agocpio: multiple fixes in list_item_verbose()
Martin Matuska [Tue, 25 Jul 2023 13:06:15 +0000 (15:06 +0200)] 
cpio: multiple fixes in list_item_verbose()

Do not call strftime() with NULL timeptr
Adjust uids and gids buffers as cpio_i64toa() may return up to 22 bytes

Fixes #1934
Fixes #1935

9 months agounzip: fix include order in la_getline.c
Martin Matuska [Tue, 25 Jul 2023 12:13:03 +0000 (14:13 +0200)] 
unzip: fix include order in la_getline.c

9 months agoCheck if clang has __builtin_bswap16 (#1932)
Joshua Root [Mon, 24 Jul 2023 12:43:42 +0000 (22:43 +1000)] 
Check if clang has __builtin_bswap16 (#1932)

Some older versions of clang do not in fact have this builtin.

Co-authored-by: Toby Peterson <toby@macports.org>
9 months agobuild: update config_freebsd.h
Martin Matuska [Mon, 24 Jul 2023 11:43:57 +0000 (13:43 +0200)] 
build: update config_freebsd.h

9 months agounzip: add NetBSD implementation of getline() if not supported
Martin Matuska [Mon, 24 Jul 2023 11:35:50 +0000 (13:35 +0200)] 
unzip: add NetBSD implementation of getline() if not supported

Fixes #1933

9 months agounzip: remove optreset from bsdunzip_platform.h
Martin Matuska [Mon, 24 Jul 2023 11:35:33 +0000 (13:35 +0200)] 
unzip: remove optreset from bsdunzip_platform.h

9 months agoCorrect assignment to r when checking for result of reading archive data (#1929)
AtariDreams [Sun, 23 Jul 2023 22:10:10 +0000 (18:10 -0400)] 
Correct assignment to r when checking for result of reading archive data (#1929)

It is impossible for if (r == ARCHIVE_FATAL) to be true otherwise.

9 months agounzip: Pull in upstream updates (#1926)
Adrian Vovk [Sat, 22 Jul 2023 09:00:20 +0000 (05:00 -0400)] 
unzip: Pull in upstream updates (#1926)

Fixes #1873

9 months agoFix various VS2019 compiler warnings (#1927)
Mostyn Bramley-Moore [Sat, 22 Jul 2023 08:57:20 +0000 (10:57 +0200)] 
Fix various VS2019 compiler warnings (#1927)

This PR fixes a bunch of warnings while building with VS2019.
Some lz4 warning fixes are included, too.

9 months agoreturn ((int)r); is not part of if statement due to missing brackets (#1930)
AtariDreams [Sat, 22 Jul 2023 02:30:44 +0000 (22:30 -0400)] 
return ((int)r); is not part of if statement due to missing brackets (#1930)

This is problematic because we need to return if an error occurs, and
because we are letting a continue to be evaluated even though it is
closed.

9 months agoReplace `svfs.f_namelen` with `svfs.f_namemax` (#1924)
Wong Hoi Sing Edison [Wed, 19 Jul 2023 08:59:32 +0000 (16:59 +0800)] 
Replace `svfs.f_namelen` with `svfs.f_namemax` (#1924)

The equivalent for `f_namelen` in struct statvfs is `f_namemax`.

Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
9 months agoMakefile: add mkdirs for all */test/list.h targets (#1923)
Michał Górny [Wed, 19 Jul 2023 08:22:25 +0000 (10:22 +0200)] 
Makefile: add mkdirs for all */test/list.h targets (#1923)

Add missing mkdir calls to `cat/test/list.h` and `unzip/test/list.h`
invocations, making them consistent with the other rules. Otherwise,
the build fails when configured with `--disable-dependency-tracking`,
as configure does not create the directories automatically then.

9 months agounzip: fix build without utimensat() or futimens()
Martin Matuska [Tue, 18 Jul 2023 14:57:10 +0000 (16:57 +0200)] 
unzip: fix build without utimensat() or futimens()

Fixes #1919

10 months agounzip: use libeal port of sys/queue.h if not available
Martin Matuska [Tue, 18 Jul 2023 13:46:20 +0000 (15:46 +0200)] 
unzip: use libeal port of sys/queue.h if not available

Fixes #1920

10 months agounzip: use lchmod() and optreset only if available (fix Android build)
Martin Matuska [Tue, 18 Jul 2023 13:41:43 +0000 (15:41 +0200)] 
unzip: use lchmod() and optreset only if available (fix Android build)

Fixes #1921

10 months agoLibarchive 3.7.1dev
Martin Matuska [Tue, 18 Jul 2023 07:29:44 +0000 (09:29 +0200)] 
Libarchive 3.7.1dev

10 months agoRelease 3.7.0 v3.7.0
Martin Matuska [Tue, 18 Jul 2023 05:54:20 +0000 (07:54 +0200)] 
Release 3.7.0

10 months ago7zip reader: add support for ARM64 filter (#1918)
Mostyn Bramley-Moore [Mon, 17 Jul 2023 11:00:23 +0000 (13:00 +0200)] 
7zip reader: add support for ARM64 filter (#1918)

7-Zip 23.00 added a new ARM64 filter, which is also supported by recent
versions of liblzma. This PR adds support for this filter for both lzma
and non-lzma encoders.

10 months agoCI: use two make jobs for Cirrus CI FreeBSD builds
Martin Matuska [Mon, 17 Jul 2023 09:37:03 +0000 (11:37 +0200)] 
CI: use two make jobs for Cirrus CI FreeBSD builds

10 months agoCI: use multiple make jobs to speed up building (#1917)
Mostyn Bramley-Moore [Mon, 17 Jul 2023 09:29:48 +0000 (11:29 +0200)] 
CI: use multiple make jobs to speed up building (#1917)

10 months agobsdunzip_test: fix link against ACL libs in cmake
Martin Matuska [Mon, 17 Jul 2023 09:20:55 +0000 (11:20 +0200)] 
bsdunzip_test: fix link against ACL libs in cmake

10 months agopax writer: depend ustar_max_mtime on size of time_t
Martin Matuska [Sat, 15 Jul 2023 23:12:25 +0000 (01:12 +0200)] 
pax writer: depend ustar_max_mtime on size of time_t

10 months agoCI: use macos-13 in GitHub Actions
Martin Matuska [Fri, 14 Jul 2023 23:35:26 +0000 (01:35 +0200)] 
CI: use macos-13 in GitHub Actions

10 months agobuild: add mising test archives to Makefile.am
Martin Matuska [Fri, 14 Jul 2023 20:30:01 +0000 (22:30 +0200)] 
build: add mising test archives to Makefile.am

10 months agobuild: fix dist-build in Makefile.am
Martin Matuska [Fri, 14 Jul 2023 18:59:36 +0000 (20:59 +0200)] 
build: fix dist-build in Makefile.am

10 months agoCI: update apt cache on Ubuntu before build
Martin Matuska [Fri, 14 Jul 2023 18:53:39 +0000 (20:53 +0200)] 
CI: update apt cache on Ubuntu before build

10 months agounzip: disable build on Windows
Martin Matuska [Fri, 14 Jul 2023 15:37:19 +0000 (17:37 +0200)] 
unzip: disable build on Windows

Bsdunzip has not been ported to Windows yet.
Add header checks for fcntl.h and sys/queue.h
Add function check for fcntl()

10 months agoCI: ignore directory traversals test nr. 4 on MacOS
Martin Matuska [Fri, 14 Jul 2023 11:53:20 +0000 (13:53 +0200)] 
CI: ignore directory traversals test nr. 4 on MacOS

10 months agounzip: fix mtime number error from last commit
Martin Matuska [Fri, 14 Jul 2023 10:39:25 +0000 (12:39 +0200)] 
unzip: fix mtime number error from last commit

10 months agounzip: fix multi-platform handling of stat mtime
Martin Matuska [Fri, 14 Jul 2023 10:33:26 +0000 (12:33 +0200)] 
unzip: fix multi-platform handling of stat mtime

10 months agoCI: fix debug build with cmake
Martin Matuska [Fri, 14 Jul 2023 09:04:51 +0000 (11:04 +0200)] 
CI: fix debug build with cmake

10 months agobuild: fix cmake build with OpenSSL
Martin Matuska [Fri, 14 Jul 2023 08:04:37 +0000 (10:04 +0200)] 
build: fix cmake build with OpenSSL

10 months agotests: fix exit on failed realloc in libarchive/test/test_fuzz.c
Martin Matuska [Fri, 14 Jul 2023 07:53:13 +0000 (09:53 +0200)] 
tests: fix exit on failed realloc in libarchive/test/test_fuzz.c

10 months agounzip: fix EXTRA_VERSION macro in unzip/test/test.h
Martin Matuska [Fri, 14 Jul 2023 07:52:24 +0000 (09:52 +0200)] 
unzip: fix EXTRA_VERSION macro in unzip/test/test.h

10 months agobuild: fix cmake build with Mbed TLS
Martin Matuska [Fri, 14 Jul 2023 07:50:54 +0000 (09:50 +0200)] 
build: fix cmake build with Mbed TLS

10 months agoFix call to setenv() in unzip/bsdunzip.c
Martin Matuska [Fri, 14 Jul 2023 06:52:06 +0000 (08:52 +0200)] 
Fix call to setenv() in unzip/bsdunzip.c

10 months agoFix missing endif in libarchive/archive_random.c
Martin Matuska [Fri, 14 Jul 2023 06:50:06 +0000 (08:50 +0200)] 
Fix missing endif in libarchive/archive_random.c

10 months agobsdunzip: make it possible to pass filenames starting with dash
Mingye Wang [Sat, 27 May 2023 13:28:23 +0000 (21:28 +0800)] 
bsdunzip: make it possible to pass filenames starting with dash

We now check for residual arguments after the second scan, so any filename protected by `--` is picked up.

10 months agoPort over FreeBSD's unzip utility
Adrian Vovk [Tue, 23 May 2023 20:56:23 +0000 (16:56 -0400)] 
Port over FreeBSD's unzip utility

This allows libarchive to act as a drop-in replacement to Info-ZIP

10 months agoAdd missing brackets to if clause
Sarah Gilmore [Tue, 25 Apr 2023 13:23:39 +0000 (09:23 -0400)] 
Add missing  brackets to if clause

10 months agoFix indentation
Sarah Gilmore [Wed, 29 Mar 2023 14:20:20 +0000 (10:20 -0400)] 
Fix indentation

10 months agoFix typo in calls to close_file_descriptor function
Sarah Gilmore [Fri, 24 Mar 2023 13:52:36 +0000 (09:52 -0400)] 
Fix typo in calls to close_file_descriptor function

10 months agoAlways close file handle on descriptor on posix systems before returning from _archiv...
Sarah Gilmore [Fri, 24 Mar 2023 13:44:38 +0000 (09:44 -0400)] 
Always close file handle on descriptor on posix systems before returning from _archive_write_disk_finish_entry

10 months agoClose file handle on windows when padding/truncating file fails
Sarah Gilmore [Fri, 17 Mar 2023 13:54:32 +0000 (09:54 -0400)] 
Close file handle on windows when padding/truncating file fails

10 months agoAdd security policy (#1866)
Pedro Nacht [Thu, 13 Jul 2023 22:48:47 +0000 (19:48 -0300)] 
Add security policy (#1866)

Signed-off-by: Pedro Kaj Kjellerup Nacht <pnacht@google.com>
Co-authored-by: Martin Matuska <martin@matuska.de>
10 months agoFix the build with libressl-devel <2.7
Enji Cooper [Sat, 13 May 2023 00:03:04 +0000 (17:03 -0700)] 
Fix the build with libressl-devel <2.7

This change is similar to what was done in
5da00ad75b09e262774ec3675bbe4d5a4502a852.

Co-authored by: Greg Lewis <glewis@FreeBSD.org>
Co-authored by: Piotr Kubaj <pkubaj@anongoth.pl>
Obtained from: FreeBSD ports (9fcaa71e4675d12dc3c9a5895edd68610e03cbcd)
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
10 months agofix incorrect test of HAVE_LZMA_STREAM_ENCODER_MT and missed LIBB2_INCLUDE_DIR
Albert Jin [Wed, 24 May 2023 02:46:01 +0000 (10:46 +0800)] 
fix incorrect test of HAVE_LZMA_STREAM_ENCODER_MT and missed LIBB2_INCLUDE_DIR

10 months agoREADME: vulnerability on implicite directory creation
Peter Kaestle [Mon, 3 Apr 2023 11:35:35 +0000 (13:35 +0200)] 
README: vulnerability on implicite directory creation

There's a race condition with the umask() execution in multi-threaded
use of the libarchive.
It's the users responsibility to mutex archive_write_disk_header()
call.

Signed-off-by: Peter Kaestle <peter.kaestle@nokia.com>
10 months agoREADME.md: HTTP => HTTPS
Kai [Wed, 24 May 2023 11:23:22 +0000 (13:23 +0200)] 
README.md: HTTP => HTTPS

10 months agoUse Windows bcrypt when enabled and building for Vista+ (#1887)
Steve Lhomme [Thu, 13 Jul 2023 22:32:56 +0000 (00:32 +0200)] 
Use Windows bcrypt when enabled and building for Vista+ (#1887)

The wincrypt API is deprecated and is not allowed in UWP builds. We can
use the more modern bcrypt API which has equivalent calls.

10 months agoDisable CreateFileA calls in UWP builds
Steve Lhomme [Fri, 26 May 2023 07:58:48 +0000 (09:58 +0200)] 
Disable CreateFileA calls in UWP builds

Only CreateFile2 and CreateFileFromAppW are allowed.

10 months agoUse CreateFile2 instead of CreateFileW on Win8+ builds
Steve Lhomme [Fri, 26 May 2023 07:57:40 +0000 (09:57 +0200)] 
Use CreateFile2 instead of CreateFileW on Win8+ builds

CreateFileW is not allowed in Universal Windows Platform (UWP) builds but
CreateFile2 is available. We could just enable this code for UWP but
it's probably to use it going forward so the code is properly tested on
both sides.

10 months agotests: use CreateFileA for char* filenames
Steve Lhomme [Wed, 24 May 2023 13:00:04 +0000 (15:00 +0200)] 
tests: use CreateFileA for char* filenames

In case the code is compiled with the UNICODE define.

10 months agoDon't call GetOEMCP() in Universal Windows Platform builds
Steve Lhomme [Wed, 24 May 2023 13:23:14 +0000 (15:23 +0200)] 
Don't call GetOEMCP() in Universal Windows Platform builds

It's not available [1] [2]. However we can use the intermediate CP_OEMCP
value. It can be used to compare charsets in create_sconv_object().
It won't work with comparing charsets in archive_string_default_conversion_for_read()
and archive_string_default_conversion_for_write(). current_codepage being
an actual CodePage value.

[1] https://learn.microsoft.com/en-us/uwp/win32-and-com/win32-apis#apis-from-api-ms-win-core-localization-l1-2-0dll
[2] https://learn.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-getoemcp#requirements

10 months agoUse the common CMake BUILD_SHARED_LIBS to build shared library or not
Steve Lhomme [Thu, 25 May 2023 11:56:00 +0000 (13:56 +0200)] 
Use the common CMake BUILD_SHARED_LIBS to build shared library or not

https://cmake.org/cmake/help/v3.0/variable/BUILD_SHARED_LIBS.html

Usually it's built-in but make sure we have it on by default.

We don't need to rename the windows static library when it's the only one built.
This will also allow proper usage of the pkg-config file in this case. Otherwise
there is no way to select the static library that way.

10 months agoFix bcrypt detection on UNIX cross-compilation
Steve Lhomme [Thu, 25 May 2023 09:47:13 +0000 (11:47 +0200)] 
Fix bcrypt detection on UNIX cross-compilation

The Windows SDK uses an uppercase on the B, but mingw-w64 doesn't.
The autoconf detection already uses a lowercase bcrypt.

10 months agoFix build error when cross-compiling for Windows
Steve Lhomme [Thu, 25 May 2023 09:33:23 +0000 (11:33 +0200)] 
Fix build error when cross-compiling for Windows

CHECK_C_SOURCE_RUNS generates a build error when cross-compiling.

ZLIB_WINAPI is the only one tested. When the run test fails, it's tested again
with just a compilation.

10 months agofix the CreateHardLinkW signature to match the real function
Steve Lhomme [Thu, 25 May 2023 08:16:08 +0000 (10:16 +0200)] 
fix the CreateHardLinkW signature to match the real function

The `ret` variable was already using BOOL instead of BOOLEAN.

10 months agoDisable CreateSymbolicLinkW use in UWP builds
Steve Lhomme [Thu, 25 May 2023 07:38:30 +0000 (09:38 +0200)] 
Disable CreateSymbolicLinkW use in UWP builds

The call is forbidden:
https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createsymboliclinkw#requirements

10 months agoUse CreateHardLinkW and CreateSymbolicLinkW directly on Vista+ builds
Steve Lhomme [Thu, 25 May 2023 07:53:49 +0000 (09:53 +0200)] 
Use CreateHardLinkW and CreateSymbolicLinkW directly on Vista+ builds

No need to load the kernel library manually. It's always available. It's not
possible to load it in Universal Windows Platform (UWP) builds anyway.

No need to load the kernel library manually. It's always available. It's not
possible to load it in Universal Windows Platform (UWP) builds anyway.

10 months agoDisable program call with stdin/stdout usage on UWP builds
Steve Lhomme [Wed, 24 May 2023 13:14:33 +0000 (15:14 +0200)] 
Disable program call with stdin/stdout usage on UWP builds

Some calls are not allowed:
* WaitForInputIdle [1]
* SetHandleInformation [2]
* STARTF_XXX flags for CreateProcess are not allowed

[1] https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-waitforinputidle#requirements
[2] https://learn.microsoft.com/en-us/windows/win32/api/handleapi/nf-handleapi-sethandleinformation#requirements

10 months agofixup! someone messed up the list
Mingye Wang [Fri, 26 May 2023 14:12:27 +0000 (22:12 +0800)] 
fixup! someone messed up the list

10 months agoarchive_read_set_options.3: document zip options
Mingye Wang [Fri, 26 May 2023 14:07:01 +0000 (22:07 +0800)] 
archive_read_set_options.3: document zip options

10 months agoProperly guard calls to sigaction
uyjulian [Sat, 27 May 2023 06:36:55 +0000 (01:36 -0500)] 
Properly guard calls to sigaction

10 months agoFix certain unused variables on certain conditions
uyjulian [Sat, 27 May 2023 06:50:12 +0000 (01:50 -0500)] 
Fix certain unused variables on certain conditions

10 months agoProperly guard calls to lstat
uyjulian [Sat, 27 May 2023 06:44:51 +0000 (01:44 -0500)] 
Properly guard calls to lstat

10 months agoRename to avoid arc4random_buf static definition clashing
uyjulian [Sat, 27 May 2023 06:52:57 +0000 (01:52 -0500)] 
Rename to avoid arc4random_buf static definition clashing

10 months ago7zip reader: add 7z ARM filter support for copy/bzip2/deflate/zstd
Mostyn Bramley-Moore [Sun, 11 Jun 2023 16:52:40 +0000 (18:52 +0200)] 
7zip reader: add 7z ARM filter support for copy/bzip2/deflate/zstd

This makes the new test_read_format_7zip_zstd_arm test pass. I expect
that the other compression algorithms in this group should also work
now.

10 months ago7zip reader: add some 7z ARM filter tests
Mostyn Bramley-Moore [Sun, 11 Jun 2023 15:32:57 +0000 (17:32 +0200)] 
7zip reader: add some 7z ARM filter tests

Note that test_read_format_7zip_lzma2_arm passes, while
test_read_format_7zip_zstd_arm fails, I believe because
liblzma implements these filters internally for itself, unlike the
other compression libraries.

These two archives contain a linux C hello world executable, built for
gnueabihf. They were created like so (the first one using a fork of
7-zip with zstandard support):
7z a -t7z -m0=zstd -mf=ARM libarchive/test/test_read_format_7zip_zstd_arm.7z hw-gnueabihf
and
7z a -t7z -m0=lzma2 -mf=ARM libarchive/test/test_read_format_7zip_lzma2_arm.7z hw-gnueabihf

10 months ago7zip reader: add support for zstandard compression in 7z archives
Mostyn Bramley-Moore [Mon, 29 May 2023 10:01:47 +0000 (12:01 +0200)] 
7zip reader: add support for zstandard compression in 7z archives

Zstandard support is not yet available in 7-Zip, though it is planned
for a future release:
https://sourceforge.net/p/sevenzip/feature-requests/1580/

The compression ID used here (4F71101) is copied from a popular 7-Zip
fork, which added ZSTD support back in 2017, and is mentioned in the
upstream 7-Zip ticket linked above:
https://github.com/mcmilk/7-Zip-zstd.git

Note that this does not add write support for Zstandard compression
in 7z archives.

Relates to #1656.

10 months agoAdd some 7zip zstd reader tests
Mostyn Bramley-Moore [Mon, 29 May 2023 06:25:37 +0000 (08:25 +0200)] 
Add some 7zip zstd reader tests

There is a popular 7-Zip fork with zstandard support, with releases as
far back as 2017:
https://github.com/mcmilk/7-Zip-zstd.git

Zstandard support is not yet available in 7-Zip, though it is planned
for a future release:
https://sourceforge.net/p/sevenzip/feature-requests/1580/

This change adds a couple of tests for reading 7-Zip archives which
use zstandard compression. They are expected to fail until support is
added in the following commit.

Relates to #1656.

10 months agosetup_current_filesystem: fail if name_max is 0
Luke Mewburn [Sat, 10 Jun 2023 10:44:52 +0000 (11:44 +0100)] 
setup_current_filesystem: fail if name_max is 0

Add error handling to the USE_READDIR_R code paths that set name_max
from struct statfs or statvfs; if the determined name_max == 0
then return an error.

Avoids a crash in tree_dir_next_posix() when the calculation of
dirent_size from name_max is too small for the memory allocated
for struct dirent.

This may fix Github issue #1149
This may fix NetBSD PR https://gnats.netbsd.org/56080

10 months agoLinux: use statvfs for name_max if available
Luke Mewburn [Sat, 10 Jun 2023 10:21:17 +0000 (11:21 +0100)] 
Linux: use statvfs for name_max if available

If using HAVE_STATVFS, set name_max from svfs.f_namelen
instead of sfs.f_namelen, to be consistent with the
rest of the function.

Noticed by code inspection.

10 months agofix unused variable error if no zstd
Wei-Cheng Pan [Thu, 15 Jun 2023 15:34:58 +0000 (00:34 +0900)] 
fix unused variable error if no zstd

10 months agoPrefer OR over addition (#1915)
AtariDreams [Sun, 9 Jul 2023 16:24:17 +0000 (12:24 -0400)] 
Prefer OR over addition (#1915)

Also cast all being ORed to uint64_t when creating a uint64_t.

This makes the code more idiomatic to compilers.

10 months agoCI: update FreeBSD versions (#1907)
Ed Maste [Wed, 21 Jun 2023 02:48:43 +0000 (22:48 -0400)] 
CI: update FreeBSD versions (#1907)

Update to latest released versions (12.4 and 13.2)

12 months agoReduce overlinking per pkg-config spec (#1870)
Enji Cooper [Sat, 13 May 2023 04:12:01 +0000 (21:12 -0700)] 
Reduce overlinking per pkg-config spec (#1870)

libssl isn't required for libarchive. Remove libssl so the installed .pc
file doesn't cause consumers to subsequently overlink libssl into their
code.

This doesn't affect how the code is linked -- only consumers of the
pkg-config specified spec.

12 months agoFix FreeBSD builds with WARNS=6 (#1869)
Enji Cooper [Sat, 13 May 2023 04:11:07 +0000 (21:11 -0700)] 
Fix FreeBSD builds with WARNS=6 (#1869)

WARNS=6 on FreeBSD passes several CFLAGS that causes the previous code
to fail with `-Wincompatible-pointer-types-discards-qualifiers` when
compiled with clang.

This particular change adjusts the code to be
`-Wincompatible-pointer-types-discards-qualifiers` clean. This change
changes the calls to use OSSL_PARAM macro abbreviated calls, instead of
calling more verbose (and less documented) callers.

While here, also address a `mac` object leak if `ctx` cannot be
allocated cleanly by always free'ing `mac` after it's been attached to
`ctx`.

Co-authored-by: Pierre Pronchery <pierre@freebsdfoundation.org>
Sponsored by: The FreeBSD Foundation
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>

13 months agoMake single bit bitfields unsigned to avoid clang 16 warning (#1860)
Dimitry Andric [Tue, 18 Apr 2023 00:59:32 +0000 (02:59 +0200)] 
Make single bit bitfields unsigned to avoid clang 16 warning (#1860)

Clang 16 introduced a warning about single bit bitfields in structs,
which is triggered by a few libarchive formats:

libarchive/archive_write_set_format_7zip.c:1541:13: error: implicit
truncation from 'int' to a one-bit wide bit-field changes value from 1
to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
                    file->dir = 1;
                              ^ ~

This is because single bit bitfields only support values -1 and 0, if
they are signed.

For bitfields with two or more bits this can be intentional, but single
bit bitfields are typically used as booleans, so it is better to make
them unsigned.

14 months agofix typo in config.h.in (#1851)
Xin "Russell" Liu [Thu, 2 Mar 2023 05:29:50 +0000 (13:29 +0800)] 
fix typo in config.h.in (#1851)

14 months agoFix date (#1846)
Po-Chuan Hsieh [Sun, 19 Feb 2023 08:18:47 +0000 (16:18 +0800)] 
Fix date (#1846)

15 months agoarchive_read_data_into_fd: Increase pointer assignment check (#1843)
Li kunyu [Tue, 14 Feb 2023 04:34:35 +0000 (12:34 +0800)] 
archive_read_data_into_fd: Increase pointer assignment check (#1843)

15 months agoAllow tests to pass after 2038 (#1838)
Bernhard M. Wiedemann [Fri, 20 Jan 2023 05:07:45 +0000 (06:07 +0100)] 
Allow tests to pass after 2038 (#1838)

Now uses 33 bits (the maximum possible) in the ustar header in order
to support times out to 2106.

Fixes #1837

16 months agoFix cpio test in 2038 (#1836)
Bernhard M. Wiedemann [Fri, 13 Jan 2023 05:27:42 +0000 (06:27 +0100)] 
Fix cpio test in 2038 (#1836)

Without this patch, `bsdcpio_test_option_c` failed after 2038-01-19 with

```
 .../libarchive-3.6.2/cpio/test/test_option_c.c:143: Assertion failed: t >= now - 2
 .../libarchive-3.6.2/cpio/test/test_option_c.c:169: Assertion failed: t >= now - 2
 .../libarchive-3.6.2/cpio/test/test_option_c.c:205: Assertion failed: t >= now - 2
```

Background:
As part of my work on reproducible builds for openSUSE, I check that
software still gives identical build results in the future.
The usual offset is +16 years, because that is how long I expect some
software will be used in some places.
This showed up failing tests in our package build.
See https://reproducible-builds.org/ for why this matters.

16 months agoAdd tests for the new zstd options.
Dag-Erling Smørgrav [Tue, 20 Dec 2022 13:21:38 +0000 (14:21 +0100)] 
Add tests for the new zstd options.

16 months agoDocument the new zstd options.
Dag-Erling Smørgrav [Thu, 1 Dec 2022 17:43:31 +0000 (17:43 +0000)] 
Document the new zstd options.

16 months agoSupport producing multi-fragment zstd archives.
Dag-Erling Smørgrav [Tue, 22 Nov 2022 02:52:43 +0000 (02:52 +0000)] 
Support producing multi-fragment zstd archives.

When the `zstd:frame-per-file` option is specified, the zstd filter will start a new frame when flushed, i.e. for each file in the archive.

The `zstd:min-frame-size=N` option modifies the `zstd:frame-per-file` option in that it will not start a new frame unless the current one exceeds `N` bytes.

When the `zstd:max-frame-size=N` option is specified, the zstd filter will start a new frame any time the compressed size of the previous one exceeds `N` bytes.

These options decrease compression efficiency by a varying amount (depending on the exact composition of its contents) but render the tarball seekable, to a certain extent.