]> git.ipfire.org Git - thirdparty/xz.git/log
thirdparty/xz.git
9 days agoxz: Fix --files/--files0 usage via XZ_OPT and XZ_DEFAULTS env vars master
rootvector2 [Thu, 28 May 2026 06:59:23 +0000 (12:29 +0530)] 
xz: Fix --files/--files0 usage via XZ_OPT and XZ_DEFAULTS env vars

If --files=FILELIST or --files0=FILELIST was specified via an enrivonment
variable, it worked if there were no errors when reading from the file
FILELIST. However, if an error occurred when reading from FILELIST,
there was a use-after-free bug when printing the error message because
the memory containing the string "FILELIST" had been freed.

    printf foo.xz > filelist.txt
    XZ_OPT=--files=filelist.txt xz -l

Because filelist.txt doesn't end in a newline, the file list is seen as
invalid/truncated, resulting in an error message like this:

    xz: ????????.txt: Unexpected end of input when reading filenames

The question marks are because the garbage string is masked using
tuklib_mask_nonprint(). After this commit, it works:

    xz: filelist.txt: Unexpected end of input when reading filenames

Co-authored-by: Lasse Collin <lasse.collin@tukaani.org>
Fixes: https://github.com/tukaani-project/xz/pull/223
9 days agoxz: Mask the multiplier suffix in str_to_uint64() error message
rootvector2 [Wed, 27 May 2026 18:21:52 +0000 (23:51 +0530)] 
xz: Mask the multiplier suffix in str_to_uint64() error message

A similar error message in the same function was masked in the
previous commit 7e7bb6c21cf9.

Fixes: https://github.com/tukaani-project/xz/pull/222
10 days agoxz: Use tuklib_mbstr_nonprint in a few more places
Lasse Collin [Tue, 26 May 2026 16:30:29 +0000 (19:30 +0300)] 
xz: Use tuklib_mbstr_nonprint in a few more places

Reported-by: GitHub user curious-rabbit
10 days agoxzgrep: Fix handling of the ' char at the end of an option
Lasse Collin [Mon, 25 May 2026 15:32:15 +0000 (18:32 +0300)] 
xzgrep: Fix handling of the ' char at the end of an option

For example, the following would run the "id" command:

    xzgrep "--a='" "--b=;id;'" "pattern" foo.xz

The bug was inherited from gzip's zgrep. It was reported to bug-gzip by
Leenear. It was fixed in gzip in the commit cd74dc30f8cc by Paul Eggert.

Link: https://lists.gnu.org/archive/html/bug-gzip/2026-04/msg00032.html
10 days agoUpdate THANKS
Lasse Collin [Thu, 21 May 2026 16:04:34 +0000 (19:04 +0300)] 
Update THANKS

10 days agoLandlock: Support ABI version 9
Lasse Collin [Thu, 21 May 2026 15:57:36 +0000 (18:57 +0300)] 
Landlock: Support ABI version 9

Features added in versions 7 and 8 shouldn't be relevant here.

10 days agoLandlock: Provide fallbacks for ABI 2, 3, and 5 macros
Lasse Collin [Thu, 21 May 2026 15:38:16 +0000 (18:38 +0300)] 
Landlock: Provide fallbacks for ABI 2, 3, and 5 macros

This way the newer features are available on new enough kernels
even if the package is built against old <linux/landlock.h>.

Landlock ABI versions 4 and 6 would require an extended
struct landlock_ruleset_attr. No fallback is provided (or planned)
for those features.

Suggested-by: Omkhar Arasaratnam
10 days agoxz: Reduce indentation of three tables on the man page
Lasse Collin [Wed, 20 May 2026 18:21:51 +0000 (21:21 +0300)] 
xz: Reduce indentation of three tables on the man page

The extra indentation makes the tables stand out from the text, and
in the English man page it works well. However, some translations
have strings that require more space, and the table might become
too wide. In some translations this has been solved by splitting
the translated string on two lines, for example, Romanian translation
of "4096-byte alignment is best".

On Debian 13 with groff 1.23.0, the "man" command shows a few warnings:

    $ LANGUAGE=it MANWIDTH=80 man --warnings xz > /dev/null
    <standard input>:477: warning: table wider than line length minus indentation
    <standard input>:545: warning: table wider than line length minus indentation
    <standard input>:1182: warning: table wider than line length minus indentation

German man page shows those warnings too. On Arch with groff 1.24.1,
there are fewer warnings because the newer groff indents less, and
fewer tables reach or exceed the right margin. Thus, some safety margin
is good to keep the output neat with different man page formatters.

It feels silly to reduce the indentation on the English man page which
has plenty of safety margin, but it's simpler than trying to do it
only for the translated man pages. This doesn't affect readability;
it's just cosmetic.

I tried using .IP instead of .RS + .PP for the tables, but on Solaris 10
it results in an extra empty line before the table. It makes some
difference on AIX 7.3 too. With groff, both are fine. Stick to
.RS + .PP + .TS ... .TE + .RE for slightly better portability.

Co-authored-by: Otto Kekäläinen <otto@debian.org>
Partially-fixes: https://github.com/tukaani-project/xz/pull/220

10 days agoTranslations: Fix a syntax typo in the Serbian xz man page translation
Lasse Collin [Wed, 20 May 2026 10:42:45 +0000 (13:42 +0300)] 
Translations: Fix a syntax typo in the Serbian xz man page translation

Testing with this:

    cd po4a
    ./update-po
    groff -K utf8 -man -t -ww -rCHECKSTYLE=3 -z man/sr/*.1

The output included this:

    an.tmac:man/sr/xz.1:751: style: 1 leading space(s) on input line

The actual reason seemed to be an unwanted newline (likely a typo).

10 days agoTranslations: Fix a groff warning in the German xz man page translation
Lasse Collin [Wed, 20 May 2026 10:37:18 +0000 (13:37 +0300)] 
Translations: Fix a groff warning in the German xz man page translation

Testing with this:

    cd po4a
    ./update-po
    groff -K utf8 -man -t -ww -rCHECKSTYLE=3 -z man/de/*.1

The output included this:

    an.tmac:man/de/xz.1:524: style: 1 leading space(s) on input line

10 days agoTranslations: Fix syntax in the Korean man page translations
Lasse Collin [Wed, 20 May 2026 10:32:43 +0000 (13:32 +0300)] 
Translations: Fix syntax in the Korean man page translations

Testing with this:

    cd po4a
    ./update-po
    groff -K utf8 -man -t -ww -z man/ko/*.1

It produced warnings:

    troff:man/ko/xz.1:1405: warning: color 'i' not defined
    troff:man/ko/xzdec.1:17: warning: cannot select font '\'
    troff:man/ko/xzdec.1:19: warning: cannot select font '\'

10 days agoTranslations: Fix a syntax typo in the French xz man page translation
Lasse Collin [Wed, 20 May 2026 10:24:03 +0000 (13:24 +0300)] 
Translations: Fix a syntax typo in the French xz man page translation

Testing with this:

    cd po4a
    ./update-po
    groff -K utf8 -man -t -ww -z man/fr/xz.1

It produced a warning:

    troff:man/fr/xz.1:516: warning: color 'i' not defined

The backslash for non-breaking space was misplaced:

    Old:  8 \\Mio,
    New:  8\\ Mio,

10 days agoMan pages: Improve rendering in mandoc
Lasse Collin [Wed, 20 May 2026 10:09:59 +0000 (13:09 +0300)] 
Man pages: Improve rendering in mandoc

Don't use "" as an argument to .IP because it makes mandoc insert
an unwanted extra empty line. With the xz man page, this change makes
no difference in plain text output with GNU groff or on AIX or
Solaris 10. The list in the xzgrep man page has a different indentation
now because previously it had two arguments (.IP "" 4), but that's OK.

I don't remember why '.IP' was changed to '.IP ""' in cec0ddc8ec4c.
Maybe it made a difference on some proprietary UNIX over 15 years ago
or maybe it was just a misunderstanding.

10 days agopo4a/update-po: Workaround an issue with non-ASCII chars in tables
Lasse Collin [Tue, 19 May 2026 22:25:41 +0000 (01:25 +0300)] 
po4a/update-po: Workaround an issue with non-ASCII chars in tables

Non-ASCII chars in tables (.TS ... .TE) result in warnings:

    man --warnings po4a/man/uk/xz.1 > /dev/null
    troff:<standard input>:464: warning: special character 'u0411\[tbl' not defined
    troff:<standard input>:1157: warning: special character 'u044\[tbl' not defined
    troff:<standard input>:1682: warning: special character 'u0434\[tbl' not defined

po4a generates groff Unicode escapes like '\u0435' followed immediately
by '[' in table contexts, causing groff to interpret the full string
'u0435[tbl' as a single special character name. Fix this by inserting
a dummy character (\&) after every Unicode escape so that the bracket
is treated as literal text instead of part of the character name.

Co-authored-by: Otto Kekäläinen <otto@debian.org>
Partially-fixes: https://github.com/tukaani-project/xz/pull/220

10 days agoTranslations: Update the German man page translations
Lasse Collin [Tue, 19 May 2026 15:12:07 +0000 (18:12 +0300)] 
Translations: Update the German man page translations

10 days agoliblzma: ARM64 & LoongArch: Avoid aligned_readXXle on unaligned pointers
Lasse Collin [Tue, 19 May 2026 14:36:15 +0000 (17:36 +0300)] 
liblzma: ARM64 & LoongArch: Avoid aligned_readXXle on unaligned pointers

While most ARM64 and LoongArch processors support unaligned access,
the code wouldn't have worked on strict-align processors.

Use byte-by-byte method if the input buffer is at most 7 bytes. This
way the code works on strict-align processors too. It might not be
the very best method for tiny buffers, but it shouldn't matter in
practice (the simple implementation for big buffers isn't amazing
either because it cannot execute more than one CRC32 instruction
at a time on superscalar processors).

Reported-by: Guanni Qu
Fixes: 0ed893668554 ("liblzma: ARM64 CRC32: Align the buffer faster")
Fixes: 7baf6835cfbf ("liblzma: Speed up CRC32 calculation on 64-bit LoongArch")
10 days agoliblzma: Document the lzma_stream_buffer_decode() bug
Lasse Collin [Tue, 19 May 2026 15:07:47 +0000 (18:07 +0300)] 
liblzma: Document the lzma_stream_buffer_decode() bug

10 days agoTests: tuktest.h: Fix a comment
Lasse Collin [Tue, 19 May 2026 11:10:03 +0000 (14:10 +0300)] 
Tests: tuktest.h: Fix a comment

10 days agoTests: Add a test for the lzma_stream_buffer_decode() bug
Lasse Collin [Tue, 19 May 2026 11:04:43 +0000 (14:04 +0300)] 
Tests: Add a test for the lzma_stream_buffer_decode() bug

10 days agoliblzma: lzma_stream_buffer_decode: Fix wrong error code
Lasse Collin [Tue, 19 May 2026 10:52:41 +0000 (13:52 +0300)] 
liblzma: lzma_stream_buffer_decode: Fix wrong error code

lzma_stream_buffer_decode() would often fail with LZMA_BUF_ERROR
when it should have failed with LZMA_DATA_ERROR.
In debug builds this also resulted in an assertion failure.

In the _buffer_decode() functions, LZMA_BUF_ERROR is only used when
the output buffer is too small. Truncated input is LZMA_DATA_ERROR.

Reported-by: Guanni Qu
Reported-by: Omkhar Arasaratnam
Fixes: c81f13ff2927 ("Added lzma_stream_buffer_decode() and made minor cleanups.")
10 days agoxz: Fix use-after-free in verbose error message to a non-tty
Lasse Collin [Tue, 19 May 2026 09:34:53 +0000 (12:34 +0300)] 
xz: Fix use-after-free in verbose error message to a non-tty

If --verbose was used when stderr isn't a terminal, the filename
contained a non-printable character, and an error occurred,
a use-after-free occurred when printing the error message.

The bug exists in versions 5.7.1alpha to 5.8.3.

Reported-by: Omkhar Arasaratnam
Fixes: d22f96921fd2 ("xz: Use tuklib_mbstr_nonprint")
2 months agodoc/SHA256SUMS: Add 5.8.3 v5.8
Lasse Collin [Tue, 31 Mar 2026 15:41:04 +0000 (18:41 +0300)] 
doc/SHA256SUMS: Add 5.8.3

2 months agoBump version and soname for 5.8.3 v5.8.3
Lasse Collin [Tue, 31 Mar 2026 14:26:16 +0000 (17:26 +0300)] 
Bump version and soname for 5.8.3

2 months agoAdd NEWS for 5.8.3
Lasse Collin [Tue, 31 Mar 2026 14:26:16 +0000 (17:26 +0300)] 
Add NEWS for 5.8.3

2 months agoTranslations: Run "make -C po update-po"
Lasse Collin [Tue, 31 Mar 2026 14:10:47 +0000 (17:10 +0300)] 
Translations: Run "make -C po update-po"

Update the PO files to contain the comment fix from 4e76651dbaf6.

2 months agoTests: Add a test for the lzma_index_prealloc() + lzma_index_append() bug
Lasse Collin [Sun, 29 Mar 2026 17:29:40 +0000 (20:29 +0300)] 
Tests: Add a test for the lzma_index_prealloc() + lzma_index_append() bug

2 months agoliblzma: Fix a buffer overflow in lzma_index_append()
Lasse Collin [Sun, 29 Mar 2026 16:11:21 +0000 (19:11 +0300)] 
liblzma: Fix a buffer overflow in lzma_index_append()

If lzma_index_decoder() was used to decode an Index that contained no
Records, the resulting lzma_index had an invalid internal "prealloc"
value. If lzma_index_append() was called on this lzma_index, too
little memory would be allocated and a buffer overflow would occur.

While this combination of the API functions is meant to work, in the
real-world apps this call sequence is rare or might not exist at all.

This bug is older than xz 5.0.0, so all stable releases are affected.

Reported-by: GitHub user christos-spearbit
2 months agoCMake: Adjust warnings with MSVC and clang-cl
Lasse Collin [Fri, 27 Mar 2026 19:15:12 +0000 (21:15 +0200)] 
CMake: Adjust warnings with MSVC and clang-cl

When using clang-cl, avoid the long list of warning options used with
GCC and Clang because, for MSVC compatibility, clang-cl's -Wall behaves
like -Weverything.

Add warning options for MSVC. Use them with clang-cl too.

2 months agoCI: Don't disable individual warnings with clang-cl
Lasse Collin [Fri, 27 Mar 2026 19:14:50 +0000 (21:14 +0200)] 
CI: Don't disable individual warnings with clang-cl

2 months agoCI: Add Haiku
Lasse Collin [Sun, 22 Mar 2026 10:02:48 +0000 (12:02 +0200)] 
CI: Add Haiku

2 months agoUpdate THANKS
Lasse Collin [Sun, 22 Mar 2026 09:30:20 +0000 (11:30 +0200)] 
Update THANKS

2 months agoCI: Update MSYS2
Lasse Collin [Sun, 22 Mar 2026 09:29:30 +0000 (11:29 +0200)] 
CI: Update MSYS2

Closes: https://github.com/tukaani-project/xz/pull/213
2 months agoCI: Update Solaris
Lasse Collin [Sun, 22 Mar 2026 09:29:23 +0000 (11:29 +0200)] 
CI: Update Solaris

Closes: https://github.com/tukaani-project/xz/pull/213
2 months agoCI: Update OpenBSD
Lasse Collin [Sun, 22 Mar 2026 09:29:14 +0000 (11:29 +0200)] 
CI: Update OpenBSD

Closes: https://github.com/tukaani-project/xz/pull/213
2 months agoCI: Update NetBSD
Lasse Collin [Sun, 22 Mar 2026 09:29:08 +0000 (11:29 +0200)] 
CI: Update NetBSD

Closes: https://github.com/tukaani-project/xz/pull/213
2 months agoCI: Update FreeBSD
Lasse Collin [Sun, 22 Mar 2026 09:28:58 +0000 (11:28 +0200)] 
CI: Update FreeBSD

Closes: https://github.com/tukaani-project/xz/pull/213
2 months agoCI: Update DragonFly BSD
Lasse Collin [Sun, 22 Mar 2026 09:28:47 +0000 (11:28 +0200)] 
CI: Update DragonFly BSD

Closes: https://github.com/tukaani-project/xz/pull/213
2 months agoCI: Upgrade GitHub Actions for Node 24 compatibility
Salman Muin Kayser Chishti [Sat, 28 Feb 2026 09:10:46 +0000 (09:10 +0000)] 
CI: Upgrade GitHub Actions for Node 24 compatibility

Signed-off-by: Salman Muin Kayser Chishti <13schishti@gmail.com>
Closes: https://github.com/tukaani-project/xz/pull/212
2 months agoxz: Prevent an integer overflow in --files and --files0
Lasse Collin [Wed, 25 Mar 2026 17:03:00 +0000 (19:03 +0200)] 
xz: Prevent an integer overflow in --files and --files0

This requires a filename (or something that pretends to be a filename)
of at least 2 GiB on a 32-bit platform, and that realloc() to
SIZE_MAX / 2 + 1 bytes has succeeded.

Fixes: https://github.com/tukaani-project/xz/pull/218
2 months agotuklib_integer: Fix inefficient aligned_writeXXne
Lasse Collin [Mon, 23 Mar 2026 21:43:56 +0000 (23:43 +0200)] 
tuklib_integer: Fix inefficient aligned_writeXXne

The __builtin_assume_aligned was applied to the wrong argument which
made aligned writes worse on strict-align archs.

Aligned writes aren't used in liblzma, so this bug didn't matter in
this package; tuklib_integer.h is meant to be usable elsewhere too.

2 months agoBuild: Remove -Wpre-c2x-compat
Lasse Collin [Sun, 22 Mar 2026 08:22:09 +0000 (10:22 +0200)] 
Build: Remove -Wpre-c2x-compat

It makes clang -std=gnu23 noisy about bool. It's also noisy about
[[__fallthrough__]] which is only used in C23 mode.

Reported-by: Collin Funk <collin.funk1@gmail.com>
2 months agoxz: Don't fsync directories on QNX
Collin Funk [Mon, 16 Mar 2026 06:24:59 +0000 (23:24 -0700)] 
xz: Don't fsync directories on QNX

On QNX calling fsync on a directory fails with EINVAL. This causes the
following test failure:

    $ cat tests/test_suffix.sh.log
    /data/home/root/xz-5.8.2/src/xz/.libs/lt-xz: suffix_temp: Synchronizing the directory of the file failed: Invalid argument
    Failed to decompress a file with a suffix set in raw format
    FAIL test_suffix.sh (exit status: 1)

Closes: https://github.com/tukaani-project/xz/pull/216
3 months agoUpdate THANKS
Lasse Collin [Wed, 25 Feb 2026 15:33:42 +0000 (17:33 +0200)] 
Update THANKS

3 months agoliblzma: Fix a copy-paste error in commented-out code
Lasse Collin [Tue, 24 Feb 2026 22:00:49 +0000 (00:00 +0200)] 
liblzma: Fix a copy-paste error in commented-out code

Fixes: https://github.com/dotnet/runtime/pull/124003#discussion_r2841960994
Fixes: 96b663f67c0e ("liblzma: Refactor CRC comments.")
3 months agoFix typos and grammar in comments and docs
Lasse Collin [Tue, 24 Feb 2026 16:34:19 +0000 (18:34 +0200)] 
Fix typos and grammar in comments and docs

Fixes: https://github.com/dotnet/runtime/pull/124003#discussion_r2789354505
Fixes: https://github.com/dotnet/runtime/pull/124003#discussion_r2789354515
Fixes: https://github.com/dotnet/runtime/pull/124003#discussion_r2820960196
3 months agotuklib_open_stdxxx: Fix a typo in macro name
Lasse Collin [Tue, 24 Feb 2026 16:24:29 +0000 (18:24 +0200)] 
tuklib_open_stdxxx: Fix a typo in macro name

It doesn't matter in this package, but it's good to fix it still.

Fixes: https://github.com/dotnet/runtime/pull/124003#discussion_r2782313660
3 months agoCMake: Fix a wrong #define
Lasse Collin [Tue, 24 Feb 2026 16:22:25 +0000 (18:22 +0200)] 
CMake: Fix a wrong #define

HAVE_SYS_PARAM_H was misspelled HAVE_PARAM_H. This might have broken
the build on systems where sysctl() is used to detect the amount of RAM
or the number of processor cores/threads.

The cpuset code for FreeBSD doesn't need the macro it so it was removed.

Fixes: https://github.com/dotnet/runtime/pull/124003#discussion_r2782313680
Fixes: https://github.com/dotnet/runtime/pull/124003#discussion_r2782313704
Fixes: 7e3493d40eac ("Build: Add very limited experimental CMake support.")
3 months agoliblzma/MSVC: Add a cast to fix a warning (C4057) with __cpuid()
Radek Zikmund [Thu, 12 Feb 2026 14:24:15 +0000 (15:24 +0100)] 
liblzma/MSVC: Add a cast to fix a warning (C4057) with __cpuid()

__cpuid from MSVC (and also the old Intel ICC) use int[], while
__get_cpuid from <cpuid.h> in GCC and Clang use unsigned int[].
Adding a cast is the simplest fix.

Link: https://github.com/tukaani-project/xz/pull/208
3 months agoCMake: Guard script configure_file() calls with ENABLE_SCRIPTS
Radek Zikmund [Mon, 23 Feb 2026 16:50:00 +0000 (17:50 +0100)] 
CMake: Guard script configure_file() calls with ENABLE_SCRIPTS

The configure_file() calls for xzdiff, xzgrep, xzmore, and xzless
were running unconditionally within the if(UNIX) block, even when
ENABLE_SCRIPTS was OFF. This would cause a build failure if the
src/scripts/*.in files were not present. Deleting those files can
simplify license compliance when the scripts aren't needed.

Move the foreach loop and related code inside if(ENABLE_SCRIPTS) guard
so that configure_file() is only called when scripts are actually needed.
This is mostly whitespace changes to adjust the indentation.

Co-authored-by: Lasse Collin <lasse.collin@tukaani.org>
Closes: https://github.com/tukaani-project/xz/pull/210
4 months agoTranslations: Add Arabic man page translations
Lasse Collin [Wed, 4 Feb 2026 10:28:07 +0000 (12:28 +0200)] 
Translations: Add Arabic man page translations

Rendering of bidirectional text from man pages might not work perfectly
in all cases.

4 months agoUpdate THANKS
Lasse Collin [Sun, 25 Jan 2026 11:51:09 +0000 (13:51 +0200)] 
Update THANKS

4 months agoliblzma: Add the "License" property to liblzma.pc
Lasse Collin [Sun, 25 Jan 2026 11:30:46 +0000 (13:30 +0200)] 
liblzma: Add the "License" property to liblzma.pc

The "License" property is a pkgconf extension. See pc(5).
pkg-config 0.29.2 (2017) ignores unrecognized properties so this
commit shouldn't create compatibility issues.

pkgconf provides bomtool which uses the "License" property to generate
a software bill of materials. In pkgconf.git there is spdxtool for the
same task but with different output format.

The pkgconf extensions "Copyright" and "Maintainer" would also be
used by bomtool and spdxtool, but I don't want to add those properties
at least for now.

Co-authored-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Closes: https://github.com/tukaani-project/xz/pull/178
4 months agoUpdate THANKS
Lasse Collin [Sun, 25 Jan 2026 10:14:46 +0000 (12:14 +0200)] 
Update THANKS

4 months agoliblzma: Don't try to use x86-64 inline asm on ARM64EC
Lasse Collin [Sun, 25 Jan 2026 10:14:25 +0000 (12:14 +0200)] 
liblzma: Don't try to use x86-64 inline asm on ARM64EC

Reported-by: Chase Knowlden
Fixes: https://github.com/tukaani-project/xz/issues/206
4 months agoAutotools: Enable x86 assembler on Hurd by default
Pino Toscano [Tue, 30 Dec 2025 18:59:55 +0000 (19:59 +0100)] 
Autotools: Enable x86 assembler on Hurd by default

It has been enabled in Debian GNU/Hurd for 15+ years with no issues.
Hence, enable it by default also in the upstream sources.

The CMake build already had it enabled.

Link: https://salsa.debian.org/debian/xz-utils/-/blob/debian/5.8.2-2/debian/rules?ref_type=tags#L98
Closes: https://github.com/tukaani-project/xz/pull/204
5 months agodoc/SHA256SUMS: Add 5.8.2
Lasse Collin [Wed, 17 Dec 2025 12:49:12 +0000 (14:49 +0200)] 
doc/SHA256SUMS: Add 5.8.2

5 months agoBump version and soname for 5.8.2 v5.8.2
Lasse Collin [Wed, 17 Dec 2025 11:36:42 +0000 (13:36 +0200)] 
Bump version and soname for 5.8.2

5 months agoAdd NEWS for 5.8.2
Lasse Collin [Wed, 17 Dec 2025 11:36:35 +0000 (13:36 +0200)] 
Add NEWS for 5.8.2

5 months agoCMake: Bump maximum policy version to 4.2
Lasse Collin [Tue, 16 Dec 2025 09:30:35 +0000 (11:30 +0200)] 
CMake: Bump maximum policy version to 4.2

CMP0186 is curious but we aren't affected.

5 months agotuklib_integer/CMake: Log a message about unaligned access check
Lasse Collin [Wed, 10 Dec 2025 17:20:05 +0000 (19:20 +0200)] 
tuklib_integer/CMake: Log a message about unaligned access check

5 months agotuklib_integer/CMake: Don't run unaligned access checks unnecessarily
Lasse Collin [Wed, 10 Dec 2025 17:11:27 +0000 (19:11 +0200)] 
tuklib_integer/CMake: Don't run unaligned access checks unnecessarily

If the cache variable TUKLIB_FAST_UNALIGNED_ACCESS is already set,
the autodetection result isn't needed because the option() command
does nothing when the cache variable is already set.

This is largely white space change to indent the if...endif block.

5 months agotuklib_integer: Use CMAKE_C_COMPILER_ARCHITECTURE_ID when available
Lasse Collin [Wed, 10 Dec 2025 14:49:55 +0000 (16:49 +0200)] 
tuklib_integer: Use CMAKE_C_COMPILER_ARCHITECTURE_ID when available

CMake >= 4.1 sets CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID on many
platforms. The list of possible values are documented. Use this
variable when available. On older CMake versions CMAKE_SYSTEM_PROCESSOR
is still used, thus the regexes have to include values like ^amd64 still.

With old CMake versions, checking CMAKE_C_COMPILER_ARCHITECTURE_ID
is somewhat useful with MSVC because CMAKE_SYSTEM_PROCESSOR might
not match the target architecture.

5 months agotuklib_integer: Autodetect when -mstrict-align is used with GCC on ARM64
Lasse Collin [Wed, 10 Dec 2025 14:49:55 +0000 (16:49 +0200)] 
tuklib_integer: Autodetect when -mstrict-align is used with GCC on ARM64

On ARM64, support for fast unaligned memory access was autodetected by
checking if __ARM_FEATURE_UNALIGNED is defined. However, at least GCC
versions up to 15.2.0 define the macro even when -mstrict-align has
been specified. Thus, autodetection with GCC doesn't work correctly,
and binaries built using -mstrict-align can be much slower than they
need to be, unless the user also passes --disable-unaligned-access
to configure or -DTUKLIB_FAST_UNALIGNED_ACCESS=OFF to cmake.

See the GCC bug:

    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111555

Workaround the issue by using heuristics with GCC on ARM64.

With Clang, the detection using __ARM_FEATURE_UNALIGNED works.
It also works with GCC on 32-bit ARM.

Fixes: e5f13a66567b ("tuklib_integer: Autodetect support for unaligned access on ARM.")
5 months agoCI: Update MSYS2
Lasse Collin [Tue, 9 Dec 2025 16:02:23 +0000 (18:02 +0200)] 
CI: Update MSYS2

5 months agoCI: Update DragonFly BSD
Lasse Collin [Tue, 9 Dec 2025 16:02:05 +0000 (18:02 +0200)] 
CI: Update DragonFly BSD

5 months agoCI: Update Solaris
Lasse Collin [Tue, 9 Dec 2025 15:58:52 +0000 (17:58 +0200)] 
CI: Update Solaris

5 months agoCI: Update NetBSD
Lasse Collin [Tue, 9 Dec 2025 15:56:58 +0000 (17:56 +0200)] 
CI: Update NetBSD

5 months agoCI: Update OpenBSD
Lasse Collin [Tue, 9 Dec 2025 15:54:54 +0000 (17:54 +0200)] 
CI: Update OpenBSD

5 months agoCI: Update FreeBSD
Lasse Collin [Tue, 9 Dec 2025 15:52:01 +0000 (17:52 +0200)] 
CI: Update FreeBSD

5 months agoUpdate THANKS
Lasse Collin [Tue, 9 Dec 2025 15:40:05 +0000 (17:40 +0200)] 
Update THANKS

5 months agoTranslations: Add src/xz/sandbox.c to POTFILES.in
Lasse Collin [Tue, 9 Dec 2025 11:01:36 +0000 (13:01 +0200)] 
Translations: Add src/xz/sandbox.c to POTFILES.in

There are no strings to translate in that file now, but it's good to
list it anyway in case translatable strings are added in the future.

Fixes: 374868d81d47 ("xz: Move sandboxing code to sandbox.c and improve Landlock sandbox.")
5 months agoxz: Never translate "Failed to enable the sandbox"
Lasse Collin [Tue, 9 Dec 2025 10:55:45 +0000 (12:55 +0200)] 
xz: Never translate "Failed to enable the sandbox"

This was already the case in practice because I had forgotten to list
src/xz/sandbox.c in po/POTFILES.in. However, it seems better to never
translate this particular error message. It should almost never occur
and if it does, an untranslated message is should make it easier to
find bug reports about it.

5 months agoTranslations: Update the Swedish man page translations
Lasse Collin [Tue, 9 Dec 2025 10:27:15 +0000 (12:27 +0200)] 
Translations: Update the Swedish man page translations

5 months agoTranslations: Update the Romanian man page translations
Lasse Collin [Tue, 9 Dec 2025 10:26:24 +0000 (12:26 +0200)] 
Translations: Update the Romanian man page translations

5 months agoUpdate THANKS
Lasse Collin [Tue, 9 Dec 2025 10:13:36 +0000 (12:13 +0200)] 
Update THANKS

5 months agoCMake: Autodetect unaligned access support on LoongArch
Lasse Collin [Tue, 9 Dec 2025 10:13:36 +0000 (12:13 +0200)] 
CMake: Autodetect unaligned access support on LoongArch

This still relies on CMAKE_SYSTEM_PROCESSOR. CMake 4.1 added more
CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID values to detect the arch in
a more defined manner, but 4.1 is too new to require for now.

Thanks-to: Li Chenggang <lichenggang@deepin.org>
Closes: https://github.com/tukaani-project/xz/pull/186
5 months agoAutotools: Autodetect unaligned access support on LoongArch
Lasse Collin [Tue, 9 Dec 2025 10:13:36 +0000 (12:13 +0200)] 
Autotools: Autodetect unaligned access support on LoongArch

According to [1] sections 7.4, 8.1, and 8.2, desktop and server
processors support fast unaligned access, but embedded systems likely
don't.

It's important that TUKLIB_FAST_UNALIGNED_ACCESS isn't defined when
-mstrict-align is in use because it will result in slower binaries
even if running on a processor that supports fast unaligned access.
It's because compilers will translate multibyte memcpy() to multiple
byte-by-byte instructions instead of wider loads and stores. The
compression times from [2] show this well:

    Unaligned access    CFLAGS                     Compression time
        enabled         -O2 -mno-strict-align          66.1 s
        disabled        -O2 -mno-strict-align          79.5 s
        disabled        -O2 -mstrict-align             79.9 s
        enabled         -O2 -mstrict-align            129.1 s

There currently (GCC 15.2) is no preprocessor macro on LoongArch
to detect if -mstrict-align or -mno-strict-align is in effect (the
default is -mno-strict-align). Use heuristics to detect which of the
flags is in effect.

[1] https://github.com/loongson/la-softdev-convention/blob/v0.2/la-softdev-convention.adoc
[2] https://github.com/tukaani-project/xz/pull/186#issuecomment-3494570304

Thanks-to: Li Chenggang <lichenggang@deepin.org>
Thanks-to: Xi Ruoyao
See: https://github.com/tukaani-project/xz/pull/186

5 months agoxz: Silence clang -Wunreachable-code-break
Lasse Collin [Wed, 26 Nov 2025 11:50:57 +0000 (13:50 +0200)] 
xz: Silence clang -Wunreachable-code-break

Fixes: a165d7df1964 ("xz: Add a new --filters-help option.")
5 months agoliblzma: Remove unwanted semicolons
Lasse Collin [Wed, 26 Nov 2025 11:50:57 +0000 (13:50 +0200)] 
liblzma: Remove unwanted semicolons

These didn't affect control flow.

5 months agoTests: Remove an unwanted semicolon from a macro definition
Lasse Collin [Wed, 26 Nov 2025 11:50:57 +0000 (13:50 +0200)] 
Tests: Remove an unwanted semicolon from a macro definition

It didn't affect control flow.

Fixes: fe3bd438fb11 ("Tests: Fix memory leaks in test_block_header.")
5 months agoBuild: Use -Wextra-semi-stmt when supported
Lasse Collin [Wed, 26 Nov 2025 11:50:57 +0000 (13:50 +0200)] 
Build: Use -Wextra-semi-stmt when supported

5 months agoCI: Add clang-cl
Lasse Collin [Wed, 26 Nov 2025 11:50:57 +0000 (13:50 +0200)] 
CI: Add clang-cl

Fixes: https://github.com/tukaani-project/xz/issues/18#issuecomment-3577456136
5 months agoxz/Windows: Add a missing #include to fix the build with clang-cl
Lasse Collin [Wed, 26 Nov 2025 11:50:57 +0000 (13:50 +0200)] 
xz/Windows: Add a missing #include to fix the build with clang-cl

Fixes: https://github.com/tukaani-project/xz/issues/18#issuecomment-1986829734
Fixes: https://github.com/tukaani-project/xz/issues/18#issuecomment-3577456136
5 months agoxz: Check return value of sigaction() before calling raise()
Lasse Collin [Tue, 25 Nov 2025 19:05:37 +0000 (21:05 +0200)] 
xz: Check return value of sigaction() before calling raise()

Fixes: Coverity CID 456022
5 months agoliblzma: Refactor a loop in lzma_filters_copy()
Lasse Collin [Sun, 2 Nov 2025 10:57:00 +0000 (12:57 +0200)] 
liblzma: Refactor a loop in lzma_filters_copy()

Arguably it's nicer if i doesn't wrap around when the loop terminates.

Fixes: Coverity CID 464589
Fixes: 6d118a0b9def ("Add lzma_filters_copy().")
5 months agoliblzma: Silence two Coverity warnings
Lasse Collin [Sun, 2 Nov 2025 10:17:50 +0000 (12:17 +0200)] 
liblzma: Silence two Coverity warnings

lzma_lzma_decoder_memusage() returns UINT64_MAX if lc/lp/pb aren't
valid. alone_decoder.c and lzip_decoder.c didn't check the return
value because in both it is known that lc/lp/pb are valid. Make them
call the _nocheck() variant instead which skips the validation (it
already existed for LZMA2's internal use).

Fixes: Coverity CID 464658
Fixes: Coverity CID 897069
5 months agoliblzma: Fix a harmless read of shared variable without mutex
Lasse Collin [Sun, 2 Nov 2025 10:17:50 +0000 (12:17 +0200)] 
liblzma: Fix a harmless read of shared variable without mutex

The partial_update_mode enumeration had three states, _DISABLED,
_START, and _ENABLED. Main thread changed it from _DISABLED to _START
while holding a mutex. Once set to _START, worker thread changed it
to _ENABLED without a mutex. Later main thread read it without a mutex,
so it could see either _START or _ENABLED. However, it made no
difference because the main thread checked for != _DISABLED, so
it didn't matter if it saw _START or _ENABLED.

Nevertheless, such things must not be done. It's clear it was a mistake
because there were two comments that directly contradicted each
other about how the variable was accessed.

Split the enumeration into two booleans:

  - partial_update_enabled: A worker thread locks the mutex to read
    this variable and the main thread locks the mutex to change the
    value. Because only the main thread modifies the variable, the
    main thread can read the value without locking the mutex.
    This variable replaces the _DISABLED -> _START transition.

  - partial_update_started is for worker thread's internal use and thus
    needs no mutex. This replaces the _START -> _ENABLED transition.

Fixes: Coverity CID 456025
Fixes: bd93b776c1bd ("liblzma: Fix a deadlock in threaded decoder.")
5 months agoCI: Add Coverity Scan
Lasse Collin [Sun, 2 Nov 2025 10:17:50 +0000 (12:17 +0200)] 
CI: Add Coverity Scan

Co-authored-by: Lasse Collin <lasse.collin@tukaani.org>
Fixes: https://github.com/tukaani-project/xz/issues/198
5 months agoChange the sorting order in THANKS
Lasse Collin [Tue, 25 Nov 2025 11:55:35 +0000 (13:55 +0200)] 
Change the sorting order in THANKS

In short, sort the names with this command (-k1,1 isn't needed because
the lines with names start with "  -"):

    LC_ALL=en_US.UTF-8 sort -k2,2 -k3,3 -k4,4 -k5,5

When THANKS was created, I wrote the names as "First Last" and attempted
to keep them sorted by last name / surname / family name. This works
with many names in THANKS, but it becomes complicated with names that
don't fit that pattern. For example, names that are written as
"Last First" can be manually sorted by family name, but only if one
knows which part of the name is the family name.[*] And of course,
the concept of first/last name doesn't apply to all names.

[*] xz had a co-maintainer who could help me with such names,
    but fortunately he isn't working on the project anymore.

Adding the names in chronological order could have worked too, although
if something is contributed by multiple people, one would still have to
decide how to sort the names within the batch. Another downside would
be that if THANKS is updated in more than one work-in-progress branch,
merge conflicts would occur more often.

Don't attempt to sort by last name. Let's be happy that people tend to
provide names that can be expressed in a reasonable number of printable
Unicode characters. In practice, people have been even nicer: if the
native language doesn't use a Latin script alphabet, people often provide
a transliterated name (only or in addition to the original spelling),
which is very much appreciated by those who don't know the native script.

Treat the names as opaque strings or space-separated strings for sorting
purposes. This means that most names will now be sorted by first name.
There still are many choices how to sort:

(1) LC_ALL=en_US.UTF-8 sort

    The project is in English, so this may sound like a logical choice.
    However, spaces have a lower weight than letters, which results in
    this order:

        - A Ba
        - Ab C
        - A Bc
        - A Bd

(2) LC_ALL=en_US.UTF-8 sort -k2,2

    This first sorts by the first word and then by the rest of the
    string. It's -k2,2 instead of -k1,1 to skip the leading dash.

        - A Ba
        - A Bc
        - A Bd
        - Ab C

    I like this more than (1). One could add -k3,3 -k4,4 -k5,5 ... too.
    With current THANKS it makes no difference but it might some day.

    NOTE: The ordering in en_US.UTF-8 can differ between libc versions
    and operating systems. Luckily it's not a big deal in THANKS.

(3) LC_ALL=en_US.UTF-8 sort -f -k2,2

    Passing -f (--ignore-case) to sort affects sorting of single-byte
    characters but not multibyte characters (GNU coreutils 9.9):

        No -f       With -f     LC_ALL=C
        Aa          A.A         A.A
        A.A         Aa          Aa
        Ää          Ää          Ä.Ä
        Ä.Ä         Ä.Ä         Ää

    In GNU coreutils, the THANKS file is sorted using "sort -f -k1,1".
    There is also a basic check that the en_US.UTF-8 locale is
    behaving as expected.

(4) LC_ALL=C sort

    This sorts by byte order which in UTF-8 is the same as Unicode
    code point order. With the strings in (1) and (2), this produces
    the same result as in (2). The difference in (3) can be seen above.

    The results differ from en_US.UTF-8 when a name component starts
    with a lower case ASCII letter (like "von" or "de"). Worse, any
    non-ASCII characters sort after ASCII chars. These properties might
    look weird in English language text, although it's good to remember
    that en_US.UTF-8 sorting can appear weird too if one's native
    language isn't English.

The choice between (2) and (4) was difficult but I went with (2).

;-)

6 months agoLandlock: Add missing #ifdefs
Lasse Collin [Sun, 23 Nov 2025 18:39:28 +0000 (20:39 +0200)] 
Landlock: Add missing #ifdefs

The build was broken on distros that have an old <sys/landlock.h>.

Fixes: 2b2652e914b1 ("Landlock: Workaround a bug in RHEL 9 kernel")
6 months agoUpdate THANKS
Lasse Collin [Sun, 23 Nov 2025 18:13:50 +0000 (20:13 +0200)] 
Update THANKS

6 months agoLandlock: Workaround a bug in RHEL 9 kernel
Lasse Collin [Sun, 23 Nov 2025 18:13:49 +0000 (20:13 +0200)] 
Landlock: Workaround a bug in RHEL 9 kernel

If one runs xz 5.8.0 or 5.8.1 from some other distribution in a container
on RHEL 9, xz will fail with the message "Failed to enable the sandbox".

RHEL 9 kernel since 5.14.0-603.el9 (2025-07-30) claims to support
Landlock ABI version 6, but it lacks support for LANDLOCK_SCOPE_SIGNAL.
The issue is still present in 5.14.0-643.el9 (2025-11-22). Red Hat is
aware of the issue, but I don't know when it will be fixed.

The sandbox is meant to be transparent to users, thus there isn't and
won't be a command line option to disable it. Instead, add a workaround
to keep xz working on the buggy RHEL 9 kernels.

Reported-by: Richard W.M. Jones
Thanks-to: Pavel Raiskup
Tested-by: Orgad Shaneh
Tested-by: Richard W.M. Jones
Fixes: https://github.com/tukaani-project/xz/issues/199
Link: https://issues.redhat.com/browse/RHEL-125143
Link: https://bugzilla.redhat.com/show_bug.cgi?id=2407105
Link: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/65BDSY56R5ZJRTUC4B6CIVCVLY4LG4ME/
6 months agoLandlock: Cache the ABI version
Lasse Collin [Sun, 23 Nov 2025 18:13:37 +0000 (20:13 +0200)] 
Landlock: Cache the ABI version

In xz it can avoid up to two syscalls that query the ABI version.

7 months agoUpdate THANKS
Lasse Collin [Mon, 3 Nov 2025 12:52:45 +0000 (14:52 +0200)] 
Update THANKS

7 months agomythread.h: Fix the build on Emscripten when threading is disabled
Lasse Collin [Mon, 3 Nov 2025 10:41:31 +0000 (12:41 +0200)] 
mythread.h: Fix the build on Emscripten when threading is disabled

To make a non-threaded liblzma-only build work with WASI SDK, <signal.h>
and mythread_sigmask() were omitted from mythread.h in the commit
81db3b889830. This broke non-threaded full build with Emscripten because
src/xz/signals.c needs mythread_sigmask() (liblzma-only build was fine).

If __wasm__ is defined, omit <signal.h> and mythread_sigmask() in
non-threaded builds only when __EMSCRIPTEN__ isn't defined.

Reported-by: Marcus Tillmanns
Thanks-to: ChanTsune
Fixes: https://github.com/tukaani-project/xz/issues/161
Fixes: 81db3b889830 ("mythread.h: Disable signal functions in builds targeting Wasm + WASI.")
7 months agoTranslations: Update the Serbian man page translations
Lasse Collin [Mon, 3 Nov 2025 09:56:32 +0000 (11:56 +0200)] 
Translations: Update the Serbian man page translations

The earlier bug fixes are now included in the Translation Project.

7 months agoxz: Silence a compiler warning when signals_block_count is unused
Lasse Collin [Sun, 2 Nov 2025 17:40:55 +0000 (19:40 +0200)] 
xz: Silence a compiler warning when signals_block_count is unused

Move the static variable signals_block_count to the #ifndef block
that already has the functions that need the variable.

7 months agoxz: Silence a warning from Clang on glibc systems
Lasse Collin [Sun, 2 Nov 2025 15:45:20 +0000 (17:45 +0200)] 
xz: Silence a warning from Clang on glibc systems

Fixes: e8838b2f5922 ("xz: Look at resource limits when determining the default memlimit")
7 months agoTranslations: Update the Serbian man page translations
Lasse Collin [Sun, 2 Nov 2025 12:37:52 +0000 (14:37 +0200)] 
Translations: Update the Serbian man page translations

Preserve the bug fixes made in 71ad5e82888f and 4f52e7387012 because
upstream hasn't included them.

7 months agoTranslations: Update the Korean man page translations
Lasse Collin [Sun, 2 Nov 2025 12:27:10 +0000 (14:27 +0200)] 
Translations: Update the Korean man page translations