]> git.ipfire.org Git - thirdparty/xz.git/log
thirdparty/xz.git
17 months agoCMake: Add support for test_compress.sh tests
Lasse Collin [Mon, 20 May 2024 13:55:00 +0000 (16:55 +0300)] 
CMake: Add support for test_compress.sh tests

(cherry picked from commit b40e6efbb48d740b9b5b303e59e344801cbb5bd8)

17 months agoTests: Make test_compress.sh more flexible
Lasse Collin [Mon, 20 May 2024 13:55:00 +0000 (16:55 +0300)] 
Tests: Make test_compress.sh more flexible

Add a new optional second argument: directory of the xz and xzdec
executables. This is need with the CMake build where the binaries
end up in the top-level build directory.

If ../config.h doesn't exist, assume that all encoders and decoders
are available. This will make this script usable from CMake in the
most common build configuration.

NOTE: Since the existence of ../config.h is checked, the working
directory of the test script must be a subdir in the build tree!
Otherwise ../config.h would look outside the build tree.

Use the default check type instead of forcing CRC32 or CRC64.
Now the script doesn't need to check if CRC64 is available.

(cherry picked from commit ac3222d2cb1ff3a15eb6d58f9ea9bc78e8bc3bb2)

17 months agoCMake: Prepare to support the test_*.sh tests
Lasse Collin [Mon, 20 May 2024 13:55:00 +0000 (16:55 +0300)] 
CMake: Prepare to support the test_*.sh tests

This is a bit hacky since the scripts grep config.h to know which
features were built but the CMake build doesn't create config.h.
So instead those test scripts will be run only when all relevant
features have been enabled.

(cherry picked from commit 006040b29c83104403621e950ada0c8956c56b3d)

17 months agoTests: test_suffix.sh: Add a comment
Lasse Collin [Mon, 20 May 2024 13:55:00 +0000 (16:55 +0300)] 
Tests: test_suffix.sh: Add a comment

(cherry picked from commit 6167607a6ea72fb74eefb943c4566e3cab528cd2)

17 months agoFix typos
Lasse Collin [Fri, 17 May 2024 21:34:07 +0000 (00:34 +0300)] 
Fix typos

Thanks to xx on #tukaani.

(cherry picked from commit 4e9023857d287f624562156b60dc23d2b64c0f10)

17 months agoliblzma: Fix white space
Lasse Collin [Fri, 17 May 2024 21:23:52 +0000 (00:23 +0300)] 
liblzma: Fix white space

Thanks to xx on #tukaani.

(cherry picked from commit b14d08fbbc254485ace9ccfe7908674f608a62ae)

17 months agoxz: Document the static function get_chains_memusage()
Lasse Collin [Mon, 13 May 2024 14:15:04 +0000 (17:15 +0300)] 
xz: Document the static function get_chains_memusage()

(cherry picked from commit 142e670a413a7bce1a2647f1cf1f33f8ee2dbe88)

17 months agoxz: Rename filters_memusage_max() to get_chains_memusage()
Lasse Collin [Mon, 13 May 2024 14:07:22 +0000 (17:07 +0300)] 
xz: Rename filters_memusage_max() to get_chains_memusage()

(cherry picked from commit 78e984399a64bfee5d11e7308e0bdbc1006db2ca)

17 months agoxz: Rename filter_memusages to chains_memusages
Lasse Collin [Mon, 13 May 2024 14:04:05 +0000 (17:04 +0300)] 
xz: Rename filter_memusages to chains_memusages

(cherry picked from commit 54c3db0a83d3e67d89aba92a0957f2dce9b111a7)

17 months agoxz: Simplify the memory usage scaling code
Lasse Collin [Sun, 12 May 2024 19:26:30 +0000 (22:26 +0300)] 
xz: Simplify the memory usage scaling code

This is closer to what it was before the --filtersX support was added,
just extended to support for scaling all filter chains. The method
before this commit was an extended version of the original too but
it was done in a more complex way for no clear reason. In case of
an error, the complex version printed fewer informative messages
(a good thing) but it's not a sigificant benefit.

In the limit is too low even for single-threaded mode, the required
amount of memory is now reported like in 5.4.x instead of like in
5.5.1alpha - 5.6.1 which showed the original non-scaled usage. It
had been a FIXME in the old code but it's not clear what message
makes the most sense.

Fixes: 5f0c5a04388f8334962c70bc37a8c2ff8f605e0a
(cherry picked from commit d9e1ae79ec90d6a7eafeaceaf0ece4f0c83d4417)

17 months agoxz: Edit comments
Lasse Collin [Mon, 13 May 2024 09:14:00 +0000 (12:14 +0300)] 
xz: Edit comments

(cherry picked from commit 0ee56983d198b776878432703de664049b1be32e)

17 months agoxz: Rename chain_idx to chain_num
Lasse Collin [Mon, 13 May 2024 09:03:51 +0000 (12:03 +0300)] 
xz: Rename chain_idx to chain_num

(cherry picked from commit ec82a49c3553f7206104582dbfb8b64fa433b491)

17 months agoxz: Edit coding style
Lasse Collin [Sun, 12 May 2024 19:29:11 +0000 (22:29 +0300)] 
xz: Edit coding style

(cherry picked from commit a731a6993c34bbbd55abaf9c166718682b1da24f)

17 months agoxz: Edit comments
Lasse Collin [Sun, 12 May 2024 19:16:05 +0000 (22:16 +0300)] 
xz: Edit comments

Fixes: 5f0c5a04388f8334962c70bc37a8c2ff8f605e0a
(cherry picked from commit 32eb176b89243fce3112347fe43a8ad14a9fd2be)

17 months agoxz: Fix grammar in a comment
Lasse Collin [Sun, 12 May 2024 18:57:49 +0000 (21:57 +0300)] 
xz: Fix grammar in a comment

Fixes: cb3111e3ed84152912b5138d690c8d9f00c6ef02
(cherry picked from commit b90339f4daa510d2b1b8c550f855a99667f1d004)

17 months agoxz: Rename filter_memusages to encoder_memusages
Lasse Collin [Sun, 12 May 2024 18:46:56 +0000 (21:46 +0300)] 
xz: Rename filter_memusages to encoder_memusages

(cherry picked from commit 4c0bdaf13d651b22ba13bd93f8379724d6ccdc13)

17 months agoxz: Edit coding style
Lasse Collin [Sun, 12 May 2024 18:42:05 +0000 (21:42 +0300)] 
xz: Edit coding style

(cherry picked from commit b54aa023e0ec291b06e976e5f094ab0549e7b09b)

17 months agoxz: Rename filters_index to chain_num
Lasse Collin [Sun, 12 May 2024 18:31:02 +0000 (21:31 +0300)] 
xz: Rename filters_index to chain_num

The reason is the same as in bd0782c1f13e52cd0fd8415208e30e47004a4c68.

(cherry picked from commit 49f67d3d3f42b640a7dfc4ca04c8934f658e10ce)

17 months agoxz: Replace a few uint32_t with "unsigned" to reduce the number of casts
Lasse Collin [Sun, 12 May 2024 18:22:43 +0000 (21:22 +0300)] 
xz: Replace a few uint32_t with "unsigned" to reduce the number of casts

These hold only tiny values.

(cherry picked from commit ff9e8b3d069ecfa52ec43dcdb198542d1692a492)

17 months agoxz: Rename filters_used_mask to chains_used_mask
Lasse Collin [Sun, 12 May 2024 18:10:45 +0000 (21:10 +0300)] 
xz: Rename filters_used_mask to chains_used_mask

The reason is the same as in bd0782c1f13e52cd0fd8415208e30e47004a4c68.

(cherry picked from commit b5e6c1113b1ba02c282bd9163eccdb521c937a78)

17 months agoxz: Move the setting of "check" in coder_set_compression_settings()
Lasse Collin [Sun, 12 May 2024 14:14:43 +0000 (17:14 +0300)] 
xz: Move the setting of "check" in coder_set_compression_settings()

It's more logical to do it in the beginning instead of in the middle
of the filter chain handling.

Fixes: d6af7f347077b22403133239592e478931307759
(cherry picked from commit 32500dfaadae2ea36fda2e17b49ae7d9ac1acf52)

17 months agoxz: Rename "filters" to "chains"
Lasse Collin [Sun, 12 May 2024 14:09:17 +0000 (17:09 +0300)] 
xz: Rename "filters" to "chains"

The convention is that

    lzma_filter filters[LZMA_FILTERS_MAX + 1];

contains the filters of a single filter chain.
It was so here as well before the commit
d6af7f347077b22403133239592e478931307759.
It changes "filters" to a ten-element array of filter chains.
It's clearer to call this array-of-arrays "chains".

This also renames "filter_idx" to "chain_idx" which is used
as an index as in chains[chain_idx].

(cherry picked from commit ad146b1f42bbb678175a503a45ce525e779f9b8b)

17 months agoxz: Clean up a comment
Lasse Collin [Sun, 12 May 2024 13:56:15 +0000 (16:56 +0300)] 
xz: Clean up a comment

(cherry picked from commit 5a4ae4e4d0105404184e9a82ee08f94e1b7783e0)

17 months agoxz: Add clarifying assertions
Lasse Collin [Sun, 12 May 2024 13:52:09 +0000 (16:52 +0300)] 
xz: Add clarifying assertions

(cherry picked from commit 2de80494ed9a4dc7db395a32a5efb770ce769804)

17 months agoxz: Add a clarifying assertion
Lasse Collin [Fri, 10 May 2024 17:23:33 +0000 (20:23 +0300)] 
xz: Add a clarifying assertion

Fixes: 5f0c5a04388f8334962c70bc37a8c2ff8f605e0a
(cherry picked from commit 1eaad004bf7748976324672db028e34f42802e61)

17 months agoxz: Clarify a comment
Lasse Collin [Sun, 12 May 2024 13:47:17 +0000 (16:47 +0300)] 
xz: Clarify a comment

(cherry picked from commit 605094329b986244833c967c04963cacc41a868d)

17 months agoxz: Use the info collected in parse_block_list()
Lasse Collin [Sun, 12 May 2024 13:28:25 +0000 (16:28 +0300)] 
xz: Use the info collected in parse_block_list()

This is slightly simpler and it avoids looping through
the opt_block_list array.

(cherry picked from commit 8fac2577f2dbb9491afd8500f60d004c9071df3b)

17 months agoxz: Remember the filter chains and the largest Block in parse_block_list()
Lasse Collin [Sun, 12 May 2024 12:48:45 +0000 (15:48 +0300)] 
xz: Remember the filter chains and the largest Block in parse_block_list()

(cherry picked from commit 81d350dab864b985b740742772f3b132d4c52914)

17 months agoxz: Update a comment and initialization of filters_used_mask
Lasse Collin [Sun, 12 May 2024 12:38:48 +0000 (15:38 +0300)] 
xz: Update a comment and initialization of filters_used_mask

(cherry picked from commit 46ab56968f7dfdac187710a1223659d832fa1565)

17 months agoxz: parse_block_list: Edit integer type casting
Lasse Collin [Sun, 12 May 2024 12:08:10 +0000 (15:08 +0300)] 
xz: parse_block_list: Edit integer type casting

(cherry picked from commit e89293a0baeb8663707c6b4a74fbb310ec698a8f)

17 months agoxz: Make filter_memusages a local variable
Lasse Collin [Sun, 12 May 2024 11:51:37 +0000 (14:51 +0300)] 
xz: Make filter_memusages a local variable

(cherry picked from commit 87011e40c168255cd2edea129ee68c901770603b)

17 months agoxz: Remove unused code and simplify
Lasse Collin [Fri, 10 May 2024 17:33:08 +0000 (20:33 +0300)] 
xz: Remove unused code and simplify

opt_mode == MODE_COMPRESS isn't possible when HAVE_ENCODERS isn't
defined. Thus, when *encoding*, the message about *decoder* memory
usage is possible to show only when both encoder and decoder have
been built.

Since the message is shown only at V_DEBUG, skip the memusage
calculation if verbosity level isn't high enough.

Fixes: 5f0c5a04388f8334962c70bc37a8c2ff8f605e0a
(cherry picked from commit 347b412a9374e0456bef9da0d7d79174c0b6f1a5)

17 months agoxz: Fix integer type from uint64_t to uint32_t
Lasse Collin [Fri, 10 May 2024 17:22:58 +0000 (20:22 +0300)] 
xz: Fix integer type from uint64_t to uint32_t

lzma_options_lzma.dict_size is uint32_t so use it here too.

Fixes: 5f0c5a04388f8334962c70bc37a8c2ff8f605e0a
(cherry picked from commit 31358c057c9de9d6aba96bae112b2d17942de7cb)

17 months agodebug/translation.bash: Remove an outdated test command
Lasse Collin [Wed, 8 May 2024 18:40:07 +0000 (21:40 +0300)] 
debug/translation.bash: Remove an outdated test command

Since 5.3.5beta, "xz --lzma2=mf=bt4,nice=2" works even though bt4 needs
at least nice=4. It is rounded up internally by liblzma when needed.

Fixes: 5cd9f0df78cc4f8a7807bf6104adea13034fbb45
(cherry picked from commit 3f71e0f3a118e1012526f94fd640a626d30cb599)

17 months agoFix the date of NEWS for 5.4.5
Lasse Collin [Tue, 7 May 2024 17:41:28 +0000 (20:41 +0300)] 
Fix the date of NEWS for 5.4.5

(cherry picked from commit b05a516830095a0e1937aeb31c937fb0400408b6)

17 months agoBuild: Update visibility.m4 from Gnulib
Lasse Collin [Tue, 7 May 2024 13:21:15 +0000 (16:21 +0300)] 
Build: Update visibility.m4 from Gnulib

This fixes the syntax of the "serial" line and renames
a temporary variable.

(cherry picked from commit 6d336aeb97b69c496ddc626af403f6f21c753658)

17 months agopo4a/update-po: Delete the *.po.authors files
Lasse Collin [Tue, 7 May 2024 12:05:21 +0000 (15:05 +0300)] 
po4a/update-po: Delete the *.po.authors files

These are temporary files that are needed only when running po4a.
The top-level Makefile.am puts the whole po4a directory into
distribution tarball (it's simpler) so deleting these temporary
files is needed to prevent them from getting into tarballs.

(cherry picked from commit ab51e8ee610e2a893906859848f93d5cb0d5ba83)

17 months agoxz: Edit comments and coding style
Lasse Collin [Tue, 7 May 2024 10:12:17 +0000 (13:12 +0300)] 
xz: Edit comments and coding style

(cherry picked from commit e4780244a17420cc95d5498cd6e02ad10eac6e5f)

17 months agoxz: Omit an incorrect comment
Lasse Collin [Mon, 6 May 2024 20:08:22 +0000 (23:08 +0300)] 
xz: Omit an incorrect comment

It likely was a leftover from a development version of the code.

Fixes: 183819bfd9efac8c184d9bf123325719b7eee30f
(cherry picked from commit fe4d8b0c80eaeca3381be302eeb89aba871a7e7c)

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)