1
0
mirror of https://git.tukaani.org/xz.git synced 2026-10-31 11:24:56 +00:00

3090 Commits

Author SHA1 Message Date
rootvector2
d0d380797e
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
2026-05-28 12:58:25 +03:00
Lasse Collin
7e7bb6c21c
xz: Use tuklib_mbstr_nonprint in a few more places
Reported-by: GitHub user curious-rabbit
2026-05-27 13:00:11 +03:00
Lasse Collin
1df00237ae
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
2026-05-27 13:00:11 +03:00
Lasse Collin
2928248922
Update THANKS 2026-05-27 13:00:11 +03:00
Lasse Collin
8654b72980
Landlock: Support ABI version 9
Features added in versions 7 and 8 shouldn't be relevant here.
2026-05-27 13:00:11 +03:00
Lasse Collin
f5665a445f
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
2026-05-27 13:00:11 +03:00
Lasse Collin
6237e4319f
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
2026-05-27 13:00:11 +03:00
Lasse Collin
f9b243e203
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).
2026-05-27 13:00:11 +03:00
Lasse Collin
625387f089
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
2026-05-27 13:00:11 +03:00
Lasse Collin
6365d4dadd
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 '\'
2026-05-27 13:00:11 +03:00
Lasse Collin
8e99c3934b
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,
2026-05-27 13:00:11 +03:00
Lasse Collin
784adc9263
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.
2026-05-27 13:00:11 +03:00
Lasse Collin
814e8828b5
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
2026-05-27 13:00:11 +03:00
Lasse Collin
bc96573a65
Translations: Update the German man page translations 2026-05-27 13:00:10 +03:00
Lasse Collin
81faa2e653
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")
2026-05-27 13:00:10 +03:00
Lasse Collin
c2fe308792
liblzma: Document the lzma_stream_buffer_decode() bug 2026-05-27 13:00:10 +03:00
Lasse Collin
6566e6251a
Tests: tuktest.h: Fix a comment 2026-05-27 13:00:10 +03:00
Lasse Collin
29584cdaf3
Tests: Add a test for the lzma_stream_buffer_decode() bug 2026-05-27 13:00:10 +03:00
Lasse Collin
b53838ae0c
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.")
2026-05-27 13:00:10 +03:00
Lasse Collin
327c906dcd
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")
2026-05-27 13:00:04 +03:00
Lasse Collin
ebb0e6789c
doc/SHA256SUMS: Add 5.8.3 2026-03-31 18:41:04 +03:00
Lasse Collin
4b73f2ec19
Bump version and soname for 5.8.3 v5.8.3 2026-03-31 17:30:50 +03:00
Lasse Collin
97b7440006
Add NEWS for 5.8.3 2026-03-31 17:30:50 +03:00
Lasse Collin
8e1022cfb1
Translations: Run "make -C po update-po"
Update the PO files to contain the comment fix from 4e76651dbaf6.
2026-03-31 17:30:50 +03:00
Lasse Collin
a3ea8832be
Tests: Add a test for the lzma_index_prealloc() + lzma_index_append() bug 2026-03-30 21:37:11 +03:00
Lasse Collin
c8c22869e7
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
2026-03-30 21:34:09 +03:00
Lasse Collin
a37658bec7
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.
2026-03-30 14:41:08 +03:00
Lasse Collin
9e499f714c
CI: Don't disable individual warnings with clang-cl 2026-03-30 14:41:03 +03:00
Lasse Collin
1e00837f72
CI: Add Haiku 2026-03-27 18:13:26 +02:00
Lasse Collin
8082851b78
Update THANKS 2026-03-27 18:13:26 +02:00
Lasse Collin
3cdd412bce
CI: Update MSYS2
Closes: https://github.com/tukaani-project/xz/pull/213
2026-03-27 18:13:26 +02:00
Lasse Collin
e38a4af340
CI: Update Solaris
Closes: https://github.com/tukaani-project/xz/pull/213
2026-03-27 18:13:26 +02:00
Lasse Collin
40b1599217
CI: Update OpenBSD
Closes: https://github.com/tukaani-project/xz/pull/213
2026-03-27 18:13:26 +02:00
Lasse Collin
3aaf2f136c
CI: Update NetBSD
Closes: https://github.com/tukaani-project/xz/pull/213
2026-03-27 18:13:26 +02:00
Lasse Collin
b5c26a249d
CI: Update FreeBSD
Closes: https://github.com/tukaani-project/xz/pull/213
2026-03-27 18:13:26 +02:00
Lasse Collin
1a73f4f917
CI: Update DragonFly BSD
Closes: https://github.com/tukaani-project/xz/pull/213
2026-03-27 18:13:26 +02:00
Salman Muin Kayser Chishti
5d61c5a3cf
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
2026-03-27 18:13:26 +02:00
Lasse Collin
0ac3b93387
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
2026-03-27 18:13:26 +02:00
Lasse Collin
2faa141bdb
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.
2026-03-27 18:13:26 +02:00
Lasse Collin
685538271e
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>
2026-03-27 18:13:26 +02:00
Collin Funk
3a78a82bd3
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
2026-03-27 18:13:21 +02:00
Lasse Collin
bfc5f12a84
Update THANKS 2026-02-25 17:33:42 +02:00
Lasse Collin
5553509f1a
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.")
2026-02-25 17:32:13 +02:00
Lasse Collin
4e76651dba
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
2026-02-25 17:32:13 +02:00
Lasse Collin
cd8a6231d0
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
2026-02-25 17:32:13 +02:00
Lasse Collin
bf5d32f489
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.")
2026-02-25 17:32:13 +02:00
Radek Zikmund
b0f3b64a25
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
2026-02-25 17:32:13 +02:00
Radek Zikmund
b51d67f4a9
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
2026-02-25 17:32:07 +02:00
Lasse Collin
1007bf08b5
Translations: Add Arabic man page translations
Rendering of bidirectional text from man pages might not work perfectly
in all cases.
2026-02-04 12:28:07 +02:00
Lasse Collin
54147ad65a
Update THANKS 2026-01-25 13:51:09 +02:00