aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-12-13Bump version to 5.4.0 and soname to 5.4.0.larhzu/v5.4.0Lasse Collin4-6/+6
2022-12-13Update INSTALL: CMake on Windows isn't experimental anymore.Lasse Collin1-6/+4
Using CMake to build liblzma should work on a few other OSes but building the command line tools is still subtly broken. It is known that shared library versioning may differ between CMake and Libtool builds on some OSes, most notably Darwin.
2022-12-13Add NEWS for 5.4.0.Lasse Collin1-0/+202
2022-12-13Fix a typo in NEWS.Lasse Collin1-1/+1
2022-12-13Add NEWS for 5.2.10.Lasse Collin1-0/+12
2022-12-13Tests: Fix a typo in tests/files/README.Lasse Collin1-1/+1
2022-12-13Tests: Add two ARM64 test files.Lasse Collin4-0/+12
2022-12-12Translations: Update the Catalan translation.Lasse Collin1-351/+306
2022-12-12Update THANKS.Lasse Collin1-0/+1
2022-12-12Update AUTHORS.Lasse Collin1-0/+12
2022-12-12Docs: Omit multi-threaded decompress from TODO.Lasse Collin1-2/+0
The TODO file outdated still.
2022-12-11Docs: Update xz-file-format.txt to 1.1.0 for ARM64 filter.Lasse Collin1-7/+22
2022-12-11xz: Rename --experimental-arm64 to --arm64.Lasse Collin1-1/+1
2022-12-11liblzma: Change LZMA_FILTER_ARM64 to the official Filter ID 0x0A.Lasse Collin1-5/+1
2022-12-08xz: Make args_info.files_name a const pointer.Lasse Collin2-2/+2
2022-12-08xz: Don't modify argv[].Lasse Collin1-4/+19
The code that parses --memlimit options and --block-list modified the argv[] when parsing the option string from optarg. This was visible in "ps auxf" and such and could be confusing. I didn't understand it back in the day when I wrote that code. Now a copy is allocated when modifiable strings are needed.
2022-12-08Translations: Update the German man page translations.Lasse Collin1-3189/+1367
2022-12-08Translations: Update the German translation.Jia Tan1-271/+315
2022-12-08Translations: Update the Turkish translation.Jia Tan1-113/+108
2022-12-08Translations: Update the Croatian translation.Jia Tan1-115/+113
2022-12-08Translations: Add Romanian translation of man pages.Jia Tan2-1/+3693
Thanks to Remus-Gabriel Chelu.
2022-12-08Translations: Update the Romanian translation.Jia Tan1-147/+147
2022-12-08liblzma: Check for unexpected NULL pointers in block_header_decode().Lasse Collin1-0/+4
The API docs gave an impression that such checks are done but they actually weren't done. In practice it made little difference since the calling code has a bug if these are NULL. Thanks to Jia Tan for the original patch that checked for block->filters == NULL.
2022-12-01Bump version number for 5.3.5beta.larhzu/v5.3.5betaLasse Collin3-12/+12
This also sorts the symbol names alphabetically in liblzma_*.map.
2022-12-01Add NEWS for 5.3.5beta.Lasse Collin1-0/+43
2022-12-01Update THANKS.Lasse Collin1-0/+3
2022-12-01liblzma: Use __has_attribute(__symver__) to fix Clang detection.Lasse Collin1-1/+14
If someone sets up Clang to define __GNUC__ to 10 or greater then symvers broke. __has_attribute is supported by such GCC and Clang versions that don't support __symver__ so this should be much better and simpler way to detect if __symver__ is actually supported. Thanks to Tomasz Gajc for the bug report.
2022-12-01liblzma: Omit zero-skipping from ARM64 filter.Lasse Collin2-59/+24
It has some complicated downsides and its usefulness is more limited than I originally thought. So this change is bad for certain very specific situations but a generic solution that works for other filters (and is otherwise better too) is planned anyway. And this way 7-Zip can use the same compatible filter for the .7z format. This is still marked as experimental with a new temporary Filter ID.
2022-12-01xz: Omit the special notes about ARM64 filter on the man page.Lasse Collin1-3/+2
2022-12-01liblzma: Don't be over-specific in lzma_str_to_filters API doc.Lasse Collin1-2/+1
2022-12-01liblzma: Silence unused variable warning when BCJ filters are disabled.Lasse Collin1-0/+15
Thanks to Jia Tan for the original patch.
2022-12-01Translations: Update the Chinese (simplified) translation.Lasse Collin1-260/+348
2022-11-30Add NEWS for 5.2.9.Lasse Collin1-0/+34
2022-11-30xz: Remove message_filters_to_str function prototype from message.h.Jia Tan1-16/+0
This was forgotten from 7484744af6cbabe81e92af7d9e061dfd597fff7b.
2022-11-30Change the bug report address.Lasse Collin5-10/+9
It forwards to me and Jia Tan. Also update the IRC reference in README as #tukaani was moved to Libera Chat long ago.
2022-11-30Build: Add string_conversion.c to CMake, DOS, and VS files.Lasse Collin8-0/+8
2022-11-30Update to HTTPS URLs in AUTHORS.Lasse Collin1-3/+3
2022-11-29liblzma: Improve documentation for string to filter functions.Jia Tan1-8/+9
2022-11-29liblzma: Two fixes to lzma_str_list_filters() API docs.Lasse Collin1-3/+3
Thanks to Jia Tan.
2022-11-28xz: Use lzma_str_from_filters().Lasse Collin2-175/+28
Two uses: Displaying encoder filter chain when compressing with -vv, and displaying the decoder filter chain in --list -vv.
2022-11-28liblzma: Add lzma_str_to_filters, _from_filters, and _list_filters.Lasse Collin5-0/+1567
lzma_str_to_filters() uses static error messages which makes them not very precise. It tells the position in the string where an error occurred though which helps quite a bit if applications take advantage of it. Dynamic error messages can be added later with a new flag if it seems important enough.
2022-11-28liblzma: Make lzma_validate_chain() available outside filter_common.c.Lasse Collin2-4/+7
2022-11-28liblzma: Remove lzma_lz_decoder_uncompressed() as it's now unused.Lasse Collin2-17/+0
2022-11-28liblzma: Use LZMA1EXT feature in lzma_microlzma_decoder().Lasse Collin1-7/+8
Here too this avoids the slightly ugly method to set the uncompressed size. Also moved the setting of dict_size to the struct initializer.
2022-11-28liblzma: Use LZMA1EXT feature in lzma_alone_decoder().Lasse Collin1-5/+13
This avoids the need to use the slightly ugly method to set the uncompressed size.
2022-11-27liblzma: Add LZMA_FILTER_LZMA1EXT to support LZMA1 without end marker.Lasse Collin9-15/+204
Some file formats need support for LZMA1 streams that don't use the end of payload marker (EOPM) alias end of stream (EOS) marker. So far liblzma API has supported decompressing such streams via lzma_alone_decoder() when .lzma header specifies a known uncompressed size. Encoding support hasn't been available in the API. Instead of adding a new LZMA1-only API for this purpose, this commit adds a new filter ID for use with raw encoder and decoder. The main benefit of this approach is that then also filter chains are possible, for example, if someone wants to implement support for .7z files that use the x86 BCJ filter with LZMA1 (not BCJ2 as that isn't supported in liblzma).
2022-11-27liblzma: Avoid unneeded use of void pointer in LZMA decoder.Lasse Collin2-3/+2
2022-11-27liblzma: Pass the Filter ID to LZ encoder and decoder.Lasse Collin14-12/+26
This allows using two Filter IDs with the same initialization function and data structures.
2022-11-27liblzma: Remove two FIXME comments.Lasse Collin1-2/+2
2022-11-26xz: Use lzma_filters_free().Lasse Collin1-6/+2
2022-11-26liblzma: Use lzma_filters_free() in more places.Lasse Collin3-38/+8
2022-11-25liblzma: Omit simple coder init functions if they are disabled.Lasse Collin6-0/+24
2022-11-24xz: Allow nice_len 2 and 3 even if match finder requires 3 or 4.Lasse Collin1-5/+0
Now that liblzma accepts these, we avoid the extra check and there's one message less for translators too.
2022-11-24liblzma: Allow nice_len 2 and 3 even if match finder requires 3 or 4.Lasse Collin3-8/+26
That is, if the specified nice_len is smaller than the minimum of the match finder, silently use the match finder's minimum value instead of reporting an error. The old behavior is annoying to users and it complicates xz options handling too.
2022-11-24liblzma: Add lzma_filters_update() support to the multi-threaded encoder.Lasse Collin2-23/+109
A tiny downside of this is that now a 1-4 tiny allocations are made for every Block because each worker thread needs its own copy of the filter chain.
2022-11-24Update THANKS.Lasse Collin1-0/+1
2022-11-24Build: Don't put GNU/Linux-specific symbol versions into static liblzma.Lasse Collin3-49/+111
It not only makes no sense to put symbol versions into a static library but it can also cause breakage. By default Libtool #defines PIC if building a shared library and doesn't define it for static libraries. This is documented in the Libtool manual. It can be overriden using --with-pic or --without-pic. configure.ac detects if --with-pic or --without-pic is used and then gives an error if neither --disable-shared nor --disable-static was used at the same time. Thus, in normal situations it works to build both shared and static library at the same time on GNU/Linux, only --with-pic or --without-pic requires that only one type of library is built. Thanks to John Paul Adrian Glaubitz from Debian for reporting the problem that occurred on ia64: https://www.mail-archive.com/xz-devel@tukaani.org/msg00610.html
2022-11-24liblzma: Refactor to use lzma_filters_free().Lasse Collin2-21/+6
lzma_filters_free() sets the options to NULL and ids to LZMA_VLI_UNKNOWN so there is no need to do it by caller; the filter arrays will always be left in a safe state. Also use memcpy() instead of a loop to copy a filter chain when it is known to be safe to copy LZMA_FILTERS_MAX + 1 (even if the elements past the terminator might be uninitialized).
2022-11-24liblzma: Fix another invalid free() after memory allocation failure.Lasse Collin1-0/+4
This time it can happen when lzma_stream_encoder_mt() is used to reinitialize an existing multi-threaded Stream encoder and one of 1-4 tiny allocations in lzma_filters_copy() fail. It's very similar to the previous bug 10430fbf3820dafd4eafd38ec8be161a6978ed2b, happening with an array of lzma_filter structures whose old options are freed but the replacement never arrives due to a memory allocation failure in lzma_filters_copy().
2022-11-24liblzma: Add support for LZMA_SYNC_FLUSH in the Block encoder.Jia Tan1-0/+1
The documentation mentions that lzma_block_encoder() supports LZMA_SYNC_FLUSH but it was never added to supported_actions[] in the internal structure. Because of this, LZMA_SYNC_FLUSH could not be used with the Block encoder unless it was the next coder after something like stream_encoder() or stream_encoder_mt().
2022-11-24liblzma: Add new API function lzma_filters_free().Lasse Collin4-0/+49
This is small but convenient and should have been added a long time ago.
2022-11-24CMake: Don't use symbol versioning with static library.Lasse Collin1-3/+7
2022-11-23liblzma: Add lzma_attr_warn_unused_result to lzma_filters_copy().Lasse Collin1-1/+2
2022-11-23liblzma: Fix invalid free() after memory allocation failure.Lasse Collin1-8/+31
The bug was in the single-threaded .xz Stream encoder in the code that is used for both re-initialization and for lzma_filters_update(). To trigger it, an application had to either re-initialize an existing encoder instance with lzma_stream_encoder() or use lzma_filters_update(), and then one of the 1-4 tiny allocations in lzma_filters_copy() (called from stream_encoder_update()) must fail. An error was correctly reported but the encoder state was corrupted. This is related to the recent fix in f8ee61e74eb40600445fdb601c374d582e1e9c8a which is good but it wasn't enough to fix the main problem in stream_encoder.c.
2022-11-22liblzma: Fix language in a comment.Lasse Collin1-1/+1
2022-11-22liblzma: Fix infinite loop in LZMA encoder init with dict_size >= 2 GiB.Lasse Collin1-4/+15
The encoder doesn't support dictionary sizes larger than 1536 MiB. This is validated, for example, when calculating the memory usage via lzma_raw_encoder_memusage(). It is also enforced by the LZ part of the encoder initialization. However, LZMA encoder with LZMA_MODE_NORMAL did an unsafe calculation with dict_size before such validation and that results in an infinite loop if dict_size was 2 << 30 or greater.
2022-11-21liblzma: Fix two Doxygen commands in the API headers.Lasse Collin2-2/+2
These were caught by clang -Wdocumentation.
2022-11-19xz: Refactor duplicate code from hardware_memlimit_mtenc_get().Lasse Collin1-1/+1
2022-11-19xz: Add support --threads=+N so that -T+1 gives threaded mode.Lasse Collin4-6/+51
2022-11-19CMake: Adds test_memlimit to CMake testsJia Tan1-0/+1
2022-11-15Translations: Update the Korean translation.Lasse Collin1-281/+371
2022-11-15Translations: Update the Turkish translation.Lasse Collin1-258/+310
2022-11-15Bump version number for 5.3.4alpha.larhzu/v5.3.4alphaLasse Collin3-3/+3
2022-11-15Add NEWS for 5.3.4alpha.Lasse Collin1-0/+96
2022-11-15Add NEWS for 5.2.8.Lasse Collin1-0/+79
2022-11-14Revert "liblzma: Simple/BCJ filters: Allow disabling generic BCJ options."Lasse Collin9-11/+10
This reverts commit 177bdc922cb17bd0fd831ab8139dfae912a5c2b8 and also does equivalent change to arm64.c. Now that ARM64 filter will use lzma_options_bcj, this change is not needed anymore.
2022-11-14Replace the experimental ARM64 filter with a new experimental version.Lasse Collin11-287/+147
This is incompatible with the previous version. This has space/tab fixes in filter_*.c and bcj.h too.
2022-11-14liblzma: Add fast CRC64 for 32/64-bit x86 using SSSE3 + SSE4.1 + CLMUL.Lasse Collin5-13/+554
It also works on E2K as it supports these intrinsics. On x86-64 runtime detection is used so the code keeps working on older processors too. A CLMUL-only build can be done by using -msse4.1 -mpclmul in CFLAGS and this will reduce the library size since the generic implementation and its 8 KiB lookup table will be omitted. On 32-bit x86 this isn't used by default for now because by default on 32-bit x86 the separate assembly file crc64_x86.S is used. If --disable-assembler is used then this new CLMUL code is used the same way as on 64-bit x86. However, a CLMUL-only build (-msse4.1 -mpclmul) won't omit the 8 KiB lookup table on 32-bit x86 due to a currently-missing check for disabled assembler usage. The configure.ac check should be such that the code won't be built if something in the toolchain doesn't support it but --disable-clmul-crc option can be used to unconditionally disable this feature. CLMUL speeds up decompression of files that have compressed very well (assuming CRC64 is used as a check type). It is know that the CLMUL code is significantly slower than the generic code for tiny inputs (especially 1-8 bytes but up to 16 bytes). If that is a real-world problem then there is already a commented-out variant that uses the generic version for small inputs. Thanks to Ilya Kurdyukov for the original patch which was derived from a white paper from Intel [1] (published in 2009) and public domain code from [2] (released in 2016). [1] https://www.intel.com/content/dam/www/public/us/en/documents/white-papers/fast-crc-computation-generic-polynomials-pclmulqdq-paper.pdf [2] https://github.com/rawrunprotected/crc
2022-11-14Translations: Update the Swedish translation one more time.Lasse Collin1-3/+3
2022-11-14Translations: Update the Swedish translation again.Lasse Collin1-8/+8
2022-11-14Translations: Update the Swedish translation.Lasse Collin1-289/+382
2022-11-14Translations: Update the Ukrainian translation.Lasse Collin1-264/+354
2022-11-14Build: Omit x86_64 from --enable-assembler.Lasse Collin1-4/+2
It didn't do anything. There are only 32-bit x86 assembly files and it feels likely that new files won't be added as intrinsics in C are more portable across toolchains and OSes.
2022-11-14liblzma: Use __attribute__((__constructor__)) if available.Lasse Collin6-5/+59
This uses it for CRC table initializations when using --disable-small. It avoids mythread_once() overhead. It also means that then --disable-small --disable-threads is thread-safe if this attribute is supported.
2022-11-12Translations: Update the Romanian translation.Lasse Collin1-271/+380
2022-11-12Translations: Update the Hungarian translation.Lasse Collin1-268/+357
2022-11-11Translations: Update the Finnish translation.Lasse Collin1-262/+348
2022-11-11Translations: Update the Croatian translation.Lasse Collin1-299/+381
2022-11-11Translations: Update the Polish translation.Lasse Collin1-260/+309
2022-11-11Translations: Update the Spanish translation.Lasse Collin1-254/+344
2022-11-11Update THANKS.Lasse Collin1-0/+1
2022-11-11liblzma: Fix building with Intel ICC (the classic compiler).Lasse Collin1-1/+1
It claims __GNUC__ >= 10 but doesn't support __symver__ attribute. Thanks to Stephen Sachs.
2022-11-11liblzma: Fix incorrect #ifdef for x86 SSE2 support.Lasse Collin1-2/+1
__SSE2__ is the correct macro for SSE2 support with GCC, Clang, and ICC. __SSE2_MATH__ means doing floating point math with SSE2 instead of 387. Often the latter macro is defined if the first one is but it was still a bug.
2022-11-11Add NEWS for 5.2.7 (forgotten cherry-pick from v5.2).Lasse Collin1-0/+74
2022-11-11xzdiff: Add support for .lz files.Lasse Collin1-5/+5
The other scripts don't need changes for .lz support because in those scripts it is enough that xz supports .lz.
2022-11-11Scripts: Ignore warnings from xz.Lasse Collin4-7/+8
In practice this means making the scripts work when the input files have an unsupported check type which isn't a problem in practice unless support for some check types has been disabled at build time.
2022-11-10Translations: Rename poa4/fr_FR.po to po4a/fr.po.Lasse Collin2-1/+1
That's how it is preferred at the Translation Project. On my system /usr/share/man/fr_FR doesn't contain any other man pages than XZ Utils while /usr/share/man/fr has quite a few, so this will fix that too. Thanks to Benno Schulenberg from the Translation Project.
2022-11-09xz: Update the man page about BCJ filters, including upcoming --arm64.Lasse Collin1-37/+29
The --arm64 isn't actually implemented yet in the form described in this commit. Thanks to Jia Tan.
2022-11-09xz: Add --arm64 to --long-help and omit endianness from ARM(-Thumb).Lasse Collin1-2/+3
Modern 32-bit ARM in big endian mode use little endian for instruction encoding still, so the filters work on such executables too. It's likely less confusing for users this way. The --arm64 option hasn't been implemented yet (there is --experimental-arm64 but it's different). The --arm64 option is added now anyway because this is the likely result and the strings need to be ready for translators. Thanks to Jia Tan.
2022-11-09Windows: Update the VS project files for ARM64 and .lz support.Lasse Collin9-4/+49
2022-11-09DOS: Update Makefile and config.h to include ARM64 and .lz support.Lasse Collin2-0/+11
2022-11-09CMake: Add lzip decoder files and #define to the build.Lasse Collin1-0/+3
2022-11-09Docs: Update INSTALL and also add new prohibited options to PACKAGERS.Lasse Collin2-8/+43
2022-11-09Tests: Test the .lz files in test_files.sh.Lasse Collin1-0/+25
2022-11-09Tests: Add .lz (lzip) test files.Lasse Collin19-11/+98
2022-11-09xz: Remove the commented-out FORMAT_GZIP, gzip, .gz, and .tgz.Lasse Collin3-12/+0
2022-11-09xz: Add .lz (lzip) decompression support.Lasse Collin6-13/+141
If configured with --disable-lzip-decoder then --long-help will still list `lzip' in --format but I left it like that since due to translations it would be messy to have two help strings. Features are disabled only in special situations so wrong help in such a situation shouldn't matter much. Thanks to Michał Górny for the original patch.
2022-11-09liblzma: Add .lz support to lzma_auto_decoder().Lasse Collin4-11/+47
Thanks to Michał Górny for the original patch.
2022-11-09liblzma: Add .lz (lzip) decompression support (format versions 0 and 1).Lasse Collin6-2/+501
Support for format version 0 was removed from lzip 1.18 for some reason. .lz format version 0 files are rare (and old) but some source packages were released in this format, and some people might have personal files in this format too. It's very little extra code to support it along side format version 1 so this commits adds support for both. The Sync Flush marker extentension to the original .lz format version 1 isn't supported. It would require changes to the LZMA decoder itself. Such files are very rare anyway. See the API doc for lzma_lzip_decoder() for more details about the .lz format support. Thanks to Michał Górny for the original patch.
2022-11-09liblzma: Add the missing Makefile.inc change for --disable-microlzma.Lasse Collin1-2/+10
This was forgotten from commit 59c4d6e1390f6f4176f43ac1dad1f7ac03c449b8.
2022-11-09xz: Add comments about stdin and src_st.st_size.Lasse Collin2-0/+13
"xz -v < regular_file > out.xz" doesn't display the percentage and estimated remaining time because it doesn't even try to check the input file size when input is read from stdin. This could be improved but for now there's just a comment to remind about it.
2022-11-09xz: Fix displaying of file sizes in progress indicator in passthru mode.Lasse Collin1-1/+5
It worked for one input file since the counters are zero when xz starts but they weren't reset when starting a new file in passthru mode. For example, if files A, B, and C are one byte each, then "xz -dcvf A B C" would show file sizes as 1, 2, and 3 bytes instead of 1, 1, and 1 byte.
2022-11-09xz: Add a comment why --to-stdout is not in --help.Lasse Collin1-0/+3
It is on the man page still.
2022-11-08xz: Make xz -lvv show that the upcoming --arm64 needs 5.4.0 to decompress.Lasse Collin1-5/+15
2022-11-08Docs: Update faq.txt a little.Lasse Collin1-23/+43
2022-11-08Translations: Update Turkish translation.Lasse Collin1-1/+1
2022-11-08Translations: Update Croatian translation.Lasse Collin1-94/+96
2022-11-08liblzma: Update API docs about decoder flags.Lasse Collin1-4/+17
2022-11-08liblzma: Use the return_if_error() macro in alone_decoder.c.Lasse Collin1-4/+2
2022-11-08liblzma: Fix a comment in auto_decoder.c.Lasse Collin1-2/+2
2022-11-08xz: Initialize the pledge(2) sandbox at the very beginning of main().Lasse Collin1-13/+14
It feels better that the initializations are sandboxed too. They don't do anything that the pledge() call wouldn't allow.
2022-11-07xz: Extend --robot --info-memory output.Lasse Collin2-15/+56
Now it includes everything that the human-readable --info-memory shows.
2022-11-07liblzma: Include cached memory in reported memusage in threaded decoder.Lasse Collin1-3/+19
This affects lzma_memusage() and lzma_memlimit_set() when used with the threaded decompressor. Now all allocations are reported by lzma_memusage() (so it's not misleading) and lzma_memlimit_set() cannot lower the limit below that value. The alternative would have been to allow lowering the limit if doing so is possible by freeing the cached memory but since the primary use case of lzma_memlimit_set() is to increase memlimit after LZMA_MEMLIMIT_ERROR this simple approach was selected. The cached memory was always included when enforcing the memory usage limit while decoding. Thanks to Jia Tan.
2022-11-07xz: Avoid a compiler warning in progress_speed() in message.c.Jia Tan1-6/+3
This should be smaller too since it avoids the string constants.
2022-10-31Build: Clarify comment in configure.ac about SSE2.Lasse Collin1-1/+4
2022-10-31Build: Remove obsolete commented-out lines from configure.ac.Lasse Collin1-4/+0
2022-10-31Windows: Fix mythread_once() macro with Vista threads.Lasse Collin1-3/+4
Don't call InitOnceComplete() if initialization was already done. So far mythread_once() has been needed only when building with --enable-small. windows/build.bash does this together with --disable-threads so the Vista-specific mythread_once() is never needed by those builds. VS project files or CMake-builds don't support HAVE_SMALL builds at all.
2022-10-31liblzma: Silence -Wconversion warning from crc64_fast.c.Lasse Collin1-2/+3
2022-10-31CMake: Sync tuklib_cpucores.cmake with tuklib_cpucores.m4.Lasse Collin1-0/+5
This was forgotten from commit 2611c4d90535652d3eb7ef4a026a6691276fab43.
2022-10-27Tests: test_files.sh: Make it not fail if features were disabled at build.Lasse Collin1-4/+46
It now tries to test as many files as easily possible. The exit status indicates skipping if any of the files were skipped. This way it is easy to notice if something is being skipped when it isn't expected.
2022-10-27Tests: test_files.sh: Suppress an expected warning from the log.Lasse Collin1-2/+2
xz (but not xzdec) will normally warn about unsupported check but since we are testing specifically such a file, it's better to silence that warning so that it doesn't look suspicious in test_files.sh.log. The use of -q and -Q in xzdec is just for consistency and doesn't affect the result at least for now.
2022-10-27Tests: test_files.sh: Print the reason for skipping if xz & xzdec missing.Lasse Collin1-0/+1
2022-10-27Tests: Keep test_compress_* working when some filters are unavailable.Lasse Collin1-14/+20
2022-10-26Tests: test_bcj_exact_size skips properly now if PowerPC filter disabled.Jia Tan1-0/+3
2022-10-26Tests: Test also unsupported-*.xz.Lasse Collin1-0/+37
2022-10-25Build: Use AC_CONFIG_HEADERS instead of the ancient AC_CONFIG_HEADER.Lasse Collin1-1/+1
We require Autoconf >= 2.69 and that has AC_CONFIG_HEADERS. There is a warning about AC_PROG_CC_C99 being obsolete but it cannot be removed because it is needed with Autoconf 2.69.
2022-10-25Build: Update m4/ax_pthread.m4 from Autoconf Archive.Lasse Collin1-7/+22
2022-10-25Build: Add configure option --disable-microlzma.Lasse Collin1-0/+22
MicroLZMA was made for EROFS and used by erofs-utils. It might be used by something else in the future but those wanting a smaller build for specific situations can now disable this rarely-needed feature.
2022-10-25xz: Fix --single-stream with an empty .xz Stream.Lasse Collin1-0/+9
Example: $ xz -dc --single-stream good-0-empty.xz xz: good-0-empty.xz: Internal error (bug) The code, that is tries to catch some input file issues early, didn't anticipate LZMA_STREAM_END which is possible in that code only when --single-stream is used.
2022-10-25xz: Add support for OpenBSD's pledge() sandbox.Lasse Collin4-4/+34
2022-10-25xz: Fix decompressor behavior if input uses an unsupported check type.Lasse Collin1-4/+15
Now files with unsupported check will make xz display a warning, set the exit status to 2 (unless --no-warn is used), and then decompress the file normally. This is how it was supposed to work since the beginning but this was broken by the commit 231c3c7098f1099a56abb8afece76fc9b8699f05, that is, a little before 5.0.0 was released. The buggy behavior displayed a message, set exit status 1 (error), and xz didn't attempt to to decompress the file. This doesn't matter today except for special builds that disable CRC64 or SHA-256 at build time (but such builds should be used in special situations only). The bug matters if new check type is added in the future and an old xz version is used to decompress such a file; however, it's likely that such files would use a new filter too and an old xz wouldn't be able to decompress the file anyway. The first hunk in the commit is the actual fix. The second hunk is a cleanup since LZMA_TELL_ANY_CHECK isn't used in xz. There is a test file for unsupported check type but it wasn't used by test_files.sh, perhaps due to different behavior between xz and the simpler xzdec.
2022-10-25xz: Clarify the man page: input file isn't removed if an error occurs.Lasse Collin1-2/+3
2022-10-25xz: Refactor to remove is_empty_filename().Lasse Collin3-17/+3
Long ago it was used in list.c too but nowadays it's needed only in io_open_src() so it's nicer to avoid a separate function.
2022-10-25xz: If input file cannot be removed, treat it as a warning, not error.Lasse Collin1-2/+2
Treating it as a warning (message + exit status 2) matches gzip and it seems more logical as at that point the output file has already been successfully closed. When it's a warning it is possible to suppress it with --no-warn.
2022-10-24liblzma: Threaded decoder: Stop the worker threads on errors.Lasse Collin1-7/+26
It's waste of CPU time and electricity to leave the unfinished worker threads running when it is known that their output will get ignored.
2022-10-20tuklib_cpucores: Use HW_NCPUONLINE on OpenBSD.Lasse Collin2-0/+14
On OpenBSD the number of cores online is often less than what HW_NCPU would return because OpenBSD disables simultaneous multi-threading (SMT) by default. Thanks to Christian Weisgerber.
2022-10-19Tests: Skip tests in test_*.sh if encoders and/or decoders are disabled.Lasse Collin3-0/+34
This isn't perfect as the scripts can still fail if only certain filters are disabled. This is still an improvement as now "make check" has better behavior when all encoders or decoders are disabled. Grepping ../config.h is simple and fairly clean but it only works if config.h was created. CMake builds don't create config.h but they don't use these test scripts either. Thanks to Sebastian Andrzej Siewior for reporting the problem. Thanks to Jia Tan for the original patch which grepped xz error messages instead of config.h.
2022-10-19Test: Remove the (exit 1) lines.Lasse Collin3-25/+0
I suspect that I used these in the original version because Autoconf's manual describes that such a trick is needed in some specific situations for portability reasons. None of those situations listed on Autoconf 2.71 manual apply to these test scripts though so this cleans them up.
2022-10-19Tests: Fix a warning in test_memlimit.c when decoders are disabled.Lasse Collin1-0/+3
2022-10-19Tests: Add test_memlimit to .gitignore.Lasse Collin1-0/+1
Thanks to Jia Tan.
2022-10-06Tests: Refactor test_stream_flags.c.Jia Tan1-117/+416
Converts test_stream_flags to tuktest. Also the test will now compile and skip properly if encoders or decoders are disabled. Thanks to Sebastian Andrzej Siewior.
2022-10-06Tests: Refactor test_block_header.c.Jia Tan1-116/+370
test_block_header now achieves higher test coverage. Also the test will now compile and skip properly if encoders or decoders are disabled. Thanks to Sebastian Andrzej Siewior.
2022-10-06Tests: Fix compilation issues.Jia Tan6-9/+56
test_bcj_exact_size, test_check, test_hardware, and test_index will all now compile and skip properly if encoders or decoders are disabled. Also fixed a small typo (disabed -> disabled). Thanks to Sebastian Andrzej Siewior.
2022-10-05Tests: Include mythread.h in the tests that use MYTHREAD_ENABLED.Lasse Collin3-0/+3
2022-10-05liblzma: Fix a compilation issue when encoders are disabled.Jia Tan1-3/+4
When encoders were disabled and threading enabled, outqueue.c and outqueue.h were not compiled. The multi threaded decoder required these files, so compilation failed.
2022-10-05Tests: Fix compilation error when threading support has been disabled.Jia Tan3-0/+12
Now tests that require threading are skipped when threading support has been disabled. Thanks to Sebastian Andrzej Siewior.
2022-10-05tuklib_integer: Add 64-bit endianness-converting reads and writes.Lasse Collin3-12/+51
Also update the comment in liblzma's memcmplen.h. Thanks to Michał Górny for the original patch for the reads.
2022-09-30liblzma: Add API doc note about the .xz decoder LZMA_MEMLIMIT_ERROR bug.Lasse Collin1-0/+11
The bug was fixed in 660739f99ab211edec4071de98889fb32ed04e98.
2022-09-28liblzma: Add dest and src NULL checks to lzma_index_cat.Jia Tan1-0/+3
The documentation states LZMA_PROG_ERROR can be returned from lzma_index_cat. Previously, lzma_index_cat could not return LZMA_PROG_ERROR. Now, the validation is similar to lzma_index_append, which does a NULL check on the index parameter.
2022-09-28Tests: Create a test for the lzma_index_cat bug.Jia Tan1-1/+42
2022-09-28liblzma: Fix copying of check type statistics in lzma_index_cat().Jia Tan1-1/+6
The check type of the last Stream in dest was never copied to dest->checks (the code tried to copy it but it was done too late). This meant that the value returned by lzma_index_checks() would only include the check type of the last Stream when multiple lzma_indexes had been concatenated. In xz --list this meant that the summary would only list the check type of the last Stream, so in this sense this was only a visual bug. However, it's possible that some applications use this information for purposes other than merely showing it to the users in an informational message. I'm not aware of such applications though and it's quite possible that such applications don't exist. Regular streamed decompression in xz or any other application doesn't use lzma_index_cat() and so this bug cannot affect them.
2022-09-28tuklib_physmem: Fix Unicode builds on Windows.Lasse Collin1-1/+1
Thanks to ArSaCiA Game.
2022-09-28Tests: Add test_memlimit.c to test restarting after LZMA_MEMLIMIT_ERROR.Lasse Collin2-0/+153
2022-09-28liblzma: Stream decoder: Fix restarting after LZMA_MEMLIMIT_ERROR.Lasse Collin1-3/+13
If lzma_code() returns LZMA_MEMLIMIT_ERROR it is now possible to use lzma_memlimit_set() to increase the limit and continue decoding. This was supposed to work from the beginning but there was a bug. With other decoders (.lzma or threaded .xz) this already worked correctly.
2022-09-28liblzma: Stream decoder: Fix comments.Lasse Collin1-7/+5
2022-09-20liblzma: ARM64: Add comments.Lasse Collin1-0/+13
2022-09-20liblzma: ARM64: Fix wrong comment in API doc.Lasse Collin1-2/+2
Thanks to Jia Tan.
2022-09-19xz: Add --experimental-arm64[=width=WIDTH].Lasse Collin4-0/+60
It will be renamed to --arm64 once it is stable. Man page or --long-help weren't updated yet.
2022-09-19liblzma: Add experimental ARM64 BCJ filter with a temporary Filter ID.Lasse Collin11-3/+313
That is, the Filter ID will be changed once the design is final. The current version will be removed. So files created with the tempoary Filter ID won't be supported in the future.
2022-09-17liblzma: Simple/BCJ filters: Allow disabling generic BCJ options.Lasse Collin8-9/+10
This will be needed for the ARM64 BCJ filter as it will use its own options struct.
2022-09-16Tests: Add a test file for lzma_index_append() integer overflow bug.Lasse Collin3-0/+18
This test fails before commit 18d7facd3802b55c287581405c4d49c98708c136. test_files.sh now runs xz -l for bad-3-index-uncomp-overflow.xz because only then the previously-buggy code path gets tested. Normal decompression doesn't use lzma_index_append() at all. Instead, lzma_index_hash functions are used and those already did the overflow check.
2022-09-16Translations: Add Turkish translation.Lasse Collin2-0/+978
2022-09-16Update THANKS.Lasse Collin1-0/+1
2022-09-16xzgrep: Fix compatibility with old shells.Lasse Collin1-3/+3
Running the current xzgrep on Slackware 10.1 with GNU bash 3.00.15: xzgrep: line 231: syntax error near unexpected token `;;' On SCO OpenServer 5.0.7 with Korn Shell 93r: syntax error at line 231 : `;;' unexpected Turns out that some old shells don't like apostrophes (') inside command substitutions. For example, the following fails: x=$(echo foo # asdf'zxcv echo bar) printf '%s\n' "$x" The problem was introduced by commits 69d1b3fc29677af8ade8dc15dba83f0589cb63d6 (2022-03-29), bd7b290f3fe4faeceb7d3497ed9bf2e6ed5e7dc5 (2022-07-18), and a648978b20495b7aa4a8b029c5a810b5ad9d08ff (2022-07-19). 5.2.6 is the only stable release that included this problem. Thanks to Kevin R. Bulgrien for reporting the problem on SCO OpenServer 5.0.7 and for providing the fix.
2022-09-09Tests: Silence warnings about unused functions from tuktest.h.Lasse Collin1-0/+10
Warnings about unused tuktest_run_test conveniently tell which test programs haven't been converted to tuktest.h yet but I silenced that warning too for now anyway. It is fine to use __attribute__((__unused__)) even when the function is actually used because the attribute only means that the function might be unused.
2022-09-09liblzma: lzma_filters_copy: Keep dest[] unmodified if an error occurs.Lasse Collin2-7/+15
lzma_stream_encoder() and lzma_stream_encoder_mt() always assumed this. Before this patch, failing lzma_filters_copy() could result in free(invalid_pointer) or invalid memory reads in stream_encoder.c or stream_encoder_mt.c. To trigger this, allocating memory for a filter options structure has to fail. These are tiny allocations so in practice they very rarely fail. Certain badness in the filter chain array could also make lzma_filters_copy() fail but both stream_encoder.c and stream_encoder_mt.c validate the filter chain before trying to copy it, so the crash cannot occur this way.
2022-09-08liblzma: lzma_index_append: Add missing integer overflow check.Jia Tan1-0/+4
The documentation in src/liblzma/api/lzma/index.h suggests that both the unpadded (compressed) size and the uncompressed size are checked for overflow, but only the unpadded size was checked. The uncompressed check is done first since that is more likely to occur than the unpadded or index field size overflows.
2022-09-08Update THANKS.Lasse Collin1-0/+1
2022-09-08CMake: Clarify a comment about Windows symlinks without file extension.Jia Tan1-4/+3
2022-09-08CMake: Update for liblzma_*.map files and fix wrong common_w32res.rc dep.Lasse Collin1-5/+19
The previous commit split liblzma.map into liblzma_linux.map and liblzma_generic.map. This commit updates the CMake build for those. common_w32res.rc dependency was listed under Linux/FreeBSD while obviously it belongs to Windows when building a DLL.
2022-09-08liblzma: Vaccinate against an ill patch from RHEL/CentOS 7.Lasse Collin10-15/+382
RHEL/CentOS 7 shipped with 5.1.2alpha, including the threaded encoder that is behind #ifdef LZMA_UNSTABLE in the API headers. In 5.1.2alpha these symbols are under XZ_5.1.2alpha in liblzma.map. API/ABI compatibility tracking isn't done between development releases so newer releases didn't have XZ_5.1.2alpha anymore. Later RHEL/CentOS 7 updated xz to 5.2.2 but they wanted to keep the exported symbols compatible with 5.1.2alpha. After checking the ABI changes it turned out that >= 5.2.0 ABI is backward compatible with the threaded encoder functions from 5.1.2alpha (but not vice versa as fixes and extensions to these functions were made between 5.1.2alpha and 5.2.0). In RHEL/CentOS 7, XZ Utils 5.2.2 was patched with xz-5.2.2-compat-libs.patch to modify liblzma.map: - XZ_5.1.2alpha was added with lzma_stream_encoder_mt and lzma_stream_encoder_mt_memusage. This matched XZ Utils 5.1.2alpha. - XZ_5.2 was replaced with XZ_5.2.2. It is clear that this was an error; the intention was to keep using XZ_5.2 (XZ_5.2.2 has never been used in XZ Utils). So XZ_5.2.2 lists all symbols that were listed under XZ_5.2 before the patch. lzma_stream_encoder_mt and _mt_memusage are included too so they are listed both here and under XZ_5.1.2alpha. The patch didn't add any __asm__(".symver ...") lines to the .c files. Thus the resulting liblzma.so exports the threaded encoder functions under XZ_5.1.2alpha only. Listing the two functions also under XZ_5.2.2 in liblzma.map has no effect without matching .symver lines. The lack of XZ_5.2 in RHEL/CentOS 7 means that binaries linked against unpatched XZ Utils 5.2.x won't run on RHEL/CentOS 7. This is unfortunate but this alone isn't too bad as the problem is contained within RHEL/CentOS 7 and doesn't affect users of other distributions. It could also be fixed internally in RHEL/CentOS 7. The second problem is more serious: In XZ Utils 5.2.2 the API headers don't have #ifdef LZMA_UNSTABLE for obvious reasons. This is true in RHEL/CentOS 7 version too. Thus now programs using new APIs can be compiled without an extra #define. However, the programs end up depending on symbol version XZ_5.1.2alpha (and possibly also XZ_5.2.2) instead of XZ_5.2 as they would with an unpatched XZ Utils 5.2.2. This means that such binaries won't run on other distributions shipping XZ Utils >= 5.2.0 as they don't provide XZ_5.1.2alpha or XZ_5.2.2; they only provide XZ_5.2 (and XZ_5.0). (This includes RHEL/CentOS 8 as the patch luckily isn't included there anymore with XZ Utils 5.2.4.) Binaries built by RHEL/CentOS 7 users get distributed and then people wonder why they don't run on some other distribution. Seems that people have found out about the patch and been copying it to some build scripts, seemingly curing the symptoms but actually spreading the illness further and outside RHEL/CentOS 7. The ill patch seems to be from late 2016 (RHEL 7.3) and in 2017 it had spread at least to EasyBuild. I heard about the events only recently. :-( This commit splits liblzma.map into two versions: one for GNU/Linux and another for other OSes that can use symbol versioning (FreeBSD, Solaris, maybe others). The Linux-specific file and the matching additions to .c files add full compatibility with binaries that have been built against a RHEL/CentOS-patched liblzma. Builds for OSes other than GNU/Linux won't get the vaccine as they should be immune to the problem (I really hope that no build script uses the RHEL/CentOS 7 patch outside GNU/Linux). The RHEL/CentOS compatibility symbols XZ_5.1.2alpha and XZ_5.2.2 are intentionally put *after* XZ_5.2 in liblzma_linux.map. This way if one forgets to #define HAVE_SYMBOL_VERSIONS_LINUX when building, the resulting liblzma.so.5 will have lzma_stream_encoder_mt@@XZ_5.2 since XZ_5.2 {...} is the first one that lists that function. Without HAVE_SYMBOL_VERSIONS_LINUX @XZ_5.1.2alpha and @XZ_5.2.2 will be missing but that's still a minor problem compared to only having lzma_stream_encoder_mt@@XZ_5.1.2alpha! The "local: *;" line was moved to XZ_5.0 so that it doesn't need to be moved around. It doesn't matter where it is put. Having two similar liblzma_*.map files is a bit silly as it is, at least for now, easily possible to generate the generic one from the Linux-specific file. But that adds extra steps and increases the risk of mistakes when supporting more than one build system. So I rather maintain two files in parallel and let validate_map.sh check that they are in sync when "make mydist" is run. This adds .symver lines for lzma_stream_encoder_mt@XZ_5.2.2 and lzma_stream_encoder_mt_memusage@XZ_5.2.2 even though these weren't exported by RHEL/CentOS 7 (only @@XZ_5.1.2alpha was for these two). I added these anyway because someone might misunderstand the RHEL/CentOS 7 patch and think that @XZ_5.2.2 (@@XZ_5.2.2) versions were exported too. At glance one could suggest using __typeof__ to copy the function prototypes when making aliases. However, this doesn't work trivially because __typeof__ won't copy attributes (lzma_nothrow, lzma_pure) and it won't change symbol visibility from hidden to default (done by LZMA_API()). Attributes could be copied with __copy__ attribute but that needs GCC 9 and a fallback method would be needed anyway. This uses __symver__ attribute with GCC >= 10 and __asm__(".symver ...") with everything else. The attribute method is required for LTO (-flto) support with GCC. Using -flto with GCC older than 10 is now broken on GNU/Linux and will not be fixed (can silently result in a broken liblzma build that has dangerously incorrect symbol versions). LTO builds with Clang seem to work with the traditional __asm__(".symver ...") method. Thanks to Boud Roukema for reporting the problem and discussing the details and testing the fix.
2022-08-31CMake: Add xz symlinks.Lasse Collin1-1/+37
These are a minor thing especially since the xz build has some real problems still like lack of large file support on 32-bit systems but I'll commit this since the code exists. Thanks to Jia Tan.
2022-08-31CMake: Put xz man page install under if(UNIX) like is for xzdec.Lasse Collin1-3/+5
Thanks to Jia Tan.
2022-08-22Bump version number for 5.3.3alpha.larhzu/v5.3.3alphaLasse Collin2-2/+2
2022-08-22Add NEWS for 5.3.3alpha.Lasse Collin1-0/+119
2022-08-22Translations: Add Portuguese translation.Lasse Collin2-0/+1002
Jia Tan made white-space changes and also changed "Language: pt_BR\n" to pt. The translator wasn't reached so I'm hoping these changes are OK and will commit it without translator's approval. Thanks to Pedro Albuquerque and Jia Tan.
2022-08-22Translations: Add Serbian translation.Lasse Collin2-0/+988
Quite a few white-space changes were made by Jia Tan to make this look good. Contacting the translator didn't succeed so I'm committing this without getting translator's approval. Thanks to Мирослав Николић (Miroslav Nikolic) and Jia Tan.
2022-08-22Translations: Add Swedish translation.Lasse Collin2-0/+984
Thanks to Sebastian Rasmussen and Jia Tan.
2022-08-22Translations: Add Esperanto translation.Lasse Collin2-0/+985
Thanks to Keith Bowes and Jia Tan.
2022-08-22Translations: Add Catalan translation.Lasse Collin2-0/+1077
Thanks to Jordi Mas and Jia Tan.
2022-08-22Translations: Add Ukrainian translation.Lasse Collin2-0/+997
Thanks to Yuri Chornoivan and Jia Tan.
2022-08-22Translators: Add Romanian translation.Lasse Collin2-0/+1017
Thanks to Remus-Gabriel Chelu and Jia Tan.
2022-08-22Translations: Update Brazilian Portuguese translation.Lasse Collin1-94/+92
One msgstr was changed. The diff is long due to changes in the source code line numbers in the comments. Thanks to Rafael Fontenelle.
2022-08-22Translations: Add Croatian translation.Lasse Collin2-0/+988
Thanks to Božidar Putanec and Jia Tan.
2022-08-22Translations: Add Spanish translation.Lasse Collin2-0/+985
Thanks to Cristian Othón Martínez Vera and Jia Tan.
2022-08-22Translations: Add Korean translation.Lasse Collin2-0/+973
Thanks to Seong-ho Cho and Jia Tan.
2022-08-22Translations: Rebuild cs.po to avoid incorrect fuzzy strings.Lasse Collin1-270/+322
"make dist" updates the .po files and the fuzzy strings would result in multiple very wrong translations.
2022-08-22Translations: Add partial Danish translation.Lasse Collin2-0/+897
I made a few minor white space changes without getting them approved by the Danish translation team.
2022-08-22Translations: Add hu, zh_CN, and zh_TW.Lasse Collin4-0/+2907
I made a few white space changes to these without getting them approved by the translation teams. (I tried to contact the hu and zh_TW teams but didn't succeed. I didn't contact the zh_CN team.)
2022-08-22Translations: Update vi.po to match the file from the TP.Lasse Collin1-228/+179
The translated strings haven't been updated but word wrapping is different.