Commit Graph

2554 Commits

Author SHA1 Message Date
Lasse Collin 46ab56968f xz: Update a comment and initialization of filters_used_mask 2024-05-13 15:39:39 +03:00
Lasse Collin e89293a0ba xz: parse_block_list: Edit integer type casting 2024-05-13 15:39:39 +03:00
Lasse Collin 87011e40c1 xz: Make filter_memusages a local variable 2024-05-13 15:39:12 +03:00
Lasse Collin 347b412a93 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: 5f0c5a0438
2024-05-13 15:31:15 +03:00
Lasse Collin 31358c057c xz: Fix integer type from uint64_t to uint32_t
lzma_options_lzma.dict_size is uint32_t so use it here too.

Fixes: 5f0c5a0438
2024-05-11 00:29:24 +03:00
Lasse Collin 3f71e0f3a1 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: 5cd9f0df78
2024-05-08 21:44:48 +03:00
Lasse Collin b05a516830 Fix the date of NEWS for 5.4.5 2024-05-07 20:41:28 +03:00
Lasse Collin 6d336aeb97 Build: Update visibility.m4 from Gnulib
This fixes the syntax of the "serial" line and renames
a temporary variable.
2024-05-07 16:21:15 +03:00
Lasse Collin ab51e8ee61 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.
2024-05-07 15:05:21 +03:00
Lasse Collin e4780244a1 xz: Edit comments and coding style 2024-05-07 13:12:17 +03:00
Lasse Collin fe4d8b0c80 xz: Omit an incorrect comment
It likely was a leftover from a development version of the code.

Fixes: 183819bfd9
2024-05-06 23:09:13 +03:00
Lasse Collin 9bef5b8d17 xz: Add braces to a for-statement and to an if-statement
No functional changes.

Fixes: 5f0c5a0438
Fixes: 479fd58d60
2024-05-06 23:04:31 +03:00
Lasse Collin de06b9f0c0 liblzma: Omit an unneeded array from the x86 filter
Fixes: 6aa2a6deeb
2024-05-06 23:00:09 +03:00
Lasse Collin 7da488cb93 CMake: Add test_suffix.sh to the tests 2024-05-06 22:56:31 +03:00
Lasse Collin a805594ed0 Test: Add CMake support to test_suffix.sh
It needs to find the xz executable from a different directory
and work without config.h.
2024-05-06 22:55:54 +03:00
Lasse Collin 50e1948938 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.
2024-05-06 20:45:34 +03:00
Lasse Collin 68d18aea14 Windows: Remove the "doc/api" line from README-Windows.txt
Fixes: 252aa1d67b
2024-05-02 23:00:16 +03:00
Lasse Collin 8ede961374 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: d3a77ebc04
2024-05-02 22:59:04 +03:00
Sam James 9a6761aa35 ci: add SPDX headers
I've checked over each of these and they're straightforward applications
of the relevant Github Actions.
2024-05-02 20:29:59 +03:00
Yaroslav Halchenko 81efe6119f 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.
2024-05-01 13:51:17 +03:00
Lasse Collin 905bfc74fe Add .gitattributes to clean up git-archive output 2024-04-30 22:26:11 +03:00
Lasse Collin 3334c71d3d xzdec: Support Landlock ABI version 4
This was added to xz in 02e3505991
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.
2024-04-30 22:24:13 +03:00
Lasse Collin 278563ef8f 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: 3b34851de1
2024-04-30 22:22:45 +03:00
Lasse Collin 77c8f60547 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: 88ccf47205
Co-authored-by: Sam James <sam@gentoo.org>
2024-04-30 21:41:11 +03:00
Lasse Collin 64503cc2b7 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.
2024-04-30 17:09:08 +03:00
Lasse Collin 0a7f5a80d8 CMake: List API headers in LIBLZMA_API_HEADERS variable
This way the same list will be usable in more than one location.
2024-04-30 17:09:08 +03:00
Lasse Collin 541406bee3 PACKAGERS: Document the optional Doxygen usage
Also add a note that packagers should check the licensing
of the Doxygen output.
2024-04-30 17:09:08 +03:00
Lasse Collin e21efdf96f Build: Add --enable-doxygen to generate and install API docs
It requires Doxygen. This option is disabled by default.
2024-04-30 17:09:08 +03:00
Lasse Collin 0ece09a575 Doxygen: update-doxygen: Support out-of-tree builds
Also, now $0 is used to refer to the script itself.
2024-04-30 17:09:08 +03:00
Lasse Collin 2c519f641f 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.
2024-04-30 17:09:08 +03:00
Lasse Collin bdba39a575 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.
2024-04-30 17:09:08 +03:00
Lasse Collin d3a77ebc04 Build: Remove old Doxygen rules from top-level Makefile.am 2024-04-30 17:09:08 +03:00
Lasse Collin fd7faa4c33 Update COPYING to match the autogen.sh and mydist changes 2024-04-30 17:09:08 +03:00
Lasse Collin b2bc55d8a0 Build: Don't run update-doxygen as part of "make mydist" 2024-04-30 17:09:08 +03:00
Lasse Collin e9be74f5b1 autogen.sh: Don't generated Doxygen docs anymore 2024-04-30 17:09:08 +03:00
Lasse Collin 252aa1d67b 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.
2024-04-30 17:09:08 +03:00
Lasse Collin 634095364d README: Don't mention PDF man pages anymore 2024-04-28 18:34:45 +03:00
Lasse Collin dc684bf76e 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.
2024-04-28 18:34:45 +03:00
Lasse Collin e3531ab412 windows/build.bash: Don't copy PDF man pages to the package 2024-04-28 18:34:45 +03:00
Lasse Collin 710a4573ef Tests: test_index: Fix failures when features are disabled
Fixes: cd88423e76
2024-04-28 01:34:50 +03:00
Lasse Collin aaff75c348 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.
2024-04-27 20:21:30 +03:00
Lasse Collin a5f2aa5618 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.
2024-04-27 20:21:30 +03:00
Lasse Collin d879686469 Tests: test_index: Edit a misleading test 2024-04-27 18:30:40 +03:00
Lasse Collin 612005bbdb Tests: test_index: Use minimal values to test integer overflow 2024-04-27 16:46:01 +03:00
Lasse Collin 4ad88b2544 Tests: test_index: Test lzma_index_buffer_decode() more 2024-04-27 15:13:39 +03:00
Lasse Collin 575b11b0d2 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.
2024-04-27 15:08:29 +03:00
Lasse Collin 2c970debdb Tests: test_index: Test lzma_index_buffer_encode() with empty output buf 2024-04-27 15:01:25 +03:00
Lasse Collin cd88423e76 Tests: test_index: Replace if-statements with tuktest assertions 2024-04-27 14:59:55 +03:00
Lasse Collin 7f865577a6 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.
2024-04-27 14:56:16 +03:00
Lasse Collin 12313a3b65 Tests: test_index: Verify also iter.block.number_in_stream 2024-04-27 14:51:52 +03:00