]> git.ipfire.org Git - thirdparty/libarchive.git/log
thirdparty/libarchive.git
3 years agolibarchive:uninitialized value 1721/head
wangkerong [Sat, 9 Apr 2022 07:08:03 +0000 (15:08 +0800)] 
libarchive:uninitialized value

Uninitialized variable crash error in oss_fuzz memory type test

3 years agoLibarchive 3.6.2dev
Martin Matuska [Fri, 8 Apr 2022 12:47:05 +0000 (14:47 +0200)] 
Libarchive 3.6.2dev

3 years agoCI: Update dependencies for Windows build v3.6.1
Martin Matuska [Fri, 8 Apr 2022 11:13:17 +0000 (13:13 +0200)] 
CI: Update dependencies for Windows build

Upgrade zlib to 1.2.12
Upgrade bzip2 to 10fe37f2e

3 years agoRelease 3.6.1
Martin Matuska [Fri, 8 Apr 2022 10:05:45 +0000 (12:05 +0200)] 
Release 3.6.1

3 years agoMerge pull request #1717 from evelikov/ssl
Martin Matuška [Wed, 6 Apr 2022 23:28:08 +0000 (01:28 +0200)] 
Merge pull request #1717 from evelikov/ssl

archive_digest: check return value of EVP_DigestInit()

3 years agoarchive_digest: check return value of EVP_DigestInit() 1717/head
Emil Velikov [Tue, 5 Apr 2022 10:36:02 +0000 (11:36 +0100)] 
archive_digest: check return value of EVP_DigestInit()

The function returns 0 on error, which is seemingly very common with
OpenSSL 3.0 and rmd160.

Just error check the lot, so we don't get even more random failures with
future releases of OpenSSL.

Fixes #1549

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
3 years agoRAR reader: fix heap-use-after-free in run_filters()
Martin Matuska [Sun, 3 Apr 2022 10:06:24 +0000 (12:06 +0200)] 
RAR reader: fix heap-use-after-free in run_filters()

OSS-Fuzz issue 46279
Fixes #1715

3 years agoISO reader: fix possible heap buffer overflow in read_children()
Martin Matuska [Wed, 30 Mar 2022 19:14:00 +0000 (21:14 +0200)] 
ISO reader: fix possible heap buffer overflow in read_children()

OSS-Fuzz issue: 38764
Fixes #1685

3 years agoZIP reader: fix possible out-of-bounds read in zipx_lzma_alone_init()
Tim Kientzle [Thu, 24 Mar 2022 09:35:00 +0000 (10:35 +0100)] 
ZIP reader: fix possible out-of-bounds read in zipx_lzma_alone_init()

Fixes #1672

3 years agoMerge pull request #1679 from michael-o/hp-ux-dirfd
Martin Matuška [Sat, 12 Mar 2022 09:19:16 +0000 (10:19 +0100)] 
Merge pull request #1679 from michael-o/hp-ux-dirfd

Add macro for dirfd() on HP-UX because no full POSIX.1-2008 coverage …

3 years agoAdd macro for dirfd() on HP-UX because no full POSIX.1-2008 coverage exists 1679/head
Michael Osipov [Thu, 10 Mar 2022 11:56:02 +0000 (12:56 +0100)] 
Add macro for dirfd() on HP-UX because no full POSIX.1-2008 coverage exists

HP-UX does neither provide a function nor a macro. This solution based on an
issue with vim: https://github.com/vim/vim/issues/6838

3 years agobuild: fix detection of readdir_r() and dirfd() in configure.ac
Martin Matuska [Thu, 10 Mar 2022 10:00:26 +0000 (11:00 +0100)] 
build: fix detection of readdir_r() and dirfd() in configure.ac

Fixes #1537

3 years agoMerge pull request #1676 from ken-matsui/patch-2
Tim Kientzle [Sat, 5 Mar 2022 17:45:01 +0000 (09:45 -0800)] 
Merge pull request #1676 from ken-matsui/patch-2

Remove the unused variable `detected_bytes`

3 years agoRemove the unused variable `detected_bytes` 1676/head
Ken Matsui [Sat, 5 Mar 2022 03:12:09 +0000 (12:12 +0900)] 
Remove the unused variable `detected_bytes`

3 years agoMerge pull request #1674 from 0mp/patch-1
Tim Kientzle [Fri, 4 Mar 2022 05:15:53 +0000 (21:15 -0800)] 
Merge pull request #1674 from 0mp/patch-1

Fix use of At mdoc(7) macro

3 years agoFix use of At mdoc(7) macro 1674/head
Mateusz Piotrowski [Thu, 3 Mar 2022 23:01:40 +0000 (00:01 +0100)] 
Fix use of At mdoc(7) macro

3 years agoRAR reader: fix null-dereference in RAR (v4) filter code
Martin Matuska [Sat, 19 Feb 2022 19:43:22 +0000 (20:43 +0100)] 
RAR reader: fix null-dereference in RAR (v4) filter code

Add safety check to run_filters() and fix return codes

Reported-by: OSS-Fuzz #44843
3 years ago7zip reader: style fixes after 3962d596d
Martin Matuska [Fri, 18 Feb 2022 23:38:53 +0000 (00:38 +0100)] 
7zip reader: style fixes after 3962d596d

3 years agoMerge pull request #1670 from bradking/include-platform-first
Martin Matuška [Fri, 18 Feb 2022 23:36:52 +0000 (00:36 +0100)] 
Merge pull request #1670 from bradking/include-platform-first

windows: include archive_platform.h first in blake2s sources

3 years agoMerge pull request #1668 from mgorny/missing-zlib
Martin Matuška [Fri, 18 Feb 2022 23:36:32 +0000 (00:36 +0100)] 
Merge pull request #1668 from mgorny/missing-zlib

Fix some test failures when building --without-zlib

3 years agoMerge pull request #1671 from cielavenir/fix7zPPMDReadBeyondBoundary
Martin Matuška [Fri, 18 Feb 2022 23:35:44 +0000 (00:35 +0100)] 
Merge pull request #1671 from cielavenir/fix7zPPMDReadBeyondBoundary

Fix 7z PPMD reading beyond boundary

3 years agocode review 1671/head
cielavenir [Fri, 18 Feb 2022 15:23:16 +0000 (00:23 +0900)] 
code review

3 years agoFix 7z PPMD reading beyond boundary
cielavenir [Fri, 18 Feb 2022 09:19:12 +0000 (18:19 +0900)] 
Fix 7z PPMD reading beyond boundary

3 years agoci (GitHub Actions): build on Windows 2022 and use Visual Studio 17 2022
Martin Matuska [Thu, 17 Feb 2022 16:09:00 +0000 (17:09 +0100)] 
ci (GitHub Actions): build on Windows 2022 and use Visual Studio 17 2022

3 years agoRAR reader: fix heap-use-after-free in RAR (v4) filter code
Martin Matuska [Wed, 16 Feb 2022 20:36:41 +0000 (21:36 +0100)] 
RAR reader: fix heap-use-after-free in RAR (v4) filter code

Rework function expand() to process integer passed by reference
and return an archive error code.

Fixes: 01a2d329dfc7 (support rar filters)
Reported-by: OSS-Fuzz #44547
3 years agowindows: include archive_platform.h first in blake2s sources 1670/head
Brad King [Wed, 16 Feb 2022 12:31:56 +0000 (07:31 -0500)] 
windows: include archive_platform.h first in blake2s sources

Move the inclusion added by commit 90978db1 (windows: make sure we use
the right calling convention for libc, 2021-10-13, v3.6.0~39^2~1) to be
first.  This is our convention in all other `.c` sources.  It ensures
that our configured `_WIN32_WINNT` value is defined before including any
system headers.

3 years agotests: reduce sample size for RAR filter test
Martin Matuska [Mon, 14 Feb 2022 00:08:46 +0000 (01:08 +0100)] 
tests: reduce sample size for RAR filter test

3 years agoLibarchive 3.6.1dev
Martin Matuska [Mon, 14 Feb 2022 00:13:03 +0000 (01:13 +0100)] 
Libarchive 3.6.1dev

3 years agoHandle missing zlib in test_read_format_zip_7z_deflate 1668/head
Michał Górny [Sat, 12 Feb 2022 10:12:27 +0000 (11:12 +0100)] 
Handle missing zlib in test_read_format_zip_7z_deflate

3 years agoFix expected error messages in test_read_format_zip_winzip_aes*
Michał Górny [Sat, 12 Feb 2022 10:11:22 +0000 (11:11 +0100)] 
Fix expected error messages in test_read_format_zip_winzip_aes*

Fix expected error messages when libarchive is compiled --without-zlib,
in order to fix test failures.

3 years agoRelease 3.6.0 v3.6.0
Martin Matuska [Wed, 9 Feb 2022 08:41:14 +0000 (09:41 +0100)] 
Release 3.6.0

3 years agoMerge pull request #1665 from juikim/master
Martin Matuška [Wed, 9 Feb 2022 07:35:52 +0000 (08:35 +0100)] 
Merge pull request #1665 from juikim/master

bsdtar(1): Document threads options for zstd and xz

3 years agobsdtar(1): Document threads options for zstd and xz 1665/head
Jung-uk Kim [Wed, 9 Feb 2022 03:03:05 +0000 (22:03 -0500)] 
bsdtar(1): Document threads options for zstd and xz

3 years agoLibarchive 3.6.0dev
Martin Matuska [Tue, 8 Feb 2022 09:47:31 +0000 (10:47 +0100)] 
Libarchive 3.6.0dev

3 years agoCI: add dist-artifact
Martin Matuska [Tue, 8 Feb 2022 08:23:37 +0000 (09:23 +0100)] 
CI: add dist-artifact

3 years agotests: fix style in test_utils/test_main.c
Martin Matuska [Tue, 8 Feb 2022 07:27:11 +0000 (08:27 +0100)] 
tests: fix style in test_utils/test_main.c

3 years agoMerge pull request #1657 from kientzle/ReorganizeTestCode
Martin Matuška [Tue, 8 Feb 2022 07:25:55 +0000 (08:25 +0100)] 
Merge pull request #1657 from kientzle/ReorganizeTestCode

Reorganize test code a bit

3 years agoMerge pull request #1664 from juikim/master
Martin Matuška [Tue, 8 Feb 2022 07:25:23 +0000 (08:25 +0100)] 
Merge pull request #1664 from juikim/master

Enable LZMA support for FreeBSD

3 years agoMerge pull request #1493 from antekone/rar5_ossfuzz_30459
Martin Matuška [Tue, 8 Feb 2022 07:16:45 +0000 (08:16 +0100)] 
Merge pull request #1493 from antekone/rar5_ossfuzz_30459

RAR5 reader: add more checks for invalid extraction parameters

3 years agoRAR5 reader: add more checks for invalid extraction parameters 1493/head
Grzegorz Antoniak [Sat, 13 Feb 2021 09:13:22 +0000 (10:13 +0100)] 
RAR5 reader: add more checks for invalid extraction parameters

Some specially crafted files declare invalid extraction parameters that
can confuse the RAR5 reader.

One of the arguments is the declared window size parameter that the
archive file can declare for each file stored in the archive. Some
crafted files declare window size equal to 0, which is clearly wrong.

This commit adds additional safety checks decreasing the tolerance of
the RAR5 format.

This commit also contains OSSFuzz sample #30459.

3 years agoEnable LZMA support for FreeBSD 1664/head
Jung-uk Kim [Mon, 7 Feb 2022 21:16:34 +0000 (16:16 -0500)] 
Enable LZMA support for FreeBSD

All supported FreeBSD releases have LZMA by default.

3 years agoMerge pull request #1663 from yelkarama/master
Martin Matuška [Mon, 7 Feb 2022 19:59:23 +0000 (20:59 +0100)] 
Merge pull request #1663 from yelkarama/master

Fix typo in libarchive/archive_read_support_filter_lzop.c

3 years agoFix typo in libarchive/archive_read_support_filter_lzop.c 1663/head
Younes El-karama [Mon, 7 Feb 2022 16:30:40 +0000 (11:30 -0500)] 
Fix typo in libarchive/archive_read_support_filter_lzop.c

Extra "dot" in line 176 of libarchive/archive_read_support_filter_lzop.c

3 years agountar.c: style fixes
Martin Matuska [Mon, 7 Feb 2022 09:48:51 +0000 (10:48 +0100)] 
untar.c: style fixes

3 years agotar: fix format name typo in creation_set.c
Martin Matuska [Mon, 7 Feb 2022 08:23:41 +0000 (09:23 +0100)] 
tar: fix format name typo in creation_set.c

Closes #1659

3 years agoMerge pull request #1170 from kidandcat/patch-1
Martin Matuška [Sun, 6 Feb 2022 23:59:09 +0000 (00:59 +0100)] 
Merge pull request #1170 from kidandcat/patch-1

Windows support for contrib/untar

3 years agoUpdate untar.c 1170/head
Jairo [Sun, 6 Feb 2022 23:13:18 +0000 (00:13 +0100)] 
Update untar.c

3 years agoUpdate untar.c
Jairo [Sun, 6 Feb 2022 23:11:02 +0000 (00:11 +0100)] 
Update untar.c

3 years agoMerge pull request #1491 from antekone/rar5_ossfuzz_30442
Martin Matuška [Sun, 6 Feb 2022 18:35:30 +0000 (19:35 +0100)] 
Merge pull request #1491 from antekone/rar5_ossfuzz_30442

RAR5 reader: fix invalid memory access in some files

3 years agoRAR5 reader: fix invalid memory access in some files 1491/head
Grzegorz Antoniak [Fri, 12 Feb 2021 19:18:31 +0000 (20:18 +0100)] 
RAR5 reader: fix invalid memory access in some files

RAR5 reader uses several variables to manage the window buffer during
extraction: the buffer itself (`window_buf`), the current size of the
window buffer (`window_size`), and a helper variable (`window_mask`)
that is used to constrain read and write offsets to the window buffer.

Some specially crafted files can force the unpacker to update the
`window_mask` variable to a value that is out of sync with current
buffer size. If the `window_mask` will be bigger than the actual buffer
size, then an invalid access operation can happen (SIGSEGV).

This commit ensures that if the `window_size` and `window_mask` will be
changed, the window buffer will be reallocated to the proper size, so no
invalid memory operation should be possible.

This commit contains a test file from OSSFuzz #30442.

3 years agoMerge pull request #1448 from arichardson/add-test-slow-host
Martin Matuška [Sun, 6 Feb 2022 10:29:22 +0000 (11:29 +0100)] 
Merge pull request #1448 from arichardson/add-test-slow-host

Reduce test_write_format_7zip_large_lzma1 buffer size

3 years agoMerge pull request #1655 from alexey-pelykh/fix-android_lf-include
Martin Matuška [Sun, 6 Feb 2022 08:49:28 +0000 (09:49 +0100)] 
Merge pull request #1655 from alexey-pelykh/fix-android_lf-include

Include android_lf.h only for libarchive sources

3 years agozip: fix possible endless loop if reading a truncated zstd archive
Martin Matuska [Sat, 5 Feb 2022 20:02:13 +0000 (21:02 +0100)] 
zip: fix possible endless loop if reading a truncated zstd archive

The fix is analogous to the behavior in case of bzip2 compression.

3 years agodist: add missing zipx-zstd test files to Makefile.am
Martin Matuska [Sat, 5 Feb 2022 09:45:32 +0000 (10:45 +0100)] 
dist: add missing zipx-zstd test files to Makefile.am

3 years agoMerge pull request #1518 from ghost/zip-zstd
Martin Matuška [Sat, 5 Feb 2022 09:32:21 +0000 (10:32 +0100)] 
Merge pull request #1518 from ghost/zip-zstd

ZIP reader: added support for Zstd decompression

3 years agoMerge pull request #1603 from evelikov/reader-filter-vtbl
Martin Matuška [Sat, 5 Feb 2022 09:02:15 +0000 (10:02 +0100)] 
Merge pull request #1603 from evelikov/reader-filter-vtbl

Reader filter rework - simplification, robustness and deadcode removal

3 years agoReorganize test code a bit 1657/head
Tim Kientzle [Wed, 2 Feb 2022 03:33:41 +0000 (19:33 -0800)] 
Reorganize test code a bit

A few guiding principles:
* Each test source file includes ONLY "test.h" to make it easy
  to create new tests.
* Each test suite has a "test.h" that includes "test_util/test_common.h"
  to get access to all the common testing utility functions.

So "test_common.h" is then responsible for including
any smaller headers that declare specific pieces of
shared test functionality.

I've also pulled some test filtering logic that was _only_ used
in test_main.c into that file, and repurposed "test_utils.[ch]"
for common utility code.  (Eventually, a lot of the assertion
helpers currently in "test_main.c" should probably be organized
into one or more source files of their own.)

3 years agoMerge pull request #1438 from arichardson/faster-tests-avoid-rand
Tim Kientzle [Wed, 2 Feb 2022 03:12:35 +0000 (19:12 -0800)] 
Merge pull request #1438 from arichardson/faster-tests-avoid-rand

Avoid millions of rand() calls() when running tests

3 years agoInclude android_lf.h only for libarchive sources 1655/head
Alexey Pelykh [Sun, 23 Jan 2022 08:40:58 +0000 (09:40 +0100)] 
Include android_lf.h only for libarchive sources

3 years agoAvoid millions of rand() calls() when running tests 1438/head
Alex Richardson [Thu, 17 Sep 2020 17:28:17 +0000 (18:28 +0100)] 
Avoid millions of rand() calls() when running tests

Many tests use a loop calling rand() to fill buffers with test data. As
these calls cannot be inlined, this adds up to noticeable overhead:
For example, running on QEMU RISC-V the test_write_format_7zip_large_copy
test took ~22 seconds before and with this change it's ~17 seconds.
This change uses a simpler xorshift64 random number generator that can be
inlined into the loop filling the data buffer. By default the seed for this
RNG is rand(), but it can be overwritten by setting the TEST_RANDOM_SEED
environment variable.

For a native build the difference is much less noticeable, but it's still
measurable: test_write_format_7zip_large_copy takes 314.9 ms ± 3.9 ms
before and 227.8 ms ± 5.8 ms after (i.e. 38% faster for that test).

3 years agoMerge pull request #1492 from antekone/rar5_ossfuzz_30448
Martin Matuška [Wed, 12 Jan 2022 15:02:58 +0000 (16:02 +0100)] 
Merge pull request #1492 from antekone/rar5_ossfuzz_30448

RAR5 reader: fixed out of bounds read in some files

3 years agoMerge pull request #1653 from zzambers/sparse-8g
Tim Kientzle [Wed, 12 Jan 2022 04:35:29 +0000 (20:35 -0800)] 
Merge pull request #1653 from zzambers/sparse-8g

Fixed size attribute in pax header for large sparse files

3 years agoFixed size filed in pax header 1653/head
Zdenek Zambersky [Tue, 11 Jan 2022 13:43:27 +0000 (14:43 +0100)] 
Fixed size filed in pax header

3 years agoRAR5 reader: fixed out of bounds read in some files 1492/head
Grzegorz Antoniak [Sat, 13 Feb 2021 08:08:13 +0000 (09:08 +0100)] 
RAR5 reader: fixed out of bounds read in some files

Added more range checks in the bit stream reading functions
(read_bits_16 and read_bits_32) in order to better guard against out of
memory reads.

This commit contains a test with OSSFuzz sample #30448.

3 years agoMerge pull request #1639 from todd-richmond/master
Martin Matuška [Tue, 4 Jan 2022 00:19:07 +0000 (01:19 +0100)] 
Merge pull request #1639 from todd-richmond/master

zip size entry of -1 should be treated the same as 0

3 years agoMerge pull request #1503 from legnaleurc/rar_filter
Martin Matuška [Mon, 3 Jan 2022 11:12:05 +0000 (12:12 +0100)] 
Merge pull request #1503 from legnaleurc/rar_filter

support rar filters (without VM filter support)

3 years agoMerge pull request #1642 from goshhhy/irix-blake2
Martin Matuška [Mon, 3 Jan 2022 11:07:45 +0000 (12:07 +0100)] 
Merge pull request #1642 from goshhhy/irix-blake2

update BLAKE2_PACKED macro with a non-GCCism fallback

3 years agoMerge pull request #1625 from evelikov/gc-sections
Martin Matuška [Mon, 3 Jan 2022 11:07:13 +0000 (12:07 +0100)] 
Merge pull request #1625 from evelikov/gc-sections

Instrument gcc/clang to discard unused code during link

3 years agoMerge pull request #1643 from eworm-de/link-unescape
Martin Matuška [Mon, 3 Jan 2022 10:56:38 +0000 (11:56 +0100)] 
Merge pull request #1643 from eworm-de/link-unescape

unescape when extracting link

3 years agoMerge pull request #1645 from ppentchev/roam-lzip-large-dict
Martin Matuška [Mon, 3 Jan 2022 10:49:08 +0000 (11:49 +0100)] 
Merge pull request #1645 from ppentchev/roam-lzip-large-dict

Raise the lzip max dictionary size to 512MB.

3 years agoMerge pull request #1649 from petris/master
Martin Matuška [Mon, 3 Jan 2022 10:39:15 +0000 (11:39 +0100)] 
Merge pull request #1649 from petris/master

Support libzstd compiled with compressor disabled

3 years agoCI: fix ubuntu distcheck
Martin Matuska [Mon, 3 Jan 2022 09:23:27 +0000 (10:23 +0100)] 
CI: fix ubuntu distcheck

Add missing test_read_format_rar5_sfx.exe.uu
Be more verbose on failure

3 years agounescape when extracting link 1643/head
Christian Hesse [Mon, 20 Dec 2021 09:36:50 +0000 (10:36 +0100)] 
unescape when extracting link

The file name is escaped when archiving, so it needs to be unescaped
when extracting.

3 years agoMerge pull request #1640 from wlozano0collabora/fix-tar
Martin Matuška [Mon, 3 Jan 2022 08:41:04 +0000 (09:41 +0100)] 
Merge pull request #1640 from wlozano0collabora/fix-tar

Fix check for tape device

3 years agoMerge pull request #1641 from goshhhy/irix-printf
Martin Matuška [Mon, 3 Jan 2022 08:38:57 +0000 (09:38 +0100)] 
Merge pull request #1641 from goshhhy/irix-printf

define printf format specifiers if not present

3 years agoMerge pull request #1644 from Tarsnap/2038
Martin Matuška [Mon, 3 Jan 2022 08:35:45 +0000 (09:35 +0100)] 
Merge pull request #1644 from Tarsnap/2038

Fix Y2038 check

3 years agoSupport libzstd compiled with compressor disabled 1649/head
Petr Malat [Thu, 23 Dec 2021 10:47:04 +0000 (11:47 +0100)] 
Support libzstd compiled with compressor disabled

ZSTD library can be compiled with the compressor disabled, which is
handy on space restricted systems as the compressor accounts for more
than two thirds of the library size.

Detect this case and use libzstd for the decompression only.
Compression will be done using zstd binary if it's available.

3 years agoRaise the lzip max dictionary size to 512MB. 1645/head
Peter Pentchev [Wed, 22 Dec 2021 15:05:53 +0000 (17:05 +0200)] 
Raise the lzip max dictionary size to 512MB.

The lzip documentation specifies that the logarithm of the dictionary
base size may be in the range 12-29, and the lzip utility is quite
capable of creating an archive with a dictionary larger than 128M if
passed the appropriate -s command-line option.

3 years agoFix Y2038 check 1644/head
Graham Percival [Wed, 22 Dec 2021 02:00:19 +0000 (18:00 -0800)] 
Fix Y2038 check

If time_t is a signed 32-bit integer, then we cannot represent times
after 03:14:07 on 2038-01-19.  Indicating an error if (Year > 2038) is
not sufficient; for safety, we need to bail if (Year >= 2038).

As the comment above this line notes, it would be better to check if
time_t is 32 bits first.  And even if we didn't check for that, we could
use a much more complicated check:

    ((Year > 2038) || ((Year == 2038) && (Month > 1)) ||
    ((Year == 2038) && (Month == 1) && (Day >= 19)))

But I don't think the additional complexity is worth it; rejecting any
dates in 2038 eliminates fewer than 3 weeks of potentially-valid dates.

Reported by: Rasmus Villemoes

3 years agoFix check for tape device 1640/head
Walter Lozano [Sat, 18 Dec 2021 01:44:09 +0000 (22:44 -0300)] 
Fix check for tape device

In b6b423f0 a fallback in tar to stdio was implemented. However, the check
for the tape device didn't interpret the correct value returned from
access(). Fix the check to implement the fallback to stdio properly.

Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
3 years agoupdate BLAKE2_PACKED macro with a non-GCCism fallback 1642/head
linear cannon [Sun, 19 Dec 2021 09:25:32 +0000 (01:25 -0800)] 
update BLAKE2_PACKED macro with a non-GCCism fallback

3 years agoupdate CMake sizeof definitions to match autotools 1641/head
linear cannon [Sun, 19 Dec 2021 08:25:57 +0000 (00:25 -0800)] 
update CMake sizeof definitions to match autotools

3 years agoimport m4_ax_compile_check_sizeof.m4 from autoconf archive
linear cannon [Sun, 19 Dec 2021 08:48:40 +0000 (00:48 -0800)] 
import m4_ax_compile_check_sizeof.m4 from autoconf archive

3 years agodefine printf format specifiers if not present
linear cannon [Sun, 19 Dec 2021 08:20:43 +0000 (00:20 -0800)] 
define printf format specifiers if not present

3 years agozip size entry of -1 should be treated the same as 0 1639/head
Todd Richmond [Sat, 18 Dec 2021 00:59:05 +0000 (16:59 -0800)] 
zip size entry of -1 should be treated the same as 0

3 years agoMerge pull request #1585 from JFranklin13/rar5_sfx
Martin Matuška [Wed, 15 Dec 2021 18:19:37 +0000 (19:19 +0100)] 
Merge pull request #1585 from JFranklin13/rar5_sfx

Add support for rar5 sfx files

3 years agoMerge pull request #1632 from wlozano0collabora/default-archive-file
Tim Kientzle [Sat, 4 Dec 2021 18:56:33 +0000 (10:56 -0800)] 
Merge pull request #1632 from wlozano0collabora/default-archive-file

Have `bsdtar` default to stdout if this system has no tape device.  This uses an `access()` check to see if the default tape device (e.g., `/dev/tape` on FreeBSD) exists and will use stdout as the default if it doesn't exist.  If the system does have a tape device, there is no change to the existing behavior.

For libarchive 4.0, we'll change the default behavior of `bsdtar`:
* The `TAPE` environment variable will still be honored at runtime
* The `_PATH_DEFTAPE` preprocessor macro will still be honored at build time
* But `_PATH_DEFTAPE` will no longer be set by libarchive's default build, with the effect that for most people, bsdtar will default to stdout if there is no `-f` option provided.

3 years agoAdd path fallback in tar 1632/head
Walter Lozano [Sat, 27 Nov 2021 00:23:20 +0000 (21:23 -0300)] 
Add path fallback in tar

Since current tar defaults to tape devices that are rare nowadays add an
additional step to fallback to "-" if tape devices are not found.

This is a clean way to have a default to "-" on those systems that tape
devices are not present while keeping the current behavior for other
cases. Additionally prepare for future releases where this kind of defaults
will be dropped.

Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
3 years agoMerge pull request #1626 from evelikov/bsdtar-allow-ax
Martin Matuška [Tue, 30 Nov 2021 23:30:08 +0000 (00:30 +0100)] 
Merge pull request #1626 from evelikov/bsdtar-allow-ax

tar: demote -xa from error to a warning

3 years agoMerge pull request #1633 from Changaco/patch-1
Martin Matuška [Tue, 30 Nov 2021 23:29:04 +0000 (00:29 +0100)] 
Merge pull request #1633 from Changaco/patch-1

Fix the archive_write_disk.3 man page

3 years agofix the archive_write_disk.3 man page 1633/head
Charly C [Sun, 28 Nov 2021 09:11:01 +0000 (10:11 +0100)] 
fix the archive_write_disk.3 man page

Some of the text was reordered incorrectly in a14fe904e2c63fefb99446980226a1bec4a95c5c.

3 years agoautotools: enable -fdata/function-sections and --gc-sections 1625/head
Emil Velikov [Sun, 21 Nov 2021 17:38:38 +0000 (17:38 +0000)] 
autotools: enable -fdata/function-sections and --gc-sections

Analogue to the parent cmake commit, with linker flag detection.

The former two split the functions and data into separate sections
within the object file. Which makes it easier for the latter to properly
garbage collect and discard unused sections.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
3 years agocmake: enable -fdata/function-sections and --gc-sections
Emil Velikov [Sun, 21 Nov 2021 17:38:28 +0000 (17:38 +0000)] 
cmake: enable -fdata/function-sections and --gc-sections

The former two split the functions and data into separate sections
within the object file. Which makes it easier for the latter to properly
garbage collect and discard unused sections. For example

   text    data     bss     dec     hex filename
 208268    2056    4424  214748   346dc bsdcat -- before
  93396    1304    4360   99060   182f4 bsdcat -- after
1059167   12112   24176 1095455  10b71f bsdcpio -- before
1002538    7320   23984 1033842   fc672 bsdcpio -- after
1093676   14248    6608 1114532  1101a4 bsdtar -- before
1062231   14176    6416 1082823  1085c7 bsdtar -- after
1097259   15032    6408 1118699  1111eb libarchive.so.18 -- before
1095675   14992    6216 1116883  110ad3 libarchive.so.18 -- after

Note:
This is enabled only with gcc/clang on non-Mac platforms. Ideally we'll
have a compile-time check, albeit that seems impossible with our ancient
cmake requirement.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
3 years agotar: demote -xa from error to a warning 1626/head
Emil Velikov [Sun, 21 Nov 2021 18:05:19 +0000 (18:05 +0000)] 
tar: demote -xa from error to a warning

It's fairly common for people to use caf and xaf on Linux. The former in
itself being GNU tar specific - libarchive tar does not allow xa.

While it makes little sense to use xaf with libarchive tar, that is
implementation detail which gets in the way when trying to write trivial
tooling/scripts.

For the sake of compatibility, reduce the error to a warning and augment
the message itself. Making it clear that the option makes little sense.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
3 years agocmake: drop -rdynamic aka CMP0065 NEW
Emil Velikov [Sun, 21 Nov 2021 14:50:25 +0000 (14:50 +0000)] 
cmake: drop -rdynamic aka CMP0065 NEW

Prior to version 3.3 cmake would always use -rdynamic. That in itself
causes all the internal symbols to be exported, increasing the binaries
by 5-10% and making it impossible for the compiler to reason, optimise
and discard unused code.

The -rdynamic is useful in two cases:
 - having a third party module (say /usr/lib/foo/foobar.so) which is
   underlinked and depends on symbols from the main binary - apps like
   irssi, bash and zsh use that

 - uses the glibc backtrace, which relies on dlopen/dlsym to fetch the
   symbol data. Unwind is much better solution, since it replies on the
   DWARF data

Our binaries do not use either of these - so drop the -rdynamic. The
autotools build doesn't use it either.

   text    data     bss     dec     hex filename
 229000    2120    4424  235544   39818 bsdcat -- before
 208324    2120    4424  214868   34754 bsdcat -- after
1093939   12128   24176 1130243  113f03 bsdcpio -- before
1059181   12128   24176 1095485  10b73d bsdcpio -- after
1130091   14264    6608 1150963  118ff3 bsdtar -- before
1093690   14264    6608 1114562  1101c2 bsdtar -- after

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
3 years agocmake: fold gcc/clang sections
Emil Velikov [Sun, 21 Nov 2021 14:26:53 +0000 (14:26 +0000)] 
cmake: fold gcc/clang sections

The flags used across the two are identical, apart from -g.
There is no compelling reason, why we would omit -g for debug builds
with GCC, while using it with clang.

De-duplicate the sections.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
3 years agoMerge pull request #1614 from diabonas/add-no-read-sparse
Martin Matuška [Sun, 21 Nov 2021 10:32:19 +0000 (11:32 +0100)] 
Merge pull request #1614 from diabonas/add-no-read-sparse

Add ARCHIVE_READDISK_NO_SPARSE/--no-read-sparse to improve reproducibility of generated archives

3 years agotest_sparse_basic: test ARCHIVE_READDISK_NO_SPARSE 1614/head
Jonas Witschel [Sat, 20 Nov 2021 10:37:50 +0000 (11:37 +0100)] 
test_sparse_basic: test ARCHIVE_READDISK_NO_SPARSE

3 years agotest_sparse_basic: do not assume that holes can be read in one go
Jonas Witschel [Sun, 21 Nov 2021 09:07:52 +0000 (10:07 +0100)] 
test_sparse_basic: do not assume that holes can be read in one go

verify_sparse_file() assumes that every hole will be fully contained in only
one archive_read_data_block(). This is a reasonable assumption if the file is
indeed sparsely encoded in the archive because archive_read_data_block() will
just skip the hole and return the offset of the next data block.

However, if the file is not sparsely encoded in the archive, a hole consists of
a lot of zeroes that need to be read byte by byte. In this case, the archive
contains no information on where this block of zeroes ends and where actual
data begins. Therefore it can happen that a single archive_read_data_block()
contains both zeroes from a hole and actual data.

If this happens, assert(sparse->type == HOLE) fails. This assertion is
reasonable for sparsely encoded files because archive_read_data_block() will
never only read part of a hole (since it does not really "read" a hole at all,
it just returns a higher offset accounting for the size of the hole).

However, we want to start testing files with verify_sparse_file() that are
explicitly not sparsely encoded. In this case, the assertion does not
necessarily hold any more. Therefore we need to account for the case where the
overlapping block consists of data. To make sure the file contents are
correctly encoded in the archive, we need to test the contents of the data
block, like it is already done for blocks completely contained in the data read
by archive_read_data_block().

Note that this modification does not change the way sparsely encoded files are
verified, it just relaxes an edge case that cannot happen with sparsely encoded
files to make it possible to test any kind of file, whether sparsely encoded or
not.

3 years agoMerge pull request #1621 from botovq/openssl_compat
Martin Matuška [Sat, 20 Nov 2021 23:19:57 +0000 (00:19 +0100)] 
Merge pull request #1621 from botovq/openssl_compat

Remove unnecessary OpenSSL compat ifdef.