Commit Graph

1397 Commits

Author SHA1 Message Date
Lasse Collin f7c2cc5561 Bump version and soname for 5.2.10. 2022-12-13 13:03:20 +02:00
Lasse Collin e4e5d5bbb1 Add NEWS for 5.2.10. 2022-12-13 13:02:15 +02:00
Lasse Collin e207267c4b Tests: Fix a typo in tests/files/README. 2022-12-13 12:31:10 +02:00
Lasse Collin 90f8e0828b Update AUTHORS. 2022-12-12 19:09:20 +02:00
Lasse Collin 59a17888e9 xz: Make args_info.files_name a const pointer. 2022-12-12 15:53:03 +02:00
Lasse Collin 4af80d4f51 xz: Don't modify argv[].
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-12 15:53:01 +02:00
Lasse Collin 7623b22d1d liblzma: Check for unexpected NULL pointers in block_header_decode().
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-12 15:47:17 +02:00
Lasse Collin ef315163ef liblzma: Use __has_attribute(__symver__) to fix Clang detection.
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-12 15:47:17 +02:00
Lasse Collin 7e86a7632c Update THANKS (sync all from master). 2022-12-12 15:45:04 +02:00
Lasse Collin d8a898eb99 Bump version and soname for 5.2.9. 2022-11-30 18:33:05 +02:00
Lasse Collin efd4430e21 Add NEWS for 5.2.9. 2022-11-30 18:31:16 +02:00
Lasse Collin 2dc1bc97a5 Change the bug report address.
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-30 18:20:18 +02:00
Lasse Collin fb13a234d9 Update to HTTPS URLs in AUTHORS. 2022-11-30 18:20:13 +02:00
Lasse Collin 841448e36d liblzma: Remove two FIXME comments. 2022-11-29 10:46:06 +02:00
Lasse Collin b61da00c7f Build: Don't put GNU/Linux-specific symbol versions into static liblzma.
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-24 23:50:46 +02:00
Lasse Collin 6c29793b3c CMake: Don't use symbol versioning with static library. 2022-11-24 23:50:46 +02:00
Lasse Collin 872623def5 liblzma: Fix another invalid free() after memory allocation failure.
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
10430fbf38, 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-24 10:58:04 +02:00
Jia Tan b0f8d9293c liblzma: Add support for LZMA_SYNC_FLUSH in the Block encoder.
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-24 10:58:04 +02:00
Lasse Collin 6997e0b5e2 liblzma: Add lzma_attr_warn_unused_result to lzma_filters_copy(). 2022-11-24 10:58:04 +02:00
Lasse Collin f94a3e3460 liblzma: Fix invalid free() after memory allocation failure.
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
f8ee61e74e which is good but
it wasn't enough to fix the main problem in stream_encoder.c.
2022-11-24 10:58:04 +02:00
Lasse Collin 8309385b44 liblzma: Fix language in a comment. 2022-11-24 10:57:11 +02:00
Lasse Collin 5fecba6022 liblzma: Fix infinite loop in LZMA encoder init with dict_size >= 2 GiB.
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-24 10:57:03 +02:00
Lasse Collin 1946b2b141 liblzma: Fix two Doxygen commands in the API headers.
These were caught by clang -Wdocumentation.
2022-11-24 10:56:50 +02:00
Lasse Collin 5476089d9c Bump version and soname for 5.2.8. 2022-11-13 19:58:47 +02:00
Lasse Collin f9994f395d Add NEWS for 5.2.8. 2022-11-13 19:57:26 +02:00
Lasse Collin cdf14b2899 Update THANKS. 2022-11-11 17:16:19 +02:00
Lasse Collin 454f567e58 liblzma: Fix building with Intel ICC (the classic compiler).
It claims __GNUC__ >= 10 but doesn't support __symver__ attribute.

Thanks to Stephen Sachs.
2022-11-11 17:16:19 +02:00
Lasse Collin 2f01169f5a liblzma: Fix incorrect #ifdef for x86 SSE2 support.
__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-11 14:36:32 +02:00
Lasse Collin fc1358679e Scripts: Ignore warnings from xz.
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-11 13:50:56 +02:00
Lasse Collin a08be1c420 xz: Add comments about stdin and src_st.st_size.
"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-11 13:48:06 +02:00
Lasse Collin 3ee411cd1c xz: Fix displaying of file sizes in progress indicator in passthru mode.
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-11 13:48:06 +02:00
Lasse Collin aa7fa9d960 xz: Add a comment why --to-stdout is not in --help.
It is on the man page still.
2022-11-11 13:48:06 +02:00
Lasse Collin ff49ff84a4 Docs: Update faq.txt a little. 2022-11-11 13:48:06 +02:00
Lasse Collin 3489565b75 liblzma: Update API docs about decoder flags. 2022-11-11 13:45:39 +02:00
Lasse Collin e493771080 liblzma: Fix a comment in auto_decoder.c. 2022-11-11 13:41:43 +02:00
Jia Tan d4674dfbb7 xz: Avoid a compiler warning in progress_speed() in message.c.
This should be smaller too since it avoids the string constants.
2022-11-11 13:41:43 +02:00
Lasse Collin 4ed56d32a9 Build: Clarify comment in configure.ac about SSE2. 2022-11-11 13:41:43 +02:00
Lasse Collin f930638797 Build: Remove obsolete commented-out lines from configure.ac. 2022-11-11 13:41:43 +02:00
Lasse Collin 6930f14733 Windows: Fix mythread_once() macro with Vista threads.
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-11-11 13:41:43 +02:00
Lasse Collin 1c8cbb5be3 CMake: Sync tuklib_cpucores.cmake with tuklib_cpucores.m4.
This was forgotten from commit 2611c4d905.
2022-11-11 13:41:43 +02:00
Lasse Collin fa9efb729b Build: Use AC_CONFIG_HEADERS instead of the ancient AC_CONFIG_HEADER.
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-11-11 13:41:43 +02:00
Lasse Collin b10ba4bf39 Build: Update m4/ax_pthread.m4 from Autoconf Archive. 2022-11-11 13:41:43 +02:00
Lasse Collin 01744b280c xz: Fix --single-stream with an empty .xz Stream.
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-11-11 13:38:34 +02:00
Lasse Collin a3e4606134 xz: Fix decompressor behavior if input uses an unsupported check type.
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 231c3c7098, 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-11-11 13:38:34 +02:00
Lasse Collin 0b5e8c7e07 xz: Clarify the man page: input file isn't removed if an error occurs. 2022-11-11 13:30:44 +02:00
Lasse Collin 23b7416d5b xz: If input file cannot be removed, treat it as a warning, not error.
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-11-11 13:29:13 +02:00
Lasse Collin 5daa40454b tuklib_cpucores: Use HW_NCPUONLINE on OpenBSD.
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-11-11 13:28:56 +02:00
Lasse Collin 0af861050f NEWS: Omit the extra copy of 5.2.5 NEWS.
It was a copy-paste error.
2022-11-11 13:25:02 +02:00
Lasse Collin f0c6a66701 Translations: Rename poa4/fr_FR.po to po4a/fr.po.
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-10 12:39:34 +02:00
Lasse Collin 6bf8b1f870 Translations: Update Turkish translation. 2022-11-08 16:57:17 +02:00