]> git.ipfire.org Git - thirdparty/xz.git/log
thirdparty/xz.git
17 months agoxz: Add braces to a for-statement and to an if-statement
Lasse Collin [Mon, 6 May 2024 20:04:31 +0000 (23:04 +0300)] 
xz: Add braces to a for-statement and to an if-statement

No functional changes.

Fixes: 5f0c5a04388f8334962c70bc37a8c2ff8f605e0a
Fixes: 479fd58d60622331fcbe48fddf756927b9f80d9a
(cherry picked from commit 9bef5b8d17dd5e009d6a6b2becc2dc535da53937)

17 months agoliblzma: Omit an unneeded array from the x86 filter
Lasse Collin [Mon, 6 May 2024 20:00:09 +0000 (23:00 +0300)] 
liblzma: Omit an unneeded array from the x86 filter

Fixes: 6aa2a6deeba04808a0fe4461396e7fb70277f3d4
(cherry picked from commit de06b9f0c0a3f72569829ecadbc9c0a3ef099f57)

17 months agoCMake: Add test_suffix.sh to the tests
Lasse Collin [Mon, 6 May 2024 19:56:31 +0000 (22:56 +0300)] 
CMake: Add test_suffix.sh to the tests

(cherry picked from commit 7da488cb933fdf51cfc14cb5810beb0766224380)

17 months agoTest: Add CMake support to test_suffix.sh
Lasse Collin [Mon, 6 May 2024 19:55:54 +0000 (22:55 +0300)] 
Test: Add CMake support to test_suffix.sh

It needs to find the xz executable from a different directory
and work without config.h.

(cherry picked from commit a805594ed0b4cbf7b81aa28ff46a8ab3c83c6876)

17 months agoUpdate INSTALL about MINIX 3
Lasse Collin [Mon, 6 May 2024 17:45:34 +0000 (20:45 +0300)] 
Update INSTALL about MINIX 3

The latest stable is 3.3.0 and it's from 2014.
Don't mention the older versions in INSTALL.
3.3.0 ships with Clang already.

Testing with 3.4.0beta6 shows that tuklib_physmem
works too so omit comments about that from INSTALL.
Visibility warnigns weren't a problem either.

Thus it's enough to mention the need for --disable-threads
as configure doesn't autodetect the lack of pthreads.

(cherry picked from commit 50e19489387774bab3c4a988397d0d9c7a142a46)

17 months agoWindows: Remove the "doc/api" line from README-Windows.txt
Lasse Collin [Thu, 2 May 2024 20:00:16 +0000 (23:00 +0300)] 
Windows: Remove the "doc/api" line from README-Windows.txt

Fixes: 252aa1d67bc015eeba462803ab72edeb7744d864
(cherry picked from commit 68d18aea1422a2b86b98b71d0b019233d84e01b0)

17 months agoBuild: Don't copy doc/api from source tree to distribution tarball
Lasse Collin [Thu, 2 May 2024 19:59:04 +0000 (22:59 +0300)] 
Build: Don't copy doc/api from source tree to distribution tarball

It was copied if it existed. This was intentional when autogen.sh
still built liblzma API docs with Doxygen.

Fixes: d3a77ebc04bf1db8d52de2d9b0f07877bc4fd139
(cherry picked from commit 8ede961374613aa302a13571d662cfaea1cf91f7)

17 months agoci: add SPDX headers
Sam James [Thu, 2 May 2024 12:26:40 +0000 (13:26 +0100)] 
ci: add SPDX headers

I've checked over each of these and they're straightforward applications
of the relevant Github Actions.

(cherry picked from commit 9a6761aa35ed84d30bd2fda2333a4fdf3f46ecdc)

17 months agocodespell: Ignore the THANKS file and debbugs.gnu.org URL
Yaroslav Halchenko [Fri, 29 Mar 2024 18:37:24 +0000 (14:37 -0400)] 
codespell: Ignore the THANKS file and debbugs.gnu.org URL

This way "codespell -i 0" is silent.

This is the first commit from
https://github.com/tukaani-project/xz/pull/93
with trivial edits by Lasse Collin.

(cherry picked from commit 81efe6119f86e3274e512c9eca5ec22b2196c2b3)

17 months agoAdd .gitattributes to clean up git-archive output
Lasse Collin [Tue, 30 Apr 2024 11:37:11 +0000 (14:37 +0300)] 
Add .gitattributes to clean up git-archive output

(cherry picked from commit 905bfc74fe2670fd9c39014803017ab53d325401)

17 months agoxzdec: Support Landlock ABI version 4
Lasse Collin [Fri, 19 Apr 2024 09:11:09 +0000 (12:11 +0300)] 
xzdec: Support Landlock ABI version 4

This was added to xz in 02e3505991233901575b7eabc06b2c6c62a96899
but I forgot to do the same in xzdec.

The Landlock sandbox in xzdec could be stricter as now it's
active only for the last file being decompressed. In xz,
read-only sandbox is used for multi-file case. On the other hand,
xz doesn't go to the strictest mode when processing the last file
when more than one file was specified; xzdec does.

(cherry picked from commit 3334c71d3d4294a4f6569df3ba9bcf2443dfa501)

17 months agoliblzma: Fix incorrect function type error from sanitizer
Lasse Collin [Tue, 30 Apr 2024 19:22:45 +0000 (22:22 +0300)] 
liblzma: Fix incorrect function type error from sanitizer

Clang 17 with -fsanitize=address,undefined:

    src/liblzma/common/filter_common.c:366:8: runtime error:
        call to function encoder_find through pointer to incorrect
        function type 'const lzma_filter_coder *(*)(unsigned long)'
    src/liblzma/common/filter_encoder.c:187: note:
        encoder_find defined here

Use a wrapper function to get the correct type neatly.
This reduces the number of casts needed too.

This issue could be a problem with control flow integrity (CFI)
methods that check the function type on indirect function calls.

Fixes: 3b34851de1eaf358cf9268922fa0eeed8278d680
(cherry picked from commit 278563ef8f2b8d98d7f2c85e1a64ec1bc21d26d8)

17 months agoxz: Avoid arithmetic on a null pointer
Lasse Collin [Tue, 30 Apr 2024 18:41:11 +0000 (21:41 +0300)] 
xz: Avoid arithmetic on a null pointer

It's undefined behavior. The result wasn't ever used as it occurred
in the last iteration of a loop.

Clang 17 with -fsanitize=address,undefined:

    $ src/xz/xz --block-list=123
    src/xz/args.c:164:12: runtime error: applying non-zero offset 1
        to null pointer

Fixes: 88ccf47205d7f3aa314d358c72ef214f10f68b43
Co-authored-by: Sam James <sam@gentoo.org>
(cherry picked from commit 77c8f60547decefca8f2d0c905d9c708c38ee8ff)

17 months agoCMake: Support building liblzma API docs using Doxygen
Lasse Collin [Sat, 27 Apr 2024 17:42:00 +0000 (20:42 +0300)] 
CMake: Support building liblzma API docs using Doxygen

This is disabled by default to match the default in Autotools.
Use -DUSE_DOXYGEN=ON to enable Doxygen usage.

This uses the update-doxygen script, thus this is under if(UNIX)
although Doxygen itself can run on Windows too.

(cherry picked from commit 64503cc2b76a388ced4ec5f68234a07f0dcddcd5)

17 months agoCMake: List API headers in LIBLZMA_API_HEADERS variable
Lasse Collin [Sat, 20 Apr 2024 20:36:39 +0000 (23:36 +0300)] 
CMake: List API headers in LIBLZMA_API_HEADERS variable

This way the same list will be usable in more than one location.

(cherry picked from commit 0a7f5a80d8532a1d8cfa0a902c9d1ad7651eca37)

17 months agoPACKAGERS: Document the optional Doxygen usage
Lasse Collin [Fri, 19 Apr 2024 12:16:42 +0000 (15:16 +0300)] 
PACKAGERS: Document the optional Doxygen usage

Also add a note that packagers should check the licensing
of the Doxygen output.

(cherry picked from commit 541406bee3f09e9813103c6406b10fc6ab2e0d30)

17 months agoBuild: Add --enable-doxygen to generate and install API docs
Lasse Collin [Sat, 27 Apr 2024 14:47:09 +0000 (17:47 +0300)] 
Build: Add --enable-doxygen to generate and install API docs

It requires Doxygen. This option is disabled by default.

(cherry picked from commit e21efdf96f39378fe417479f89e97046680406f5)

17 months agoDoxygen: update-doxygen: Support out-of-tree builds
Lasse Collin [Fri, 19 Apr 2024 12:15:17 +0000 (15:15 +0300)] 
Doxygen: update-doxygen: Support out-of-tree builds

Also, now $0 is used to refer to the script itself.

(cherry picked from commit 0ece09a575d7e542bda8825808ddd6cf7de8cc4b)

17 months agoDoxygen: Simplify Doxyfile and add SPDX license identifier
Lasse Collin [Sun, 28 Apr 2024 18:08:00 +0000 (21:08 +0300)] 
Doxygen: Simplify Doxyfile and add SPDX license identifier

This omits all comments and a few non-default options that weren't
needed. Now it contains no copyrighted content from Doxygen itself.

(cherry picked from commit 2c519f641f266fd897edf680827d9c905f411440)

17 months agoDoxygen: Don't strip JavaScript anymore
Lasse Collin [Fri, 19 Apr 2024 12:14:02 +0000 (15:14 +0300)] 
Doxygen: Don't strip JavaScript anymore

The stripping method worked well with Doxygen 1.8 and 1.9 but
it doesn't work with Doxygen 1.10 anymore. Since we won't ship
pre-generated liblzma API docs anymore, the extra bloat and
extra license info of the JavaScript files won't affect the
upstream source package anymore.

(cherry picked from commit bdba39a57530d11b88440df8024002be3d09e4a1)

17 months agoBuild: Remove old Doxygen rules from top-level Makefile.am
Lasse Collin [Fri, 19 Apr 2024 14:26:41 +0000 (17:26 +0300)] 
Build: Remove old Doxygen rules from top-level Makefile.am

(cherry picked from commit d3a77ebc04bf1db8d52de2d9b0f07877bc4fd139)

17 months agoUpdate COPYING to match the autogen.sh and mydist changes
Lasse Collin [Fri, 19 Apr 2024 12:10:06 +0000 (15:10 +0300)] 
Update COPYING to match the autogen.sh and mydist changes

(cherry picked from commit fd7faa4c338a42a6a40e854b837d285ae2e8c609)

17 months agoBuild: Don't run update-doxygen as part of "make mydist"
Lasse Collin [Fri, 19 Apr 2024 14:23:43 +0000 (17:23 +0300)] 
Build: Don't run update-doxygen as part of "make mydist"

(cherry picked from commit b2bc55d8a0a9f2f59bfd4302067300e650f6baa3)

17 months agoautogen.sh: Don't generated Doxygen docs anymore
Lasse Collin [Fri, 19 Apr 2024 12:09:48 +0000 (15:09 +0300)] 
autogen.sh: Don't generated Doxygen docs anymore

(cherry picked from commit e9be74f5b129fe8a5388d588e68b1b7f5168a310)

17 months agowindows/build.bash: Omit Doxygen docs from the package
Lasse Collin [Fri, 19 Apr 2024 14:41:36 +0000 (17:41 +0300)] 
windows/build.bash: Omit Doxygen docs from the package

They will be omitted from the source tarball and I don't want
to make Doxygen a dependency of build.bash.

(cherry picked from commit 252aa1d67bc015eeba462803ab72edeb7744d864)

17 months agoREADME: Don't mention PDF man pages anymore
Lasse Collin [Fri, 19 Apr 2024 11:14:47 +0000 (14:14 +0300)] 
README: Don't mention PDF man pages anymore

(cherry picked from commit 634095364d87444d62d8ec54c134c0cd4705f5d7)

17 months agoBuild: Omit PDF man pages from the package
Lasse Collin [Fri, 19 Apr 2024 11:10:39 +0000 (14:10 +0300)] 
Build: Omit PDF man pages from the package

pdf-local rule was added to create the PDFs still with "make pdf".
The install rules are missing but that likely doesn't matter at all.

(cherry picked from commit dc684bf76ea23574ee9d88382057381e04e6089a)

17 months agowindows/build.bash: Don't copy PDF man pages to the package
Lasse Collin [Fri, 19 Apr 2024 10:54:39 +0000 (13:54 +0300)] 
windows/build.bash: Don't copy PDF man pages to the package

(cherry picked from commit e3531ab4125cbd5c01ebd3200791350960547189)

17 months agoTests: test_index: Fix failures when features are disabled
Lasse Collin [Sat, 27 Apr 2024 22:34:50 +0000 (01:34 +0300)] 
Tests: test_index: Fix failures when features are disabled

Fixes: cd88423e76d54eb72aea037364f3ebb21f122503
(cherry picked from commit 710a4573ef2cbd19c66318c3b2d1388e418e26c7)

17 months agoCMake: Keep the build working if the "tests" directory is missing
Lasse Collin [Sat, 20 Apr 2024 14:09:11 +0000 (17:09 +0300)] 
CMake: Keep the build working if the "tests" directory is missing

This moves the tests section as is from CMakeLists.txt into
tests/tests.cmake. CMakeLists.txt now includes tests/tests.cmake
if the latter file exists.

Now it's possible to delete the whole "tests" directory and
building with CMake will still work normally, just without
the tests. This way the tests are readily available for those
who want them, and those who won't run the tests anyway have
a straightforward way to ensure that nothing from the "tests"
directory can affect the build process.

(cherry picked from commit aaff75c3486c4489ce88b0efb36b41cf138af7c3)

17 months agoTests: Remove x86 and SPARC BCJ tests
Lasse Collin [Sat, 20 Apr 2024 10:12:50 +0000 (13:12 +0300)] 
Tests: Remove x86 and SPARC BCJ tests

These are very old but the exact test file isn't easy to reproduce
as it was compiled from a short C program (bcj_test.c) long ago.
These tests weren't very good anyway, just a little better than nothing.

(cherry picked from commit a5f2aa5618fe9183706c9c514c3067985f6c338b)

17 months agoTests: test_index: Edit a misleading test
Lasse Collin [Sat, 27 Apr 2024 15:30:40 +0000 (18:30 +0300)] 
Tests: test_index: Edit a misleading test

(cherry picked from commit d879686469c9c4bf2a7c0bb6420ebe4530fc8f07)

17 months agoTests: test_index: Use minimal values to test integer overflow
Lasse Collin [Sat, 27 Apr 2024 13:46:01 +0000 (16:46 +0300)] 
Tests: test_index: Use minimal values to test integer overflow

(cherry picked from commit 612005bbdb0dea9dc09e9e2e9cc16a15c1480acd)

17 months agoTests: test_index: Test lzma_index_buffer_decode() more
Lasse Collin [Sat, 27 Apr 2024 12:13:39 +0000 (15:13 +0300)] 
Tests: test_index: Test lzma_index_buffer_decode() more

(cherry picked from commit 4ad88b2544c2aaf8de8f38af54587098cbe66c1d)

17 months agoTests: test_index: Test that *i = NULL is done on LZMA_PROG_ERROR
Lasse Collin [Sat, 27 Apr 2024 12:08:29 +0000 (15:08 +0300)] 
Tests: test_index: Test that *i = NULL is done on LZMA_PROG_ERROR

On LZMA_DATA_ERROR from lzma_index_buffer_decode(), *i = NULL was
already done but this adds a test for that case too.

(cherry picked from commit 575b11b0d291e66c5fce31ce7a72f11436d57c83)

17 months agoTests: test_index: Test lzma_index_buffer_encode() with empty output buf
Lasse Collin [Sat, 27 Apr 2024 12:01:25 +0000 (15:01 +0300)] 
Tests: test_index: Test lzma_index_buffer_encode() with empty output buf

(cherry picked from commit 2c970debdb285823f01f75e875561d893345ac2b)

17 months agoTests: test_index: Replace if-statements with tuktest assertions
Lasse Collin [Sat, 27 Apr 2024 11:59:55 +0000 (14:59 +0300)] 
Tests: test_index: Replace if-statements with tuktest assertions

(cherry picked from commit cd88423e76d54eb72aea037364f3ebb21f122503)

17 months agoTests: test_index: Make it clear that my_alloc() has no integer overflows
Lasse Collin [Sat, 27 Apr 2024 11:56:16 +0000 (14:56 +0300)] 
Tests: test_index: Make it clear that my_alloc() has no integer overflows

liblzma guarantees that the product of the allocation size arguments
will fit in size_t.

Putting the pre-increment in the if-statement was clearly wrong
although in practice it didn't matter here as the function is
called only a couple of times.

(cherry picked from commit 7f865577a6224fbbb5f5ca52574b62ea8ac9bf51)

17 months agoTests: test_index: Verify also iter.block.number_in_stream
Lasse Collin [Sat, 27 Apr 2024 11:51:52 +0000 (14:51 +0300)] 
Tests: test_index: Verify also iter.block.number_in_stream

(cherry picked from commit 12313a3b6596cdcf012e180597f84d231f8730d3)

17 months agoTests: test_index: Check cases that aren't a multiple of 4 bytes
Lasse Collin [Sat, 27 Apr 2024 11:51:06 +0000 (14:51 +0300)] 
Tests: test_index: Check cases that aren't a multiple of 4 bytes

(cherry picked from commit ad2654010d9d641ce1601beeff00630027e6bcd4)

17 months agoTests: test_index: Edit comments and white space
Lasse Collin [Sat, 27 Apr 2024 11:40:25 +0000 (14:40 +0300)] 
Tests: test_index: Edit comments and white space

(cherry picked from commit 2524fcf2b68b662035437cee8edbe80067c0c240)

17 months agoliblzma: index_decoder: Fix missing initializations on LZMA_PROG_ERROR
Lasse Collin [Sat, 27 Apr 2024 11:33:38 +0000 (14:33 +0300)] 
liblzma: index_decoder: Fix missing initializations on LZMA_PROG_ERROR

If the arguments to lzma_index_decoder() or lzma_index_buffer_decode()
were such that LZMA_PROG_ERROR was returned, the lzma_index **i
argument wasn't touched even though the API docs say that *i = NULL
is done if an error occurs. This obviously won't be done even now
if i == NULL but otherwise it is best to do it due to the wording
in the API docs.

In practice this matters very little: The problem can occur only
if the functions are called with invalid arguments, that is,
the calling application must already have a bug.

(cherry picked from commit 71eed2520e2eecae89bade9dceea16e56cfa2ea0)

17 months agoCMake: Bump maximum policy version to 3.29
Lasse Collin [Fri, 26 Apr 2024 15:25:18 +0000 (18:25 +0300)] 
CMake: Bump maximum policy version to 3.29

(cherry picked from commit 0478473953f50716a2bc37b619b1c7dc2682b1ad)

17 months agoci: add NetBSD
Sam James [Sat, 13 Apr 2024 21:30:44 +0000 (22:30 +0100)] 
ci: add NetBSD

(cherry picked from commit a607e2b40d23f7d998dbaba76692aa30b4c3d9d3)

17 months agoci: add FreeBSD
Sam James [Sat, 13 Apr 2024 22:49:26 +0000 (23:49 +0100)] 
ci: add FreeBSD

(cherry picked from commit 72c210336de26fb87a928160d025fa10a638d23b)

17 months agoci: add OpenBSD
Sam James [Sat, 13 Apr 2024 22:16:08 +0000 (23:16 +0100)] 
ci: add OpenBSD

(cherry picked from commit b526ec2dbfb5889845ea60548c4f5b1f97d84ab2)

17 months agoliblzma: outqueue: add header guard
Sam James [Mon, 15 Apr 2024 04:53:01 +0000 (05:53 +0100)] 
liblzma: outqueue: add header guard

Reported by github's codeql.

(cherry picked from commit c7ef767c49351743d8d011574abb9e200bf6b24f)

17 months agoliblzma: easy_preset: add header guard
Sam James [Mon, 15 Apr 2024 04:53:56 +0000 (05:53 +0100)] 
liblzma: easy_preset: add header guard

Reported by github's codeql.

(cherry picked from commit 55dcae3056d95cb2ddb8b560c12ba7596bc79f2c)

17 months agotuklib_integer: Rename bswapXX to byteswapXX
Lasse Collin [Thu, 25 Apr 2024 11:00:57 +0000 (14:00 +0300)] 
tuklib_integer: Rename bswapXX to byteswapXX

The __builtin_bswapXX from GCC and Clang are preferred when
they are available. This can allow compilers to emit the x86 MOVBE
instruction instead of doing a load + byteswap as two instructions
(which would happen if the byteswapping is done in inline asm).

bswap16, bswap32, and bswap64 exist in system headers on *BSDs
and Darwin. #defining bswap16 on NetBSD results in a warning about
macro redefinition. It's safest to avoid this namespace conflict
completely.

No OS supported by tuklib_integer.h uses byteswapXX names and
a web search doesn't immediately find any obvious danger of
namespace conflicts. So let's try these still-pretty-short names
for the macros.

Thanks to Sam James for pointing out the compiler warning on
NetBSD 10.0.

(cherry picked from commit 4ffc60f32397371769b7d6b5e3ed8626292d58df)

17 months agoliblzma: API doc cleanups
Lasse Collin [Tue, 23 Apr 2024 22:20:26 +0000 (01:20 +0300)] 
liblzma: API doc cleanups

(cherry picked from commit 08ab0966a75b501aa7c717622223f0c13a113c75)

17 months agoTests: test_filter_str: Add a few assertions
Lasse Collin [Tue, 23 Apr 2024 13:35:33 +0000 (16:35 +0300)] 
Tests: test_filter_str: Add a few assertions

(cherry picked from commit 3ac8a9bb4cccbee88350696dc9c645c48d77c989)

17 months agoTests: test_filter_str: Move one assertion and add a comment
Lasse Collin [Tue, 23 Apr 2024 13:35:08 +0000 (16:35 +0300)] 
Tests: test_filter_str: Move one assertion and add a comment

(cherry picked from commit 26c69be80523b05c84dea86c47c4ddd9a10945d7)

17 months agoTests: test_filter_str: Tweak comments and white space
Lasse Collin [Tue, 23 Apr 2024 13:26:06 +0000 (16:26 +0300)] 
Tests: test_filter_str: Tweak comments and white space

(cherry picked from commit 4f6af853bc99904efb8b6c28a0af7b81a8476c1b)

17 months agoTests: test_filter_str: Add missing RISC-V case
Lasse Collin [Tue, 23 Apr 2024 13:25:22 +0000 (16:25 +0300)] 
Tests: test_filter_str: Add missing RISC-V case

Fixes: 89ea1a22f4ed3685b053b7260bc5acf6c75d1664
(cherry picked from commit c92663aa1bd576e0615498a4189acf0df12e84b9)

17 months agoTests: test_filter_str: Test *error_pos more thoroughly
Lasse Collin [Mon, 22 Apr 2024 19:23:32 +0000 (22:23 +0300)] 
Tests: test_filter_str: Test *error_pos more thoroughly

(cherry picked from commit b0366df1d7ed26268101f9303a001c91c0806dfc)

17 months agoliblzma: lzma_str_to_filters: Set *error_pos on all errors
Lasse Collin [Mon, 22 Apr 2024 18:54:39 +0000 (21:54 +0300)] 
liblzma: lzma_str_to_filters: Set *error_pos on all errors

The API docs clearly say that if error_pos isn't NULL then *error
is always set on any error. However, it wasn't touched if str == NULL
or filters == NULL or unsupported flags were specified.

Fixes: cedeeca2ea6ada5b0411b2ae10d7a859e837f203
(cherry picked from commit 70d12dd069bb9bb0d6bb1c8fafc4e6f77780263d)

17 months agoliblzma: Clean up white space
Lasse Collin [Mon, 22 Apr 2024 17:31:25 +0000 (20:31 +0300)] 
liblzma: Clean up white space

(cherry picked from commit ed8e552395701fbf046027cebc8be4a6755b263f)

17 months agoTests: test_filter_flags: Edit comments and style
Lasse Collin [Mon, 22 Apr 2024 15:35:19 +0000 (18:35 +0300)] 
Tests: test_filter_flags: Edit comments and style

(cherry picked from commit 2f06920f20b1ad63b7953dc09569e1d424998849)

17 months agoTests: Fix C99/C11 compatibility when features are disabled
Lasse Collin [Mon, 22 Apr 2024 13:39:44 +0000 (16:39 +0300)] 
Tests: Fix C99/C11 compatibility when features are disabled

The array could become empty and then the initializer would be
simply {} which is allowed only in GNU-C and C23.

(cherry picked from commit b101e1d1dbc81577c0c9aa0cb89cf2e46a15eb82)

17 months agoDOS: Omit useless defines from config.h
Lasse Collin [Sun, 21 Apr 2024 17:32:16 +0000 (20:32 +0300)] 
DOS: Omit useless defines from config.h

(cherry picked from commit f8f3a220ac8afcb8cb2812917d3b77e00c2eab0d)

17 months agoBuild: Omit useless checks for fcntl.h, limits.h, and sys/time.h
Lasse Collin [Sun, 21 Apr 2024 17:27:50 +0000 (20:27 +0300)] 
Build: Omit useless checks for fcntl.h, limits.h, and sys/time.h

(cherry picked from commit fc1921b04b8840caaa777c2bd5340d41b259da20)

17 months agoliblzma: Silence a warning from Coverity static analysis
Lasse Collin [Fri, 19 Apr 2024 19:04:21 +0000 (22:04 +0300)] 
liblzma: Silence a warning from Coverity static analysis

It is logical why it cannot know for sure that the value has
to be at most 4 if it is less than 16.

The x86 filter is based on a very old LZMA SDK version. Newer
ones have quite a different implementation for the same filter.

Thanks to Sam James.

(cherry picked from commit 6aa2a6deeba04808a0fe4461396e7fb70277f3d4)

17 months agoUpdate .gitignore
Lasse Collin [Fri, 19 Apr 2024 20:18:19 +0000 (23:18 +0300)] 
Update .gitignore

(cherry picked from commit e89d3e83b4496d0b5410870634970c0aa9721d59)

17 months agoTests: test_lzip_decoder: Tweak coding style and comments
Lasse Collin [Fri, 19 Apr 2024 17:53:24 +0000 (20:53 +0300)] 
Tests: test_lzip_decoder: Tweak coding style and comments

(cherry picked from commit 86fc4ee859709da0ff9617a1490f13ddac0a109b)

17 months agoTests: test_lzip_decoder: Remove redundant initializations
Lasse Collin [Fri, 19 Apr 2024 17:51:36 +0000 (20:51 +0300)] 
Tests: test_lzip_decoder: Remove redundant initializations

(cherry picked from commit 38be573a279bd7b608ee7d8509ec10884e6fb0d5)

17 months agoTests: test_lzip_decoder: Remove unneeded tuktest_malloc() calls
Lasse Collin [Fri, 19 Apr 2024 17:47:24 +0000 (20:47 +0300)] 
Tests: test_lzip_decoder: Remove unneeded tuktest_malloc() calls

(cherry picked from commit d7e4bc53eacfab9f3de95d8252bdfdc9419079c9)

17 months agoxz: Fix white space error.
Lasse Collin [Mon, 15 Apr 2024 17:35:07 +0000 (20:35 +0300)] 
xz: Fix white space error.

Thanks to xx on #tukaani.

(cherry picked from commit eeca8f7c5baf1ad69606bb734d5001763466d58f)

17 months agoxz: add missing noreturn for message_filters_help
Sam James [Thu, 11 Apr 2024 22:01:44 +0000 (23:01 +0100)] 
xz: add missing noreturn for message_filters_help

Fixes: a165d7df1964121eb9df715e6f836a31c865beef
(cherry picked from commit 462ca9409940a19f743daee6b3bcc611277d0007)

17 months agoxz: signals: suppress -Wsign-conversion on macOS
Sam James [Thu, 11 Apr 2024 18:34:04 +0000 (19:34 +0100)] 
xz: signals: suppress -Wsign-conversion on macOS

On macOS, we get:
```
signals.c: In function 'signals_init':
signals.c:76:17: error: conversion to 'sigset_t' {aka 'unsigned int'} from 'int' may change the sign of the result [-Werror=sign-conversion]
   76 |                 sigaddset(&hooked_signals, sigs[i]);
      |                 ^~~~~~~~~
signals.c:81:17: error: conversion to 'sigset_t' {aka 'unsigned int'} from 'int' may change the sign of the result [-Werror=sign-conversion]
   81 |                 sigaddset(&hooked_signals, message_progress_sigs[i]);
      |                 ^~~~~~~~~
signals.c:86:9: error: conversion to 'sigset_t' {aka 'unsigned int'} from 'int' may change the sign of the result [-Werror=sign-conversion]
   86 |         sigaddset(&hooked_signals, SIGTSTP);
      |         ^~~~~~~~~
```

We use `int` for `hooked_signals` but we can't just cast to whatever
`sigset_t` is because `sigset_t` is an opaque type. It's an unsigned int
on macOS. On macOS, `sigaddset` is implemented as a macro.

Just suppress -Wsign-conversion for `signals_init` for macOS given
there's no real nice way of fixing this.

(cherry picked from commit 863f13d2828b99b0539ce73f9cf85bde32358034)

17 months agoTests: test_microlzma: Add a "FIXME?" about LZMA_FINISH handling
Lasse Collin [Sat, 13 Apr 2024 19:19:40 +0000 (22:19 +0300)] 
Tests: test_microlzma: Add a "FIXME?" about LZMA_FINISH handling

(cherry picked from commit fcbd0d199933a69713cb293cbd7409a757d854cd)

17 months agoTests: test_microlzma: Tweak comments, coding style, and minor details
Lasse Collin [Sat, 13 Apr 2024 15:05:31 +0000 (18:05 +0300)] 
Tests: test_microlzma: Tweak comments, coding style, and minor details

A few lines were reordered, a few ARRAY_SIZE were changed to sizeof,
and a few uint32_t were changed to size_t. No real functional changes
were intended.

(cherry picked from commit 0fe2dfa68355d2b165544b2bc8babf77dcc2039e)

17 months agoCI: Use only the active CPUs on macOS
Ryan Carsten Schmidt [Sat, 13 Apr 2024 00:31:13 +0000 (19:31 -0500)] 
CI: Use only the active CPUs on macOS

hw.ncpu counts all CPUs including inactive ones. hw.activecpu counts
only the active CPUs.

(cherry picked from commit 97f0ee0f1f903f4e7c4ea23e9b89d687025d2992)

17 months agoci: rename ci_build.sh -> ci_build.bash
Sam James [Wed, 10 Apr 2024 17:33:55 +0000 (18:33 +0100)] 
ci: rename ci_build.sh -> ci_build.bash

We discussed the name and it's less cognitive load to just call it '.bash'
so you don't have an immediate question about if bashisms are OK.

(cherry picked from commit 73f629e321b74f68c9954728fa4f19261afccf46)

17 months agoci: build in parallel by default
Sam James [Wed, 10 Apr 2024 16:42:23 +0000 (17:42 +0100)] 
ci: build in parallel by default

(cherry picked from commit 8709407a9ef8e7e8aec117879400e4dd3e227ada)

17 months agoci: default to -O2
Sam James [Wed, 10 Apr 2024 14:41:08 +0000 (15:41 +0100)] 
ci: default to -O2

We need this for when we're passing sanitizer flags or -gdwarf-4 for Clang
with Valgrind. Just always start with -O2 if CFLAGS isn't set in the
environment and append what was passed on the command line.

(cherry picked from commit 65bf7e0a1ca6386f17608e8afb84ac470c18d23f)

17 months agoci: make automake's test runner verbose on failures
Sam James [Wed, 10 Apr 2024 14:17:47 +0000 (15:17 +0100)] 
ci: make automake's test runner verbose on failures

This is a lot easier to work with than the save-logs thing the action
tries to do...

(cherry picked from commit bc899f9e0700ad153bd65f4804c4de7515c8a847)

17 months agoci: make UBSAN abort on errors
Sam James [Wed, 10 Apr 2024 11:38:51 +0000 (12:38 +0100)] 
ci: make UBSAN abort on errors

Unfortunately, UBSAN doesn't do this by default. See also the change
I made in Meson for this in October [0].

[0] https://github.com/mesonbuild/meson/commit/7b7d2e060b447de9c2642848847370a58711ac1c

(cherry picked from commit b5e3470442531717b2457b40ab412740296af1bc)

17 months agoci: test Valgrind
Sam James [Wed, 10 Apr 2024 10:43:10 +0000 (11:43 +0100)] 
ci: test Valgrind

Using `--trace-children=yes` has a trade-off here, as it makes
`test_scripts.sh` pretty slow when calling various non-xz utilities.

But I also feel like it's not useless to have Valgrind used there and it's
not easy to exclude Valgrind just for that one test...

I did consider using AX_VALGRIND_CHECK [0][1] but I couldn't get it working
immediately with some conditionally-built tests and I wondered if it was
worth spending time on at least while we're debating xz's future build
system situation.

[0] https://www.gnu.org/software/autoconf-archive/ax_valgrind_check.html
[1] https://tecnocode.co.uk/2014/12/23/automatically-valgrinding-code-with-ax_valgrind_check/

(cherry picked from commit 6c095a98fbec70b790253a663173ecdb669108c4)

17 months agoliblzma: CRC: Simplify table omission macros
Lasse Collin [Wed, 10 Apr 2024 20:20:02 +0000 (23:20 +0300)] 
liblzma: CRC: Simplify table omission macros

A macro is useful to prevent a single #if directive from
getting too ugly but only one macro is needed for all archs.

(cherry picked from commit 6286c1900c2d2ca33d9b1b397122c7bcdb9a4d59)

17 months agoliblzma: ARM64 CRC: Fix omission of CRC32 table
Lasse Collin [Wed, 10 Apr 2024 20:09:40 +0000 (23:09 +0300)] 
liblzma: ARM64 CRC: Fix omission of CRC32 table

The macro name had an odd typo so the table wasn't omitted
when it should have.

Fixes: 1940f0ec28f08c0ac72c1413d9706fb82eabe6ad
(cherry picked from commit 45da936c879acf4f053a3055665bf1b10ded4462)

17 months agoBuild: If ARM64 feature detection func is found, stop looking for others
Lasse Collin [Wed, 10 Apr 2024 19:21:51 +0000 (22:21 +0300)] 
Build: If ARM64 feature detection func is found, stop looking for others

This can speed up configure a tiny bit.

Fixes: c5f6d79cc9515a7f22d7ea4860c6cc394b295732
(cherry picked from commit 308a9af85400b0e2019f0f012c8354e831d06d65)

17 months agoliblzma: ARM64 CRC32: Change style of the macOS code to match FreeBSD
Lasse Collin [Wed, 10 Apr 2024 19:04:27 +0000 (22:04 +0300)] 
liblzma: ARM64 CRC32: Change style of the macOS code to match FreeBSD

I didn't test this but it shouldn't change any functionality.

Fixes: 761f5b69a4c778c8bcb09279b845b07c28790575
(cherry picked from commit fc43cecd32bf9d5f8caa599206b15c9569af1eb6)

17 months agoliblzma: ARM64 CRC32: Add error checking to FreeBSD-specific code
Lasse Collin [Wed, 10 Apr 2024 18:59:27 +0000 (21:59 +0300)] 
liblzma: ARM64 CRC32: Add error checking to FreeBSD-specific code

Also add parenthesis to the return statement.

I didn't test this.

Fixes: 761f5b69a4c778c8bcb09279b845b07c28790575
(cherry picked from commit 1024cd4cd966b998fedec51e385e9ee9a49b3c57)

17 months agoliblzma: ARM64 CRC32: Use negation instead of subtracting from 8
Lasse Collin [Wed, 10 Apr 2024 18:56:33 +0000 (21:56 +0300)] 
liblzma: ARM64 CRC32: Use negation instead of subtracting from 8

Subtracting from 0 is negation, this just keeps warnings away.

Fixes: 761f5b69a4c778c8bcb09279b845b07c28790575
(cherry picked from commit 2337f7021c860b026e3e849e60a9ae8d09ec0ea0)

17 months agoliblzma: ARM64 CRC32: Tweak coding style and comments
Lasse Collin [Wed, 10 Apr 2024 18:55:10 +0000 (21:55 +0300)] 
liblzma: ARM64 CRC32: Tweak coding style and comments

(cherry picked from commit d8fffd01aa1a3c18e437a222abd34699e23ff5e7)

17 months agoCI: Remove ifunc support.
Lasse Collin [Tue, 9 Apr 2024 14:47:01 +0000 (17:47 +0300)] 
CI: Remove ifunc support.

(cherry picked from commit 986865ea2f9d1f8dbef4a130926df106b0f6d41a)

17 months agoliblzma: Remove ifunc support.
Lasse Collin [Tue, 9 Apr 2024 14:43:16 +0000 (17:43 +0300)] 
liblzma: Remove ifunc support.

This is *NOT* done for security reasons even though the backdoor
relied on the ifunc code. Instead, the reason is that in this
project ifunc provides little benefits but it's quite a bit of
extra code to support it. The only case where ifunc *might* matter
for performance is if the CRC functions are used directly by an
application. In normal compression use it's completely irrelevant.

(cherry picked from commit 689ae2427342a2ea1206eb5ca08301baf410e7e0)

17 months agotests/files/README: Update the main heading.
Lasse Collin [Mon, 8 Apr 2024 19:04:41 +0000 (22:04 +0300)] 
tests/files/README: Update the main heading.

(cherry picked from commit 6b4c859059a7eb9b0547590c081668e14ecf8af6)

17 months agotests/files/README: Explain how to recreate the ARM64 test files.
Lasse Collin [Mon, 8 Apr 2024 19:02:45 +0000 (22:02 +0300)] 
tests/files/README: Explain how to recreate the ARM64 test files.

(cherry picked from commit 2a851e06b891ce894f918faff32a6cca6fdecee6)

17 months agodebug: Add generator for the ARM64 test file data.
Lasse Collin [Mon, 8 Apr 2024 18:51:55 +0000 (21:51 +0300)] 
debug: Add generator for the ARM64 test file data.

(cherry picked from commit 3d09b721b94e18fe1f853a04799697f5de10b291)

17 months agoxz man page: Use .ft CR instead of CW to silence warnings from groff.
Lasse Collin [Mon, 8 Apr 2024 18:19:38 +0000 (21:19 +0300)] 
xz man page: Use .ft CR instead of CW to silence warnings from groff.

(cherry picked from commit 31ef676567c9d6fcc4ec9fc833c312f7a7c21c48)

17 months agoFix NEWS for 5.6.0 and 5.6.1.
Lasse Collin [Mon, 8 Apr 2024 16:28:35 +0000 (19:28 +0300)] 
Fix NEWS for 5.6.0 and 5.6.1.

(cherry picked from commit 780cbf29d5a88db2b546e9b7b019c4c33ca72685)

17 months agoRemove the XZ logo.
Lasse Collin [Mon, 8 Apr 2024 16:22:26 +0000 (19:22 +0300)] 
Remove the XZ logo.

(cherry picked from commit bfd0c7c478e93a1911b845459549ff94587b6ea2)

17 months agoUpdate maintainer and author info.
Lasse Collin [Mon, 8 Apr 2024 15:27:39 +0000 (18:27 +0300)] 
Update maintainer and author info.

The other maintainer suddenly disappeared.

(cherry picked from commit 77a294d98a9d2d48f7e4ac273711518bf689f5c4)

17 months agoDocs: Update .xz file format specification to 1.2.1.
Lasse Collin [Mon, 8 Apr 2024 15:05:32 +0000 (18:05 +0300)] 
Docs: Update .xz file format specification to 1.2.1.

This only reverts the XZ URL changes.

(cherry picked from commit 8dd03d4484ccf80022722a16d0ed9b37f2b58072)

17 months agoUpdate website URLs back to tukaani.org.
Lasse Collin [Mon, 8 Apr 2024 14:33:56 +0000 (17:33 +0300)] 
Update website URLs back to tukaani.org.

The XZ projects were moved back to their original URLs.

(cherry picked from commit 17aa2e1a796d3f758802df29afc89dcf335db567)

17 months agoxzdec: Tweak coding style and comments.
Lasse Collin [Mon, 8 Apr 2024 14:07:08 +0000 (17:07 +0300)] 
xzdec: Tweak coding style and comments.

(cherry picked from commit 2739db981023373a2ddabc7b456c7e658bb4f582)

17 months agotests/ossfuzz: Tiny fix to a comment.
Lasse Collin [Mon, 8 Apr 2024 12:53:46 +0000 (15:53 +0300)] 
tests/ossfuzz: Tiny fix to a comment.

(cherry picked from commit 408b6adb2a07d07c6535f859571cca38837caaf3)

17 months agoCMake: Fix sabotaged Landlock sandbox check.
Lasse Collin [Sat, 30 Mar 2024 12:36:28 +0000 (14:36 +0200)] 
CMake: Fix sabotaged Landlock sandbox check.

It never enabled it.

(cherry picked from commit f9cf4c05edd14dedfe63833f8ccbe41b55823b00)

17 months agoDelete SECURITY.md from v5.6
Lasse Collin [Wed, 22 May 2024 11:08:33 +0000 (14:08 +0300)] 
Delete SECURITY.md from v5.6

It's too easily out of date in the stable branches.
It's not included in the release packages anyway.