]> git.ipfire.org Git - thirdparty/xz.git/log
thirdparty/xz.git
2 years agoUpdate THANKS.
Jia Tan [Thu, 20 Apr 2023 12:15:00 +0000 (20:15 +0800)] 
Update THANKS.

2 years agoWindows: Include <intrin.h> when needed.
Jia Tan [Wed, 19 Apr 2023 14:22:16 +0000 (22:22 +0800)] 
Windows: Include <intrin.h> when needed.

Legacy Windows did not need to #include <intrin.h> to use the MSVC
intrinsics. Newer versions likely just issue a warning, but the MSVC
documentation says to include the header file for the intrinsics we use.

GCC and Clang can "pretend" to be MSVC on Windows, so extra checks are
needed in tuklib_integer.h to only include <intrin.h> when it will is
actually needed.

2 years agotuklib_integer: Use __builtin_clz() with Clang.
Jia Tan [Wed, 19 Apr 2023 13:59:03 +0000 (21:59 +0800)] 
tuklib_integer: Use __builtin_clz() with Clang.

Clang has support for __builtin_clz(), but previously Clang would
fallback to either the MSVC intrinsic or the regular C code. This was
discovered due to a bug where a new version of Clang required the
<intrin.h> header file in order to use the MSVC intrinsics.

Thanks to Anton Kochkov for notifying us about the bug.

2 years agoliblzma: Update project maintainers in lzma.h.
Lasse Collin [Fri, 14 Apr 2023 15:42:33 +0000 (18:42 +0300)] 
liblzma: Update project maintainers in lzma.h.

AUTHORS was updated earlier, lzma.h was simply forgotten.

2 years agoliblzma: Cleans up old commented out code.
Jia Tan [Thu, 13 Apr 2023 12:45:19 +0000 (20:45 +0800)] 
liblzma: Cleans up old commented out code.

2 years agoBuild: Removes redundant check for LZMA1 filter support.
Jia Tan [Wed, 22 Mar 2023 07:42:04 +0000 (15:42 +0800)] 
Build: Removes redundant check for LZMA1 filter support.

2 years agoBuild: Add a comment that AC_PROG_CC_C99 is needed for Autoconf 2.69.
Lasse Collin [Tue, 21 Mar 2023 12:07:51 +0000 (14:07 +0200)] 
Build: Add a comment that AC_PROG_CC_C99 is needed for Autoconf 2.69.

It's obsolete in Autoconf >= 2.70 and just an alias for AC_PROG_CC
but Autoconf 2.69 requires AC_PROG_CC_C99 to get a C99 compiler.

2 years agoBuild: configure.ac: Use AS_IF and AS_CASE where required.
Lasse Collin [Tue, 21 Mar 2023 12:04:37 +0000 (14:04 +0200)] 
Build: configure.ac: Use AS_IF and AS_CASE where required.

This makes no functional difference in the generated configure
(at least with the Autotools versions I have installed) but this
change might prevent future bugs like the one that was just
fixed in the commit 5a5bd7f871818029d5ccbe189f087f591258c294.

2 years agoUpdate THANKS.
Lasse Collin [Tue, 21 Mar 2023 11:12:03 +0000 (13:12 +0200)] 
Update THANKS.

2 years agoBuild: Fix --disable-threads breaking the building of shared libs.
Lasse Collin [Tue, 21 Mar 2023 11:11:49 +0000 (13:11 +0200)] 
Build: Fix --disable-threads breaking the building of shared libs.

This is broken in the releases 5.2.6 to 5.4.2. A workaround
for these releases is to pass EGREP='grep -E' as an argument
to configure in addition to --disable-threads.

The problem appeared when m4/ax_pthread.m4 was updated in
the commit 6629ed929cc7d45a11e385f357ab58ec15e7e4ad which
introduced the use of AC_EGREP_CPP. AC_EGREP_CPP calls
AC_REQUIRE([AC_PROG_EGREP]) to set the shell variable EGREP
but this was only executed if POSIX threads were enabled.
Libtool code also has AC_REQUIRE([AC_PROG_EGREP]) but Autoconf
omits it as AC_PROG_EGREP has already been required earlier.
Thus, if not using POSIX threads, the shell variable EGREP
would be undefined in the Libtool code in configure.

ax_pthread.m4 is fine. The bug was in configure.ac which called
AX_PTHREAD conditionally in an incorrect way. Using AS_CASE
ensures that all AC_REQUIREs get always run.

Thanks to Frank Busse for reporting the bug.
Fixes: https://github.com/tukaani-project/xz/issues/45
2 years agoBump version and soname for 5.2.11. v5.2.11
Jia Tan [Sat, 18 Mar 2023 14:25:59 +0000 (22:25 +0800)] 
Bump version and soname for 5.2.11.

2 years agoAdd NEWS for 5.2.11.
Jia Tan [Sat, 18 Mar 2023 14:16:09 +0000 (22:16 +0800)] 
Add NEWS for 5.2.11.

2 years agoUpdate the copy of GNU GPLv3 from gnu.org to COPYING.GPLv3.
Lasse Collin [Sat, 18 Mar 2023 14:00:54 +0000 (16:00 +0200)] 
Update the copy of GNU GPLv3 from gnu.org to COPYING.GPLv3.

2 years agoChange a few HTTP URLs to HTTPS.
Lasse Collin [Sat, 18 Mar 2023 13:51:57 +0000 (15:51 +0200)] 
Change a few HTTP URLs to HTTPS.

The xz man page timestamp was intentionally left unchanged.

2 years agoCMake: Require that the C compiler supports C99 or a newer standard.
Lasse Collin [Mon, 27 Feb 2023 16:38:35 +0000 (18:38 +0200)] 
CMake: Require that the C compiler supports C99 or a newer standard.

Thanks to autoantwort for reporting the issue and suggesting
a different patch:
https://github.com/tukaani-project/xz/pull/42

2 years agoUpdate THANKS.
Lasse Collin [Thu, 23 Feb 2023 18:46:16 +0000 (20:46 +0200)] 
Update THANKS.

2 years agoliblzma: Avoid null pointer + 0 (undefined behavior in C).
Lasse Collin [Tue, 21 Feb 2023 20:57:10 +0000 (22:57 +0200)] 
liblzma: Avoid null pointer + 0 (undefined behavior in C).

In the C99 and C17 standards, section 6.5.6 paragraph 8 means that
adding 0 to a null pointer is undefined behavior. As of writing,
"clang -fsanitize=undefined" (Clang 15) diagnoses this. However,
I'm not aware of any compiler that would take advantage of this
when optimizing (Clang 15 included). It's good to avoid this anyway
since compilers might some day infer that pointer arithmetic implies
that the pointer is not NULL. That is, the following foo() would then
unconditionally return 0, even for foo(NULL, 0):

    void bar(char *a, char *b);

    int foo(char *a, size_t n)
    {
        bar(a, a + n);
        return a == NULL;
    }

In contrast to C, C++ explicitly allows null pointer + 0. So if
the above is compiled as C++ then there is no undefined behavior
in the foo(NULL, 0) call.

To me it seems that changing the C standard would be the sane
thing to do (just add one sentence) as it would ensure that a huge
amount of old code won't break in the future. Based on web searches
it seems that a large number of codebases (where null pointer + 0
occurs) are being fixed instead to be future-proof in case compilers
will some day optimize based on it (like making the above foo(NULL, 0)
return 0) which in the worst case will cause security bugs.

Some projects don't plan to change it. For example, gnulib and thus
many GNU tools currently require that null pointer + 0 is defined:

    https://lists.gnu.org/archive/html/bug-gnulib/2021-11/msg00000.html

    https://www.gnu.org/software/gnulib/manual/html_node/Other-portability-assumptions.html

In XZ Utils null pointer + 0 issue should be fixed after this
commit. This adds a few if-statements and thus branches to avoid
null pointer + 0. These check for size > 0 instead of ptr != NULL
because this way bugs where size > 0 && ptr == NULL will likely
get caught quickly. None of them are in hot spots so it shouldn't
matter for performance.

A little less readable version would be replacing

    ptr + offset

with

    offset != 0 ? ptr + offset : ptr

or creating a macro for it:

    #define my_ptr_add(ptr, offset) \
            ((offset) != 0 ? ((ptr) + (offset)) : (ptr))

Checking for offset != 0 instead of ptr != NULL allows GCC >= 8.1,
Clang >= 7, and Clang-based ICX to optimize it to the very same code
as ptr + offset. That is, it won't create a branch. So for hot code
this could be a good solution to avoid null pointer + 0. Unfortunately
other compilers like ICC 2021 or MSVC 19.33 (VS2022) will create a
branch from my_ptr_add().

Thanks to Marcin Kowalczyk for reporting the problem:
https://github.com/tukaani-project/xz/issues/36

2 years agoUpdate THANKS.
Lasse Collin [Fri, 17 Feb 2023 18:56:49 +0000 (20:56 +0200)] 
Update THANKS.

2 years agoBuild: Use only the generic symbol versioning on MicroBlaze.
Lasse Collin [Fri, 17 Feb 2023 18:48:28 +0000 (20:48 +0200)] 
Build: Use only the generic symbol versioning on MicroBlaze.

On MicroBlaze, GCC 12 is broken in sense that
__has_attribute(__symver__) returns true but it still doesn't
support the __symver__ attribute even though the platform is ELF
and symbol versioning is supported if using the traditional
__asm__(".symver ...") method. Avoiding the traditional method is
good because it breaks LTO (-flto) builds with GCC.

See also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101766

For now the only extra symbols in liblzma_linux.map are the
compatibility symbols with the patch that spread from RHEL/CentOS 7.
These require the use of __symver__ attribute or __asm__(".symver ...")
in the C code. Compatibility with the patch from CentOS 7 doesn't
seem valuable on MicroBlaze so use liblzma_generic.map on MicroBlaze
instead. It doesn't require anything special in the C code and thus
no LTO issues either.

An alternative would be to detect support for __symver__
attribute in configure.ac and CMakeLists.txt and fall back
to __asm__(".symver ...") but then LTO would be silently broken
on MicroBlaze. It sounds likely that MicroBlaze is a special
case so let's treat it as a such because that is simpler. If
a similar issue exists on some other platform too then hopefully
someone will report it and this can be reconsidered.

(This doesn't do the same fix in CMakeLists.txt. Perhaps it should
but perhaps CMake build of liblzma doesn't matter much on MicroBlaze.
The problem breaks the build so it's easy to notice and can be fixed
later.)

Thanks to Vincent Fazio for reporting the problem and proposing
a patch (in the end that solution wasn't used):
https://github.com/tukaani-project/xz/pull/32

2 years agoliblzma: Fix documentation for LZMA_MEMLIMIT_ERROR.
Jia Tan [Sat, 21 Jan 2023 13:32:03 +0000 (21:32 +0800)] 
liblzma: Fix documentation for LZMA_MEMLIMIT_ERROR.

LZMA_MEMLIMIT_ERROR was missing the "<" character needed to put
documentation after a member.

2 years agotuklib_physmem: Silence warning from -Wcast-function-type on MinGW-w64.
Jia Tan [Thu, 19 Jan 2023 12:35:09 +0000 (20:35 +0800)] 
tuklib_physmem: Silence warning from -Wcast-function-type on MinGW-w64.

tuklib_physmem depends on GetProcAddress() for both MSVC and MinGW-w64
to retrieve a function address. The proper way to do this is to cast the
return value to the type of function pointer retrieved. Unfortunately,
this causes a cast-function-type warning, so the best solution is to
simply ignore the warning.

2 years agoxz: Add missing comment for coder_set_compression_settings()
Jia Tan [Mon, 16 Jan 2023 13:35:45 +0000 (21:35 +0800)] 
xz: Add missing comment for coder_set_compression_settings()

2 years agoxz: Do not set compression settings with raw format in list mode.
Jia Tan [Mon, 16 Jan 2023 12:55:10 +0000 (20:55 +0800)] 
xz: Do not set compression settings with raw format in list mode.

Calling coder_set_compression_settings() in list mode with verbose mode
on caused the filter chain and memory requirements to print. This was
unnecessary since the command results in an error and not consistent
with other formats like lzma and alone.

2 years agoxz: Use ssize_t for the to-be-ignored return value from write(fd, ptr, 1).
Lasse Collin [Thu, 12 Jan 2023 04:05:58 +0000 (06:05 +0200)] 
xz: Use ssize_t for the to-be-ignored return value from write(fd, ptr, 1).

It makes no difference here as the return value fits into an int
too and it then gets ignored but this looks better.

2 years agoliblzma: Silence warnings from clang -Wconditional-uninitialized.
Lasse Collin [Thu, 12 Jan 2023 01:19:59 +0000 (03:19 +0200)] 
liblzma: Silence warnings from clang -Wconditional-uninitialized.

This is similar to 2ce4f36f179a81d0c6e182a409f363df759d1ad0.
The actual initialization of the variables is done inside
mythread_sync() macro. Clang doesn't seem to see that
the initialization code inside the macro is always executed.

2 years agoFix warnings from clang -Wdocumentation.
Lasse Collin [Thu, 12 Jan 2023 01:11:40 +0000 (03:11 +0200)] 
Fix warnings from clang -Wdocumentation.

2 years agoxz: Fix warning -Wformat-nonliteral on clang in message.c.
Jia Tan [Wed, 11 Jan 2023 14:46:48 +0000 (22:46 +0800)] 
xz: Fix warning -Wformat-nonliteral on clang in message.c.

clang and gcc differ in how they handle -Wformat-nonliteral. gcc will
allow a non-literal format string as long as the function takes its
format arguments as a va_list.

2 years agoCMake/Windows: Add a workaround for windres from GNU binutils.
Lasse Collin [Tue, 10 Jan 2023 06:50:26 +0000 (08:50 +0200)] 
CMake/Windows: Add a workaround for windres from GNU binutils.

This is combined from the following commits in the master branch:
443dfebced041adc88f10d824188eeef5b5821a9
6b117d3b1fe91eb26d533ab16a2e552f84148d47
5e34774c31d1b7509b5cb77a3be9973adec59ea0

Thanks to Iouri Kharon for the bug report, the original patch,
and testing.

2 years agoCMake: Update cmake_minimum_required from 3.13...3.16 to 3.13...3.25.
Lasse Collin [Sat, 7 Jan 2023 19:57:11 +0000 (21:57 +0200)] 
CMake: Update cmake_minimum_required from 3.13...3.16 to 3.13...3.25.

The changes listed on cmake-policies(7) for versions 3.17 to 3.25
shouldn't affect this project.

2 years agoUpdate THANKS.
Lasse Collin [Sat, 7 Jan 2023 17:50:35 +0000 (19:50 +0200)] 
Update THANKS.

2 years agoCMake: Fix a copypaste error in xzdec Windows resource file handling.
Lasse Collin [Mon, 9 Jan 2023 09:27:24 +0000 (11:27 +0200)] 
CMake: Fix a copypaste error in xzdec Windows resource file handling.

It was my mistake. Thanks to Iouri Kharon for the bug report.

2 years agoCMake/Windows: Add resource files to xz.exe and xzdec.exe.
Lasse Collin [Sat, 7 Jan 2023 17:50:03 +0000 (19:50 +0200)] 
CMake/Windows: Add resource files to xz.exe and xzdec.exe.

The command line tools cannot be built with MSVC for now but
they can be built with MinGW-w64.

Thanks to Iouri Kharon for the bug report and the original patch.

2 years agoliblzma: Update documentation for lzma_filter_encoder.
Jia Tan [Thu, 22 Dec 2022 15:14:53 +0000 (23:14 +0800)] 
liblzma: Update documentation for lzma_filter_encoder.

2 years agoDoxygen: Update .gitignore for generating docs for in source build.
Jia Cheong Tan [Tue, 20 Dec 2022 14:05:21 +0000 (22:05 +0800)] 
Doxygen: Update .gitignore for generating docs for in source build.

In source builds are not recommended, but we should still ignore
the generated artifacts.

2 years agoCMake: Update .gitignore for CMake artifacts from in source build.
Jia Tan [Fri, 16 Dec 2022 12:58:55 +0000 (20:58 +0800)] 
CMake: Update .gitignore for CMake artifacts from in source build.

In source builds are not recommended, but we can make it easier
by ignoring the generated artifacts from CMake.

2 years agoBump version and soname for 5.2.10. v5.2.10
Lasse Collin [Tue, 13 Dec 2022 11:03:20 +0000 (13:03 +0200)] 
Bump version and soname for 5.2.10.

2 years agoAdd NEWS for 5.2.10.
Lasse Collin [Tue, 13 Dec 2022 11:02:15 +0000 (13:02 +0200)] 
Add NEWS for 5.2.10.

2 years agoTests: Fix a typo in tests/files/README.
Lasse Collin [Tue, 13 Dec 2022 10:30:45 +0000 (12:30 +0200)] 
Tests: Fix a typo in tests/files/README.

2 years agoUpdate AUTHORS.
Lasse Collin [Mon, 12 Dec 2022 17:09:20 +0000 (19:09 +0200)] 
Update AUTHORS.

2 years agoxz: Make args_info.files_name a const pointer.
Lasse Collin [Thu, 8 Dec 2022 17:24:22 +0000 (19:24 +0200)] 
xz: Make args_info.files_name a const pointer.

2 years agoxz: Don't modify argv[].
Lasse Collin [Thu, 8 Dec 2022 17:18:16 +0000 (19:18 +0200)] 
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.

2 years agoliblzma: Check for unexpected NULL pointers in block_header_decode().
Lasse Collin [Thu, 8 Dec 2022 15:30:09 +0000 (17:30 +0200)] 
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.

2 years agoliblzma: Use __has_attribute(__symver__) to fix Clang detection.
Lasse Collin [Thu, 1 Dec 2022 18:04:17 +0000 (20:04 +0200)] 
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.

2 years agoUpdate THANKS (sync all from master).
Lasse Collin [Mon, 12 Dec 2022 13:45:04 +0000 (15:45 +0200)] 
Update THANKS (sync all from master).

2 years agoBump version and soname for 5.2.9. v5.2.9
Lasse Collin [Wed, 30 Nov 2022 16:33:05 +0000 (18:33 +0200)] 
Bump version and soname for 5.2.9.

2 years agoAdd NEWS for 5.2.9.
Lasse Collin [Wed, 30 Nov 2022 16:31:16 +0000 (18:31 +0200)] 
Add NEWS for 5.2.9.

2 years agoChange the bug report address.
Lasse Collin [Wed, 30 Nov 2022 16:08:34 +0000 (18:08 +0200)] 
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.

2 years agoUpdate to HTTPS URLs in AUTHORS.
Lasse Collin [Wed, 30 Nov 2022 15:38:32 +0000 (17:38 +0200)] 
Update to HTTPS URLs in AUTHORS.

2 years agoliblzma: Remove two FIXME comments.
Lasse Collin [Sat, 26 Nov 2022 23:03:16 +0000 (01:03 +0200)] 
liblzma: Remove two FIXME comments.

2 years agoBuild: Don't put GNU/Linux-specific symbol versions into static liblzma.
Lasse Collin [Thu, 24 Nov 2022 12:52:44 +0000 (14:52 +0200)] 
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

2 years agoCMake: Don't use symbol versioning with static library.
Lasse Collin [Wed, 23 Nov 2022 22:02:31 +0000 (00:02 +0200)] 
CMake: Don't use symbol versioning with static library.

2 years agoliblzma: Fix another invalid free() after memory allocation failure.
Lasse Collin [Wed, 23 Nov 2022 23:26:37 +0000 (01:26 +0200)] 
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
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().

2 years agoliblzma: Add support for LZMA_SYNC_FLUSH in the Block encoder.
Jia Tan [Thu, 5 May 2022 12:53:42 +0000 (20:53 +0800)] 
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().

2 years agoliblzma: Add lzma_attr_warn_unused_result to lzma_filters_copy().
Lasse Collin [Wed, 23 Nov 2022 19:55:22 +0000 (21:55 +0200)] 
liblzma: Add lzma_attr_warn_unused_result to lzma_filters_copy().

2 years agoliblzma: Fix invalid free() after memory allocation failure.
Lasse Collin [Wed, 23 Nov 2022 19:26:21 +0000 (21:26 +0200)] 
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
f8ee61e74eb40600445fdb601c374d582e1e9c8a which is good but
it wasn't enough to fix the main problem in stream_encoder.c.

2 years agoliblzma: Fix language in a comment.
Lasse Collin [Tue, 22 Nov 2022 14:37:15 +0000 (16:37 +0200)] 
liblzma: Fix language in a comment.

2 years agoliblzma: Fix infinite loop in LZMA encoder init with dict_size >= 2 GiB.
Lasse Collin [Tue, 22 Nov 2022 09:20:17 +0000 (11:20 +0200)] 
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.

2 years agoliblzma: Fix two Doxygen commands in the API headers.
Lasse Collin [Mon, 21 Nov 2022 11:02:33 +0000 (13:02 +0200)] 
liblzma: Fix two Doxygen commands in the API headers.

These were caught by clang -Wdocumentation.

2 years agoBump version and soname for 5.2.8. v5.2.8
Lasse Collin [Sun, 13 Nov 2022 17:58:47 +0000 (19:58 +0200)] 
Bump version and soname for 5.2.8.

2 years agoAdd NEWS for 5.2.8.
Lasse Collin [Sun, 13 Nov 2022 17:57:26 +0000 (19:57 +0200)] 
Add NEWS for 5.2.8.

2 years agoUpdate THANKS.
Lasse Collin [Fri, 11 Nov 2022 15:16:03 +0000 (17:16 +0200)] 
Update THANKS.

2 years agoliblzma: Fix building with Intel ICC (the classic compiler).
Lasse Collin [Fri, 11 Nov 2022 15:15:25 +0000 (17:15 +0200)] 
liblzma: Fix building with Intel ICC (the classic compiler).

It claims __GNUC__ >= 10 but doesn't support __symver__ attribute.

Thanks to Stephen Sachs.

2 years agoliblzma: Fix incorrect #ifdef for x86 SSE2 support.
Lasse Collin [Fri, 11 Nov 2022 12:35:58 +0000 (14:35 +0200)] 
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.

2 years agoScripts: Ignore warnings from xz.
Lasse Collin [Fri, 11 Nov 2022 10:23:58 +0000 (12:23 +0200)] 
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.

2 years agoxz: Add comments about stdin and src_st.st_size.
Lasse Collin [Wed, 9 Nov 2022 12:10:52 +0000 (14:10 +0200)] 
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.

2 years agoxz: Fix displaying of file sizes in progress indicator in passthru mode.
Lasse Collin [Wed, 9 Nov 2022 10:48:22 +0000 (12:48 +0200)] 
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.

2 years agoxz: Add a comment why --to-stdout is not in --help.
Lasse Collin [Wed, 9 Nov 2022 09:27:20 +0000 (11:27 +0200)] 
xz: Add a comment why --to-stdout is not in --help.

It is on the man page still.

2 years agoDocs: Update faq.txt a little.
Lasse Collin [Tue, 8 Nov 2022 20:26:54 +0000 (22:26 +0200)] 
Docs: Update faq.txt a little.

2 years agoliblzma: Update API docs about decoder flags.
Lasse Collin [Tue, 8 Nov 2022 12:13:03 +0000 (14:13 +0200)] 
liblzma: Update API docs about decoder flags.

2 years agoliblzma: Fix a comment in auto_decoder.c.
Lasse Collin [Tue, 8 Nov 2022 12:00:58 +0000 (14:00 +0200)] 
liblzma: Fix a comment in auto_decoder.c.

2 years agoxz: Avoid a compiler warning in progress_speed() in message.c.
Jia Tan [Mon, 7 Nov 2022 14:24:14 +0000 (16:24 +0200)] 
xz: Avoid a compiler warning in progress_speed() in message.c.

This should be smaller too since it avoids the string constants.

2 years agoBuild: Clarify comment in configure.ac about SSE2.
Lasse Collin [Mon, 31 Oct 2022 14:26:05 +0000 (16:26 +0200)] 
Build: Clarify comment in configure.ac about SSE2.

2 years agoBuild: Remove obsolete commented-out lines from configure.ac.
Lasse Collin [Mon, 31 Oct 2022 14:16:37 +0000 (16:16 +0200)] 
Build: Remove obsolete commented-out lines from configure.ac.

2 years agoWindows: Fix mythread_once() macro with Vista threads.
Lasse Collin [Mon, 31 Oct 2022 11:31:58 +0000 (13:31 +0200)] 
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.

2 years agoCMake: Sync tuklib_cpucores.cmake with tuklib_cpucores.m4.
Lasse Collin [Mon, 31 Oct 2022 09:49:47 +0000 (11:49 +0200)] 
CMake: Sync tuklib_cpucores.cmake with tuklib_cpucores.m4.

This was forgotten from commit 2611c4d90535652d3eb7ef4a026a6691276fab43.

2 years agoBuild: Use AC_CONFIG_HEADERS instead of the ancient AC_CONFIG_HEADER.
Lasse Collin [Tue, 25 Oct 2022 20:45:03 +0000 (23:45 +0300)] 
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.

2 years agoBuild: Update m4/ax_pthread.m4 from Autoconf Archive.
Lasse Collin [Tue, 25 Oct 2022 20:31:44 +0000 (23:31 +0300)] 
Build: Update m4/ax_pthread.m4 from Autoconf Archive.

2 years agoxz: Fix --single-stream with an empty .xz Stream.
Lasse Collin [Tue, 25 Oct 2022 20:09:11 +0000 (23:09 +0300)] 
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.

2 years agoxz: Fix decompressor behavior if input uses an unsupported check type.
Lasse Collin [Tue, 25 Oct 2022 16:07:17 +0000 (19:07 +0300)] 
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 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.

2 years agoxz: Clarify the man page: input file isn't removed if an error occurs.
Lasse Collin [Tue, 25 Oct 2022 15:36:19 +0000 (18:36 +0300)] 
xz: Clarify the man page: input file isn't removed if an error occurs.

2 years agoxz: If input file cannot be removed, treat it as a warning, not error.
Lasse Collin [Tue, 25 Oct 2022 15:23:54 +0000 (18:23 +0300)] 
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.

2 years agotuklib_cpucores: Use HW_NCPUONLINE on OpenBSD.
Lasse Collin [Thu, 20 Oct 2022 17:22:50 +0000 (20:22 +0300)] 
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.

2 years agoNEWS: Omit the extra copy of 5.2.5 NEWS.
Lasse Collin [Fri, 11 Nov 2022 11:25:02 +0000 (13:25 +0200)] 
NEWS: Omit the extra copy of 5.2.5 NEWS.

It was a copy-paste error.

2 years agoTranslations: Rename poa4/fr_FR.po to po4a/fr.po.
Lasse Collin [Thu, 10 Nov 2022 10:34:43 +0000 (12:34 +0200)] 
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.

2 years agoTranslations: Update Turkish translation.
Lasse Collin [Tue, 8 Nov 2022 14:57:17 +0000 (16:57 +0200)] 
Translations: Update Turkish translation.

2 years agoTranslations: Update Croatian translation.
Lasse Collin [Tue, 8 Nov 2022 12:55:32 +0000 (14:55 +0200)] 
Translations: Update Croatian translation.

2 years agoBump version and soname for 5.2.7. v5.2.7
Lasse Collin [Fri, 30 Sep 2022 13:41:03 +0000 (16:41 +0300)] 
Bump version and soname for 5.2.7.

2 years agoAdd NEWS for 5.2.7.
Lasse Collin [Fri, 30 Sep 2022 13:40:39 +0000 (16:40 +0300)] 
Add NEWS for 5.2.7.

2 years agoliblzma: Add API doc note about the .xz decoder LZMA_MEMLIMIT_ERROR bug.
Lasse Collin [Fri, 30 Sep 2022 09:06:13 +0000 (12:06 +0300)] 
liblzma: Add API doc note about the .xz decoder LZMA_MEMLIMIT_ERROR bug.

The bug was fixed in 660739f99ab211edec4071de98889fb32ed04e98.

2 years agoliblzma: Add dest and src NULL checks to lzma_index_cat.
Jia Tan [Wed, 21 Sep 2022 08:15:50 +0000 (16:15 +0800)] 
liblzma: Add dest and src NULL checks to lzma_index_cat.

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.

2 years agoTests: Create a test for the lzma_index_cat bug.
Jia Tan [Wed, 21 Sep 2022 12:29:28 +0000 (20:29 +0800)] 
Tests: Create a test for the lzma_index_cat bug.

2 years agoliblzma: Fix copying of check type statistics in lzma_index_cat().
Jia Tan [Wed, 21 Sep 2022 11:28:53 +0000 (19:28 +0800)] 
liblzma: Fix copying of check type statistics in lzma_index_cat().

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.

2 years agotuklib_physmem: Fix Unicode builds on Windows.
Lasse Collin [Wed, 28 Sep 2022 09:20:41 +0000 (12:20 +0300)] 
tuklib_physmem: Fix Unicode builds on Windows.

Thanks to ArSaCiA Game.

2 years agoliblzma: Stream decoder: Fix restarting after LZMA_MEMLIMIT_ERROR.
Lasse Collin [Wed, 28 Sep 2022 08:05:15 +0000 (11:05 +0300)] 
liblzma: Stream decoder: Fix restarting after LZMA_MEMLIMIT_ERROR.

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.

2 years agoliblzma: Stream decoder: Fix comments.
Lasse Collin [Wed, 28 Sep 2022 08:00:23 +0000 (11:00 +0300)] 
liblzma: Stream decoder: Fix comments.

2 years agoUpdate THANKS.
Lasse Collin [Fri, 16 Sep 2022 11:09:07 +0000 (14:09 +0300)] 
Update THANKS.

2 years agoxzgrep: Fix compatibility with old shells.
Lasse Collin [Fri, 16 Sep 2022 11:07:03 +0000 (14:07 +0300)] 
xzgrep: Fix compatibility with old shells.

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.

2 years agoliblzma: lzma_filters_copy: Keep dest[] unmodified if an error occurs.
Lasse Collin [Fri, 9 Sep 2022 10:51:57 +0000 (13:51 +0300)] 
liblzma: lzma_filters_copy: Keep dest[] unmodified if an error occurs.

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.

2 years agoTests: Add a test file for lzma_index_append() integer overflow bug.
Lasse Collin [Fri, 16 Sep 2022 14:08:53 +0000 (17:08 +0300)] 
Tests: Add a test file for lzma_index_append() integer overflow bug.

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.

2 years agoliblzma: lzma_index_append: Add missing integer overflow check.
Jia Tan [Fri, 2 Sep 2022 12:18:55 +0000 (20:18 +0800)] 
liblzma: lzma_index_append: Add missing integer overflow check.

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.