]> git.ipfire.org Git - thirdparty/xz.git/log
thirdparty/xz.git
19 months agoliblzma: Make parameter names in function definition match declaration.
Jia Tan [Sat, 16 Dec 2023 12:28:21 +0000 (20:28 +0800)] 
liblzma: Make parameter names in function definition match declaration.

lzma_raw_encoder() and lzma_raw_encoder_init() used "options" as the
parameter name instead of "filters" (used by the declaration). "filters"
is more clear since the parameter represents the list of filters passed
to the raw encoder, each of which contains filter options.

19 months agoliblzma: Improve lzma encoder init function consistency.
Jia Tan [Sat, 16 Dec 2023 12:18:47 +0000 (20:18 +0800)] 
liblzma: Improve lzma encoder init function consistency.

lzma_encoder_init() did not check for NULL options, but
lzma2_encoder_init() did. This is more of a code style improvement than
anything else to help make lzma_encoder_init() and lzma2_encoder_init()
more similar.

19 months agoDocs: Update repository URL in Changelog.
Jia Tan [Sat, 16 Dec 2023 03:20:20 +0000 (11:20 +0800)] 
Docs: Update repository URL in Changelog.

19 months agoTests: Silence -Wsign-conversion warning on GCC version < 10.
Jia Tan [Thu, 7 Dec 2023 13:48:07 +0000 (21:48 +0800)] 
Tests: Silence -Wsign-conversion warning on GCC version < 10.

Since GCC version 10, GCC no longer complains about simple implicit
integer conversions with Arithmetic operators.

For instance:

    uint8_t a = 5;
    uint32_t b = a + 5;

Give a warning on GCC 9 and earlier but this:

    uint8_t a = 5;
    uint32_t b = (a + 5) * 2;

Gives a warning with GCC 10+.

19 months agoUpdate THANKS.
Jia Tan [Thu, 30 Nov 2023 15:10:43 +0000 (23:10 +0800)] 
Update THANKS.

19 months agoTests: Fix typos
Kian-Meng Ang [Thu, 30 Nov 2023 15:01:19 +0000 (23:01 +0800)] 
Tests: Fix typos

19 months agoxz: Use is_tty() in message.c.
Jia Tan [Thu, 23 Nov 2023 14:13:39 +0000 (22:13 +0800)] 
xz: Use is_tty() in message.c.

19 months agoxz: Create separate is_tty() function.
Jia Tan [Thu, 23 Nov 2023 14:04:35 +0000 (22:04 +0800)] 
xz: Create separate is_tty() function.

The new is_tty() will report if a file descriptor is a terminal or not.
On POSIX systems, it is a wrapper around isatty(). However, the native
Windows implementation of isatty() will return true for all character
devices, not just terminals. So is_tty() has a special case for Windows
so it can use alternative Windows API functions to determine if a file
descriptor is a terminal.

This fixes a bug with MSVC and MinGW-w64 builds that refused to read from
or write to non-terminal character devices because xz thought it was a
terminal. For instance:

    xz foo -c > /dev/null

would fail because /dev/null was assumed to be a terminal.

19 months agotuklib_integer: Fix typo discovered by codespell.
Jia Tan [Wed, 22 Nov 2023 12:39:41 +0000 (20:39 +0800)] 
tuklib_integer: Fix typo discovered by codespell.

Based on internet dictionary searches, 'choise' is an outdated spelling
of 'choice'.

19 months agoTests: Fix typo in a comment.
Jia Tan [Fri, 17 Nov 2023 12:04:58 +0000 (20:04 +0800)] 
Tests: Fix typo in a comment.

19 months agoTests: Create test_suffix.sh.
Jia Tan [Fri, 17 Nov 2023 12:35:11 +0000 (20:35 +0800)] 
Tests: Create test_suffix.sh.

This tests some complicated interactions with the --suffix= option.
The suffix option must be used with --format=raw, but can optionally
be used to override the default .xz suffix.

This test also verifies some recent bugs have been correctly solved
and to hopefully avoid further regressions in the future.

19 months agoxz: Fix suffix check.
Jia Tan [Tue, 14 Nov 2023 12:27:04 +0000 (20:27 +0800)] 
xz: Fix suffix check.

The suffix refactor done in 99575947a58a60416c570eb78038d18a1ea4cef4
had a small regression where raw format compression to standard out
failed if a suffix was not set. In this case, setting the suffix did
not make sense since a file is not created.

Now, xz should only fail when a suffix is not provided when it is
actually needed.

For instance:

    echo "foo" | xz --format=raw --lzma2 | wc -c

does not need a suffix check since it creates no files. But:

    xz --format=raw --lzma2 --suffix=.bar foo

Needs the suffix to be set since it must create foo.bar.

19 months agoliblzma: Add missing comments to lz_encoder.h.
Jia Tan [Wed, 8 Nov 2023 17:21:53 +0000 (01:21 +0800)] 
liblzma: Add missing comments to lz_encoder.h.

21 months agoBump version and soname for 5.4.5. v5.4.5
Jia Tan [Tue, 31 Oct 2023 14:30:29 +0000 (22:30 +0800)] 
Bump version and soname for 5.4.5.

21 months agoAdd NEWS for 5.4.5.
Jia Tan [Wed, 1 Nov 2023 12:18:30 +0000 (20:18 +0800)] 
Add NEWS for 5.4.5.

21 months agoliblzma: Fix compilation of fastpos_tablegen.c.
Lasse Collin [Tue, 31 Oct 2023 19:41:09 +0000 (21:41 +0200)] 
liblzma: Fix compilation of fastpos_tablegen.c.

The macro lzma_attr_visibility_hidden has to be defined to make
fastpos.h usable. The visibility attribute is irrelevant to
fastpos_tablegen.c so simply #define the macro to an empty value.

fastpos_tablegen.c is never built by the included build systems
and so the problem wasn't noticed earlier. It's just a standalone
program for generating fastpos_table.c.

Fixes: https://github.com/tukaani-project/xz/pull/69
Thanks to GitHub user Jamaika1.

21 months agoBuild: Fix text wrapping in an output message.
Jia Tan [Tue, 31 Oct 2023 13:51:40 +0000 (21:51 +0800)] 
Build: Fix text wrapping in an output message.

21 months agoliblzma: Use lzma_always_inline in memcmplen.h.
Lasse Collin [Sun, 22 Oct 2023 14:59:11 +0000 (17:59 +0300)] 
liblzma: Use lzma_always_inline in memcmplen.h.

21 months agoliblzma: #define lzma_always_inline in common.h.
Lasse Collin [Mon, 30 Oct 2023 15:43:03 +0000 (17:43 +0200)] 
liblzma: #define lzma_always_inline in common.h.

21 months agoliblzma: Use lzma_attr_visibility_hidden on private extern declarations.
Lasse Collin [Sun, 22 Oct 2023 14:15:32 +0000 (17:15 +0300)] 
liblzma: Use lzma_attr_visibility_hidden on private extern declarations.

These variables are internal to liblzma and not exposed in the API.

21 months agoliblzma: #define lzma_attr_visibility_hidden in common.h.
Lasse Collin [Sun, 22 Oct 2023 14:08:39 +0000 (17:08 +0300)] 
liblzma: #define lzma_attr_visibility_hidden in common.h.

In ELF shared libs:

-fvisibility=hidden affects definitions of symbols but not
declarations.[*] This doesn't affect direct calls to functions
inside liblzma as a linker can replace a call to lzma_foo@plt
with a call directly to lzma_foo when -fvisibility=hidden is used.

[*] It has to be like this because otherwise every installed
    header file would need to explictly set the symbol visibility
    to default.

When accessing extern variables that aren't defined in the
same translation unit, compiler assumes that the variable has
the default visibility and thus indirection is needed. Unlike
function calls, linker cannot optimize this.

Using __attribute__((__visibility__("hidden"))) with the extern
variable declarations tells the compiler that indirection isn't
needed because the definition is in the same shared library.

About 15+ years ago, someone told me that it would be good if
the CRC tables would be defined in the same translation unit
as the C code of the CRC functions. While I understood that it
could help a tiny amount, I didn't want to change the code because
a separate translation unit for the CRC tables was needed for the
x86 assembly code anyway. But when visibility attributes are
supported, simply marking the extern declaration with the
hidden attribute will get identical result. When there are only
a few affected variables, this is trivial to do. I wish I had
understood this back then already.

21 months agoliblzma: Refer to MinGW-w64 instead of MinGW in the API headers.
Lasse Collin [Sat, 30 Sep 2023 19:54:28 +0000 (22:54 +0300)] 
liblzma: Refer to MinGW-w64 instead of MinGW in the API headers.

MinGW (formely a MinGW.org Project, later the MinGW.OSDN Project
at <https://osdn.net/projects/mingw/>) has GCC 9.2.0 as the
most recent GCC package (released 2021-02-02). The project might
still be alive but majority of people have switched to MinGW-w64.
Thus it seems clearer to refer to MinGW-w64 in our API headers too.
Building with MinGW is likely to still work but I haven't tested it
in the recent years.

21 months agoCMake: Use -D_FILE_OFFSET_BITS=64 if (and only if) needed.
Lasse Collin [Tue, 26 Sep 2023 21:58:17 +0000 (00:58 +0300)] 
CMake: Use -D_FILE_OFFSET_BITS=64 if (and only if) needed.

A CMake option LARGE_FILE_SUPPORT is created if and only if
-D_FILE_OFFSET_BITS=64 affects sizeof(off_t).

This is needed on many 32-bit platforms and even with 64-bit builds
with MinGW-w64 to get support for files larger than 2 GiB.

21 months agoCMake: Generate and install liblzma.pc if not using MSVC.
Lasse Collin [Fri, 29 Sep 2023 23:14:25 +0000 (02:14 +0300)] 
CMake: Generate and install liblzma.pc if not using MSVC.

Autotools based build uses -pthread and thus adds it to Libs.private
in liblzma.pc. CMake doesn't use -pthread at all if pthread functions
are available in libc so Libs.private doesn't get -pthread either.

21 months agoCMake: Rearrange the PACKAGE_ variables.
Lasse Collin [Fri, 29 Sep 2023 22:13:13 +0000 (01:13 +0300)] 
CMake: Rearrange the PACKAGE_ variables.

The windres workaround now replaces spaces with \x20 so
the package name isn't repeated.

These changes will help with creation of liblzma.pc.

21 months agoliblzma: Add Cflags.private to liblzma.pc.in for MSYS2.
Lasse Collin [Fri, 29 Sep 2023 17:46:11 +0000 (20:46 +0300)] 
liblzma: Add Cflags.private to liblzma.pc.in for MSYS2.

It properly adds -DLZMA_API_STATIC when compiling code that
will be linked against static liblzma. Having it there on
systems other than Windows does no harm.

See: https://www.msys2.org/docs/pkgconfig/

21 months agoCMake: Create liblzma.def when building liblzma.dll with MinGW-w64.
Lasse Collin [Wed, 27 Sep 2023 19:46:20 +0000 (22:46 +0300)] 
CMake: Create liblzma.def when building liblzma.dll with MinGW-w64.

21 months agoCMake: Change one CMAKE_CURRENT_SOURCE_DIR to CMAKE_CURRENT_LIST_DIR.
Lasse Collin [Thu, 26 Oct 2023 18:44:42 +0000 (21:44 +0300)] 
CMake: Change one CMAKE_CURRENT_SOURCE_DIR to CMAKE_CURRENT_LIST_DIR.

In this case they have identical values.

21 months agoCMake/Windows: Fix the import library filename.
Lasse Collin [Sun, 1 Oct 2023 16:10:57 +0000 (19:10 +0300)] 
CMake/Windows: Fix the import library filename.

Both PREFIX and IMPORT_PERFIX have to be set to "" to get
liblzma.dll and liblzma.dll.a.

21 months agoCMake: Don't shadow the cache entry ENABLE_THREADS with a normal variable.
Lasse Collin [Wed, 11 Oct 2023 16:47:44 +0000 (19:47 +0300)] 
CMake: Don't shadow the cache entry ENABLE_THREADS with a normal variable.

Using set(ENABLE_THREADS "posix") is confusing because it sets
a new normal variable and leaves the cache entry with the same
name unchanged. The intent wasn't to change the cache entry so
this switches to a different variable name.

21 months agoCMake: Edit threading related messages.
Lasse Collin [Mon, 9 Oct 2023 18:12:31 +0000 (21:12 +0300)] 
CMake: Edit threading related messages.

It's mostly to change from "thread method" to "threading method".

21 months agoCMake: Use FATAL_ERROR if user-supplied options aren't understood.
Lasse Collin [Mon, 9 Oct 2023 17:59:24 +0000 (20:59 +0300)] 
CMake: Use FATAL_ERROR if user-supplied options aren't understood.

This way typos are caught quickly and compounding error messages
are avoided (a single typo could cause more than one error).

This keeps using SEND_ERROR when the system is lacking a feature
(like threading library or sandboxing method). This way the whole
configuration log will be generated in case someone wishes to
report a problem upstream.

21 months agoCMake: Add ALLOW_CLMUL_CRC option to enable/disable CLMUL.
Jia Tan [Thu, 19 Oct 2023 08:09:01 +0000 (16:09 +0800)] 
CMake: Add ALLOW_CLMUL_CRC option to enable/disable CLMUL.

The option is enabled by default, but will only be visible to a user
listing cache variables or using a CMake GUI application if the
immintrin.h header file is found.

This mirrors our Autotools build --disable-clmul-crc functionality.

21 months agotuklib_integer: Revise unaligned reads and writes on strict-align archs.
Lasse Collin [Sat, 14 Oct 2023 14:56:59 +0000 (17:56 +0300)] 
tuklib_integer: Revise unaligned reads and writes on strict-align archs.

In XZ Utils context this doesn't matter much because
unaligned reads and writes aren't used in hot code
when TUKLIB_FAST_UNALIGNED_ACCESS isn't #defined.

21 months agotuklib_integer: Add missing write64be and write64le fallback functions.
Lasse Collin [Fri, 22 Sep 2023 23:21:49 +0000 (02:21 +0300)] 
tuklib_integer: Add missing write64be and write64le fallback functions.

21 months agoBuild: Update visibility.m4 from Gnulib.
Jia Tan [Thu, 12 Oct 2023 12:12:18 +0000 (20:12 +0800)] 
Build: Update visibility.m4 from Gnulib.

Updating from version 6 -> 8 from upstream. Declarations for variables
and function bodies were added to avoid unnecessary failures with
-Werror.

21 months agoUpdate THANKS.
Lasse Collin [Fri, 6 Oct 2023 16:36:35 +0000 (19:36 +0300)] 
Update THANKS.

21 months agoCMake: Rename xz and man page symlink custom targets.
Jia Tan [Fri, 29 Sep 2023 12:14:39 +0000 (20:14 +0800)] 
CMake: Rename xz and man page symlink custom targets.

The Ninja Generator for CMake cannot have a custom target and its
BYPRODUCTS have the same name. This has prevented Ninja builds on
Unix-like systems since the xz symlinks were introduced in
80a1a8bb838842a2be343bd88ad1462c21c5e2c9.

21 months agoCMake: Fix Windows build with Clang/LLVM 17.
Lasse Collin [Wed, 27 Sep 2023 16:54:35 +0000 (19:54 +0300)] 
CMake: Fix Windows build with Clang/LLVM 17.

llvm-windres 17.0.0 has more accurate emulation of GNU windres, so
the hack for GNU windres must now be used with llvm-windres too.

LLVM 16.0.6 has the old behavior and there likely won't be more
16.x releases. So we can simply check for >= 17.0.0.

The workaround must not be used with Clang that is acting in
MSVC mode. This checks for the known environments that need
the workaround instead of using "NOT MSVC".

See also:
https://github.com/llvm/llvm-project/commit/2bcc0fdc58a220cb9921b47ec8a32c85f2511a47

21 months agoliblzma: Avoid compiler warning without creating extra symbol.
Jia Tan [Tue, 26 Sep 2023 16:02:11 +0000 (00:02 +0800)] 
liblzma: Avoid compiler warning without creating extra symbol.

When the generic fast crc64 method is used, then we omit
lzma_crc64_table[][].

The C standards don't allow an empty translation unit which can be
avoided by declaring something, without exporting any symbols.

21 months agoBuild: Update the comment about -Werror usage in checks.
Lasse Collin [Tue, 26 Sep 2023 14:24:15 +0000 (17:24 +0300)] 
Build: Update the comment about -Werror usage in checks.

21 months agoBuild: Fix underquoted AC_LANG_SOURCE.
Lasse Collin [Tue, 26 Sep 2023 10:51:31 +0000 (13:51 +0300)] 
Build: Fix underquoted AC_LANG_SOURCE.

It made no practical difference in this case.

21 months agoBuild: Silence Autoconf warning.
Lasse Collin [Tue, 26 Sep 2023 10:14:37 +0000 (13:14 +0300)] 
Build: Silence Autoconf warning.

There was a use of AC_COMPILE_IFELSE that didn't use
AC_LANG_SOURCE and Autoconf warned about this. The omission
had been intentional but it turned out that this didn't do
what I thought it would.

Autoconf 2.71 manual gives an impression that AC_LANG_SOURCE
inserts all #defines that have been made with AC_DEFINE so
far (confdefs.h). The idea was that omitting AC_LANG_SOURCE
would mean that only the exact code included in the
AC_COMPILE_IFELSE call would be compiled.

With C programs this is not true: the #defines get added without
AC_LANG_SOURCE too. There seems to be no neat way to avoid this.
Thus, with the C language at least, adding AC_LANG_SOURCE makes
no other difference than silencing a warning from Autoconf. The
generated "configure" remains identical. (Docs of AC_LANG_CONFTEST
say that the #defines have been inserted since Autoconf 2.63b and
that AC_COMPILE_IFELSE uses AC_LANG_CONFTEST. So the behavior is
documented if one also reads the docs of macros that one isn't
calling directly.)

Any extra code, including #defines, can cause problems for
these two tests because these tests must use -Werror.
CC=clang CFLAGS=-Weverything is the most extreme example.
It enables -Wreserved-macro-identifier which warns about
It's possible to write a test file that passes -Weverything but
it becomes impossible when Autoconf inserts confdefs.h.

So this commit adds AC_LANG_SOURCE to silence Autoconf warnings.
A different solution is needed for -Werror tests.

21 months agoBuild: Remove Gnulib dependency from tests.
Jia Tan [Mon, 25 Sep 2023 16:47:26 +0000 (00:47 +0800)] 
Build: Remove Gnulib dependency from tests.

The tests do not use any Gnulib replacements so they do not need to link
libgnu.a or have /lib in the include path.

21 months agoCMake: Remove /lib from tests include path.
Jia Tan [Mon, 25 Sep 2023 16:43:43 +0000 (00:43 +0800)] 
CMake: Remove /lib from tests include path.

The tests never included anything from /lib, so this was not needed.

21 months agosysdefs.h: Update the comment about __USE_MINGW_ANSI_STDIO.
Lasse Collin [Sun, 24 Sep 2023 13:32:32 +0000 (16:32 +0300)] 
sysdefs.h: Update the comment about __USE_MINGW_ANSI_STDIO.

21 months agoxz: Windows: Don't (de)compress to special files like "con" or "nul".
Lasse Collin [Thu, 21 Sep 2023 23:33:29 +0000 (02:33 +0300)] 
xz: Windows: Don't (de)compress to special files like "con" or "nul".

Before this commit, the following writes "foo" to the
console and deletes the input file:

    echo foo | xz > con_xz
    xz --suffix=_xz --decompress con_xz

It cannot happen without --suffix because names like con.xz
are also special and so attempting to decompress con.xz
(or compress con to con.xz) will already fail when opening
the input file.

Similar thing is possible when compressing. The following
writes to "nul" and the input file "n" is deleted.

    echo foo | xz > n
    xz --suffix=ul n

Now xz checks if the destination is a special file before
continuing. DOS/DJGPP version had a check for this but
Windows (and OS/2) didn't.

21 months agoCMake: Wrap two overlong lines that are possible to wrap.
Lasse Collin [Thu, 21 Sep 2023 17:42:52 +0000 (20:42 +0300)] 
CMake: Wrap two overlong lines that are possible to wrap.

21 months agoCMake: Add a comment about threads on Cygwin.
Lasse Collin [Thu, 21 Sep 2023 17:36:31 +0000 (20:36 +0300)] 
CMake: Add a comment about threads on Cygwin.

21 months agoCMake: Bump maximum policy version to 3.27.
Lasse Collin [Tue, 12 Sep 2023 18:12:34 +0000 (21:12 +0300)] 
CMake: Bump maximum policy version to 3.27.

There are several new policies. CMP0149 may affect the Windows SDK
version that CMake will choose by default. The new behavior is more
predictable, always choosing the latest SDK version by default.

The other new policies shouldn't affect this package.

21 months agoDoxygen: Add more C macro names to PREDEFINED.
Lasse Collin [Fri, 8 Sep 2023 16:08:57 +0000 (19:08 +0300)] 
Doxygen: Add more C macro names to PREDEFINED.

21 months agoliblzma: Move a few __attribute__ uses in function declarations.
Lasse Collin [Mon, 11 Sep 2023 15:47:26 +0000 (18:47 +0300)] 
liblzma: Move a few __attribute__ uses in function declarations.

The API headers have many attributes but these were left
as is for now.

21 months agoxz, xzdec, lzmainfo: Use tuklib_attr_noreturn.
Lasse Collin [Mon, 11 Sep 2023 16:03:35 +0000 (19:03 +0300)] 
xz, xzdec, lzmainfo: Use tuklib_attr_noreturn.

For compatibility with C23's [[noreturn]], tuklib_attr_noreturn
must be at the beginning of declaration (before "extern" or
"static", and even before any GNU C's __attribute__).

This commit also moves all other function attributes to
the beginning of function declarations. "extern" is kept
at the beginning of a line so the attributes are listed on
separate lines before "extern" or "static".

21 months agoRemove incorrect uses of __attribute__((__malloc__)).
Lasse Collin [Mon, 11 Sep 2023 15:53:31 +0000 (18:53 +0300)] 
Remove incorrect uses of __attribute__((__malloc__)).

xrealloc() is obviously incorrect, modern GCC docs even
mention realloc() as an example where this attribute
cannot be used.

liblzma's lzma_alloc() and lzma_alloc_zero() would be
correct uses most of the time but custom allocators
may use a memory pool or otherwise hold the pointer
so aliasing issues could happen in theory.

The xstrdup() case likely was correct but I removed it anyway.
Now there are no __malloc__ attributes left in the code.
The allocations aren't in hot paths so this should make
no practical difference.

21 months agoUpdate THANKS.
Lasse Collin [Tue, 19 Sep 2023 11:03:45 +0000 (14:03 +0300)] 
Update THANKS.

21 months agoUpdate THANKS.
Lasse Collin [Thu, 14 Sep 2023 13:35:46 +0000 (16:35 +0300)] 
Update THANKS.

21 months agoliblzma: Mark crc64_clmul() with __attribute__((__no_sanitize_address__)).
Lasse Collin [Thu, 14 Sep 2023 13:34:07 +0000 (16:34 +0300)] 
liblzma: Mark crc64_clmul() with __attribute__((__no_sanitize_address__)).

Thanks to Agostino Sarubbo.
Fixes: https://github.com/tukaani-project/xz/issues/62
21 months agoCMake: Fix time.h checks not running on second CMake run.
Jia Tan [Tue, 12 Sep 2023 14:36:12 +0000 (22:36 +0800)] 
CMake: Fix time.h checks not running on second CMake run.

If CMake was configured more than once, HAVE_CLOCK_GETTIME and
HAVE_CLOCK_MONOTONIC would not be set as compile definitions. The check
for librt being needed to provide HAVE_CLOCK_GETTIME was also
simplified.

21 months agoCMake: Fix unconditionally defining HAVE_CLOCK_MONOTONIC.
Jia Tan [Tue, 12 Sep 2023 14:34:06 +0000 (22:34 +0800)] 
CMake: Fix unconditionally defining HAVE_CLOCK_MONOTONIC.

If HAVE_CLOCK_GETTIME was defined, then HAVE_CLOCK_MONOTONIC was always
added as a compile definition even if the check for it failed.

21 months agoxz: Refactor thousand separator detection and disable it on MSVC.
Lasse Collin [Thu, 31 Aug 2023 16:50:05 +0000 (19:50 +0300)] 
xz: Refactor thousand separator detection and disable it on MSVC.

Now the two variations of the format strings are created with
a macro, and the whole detection code can be easily disabled
on platforms where thousand separator formatting is known to
not work (MSVC has no support, and on DJGPP 2.05 it can have
problems in some cases).

21 months agoxz: Fix a too relaxed assertion and remove uses of SSIZE_MAX.
Lasse Collin [Thu, 31 Aug 2023 15:14:43 +0000 (18:14 +0300)] 
xz: Fix a too relaxed assertion and remove uses of SSIZE_MAX.

SSIZE_MAX isn't readily available on MSVC. Removing it means
that there is one thing less to worry when porting to MSVC.

21 months agoTests: Improve invalid unpadded size check in test_lzma_index_append().
Jia Tan [Mon, 28 Aug 2023 15:14:45 +0000 (23:14 +0800)] 
Tests: Improve invalid unpadded size check in test_lzma_index_append().

This check was extended to test the code added to fix a failing assert
in 68bda971bb8b666a009331455fcedb4e18d837a4.

21 months agoTests: Improve comments in test_index.c.
Jia Tan [Mon, 28 Aug 2023 13:54:41 +0000 (21:54 +0800)] 
Tests: Improve comments in test_index.c.

21 months agoUpdate THANKS.
Jia Tan [Mon, 28 Aug 2023 13:52:54 +0000 (21:52 +0800)] 
Update THANKS.

21 months agoliblzma: Update assert in vli_ceil4().
Jia Tan [Mon, 28 Aug 2023 13:50:16 +0000 (21:50 +0800)] 
liblzma: Update assert in vli_ceil4().

The argument to vli_ceil4() should always guarantee the return value
is also a valid lzma_vli. Thus the highest three valid lzma_vli values
are invalid arguments. All uses of the function ensure this so the
assert is updated to match this.

21 months agoliblzma: Add overflow check for Unpadded size in lzma_index_append().
Jia Tan [Mon, 28 Aug 2023 13:31:25 +0000 (21:31 +0800)] 
liblzma: Add overflow check for Unpadded size in lzma_index_append().

This was not a security bug since there was no path to overflow
UINT64_MAX in lzma_index_append() or when it calls index_file_size().
The bug was discovered by a failing assert() in vli_ceil4() when called
from index_file_size() when unpadded_sum (the sum of the compressed size
of current Stream and the unpadded_size parameter) exceeds LZMA_VLI_MAX.

Previously, the unpadded_size parameter was checked to be not greater
than UNPADDED_SIZE_MAX, but no check was done once compressed_base was
added.

This could not have caused an integer overflow in index_file_size() when
called by lzma_index_append(). The calculation for file_size breaks down
into the sum of:

- Compressed base from all previous Streams
- 2 * LZMA_STREAM_HEADER_SIZE (size of the current Streams header and
  footer)
- stream_padding (can be set by lzma_index_stream_padding())
- Compressed base from the current Stream
- Unpadded size (parameter to lzma_index_append())

The sum of everything except for Unpadded size must be less than
LZMA_VLI_MAX. This is guarenteed by overflow checks in the functions
that can set these values including lzma_index_stream_padding(),
lzma_index_append(), and lzma_index_cat(). The maximum value for
Unpadded size is enforced by lzma_index_append() to be less than or
equal UNPADDED_SIZE_MAX. Thus, the sum cannot exceed UINT64_MAX since
LZMA_VLI_MAX is half of UINT64_MAX.

Thanks to Joona Kannisto for reporting this.

21 months agoTranslations: Update the Esperanto translation.
Jia Tan [Mon, 28 Aug 2023 14:18:29 +0000 (22:18 +0800)] 
Translations: Update the Esperanto translation.

21 months agoDocs: Update INSTALL for --enable-threads method win95.
Jia Tan [Wed, 9 Aug 2023 12:55:36 +0000 (20:55 +0800)] 
Docs: Update INSTALL for --enable-threads method win95.

The Autotools build allows win95 threads and --enable-small together now
if the compiler supports __attribute__((__constructor__)).

21 months agoCMake: Conditionally allow win95 threads and --enable-small.
Jia Tan [Wed, 9 Aug 2023 12:54:15 +0000 (20:54 +0800)] 
CMake: Conditionally allow win95 threads and --enable-small.

21 months agoBuild: Conditionally allow win95 threads and --enable-small.
Jia Tan [Wed, 9 Aug 2023 12:35:16 +0000 (20:35 +0800)] 
Build: Conditionally allow win95 threads and --enable-small.

When the compiler supports __attribute__((__constructor__))
mythread_once() is never used, even with --enable-small. A configuration
with win95 threads and --enable-small will compile and be thread safe so
it can be allowed.

This isn't a very common configuration since MSVC does not support
__attribute__((__constructor__)), but MINGW32 and CLANG32 environments
for MSYS2 can use win95 threads and have
__attribute__((__constructor__)) support.

21 months agomythread.h: Fix typo error in Vista threads mythread_once().
Jamaika1 [Tue, 8 Aug 2023 12:07:59 +0000 (14:07 +0200)] 
mythread.h: Fix typo error in Vista threads mythread_once().

The "once_" variable was accidentally referred to as just "once". This
prevented building with Vista threads when
HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR was not defined.

21 months agoTests: Style fixes to test_lzip_decoder.c.
Jia Tan [Thu, 3 Aug 2023 12:10:21 +0000 (20:10 +0800)] 
Tests: Style fixes to test_lzip_decoder.c.

21 months agoTranslations: Update the Chinese (simplified) translation.
Jia Tan [Thu, 3 Aug 2023 07:56:20 +0000 (15:56 +0800)] 
Translations: Update the Chinese (simplified) translation.

2 years agoxz: Omit an empty paragraph on the man page.
Lasse Collin [Wed, 2 Aug 2023 14:15:12 +0000 (17:15 +0300)] 
xz: Omit an empty paragraph on the man page.

2 years agoBump version and soname for 5.4.4. v5.4.4
Jia Tan [Wed, 2 Aug 2023 12:32:20 +0000 (20:32 +0800)] 
Bump version and soname for 5.4.4.

2 years agoAdd NEWS for 5.4.4.
Jia Tan [Wed, 2 Aug 2023 12:30:07 +0000 (20:30 +0800)] 
Add NEWS for 5.4.4.

2 years agobuild-aux/manconv.sh: Fix US-ASCII and UTF-8 output.
Lasse Collin [Wed, 2 Aug 2023 12:19:43 +0000 (15:19 +0300)] 
build-aux/manconv.sh: Fix US-ASCII and UTF-8 output.

groff defaults to SGR escapes. Using -P-c passes -c to grotty
which restores the old behavior. Perhaps there is a better way to
get pure plain text output but this works for now.

2 years agoUpdate THANKS.
Lasse Collin [Tue, 1 Aug 2023 16:10:43 +0000 (19:10 +0300)] 
Update THANKS.

2 years agoUpdate THANKS.
Lasse Collin [Tue, 1 Aug 2023 15:22:24 +0000 (18:22 +0300)] 
Update THANKS.

2 years agomythread.h: Disable signal functions in builds targeting Wasm + WASI.
ChanTsune [Tue, 1 Aug 2023 15:17:17 +0000 (18:17 +0300)] 
mythread.h: Disable signal functions in builds targeting Wasm + WASI.

signal.h in WASI SDK doesn't currently provide sigprocmask()
or sigset_t. liblzma doesn't need them so this change makes
liblzma and xzdec build against WASI SDK. xz doesn't build yet
and the tests don't either as tuktest needs setjmp() which
isn't (yet?) implemented in WASI SDK.

Closes: https://github.com/tukaani-project/xz/pull/57
See also: https://github.com/tukaani-project/xz/pull/56

(The original commit was edited a little by Lasse Collin.)

2 years agoDocs: Fix typos found by codespell
Dimitri Papadopoulos Orfanos [Mon, 31 Jul 2023 12:02:21 +0000 (14:02 +0200)] 
Docs: Fix typos found by codespell

2 years agoUpdate .gitignore.
Jia Tan [Wed, 26 Jul 2023 12:26:23 +0000 (20:26 +0800)] 
Update .gitignore.

2 years agoCMake: Conditionally allow the creation of broken symlinks.
Jia Tan [Fri, 28 Jul 2023 14:03:08 +0000 (22:03 +0800)] 
CMake: Conditionally allow the creation of broken symlinks.

The CMake build will try to create broken symlinks on Unix and Unix-like
platforms. Cygwin and MSYS2 are Unix-like, but may not be able to create
broken symlinks. The value of the CYGWIN or MSYS environment variables
determine if broken symlinks are valid.

The default for MSYS2 does not allow for broken symlinks, so the CMake
build has been broken for MSYS2 since commit
80a1a8bb838842a2be343bd88ad1462c21c5e2c9.

2 years agoliblzma: Prevent an empty translation unit in Windows builds.
Jia Tan [Mon, 24 Jul 2023 13:43:44 +0000 (21:43 +0800)] 
liblzma: Prevent an empty translation unit in Windows builds.

To workaround Automake lacking Windows resource compiler support, an
empty source file is compiled to overwrite the resource files for static
library builds. Translation units without an external declaration are
not allowed by the C standard and result in a warning when used with
-Wempty-translation-unit (Clang) or -pedantic (GCC).

2 years agoTests: Skip .lz files in test_files.sh if not configured.
Jia Tan [Fri, 21 Jul 2023 10:05:44 +0000 (18:05 +0800)] 
Tests: Skip .lz files in test_files.sh if not configured.

Previously if the lzip decoder was not configured then test_files.sh
would pass the lzip tests instead of skipping them.

2 years agoTests: Add ARM64 filter test to test_compress.sh.
Jia Tan [Thu, 20 Jul 2023 14:11:13 +0000 (22:11 +0800)] 
Tests: Add ARM64 filter test to test_compress.sh.

2 years agoTranslations: Update the Vietnamese translation.
Jia Tan [Sat, 22 Jul 2023 10:37:56 +0000 (18:37 +0800)] 
Translations: Update the Vietnamese translation.

2 years agoTranslations: Update the Croatian translation.
Jia Tan [Thu, 20 Jul 2023 12:30:05 +0000 (20:30 +0800)] 
Translations: Update the Croatian translation.

2 years agoTranslations: Update the Korean man page translations.
Jia Tan [Thu, 20 Jul 2023 12:28:32 +0000 (20:28 +0800)] 
Translations: Update the Korean man page translations.

2 years agoTranslations: Update the Korean translation.
Jia Tan [Thu, 20 Jul 2023 12:25:24 +0000 (20:25 +0800)] 
Translations: Update the Korean translation.

2 years agoTranslations: Update the Polish translation.
Jia Tan [Thu, 20 Jul 2023 12:24:05 +0000 (20:24 +0800)] 
Translations: Update the Polish translation.

2 years agoTranslations: Update the German man page translations.
Jia Tan [Thu, 20 Jul 2023 12:22:23 +0000 (20:22 +0800)] 
Translations: Update the German man page translations.

2 years agoTranslations: Update the German translation.
Jia Tan [Thu, 20 Jul 2023 12:18:44 +0000 (20:18 +0800)] 
Translations: Update the German translation.

2 years agoTranslations: Update the Chinese (simplified) translation.
Jia Tan [Thu, 20 Jul 2023 12:17:10 +0000 (20:17 +0800)] 
Translations: Update the Chinese (simplified) translation.

2 years agoTranslations: Update the Swedish translation.
Jia Tan [Thu, 20 Jul 2023 12:15:47 +0000 (20:15 +0800)] 
Translations: Update the Swedish translation.

2 years agoTranslations: Update the Ukrainian man page translations.
Jia Tan [Thu, 20 Jul 2023 12:14:00 +0000 (20:14 +0800)] 
Translations: Update the Ukrainian man page translations.

2 years agoTranslations: Update the Ukrainian translation.
Jia Tan [Thu, 20 Jul 2023 12:09:15 +0000 (20:09 +0800)] 
Translations: Update the Ukrainian translation.

2 years agoTranslations: Update the Spanish translation.
Jia Tan [Thu, 20 Jul 2023 12:06:57 +0000 (20:06 +0800)] 
Translations: Update the Spanish translation.

2 years agoTranslations: Update the Romanian translation.
Jia Tan [Thu, 20 Jul 2023 12:05:19 +0000 (20:05 +0800)] 
Translations: Update the Romanian translation.

2 years agoTranslations: Update the Romanian man page translations.
Jia Tan [Thu, 20 Jul 2023 12:02:56 +0000 (20:02 +0800)] 
Translations: Update the Romanian man page translations.