1
0
mirror of https://git.tukaani.org/xz.git synced 2025-04-15 04:00:50 +00:00

Compare commits

...

570 Commits

Author SHA1 Message Date
Lasse Collin
a69fbd3aae
CI: MSVC: Use fewer runners for the same number of tests
Using eight runners seems wasteful. Using only two runners isn't
much slower due to the runner startup overhead.

Also add a comment about the test that fails without b5a5d9e3f702.
2025-04-10 20:13:07 +03:00
Lasse Collin
8a300d1c4f
Update THANKS 2025-04-10 20:10:31 +03:00
Lasse Collin
b5a5d9e3f7
liblzma: Disable CLMUL CRC on old MSVC targeting 32-bit x86
On GitHub runners, VS 2019 16.11 (MSVC 19.29.30158) results in
test failures. VS 2022 17.13 (MSVC 19.43.34808) works.

In xz 5.6.x there was a #pragma-based workaround for MSVC builds for
32-bit x86. Another method was thought to work with the new rewritten
CLMUL CRC. Apparently it doesn't. Keep it simple and disable CLMUL CRC
with any non-recent MSVC when building for 32-bit x86.

Fixes: 54eaea5ea49b ("liblzma: x86 CLMUL CRC: Rewrite")
Fixes: https://github.com/tukaani-project/xz/issues/171
Reported-by: Andrew Murray
2025-04-07 22:36:58 +03:00
Lasse Collin
c5fd88dfc3
liblzma: Remove MSVC hack from CLMUL CRC
It's not enough with MSVC 19.29 (VS 2019) even if the hack was also
applied to the CRC32 code. The tests crash when built for 32-bit x86.
2025-04-07 22:36:58 +03:00
Lasse Collin
49ba8c69ea
CI: Test 32/64-bit x86 builds with Visual Studio 2019 and 2022 2025-04-07 22:36:52 +03:00
Lasse Collin
1176a19df6
Tests: Add fuzz_decode_stream_mt.options 2025-04-04 20:08:37 +03:00
Lasse Collin
c3cb1e53a1
doc/SHA256SUMS: Add 5.8.1 2025-04-03 15:06:07 +03:00
Lasse Collin
a522a22654
Bump version and soname for 5.8.1 2025-04-03 14:34:43 +03:00
Lasse Collin
1c462c2ad8
Add NEWS for 5.8.1 2025-04-03 14:34:43 +03:00
Lasse Collin
513cabcf7f
Tests: Call lzma_code() in smaller chunks in fuzz_common.h
This makes it easy to crash fuzz_decode_stream_mt when tested
against the code from 5.8.0.

Obviously this might make it harder to reach some other code path now.
The previous code has been in use since 2018 when fuzzing was added
in 106d1a663d4b ("Tests: Add a fuzz test program and a config file
for OSS-Fuzz.").
2025-04-03 14:34:43 +03:00
Lasse Collin
48440e24a2
Tests: Add a fuzzing target for the multithreaded .xz decoder
It doesn't seem possible to trigger the CVE-2025-31115 bug with this
fuzzing target at the moment. It's because the code in fuzz_common.h
passes the whole input buffer to lzma_code() at once.
2025-04-03 14:34:43 +03:00
Lasse Collin
0c80045ab8
liblzma: mt dec: Fix lack of parallelization in single-shot decoding
Single-shot decoding means calling lzma_code() by giving it the whole
input at once and enough output buffer space to store the uncompressed
data, and combining this with LZMA_FINISH and no timeout
(lzma_mt.timeout = 0). This way the file is decoded with a single
lzma_code() call if possible.

The bug prevented the decoder from starting more than one worker thread
in single-shot mode. The issue was noticed when reviewing the code;
there are no bug reports. Thus maybe few have tried this mode.

Fixes: 64b6d496dc81 ("liblzma: Threaded decoder: Always wait for output if LZMA_FINISH is used.")
2025-04-03 14:34:42 +03:00
Lasse Collin
8188048854
liblzma: mt dec: Don't modify thr->in_size in the worker thread
Don't set thr->in_size = 0 when returning the thread to the stack of
available threads. Not only is it useless, but the main thread may
read the value in SEQ_BLOCK_THR_RUN. With valid inputs, it made
no difference if the main thread saw the original value or 0. With
invalid inputs (when worker thread stops early), thr->in_size was
no longer modified after the previous commit with the security fix
("Don't free the input buffer too early").

So while the bug appears harmless now, it's important to fix it because
the variable was being modified without proper locking. It's trivial
to fix because there is no need to change the value. Only main thread
needs to set the value in (in SEQ_BLOCK_THR_INIT) when starting a new
Block before the worker thread is activated.

Fixes: 4cce3e27f529 ("liblzma: Add threaded .xz decompressor.")
Reviewed-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Thanks-to: Sam James <sam@gentoo.org>
2025-04-03 14:34:42 +03:00
Lasse Collin
d5a2ffe41b
liblzma: mt dec: Don't free the input buffer too early (CVE-2025-31115)
The input buffer must be valid as long as the main thread is writing
to the worker-specific input buffer. Fix it by making the worker
thread not free the buffer on errors and not return the worker thread to
the pool. The input buffer will be freed when threads_end() is called.

With invalid input, the bug could at least result in a crash. The
effects include heap use after free and writing to an address based
on the null pointer plus an offset.

The bug has been there since the first committed version of the threaded
decoder and thus affects versions from 5.3.3alpha to 5.8.0.

As the commit message in 4cce3e27f529 says, I had made significant
changes on top of Sebastian's patch. This bug was indeed introduced
by my changes; it wasn't in Sebastian's version.

Thanks to Harri K. Koskinen for discovering and reporting this issue.

Fixes: 4cce3e27f529 ("liblzma: Add threaded .xz decompressor.")
Reported-by: Harri K. Koskinen <x64nop@nannu.org>
Reviewed-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Thanks-to: Sam James <sam@gentoo.org>
2025-04-03 14:34:42 +03:00
Lasse Collin
c0c835964d
liblzma: mt dec: Simplify by removing the THR_STOP state
The main thread can directly set THR_IDLE in threads_stop() which is
called when errors are detected. threads_stop() won't return the stopped
threads to the pool or free the memory pointed by thr->in anymore, but
it doesn't matter because the existing workers won't be reused after
an error. The resources will be cleaned up when threads_end() is
called (reinitializing the decoder always calls threads_end()).

Reviewed-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Thanks-to: Sam James <sam@gentoo.org>
2025-04-03 14:34:42 +03:00
Lasse Collin
831b55b971
liblzma: mt dec: Fix a comment
Reviewed-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Thanks-to: Sam James <sam@gentoo.org>
2025-04-03 14:34:42 +03:00
Lasse Collin
b9d168eee4
liblzma: Add assertions to lzma_bufcpy() 2025-04-03 14:34:30 +03:00
Lasse Collin
c8e0a4897b
DOS: Update Makefile to fix the build 2025-04-02 16:54:40 +03:00
Lasse Collin
307c02ed69
sysdefs.h: Avoid <stdalign.h> even with C11 compilers
Oracle Developer Studio 12.6 on Solaris 10 claims C11 support in
__STDC_VERSION__ and supports _Alignas. However, <stdalign.h> is missing.
We only need alignas, so define it to _Alignas with C11/C17 compilers.
If something included <stdalign.h> later, it shouldn't cause problems.

Thanks to Ihsan Dogan for reporting the issue and testing the fix.

Fixes: c0e7eaae8d6eef1e313c9d0da20ccf126ec61f38
2025-03-29 12:41:32 +02:00
Lasse Collin
7ce38b3183
Update THANKS 2025-03-29 12:32:05 +02:00
Lasse Collin
688e51bde4
Translations: Update the Croatian translation 2025-03-29 12:21:51 +02:00
Lasse Collin
173fb5c68b
doc/SHA256SUMS: Add 5.8.0 2025-03-25 18:23:57 +02:00
Lasse Collin
db9258e828
Bump version and soname for 5.8.0
Also remove the LZMA_UNSTABLE macro.
2025-03-25 15:18:32 +02:00
Lasse Collin
bfb752a38f
Add NEWS for 5.8.0 2025-03-25 15:18:32 +02:00
Lasse Collin
6ccbb904da
Translations: Run "make -C po update-po"
POT-Creation-Date is set to match the timestamp in 5.7.2beta which
in the Translation Project is known as 5.8.0-pre1. The strings
haven't changed since 5.7.1alpha but a few comments have.

This is a very noisy commit, but this helps keeping the PO files
similar between the Git repository and stable release tarballs.
2025-03-25 15:18:31 +02:00
Lasse Collin
891a5f057a
Translations: Run po4a/update-po
Also remove the trivial obsolete messages like man page dates.

This is a noisy commit, but this helps keeping the PO files similar
between the Git repository and stable release tarballs.
2025-03-25 15:18:31 +02:00
Lasse Collin
4f52e73870
Translations: Partially fix overtranslation in Serbian man pages
Names of environment variables and some other strings must be present
in the original form. The translator couldn't be reached so I'm
changing some of the strings myself. In the "Robot mode" section,
occurrences in the middle of sentences weren't changed to reduce
the chance of grammar breakage, but I kept the translated strings in
parenthesis in the headings. It's not ideal, but now people shouldn't
need to look at the English man page to find the English strings.
2025-03-25 15:18:31 +02:00
Lasse Collin
ff5d944749
liblzma: Count the extra bytes in LZMA/LZMA2 decoder memory usage 2025-03-25 15:18:31 +02:00
Lasse Collin
943b012d09
liblzma: Use SSE2 intrinsics instead of memcpy() in dict_repeat()
SSE2 is supported on every x86-64 processor. The SSE2 code is used on
32-bit x86 if compiler options permit unconditional use of SSE2.

dict_repeat() copies short random-sized unaligned buffers. At least
on glibc, FreeBSD, and Windows (MSYS2, UCRT, MSVCRT), memcpy() is
clearly faster than byte-by-byte copying in this use case. Compared
to the memcpy() version, the new SSE2 version reduces decompression
time by 0-5 % depending on the machine and libc. It should never be
slower than the memcpy() version.

However, on musl 1.2.5 on x86-64, the memcpy() version is the slowest.
Compared to the memcpy() version:

  - The byte-by-version takes 6-7 % less time to decompress.
  - The SSE2 version takes 16-18 % less time to decompress.

The numbers are from decompressing a Linux kernel source tarball in
single-threaded mode on older AMD and Intel systems. The tarball
compresses well, and thus dict_repeat() performance matters more
than with some other files.
2025-03-25 15:18:31 +02:00
Lasse Collin
bc14e4c94e
liblzma: Add "restrict" to a few functions in lz_decoder.h
This doesn't make any difference in practice because compilers can
already see that writing through the dict->buf pointer cannot modify
the contents of *dict itself: The LZMA decoder makes a local copy of
the lzma_dict structure, and even if it didn't, the pointer to
lzma_dict in the LZMA decoder is already "restrict".

It's nice to add "restrict" anyway. uint8_t is typically unsigned char
which can alias anything. Without the above conditions or "restrict",
compilers could need to assume that writing through dict->buf might
modify *dict. This would matter in dict_repeat() because the loops
refer to dict->buf and dict->pos instead of making local copies of
those members for the duration of the loops. If compilers had to
assume that writing through dict->buf can affect *dict, then compilers
would need to emit code that reloads dict->buf and dict->pos after
every write through dict->buf.
2025-03-25 15:18:31 +02:00
Lasse Collin
e82ee090c5
liblzma: Define LZ_DICT_INIT_POS for initial dictionary position
It's more readable.
2025-03-25 15:18:30 +02:00
Lasse Collin
8e7cd0091e
Windows: Update README-Windows.txt about UCRT 2025-03-25 15:18:30 +02:00
Lasse Collin
2c24292d34
Update THANKS 2025-03-25 15:18:15 +02:00
Lasse Collin
48053c9089
Translations: Update the Italian translation 2025-03-17 15:33:25 +02:00
Lasse Collin
8d6f06a65f
Translations: Update the Portuguese translation
The language tag in the Translation Project is pt, not pt_PT,
thus I changed the "Language:" line to pt.
2025-03-17 15:28:56 +02:00
Lasse Collin
c3439b039f
Translations: Update the Italian translation 2025-03-14 13:13:32 +02:00
Lasse Collin
79b4ab8d79
Translations: Update the Italian man page translations
Only trivial additions but this keeps the file in sync with the TP.
2025-03-12 20:48:39 +02:00
Lasse Collin
515b6fc855
Translations: Update the Italian man page translations 2025-03-12 19:38:54 +02:00
Lasse Collin
333b7c0b77
Translations: Update the Korean man page translations 2025-03-10 21:00:31 +02:00
Lasse Collin
ae52ebd27d
Translations: Update the German man page translations 2025-03-10 20:56:57 +02:00
Lasse Collin
1028e52c93
CMake: Fix tuklib_use_system_extensions
Revert back to a macro so that list(APPEND CMAKE_REQUIRED_DEFINITIONS)
will affect the calling scope. I had forgotten that while CMake
functions inherit the variables from the parent scope, the changes
to them are local unless using set(... PARENT_SCOPE).

This also means that the commit message in 5bb77d0920dc is wrong. The
commit itself is still fine, making it clearer that -DHAVE_SYS_PARAM_H
is only needed for specific check_c_source_compiles() calls.

Fixes: c1ea7bd0b60eed6ebcdf9a713ca69034f6f07179
2025-03-10 13:41:50 +02:00
Lasse Collin
80e4883602
INSTALL: Document -bmaxdata on AIX
This is based on a pull request and AIX docs. I haven't tested the
instructions myself.

Closes: https://github.com/tukaani-project/xz/pull/137
2025-03-10 13:41:49 +02:00
Lasse Collin
ab319186b6
Update THANKS 2025-03-10 11:37:19 +02:00
Collin Funk
4434671a04
tuklib_physmem: Silence -Wsign-conversion on AIX
Closes: https://github.com/tukaani-project/xz/pull/168
2025-03-10 11:36:44 +02:00
Lasse Collin
18bcaa4faf
Translations: Update the Romanian man page translations 2025-03-09 22:11:35 +02:00
Lasse Collin
1e17b7f42f
Translations: Update the Croatian translation 2025-03-09 22:11:35 +02:00
Lasse Collin
ff85e6130d
Translations: Update the Romanian translation 2025-03-09 22:11:34 +02:00
Lasse Collin
a5bfb33f30
Translations: Update the Ukrainian man page translations 2025-03-09 22:11:34 +02:00
Lasse Collin
5bb77d0920
CMake: Use cmake_push_check_state in tuklib_cpucores and tuklib_physmem
Now the changes to CMAKE_REQUIRED_DEFINITIONS are temporary and don't
leak to the calling code.
2025-03-09 17:44:37 +02:00
Lasse Collin
c1ea7bd0b6
CMake: Revise tuklib_use_system_extensions
Define NetBSD and Darwin/macOS feature test macros. Autoconf defines
these too (and a few others).

Define the macros on Windows except with MSVC. The _GNU_SOURCE macro
makes a difference with mingw-w64.

Use a function instead of a macro. Don't take the TARGET_OR_ALL argument
because there's always global effect because the global variable
CMAKE_REQUIRED_DEFINITIONS is modified.
2025-03-09 17:44:31 +02:00
Lasse Collin
4243c45a48
doc/SHA256SUMS: Add 5.7.2beta 2025-03-08 14:54:29 +02:00
Lasse Collin
cc7f2fc1cf
Bump version and soname for 5.7.2beta 2025-03-08 14:38:56 +02:00
Lasse Collin
62e44b3616
Add NEWS for 5.7.2beta 2025-03-08 14:25:17 +02:00
Lasse Collin
70f1f20378
COPYING: Remove the note about old releases 2025-03-08 14:25:17 +02:00
Lasse Collin
db9827dc38
xz: Update the man page about the environment variables again 2025-03-08 14:25:16 +02:00
Lasse Collin
99c584891b
liblzma: Edit spelling in a comment
It was found with codespell.
2025-03-06 19:37:03 +02:00
Lasse Collin
7a234c8c05
xz: Update the man page about the environment variables 2025-03-06 19:37:03 +02:00
Lasse Collin
808f05af3e
Docs: Add a few TRANSLATORS comments to man pages
All translators know that --command-line-options must not be translated.
With some other strings it's not obvious when the untranslated string
must be preserved. These comments hopefully help.
2025-03-06 19:37:03 +02:00
Lasse Collin
051de255f0
Scripts: Mark the LZMA Utils script aliases as deprecated
The deprecated aliases are lzcmp, lzdiff, lzless, lzmore,
lzgrep, lzegrep, and lzfgrep. The commands that start with
the xz prefix have identical behavior, for example, both
lzgrep and xzgrep handle all supported file formats.

This doesn't affect lzma, unlzma, lzcat, lzmadec, or lzmainfo.
The last release of LZMA Utils was made in 2008, but the lzma
compatibility alias for the gzip-like tool is still in common use.
Deprecating it would cause unnecessary breakage.
2025-03-06 19:36:56 +02:00
Lasse Collin
4941ea454c
Translations: Add Serbian man page translations 2025-03-02 21:13:04 +02:00
Lasse Collin
d142d96f24
Translations: Update Georgian translation 2025-03-02 20:42:14 +02:00
Lasse Collin
9b7e45d841
Update THANKS 2025-02-28 21:07:21 +02:00
Lasse Collin
9351592710
Update THANKS 2025-02-22 16:04:58 +02:00
Lasse Collin
9023be7831
Translations: Update the Croatian translation 2025-02-19 16:33:52 +02:00
Lasse Collin
2eaf242c56
Build: Fix out-of-tree builds when using the replacement getopt_long
Nowaways $(top_builddir)/lib/getopt.h depends on headers in
$(top_srcdir)/lib, so both have to be in the include path.
CMake-based build already did this.

Fixes: 7e884c00d0093c38339f17fb1d280eec493f42ca
2025-02-17 21:48:24 +02:00
Lasse Collin
41322b2c60
m4/getopt.m4: Remove an outdated comment 2025-02-17 18:25:52 +02:00
Lasse Collin
03c23a4952
Build: Allow forcing the use of the replacement getopt_long
Now one can pass gl_replace_getopt=yes to configure to force the use
of GNU getopt_long from the lib directory. This only checks that the
value of gl_replace_getopt is non-empty, so one cannot force the
replacement to be disabled.

Closes: https://github.com/tukaani-project/xz/pull/166
2025-02-17 18:11:58 +02:00
Lasse Collin
c23b837d15
Update THANKS 2025-02-17 18:11:42 +02:00
Lasse Collin
2672a38f11
Update THANKS 2025-02-12 19:23:31 +02:00
Lasse Collin
4fdcbfaf3f
Update THANKS 2025-02-11 12:13:41 +02:00
Lasse Collin
0d553568f1
Translations: Update the Polish translation 2025-02-08 11:39:08 +02:00
Lasse Collin
9f165076ae
Docs: Update TODO a little 2025-02-07 19:13:43 +02:00
Lasse Collin
f5aa292c53
Add researcher credits of CVE-2022-1271 and CVE-2024-47611 to THANKS
These are specific phrases that were included in the advisories and
NEWS. It's nice to have them in THANKS as well.
2025-02-07 18:50:56 +02:00
Lasse Collin
7cf463b5ad
Update THANKS 2025-02-07 18:43:00 +02:00
Lasse Collin
6b7fe7e27b
Docs: Update the "Translations" section in README
Make it clearer that translations cannot be accepted if they don't
come via the Translation Project.

Column headings have been handled automatically for years and now --help
is autowrapped too, so the related instructions can be removed.
2025-02-04 19:37:32 +02:00
Lasse Collin
2c7aee9493
debug/translations.bash: Revise a little
Make it work for out-of-tree builds without requiring one to specify
the location of the xz executable.

Add xz --filters-help.

Make the output shorter by reducing the number of xz -lvv test files.

Show the value of LANGUAGE environment variable.

Show the xz.git version using git describe --abbrev=8 instead of =4.
2025-02-04 19:37:31 +02:00
Lasse Collin
c6b15e7045
Build: Use "git describe --abbrev=8" in snapshot tarball names
8 is more likely to be reproducible than the old 4 without being
excessively long for a small repository like this.
2025-02-04 19:37:31 +02:00
Lasse Collin
0ce97987c5
Update THANKS 2025-02-04 19:37:31 +02:00
Lasse Collin
353c33355c
Translations: Update the Serbian translation 2025-02-03 16:58:53 +02:00
Lasse Collin
887dc28188
Translations: Update Chinese (traditional) translation
Since there are no spaces between words, the unsophisticated automatic
word wrapping code needs some help. Compared to the version in the
Translation Project, I added a few \t characters which the word
wrapping code interprets as zero width spaces (hopefully they are
placed correctly). These edits can be seen with this command:

    grep -v ^# po/zh_TW.po | grep --color -F '\t'
2025-02-03 16:55:39 +02:00
Lasse Collin
0f1454cf5f
Update THANKS 2025-02-03 16:12:44 +02:00
Lasse Collin
23ea031820
Build: Update posix-shell.m4 from Gnulib
Tabs have been converted to spaces and a "serial" number has been
added. The previous version was from 2008/2009. There are no functional
changes since then but now it's clearer that the copy in XZ Utils
isn't outdated.

The new file was picked from the Gnulib commit
81a4c1e3b7692e95c0806d948cbab9148ad85ef2. A later commit adds
a warranty disclaimer to the license, which obviously is fine,
but I didn't find a SPDX license identifier for the new license,
so for simplicity I used the earlier commit.
2025-02-02 14:30:19 +02:00
Lasse Collin
84c33c0384
Build: Check for -fsanitize= also in $CC
People may put -fsanitize in CC instead of CFLAGS so check both.
Landlock sandbox isn't compatible with sanitizers so it's nice
to catch the incompatible options at configure time.

Don't attempt to do the same in CMakeLists.txt; the check for
CMAKE_C_FLAGS / CFLAGS shall be enough there. The extra flags from
the CC environment variable go into the undocumented internal variable
CMAKE_C_COMPILER_ARG1 (all flags from CC go into that same variable).
Peeking the internal variable merely for improved diagnostics isn't
worth it.

Fixes: 88588b1246d8c26ffbc138b3e5c413c5f14c3179
2025-02-02 14:30:19 +02:00
Lasse Collin
a7304ea4a7
Build: Remove the FIXME about -Werror checks 2025-02-02 14:30:19 +02:00
Lasse Collin
1780bba740
Build: If using a GCC compatible compiler, ensure that -Werror works
The check can be skipped by passing SKIP_WERROR_CHECK=yes to configure.
It won't be documented anywhere else than in the error message.

Ways to test:

    ./configure CC=gcc CFLAGS=-Wunused-macros
    ./configure CC=clang CFLAGS=-Weverything
    ./configure CC=clang CFLAGS=-Weverything SKIP_WERROR_CHECK=yes
2025-02-02 14:30:19 +02:00
Lasse Collin
3aca2daefb
Update THANKS 2025-02-02 14:30:15 +02:00
Lasse Collin
186ff78ab4
Translations: Update Romanian translation 2025-02-01 12:49:09 +02:00
Lasse Collin
40a8ce3e10
Translations: Update Korean man page translations 2025-01-30 18:16:43 +02:00
Lasse Collin
1787f9bd18
Translations: Add Italian man page translations 2025-01-30 18:15:52 +02:00
Lasse Collin
9b9182e561
Translations: Update the Finnish translation 2025-01-29 22:18:29 +02:00
Lasse Collin
7d73ff7a9d
lzmainfo: Use tuklib_mbstr_wrap for --help text
Some languages have so long strings that they need to be wrapped.
2025-01-29 20:59:53 +02:00
Lasse Collin
c56eb47076
Translations: Update the Croatian translation 2025-01-29 20:59:53 +02:00
Lasse Collin
69f4aec0a2
Translations: Update the Finnish translation 2025-01-29 20:59:53 +02:00
Lasse Collin
d49dde33cf
Translations: Update the German man page translations 2025-01-29 20:59:53 +02:00
Lasse Collin
23b99fc4a1
Translations: Update the German translation 2025-01-29 20:59:52 +02:00
Lasse Collin
7edab2bde0
Translations: Update the Turkish translation 2025-01-29 20:59:52 +02:00
Lasse Collin
fac4d0fa52
Translations: Add the Dutch translation 2025-01-29 20:59:52 +02:00
Lasse Collin
abe5092f24
Translations: Update the Georgian translation 2025-01-29 20:59:52 +02:00
Lasse Collin
b97b23c78d
Translations: Update the Spanish translation 2025-01-29 20:59:52 +02:00
Lasse Collin
c68318cb49
Translations: Update the Korean translation 2025-01-29 20:59:52 +02:00
Lasse Collin
153ee17f63
Translations: Update the Romanian man page translations 2025-01-29 20:59:51 +02:00
Lasse Collin
6ed308197e
Translations: Update the Romanian translation 2025-01-29 20:59:51 +02:00
Lasse Collin
06028803e1
Translations: Update the Ukrainian man page translations 2025-01-29 20:59:51 +02:00
Lasse Collin
8cbaf896a6
Translations: Update the Ukrainian translation 2025-01-29 20:59:51 +02:00
Lasse Collin
81c352907b
Translations: Update the Swedish translation 2025-01-29 20:59:51 +02:00
Lasse Collin
999ce26371
tuklib_physmem: Clean up disabled code 2025-01-29 20:59:51 +02:00
Lasse Collin
4d7e7c9d94
Windows: Avoid an error message on broken pipe
Also make xz not process more input files after a broken pipe has
been detected. This matches the behavior on POSIX. If all files
are being written to standard output, trying with the next file is
pointless when it's known that standard output won't accept more data.

xzdec already stopped after the first error. It does so with all
errors, so it differs from xz:

    $ xz -dc not_found_1 not_found_2
    xz: not_found_1: No such file or directory
    xz: not_found_2: No such file or directory

    $ xzdec not_found_1 not_found_2
    xzdec: not_found_1: No such file or directory

Reported-by: Vincent Torri
2025-01-29 20:59:44 +02:00
Lasse Collin
95b638480a
doc/SHA256SUMS: Add 5.6.4 and 5.7.1alpha 2025-01-23 19:59:17 +02:00
Lasse Collin
cdae0df31e
Bump version and soname for 5.7.1alpha 2025-01-23 11:50:47 +02:00
Lasse Collin
4d2af2c43b
Translations: Run po4a/update-po 2025-01-23 11:48:51 +02:00
Lasse Collin
ff0b825505
Add NEWS for 5.7.1alpha 2025-01-23 11:42:36 +02:00
Lasse Collin
f6cd3e3bfc
Add NEWS for 5.6.4 2025-01-23 11:42:23 +02:00
Lasse Collin
b3af3297e4
NEWS: The security fix in 5.6.3 is known as CVE-2024-47611 2025-01-23 11:40:58 +02:00
Lasse Collin
a04b9dd0c7
windows/build.bash: Fix error message
Fixes: 1ee716f74085223c8fbcae1d5a384e6bf53c0f6a
2025-01-22 16:55:14 +02:00
Lasse Collin
4eae859ae8
Windows: Disable MinGW-w64's stdio functions in size-optimized builds
This only affects builds with UCRT. With legacy MSVCRT, the replacement
functions are always enabled.

Omitting the MinGW-w64 replacements saves over 20 KiB per executable.
The downside is that --enable-small or XZ_SMALL=ON disables thousand
separator support in xz messages. If someone is OK with the slower
speed of slightly smaller builds, lack of thousand separators won't
matter.

Don't override __USE_MINGW_ANSI_STDIO if it is already defined (via
CPPFLAGS or such method).
2025-01-22 15:39:05 +02:00
Lasse Collin
a831bc185b
liblzma: Add raw ARM64, RISC-V, and x86 BCJ filter APIs
Put them behind the LZMA_UNSTABLE macro for now.

These low-level special APIs might become useful in erofs-utils.
2025-01-20 16:44:27 +02:00
Lasse Collin
6f5cdd4534
xz: Unify a few strings with liblzma
Avoid having both "%s: foo" and "foo" as translatable strings
so that translators don't need to handle it twice.
2025-01-20 16:31:49 +02:00
Lasse Collin
713fdaa8b0
xz: Translate error messages from lzma_str_to_filters()
liblzma doesn't use gettext but the messages are included in xz.pot,
so xz can translate the messages.
2025-01-20 16:31:49 +02:00
Lasse Collin
f2e2b267ca
liblzma: Mark string conversion messages as translatable 2025-01-20 16:31:49 +02:00
Lasse Collin
f49d7413d9
liblzma: Tweak a few error messages in lzma_str_to_filters() 2025-01-20 16:31:35 +02:00
Lasse Collin
da359c360e
Update THANKS 2025-01-19 20:11:54 +02:00
Lasse Collin
f032373561
Update THANKS 2025-01-19 19:40:32 +02:00
Lasse Collin
51f038f8cb
liblzma: memcmplen.h: Use 8-byte method on 64-bit unaligned archs
Previously it was enabled only on x86-64 and ARM64 when also support
for unaligned access was detected or manually enabled at built time.

In the default build configuration, the 8-byte method is now enabled
also on 64-bit RISC-V and 64-bit PowerPC (both endiannesses). It was
reported that on big endian POWER9, encoding time may reduce 12-13 %.

This change only affects builds with GCC and Clang because the code
uses __builtin_ctzll or __builtin_clzll.

Thanks to Marcus Comstedt for testing on POWER9.
2025-01-13 08:44:58 +02:00
Lasse Collin
96336b0110
Update THANKS 2025-01-12 13:08:55 +02:00
Lasse Collin
150356207c
liblzma: Fix the encoder breakage on big endian ARM64
When the 8-byte method was enabled for ARM64, a check for endianness
wasn't added. This broke the LZMA/LZMA2 encoder. Test suite caught it.

Fixes: cd64dd70d5665b6048829c45772d08606f44672e
Co-authored-by: Marcus Comstedt <marcus@mc.pp.se>
2025-01-12 13:08:55 +02:00
Lasse Collin
b01b095802
Windows: Update manifest comments about long UTF-8 filenames 2025-01-12 13:08:55 +02:00
Lasse Collin
0dfc67d37e
Windows: Update build.bash and its README-Windows.txt to UCRT
While MSVCRT builds are possible, UCRT works better with UTF-8.
A 32-bit build is included still but hopefully it's not actually
needed anymore.
2025-01-12 13:08:49 +02:00
Lasse Collin
7b3eb2db6c
Translations: Update Serbian translation
I rewrapped a few overlong lines. Those edits aren't in the
Translation Project. Automatic wrapping in the master branch
means that these strings need to be updated soon anyway.
2025-01-10 13:19:32 +02:00
Lasse Collin
950da11ce0
Build: Use --sort=name in TAR_OPTIONS
Use also LC_COLLATE=C to make the sorting locale-independent.
Sorting makes the file order reproducible.
2025-01-08 19:29:53 +02:00
Lasse Collin
75d91d6b39
xz: Workaround broken O_SEARCH in musl
Testing with musl 1.2.5 and Linux 6.12, O_SEARCH doesn't result
in a file descriptor that works with fsync() although it should work.
See the added comment.

The same issue affected gzip --synchronous:

    https://bugs.gnu.org/75405

Thanks to Paul Eggert.
2025-01-08 19:20:28 +02:00
Lasse Collin
ea92eae122
Revert "xz: O_SEARCH cannot be used for fsync()"
This reverts commit 4014e2479c7b0273f15bd0c9c017c5fe859b0d8f.

POSIX-conforming O_SEARCH should allow fsync().
2025-01-08 19:20:21 +02:00
Lasse Collin
4014e2479c
xz: O_SEARCH cannot be used for fsync()
Opening a directory with O_SEARCH results in a file descriptor that can
be used with functions like openat(). Such a file descriptor cannot be
used with fsync(). Use O_RDONLY instead.

In musl, O_SEARCH becomes Linux-specific O_PATH. A file descriptor
from O_PATH doesn't allow fsync().

Seems that it's not possible to fsync() a directory that has write
and search permissions but not read permission.

Fixes: 2a9e91d796d091740489d951fa7780525e4275f1
2025-01-05 21:43:11 +02:00
Lasse Collin
ad2b57cb47
CI: Make ctest show errors from failed tests 2025-01-05 20:51:53 +02:00
Lasse Collin
c405264c03
tuklib_mbstr_nonprint: Preserve the value of errno
A typical use case is like this:

    printf("%s: %s\n", tuklib_mask_nonprint(filename), strerror(errno));

tuklib_mask_nonprint() may call mbrtowc() and malloc() which may modify
errno. If errno isn't preserved, the error message might be wrong if
a compiler decides to call tuklib_mask_nonprint() before strerror().

Fixes: 40e573305535960574404d2eae848b248c95ea7e
2025-01-05 20:16:09 +02:00
Lasse Collin
2a9e91d796
xz: Use fsync() before deleting the input file, and add --no-sync
xz's default behavior is to delete the input file after successful
compression or decompression (unless writing to standard output).
If the system crashes soon after the deletion, it is possible that
the newly written file has not yet hit the disk while the previous
delete operation might have. In that case neither the original file
nor the written file is available.

Call fsync() on the file. On POSIX systems, sync also the directory
where the file was created.

Add a new option --no-sync which disables fsync() usage. It can avoid
a (possibly significant) performance penalty when processing many
small files. It's fine to use --no-sync when one knows that the files
are easy to recreate or restore after a system crash.

Using fsync() after every flush initiated by --flush-timeout was
considered. It wasn't implemented at least for now.

  - --flush-timeout is typically used when writing to stdout. If stdout
    is a file, xz cannot (portably) sync the directory of the file.
    One would need to create the output file first, sync the directory,
    and then run xz with fsync() enabled.

  - If xz --flush-timeout output goes to a file, it's possible to use
    a separate script to sync the file, for example, once per minute
    while telling xz to flush more frequently.

  - Not supporting syncing with --flush-timeout was simpler.

Portability notes:

  - On systems that lack O_SEARCH (like Linux), "xz dir/file" will now
    fail if "dir" cannot be opened for reading. If "dir" still has
    write and search permissions (like d-wx------ in "ls -l"),
    previously xz would have been able to compress "dir/file" still.
    Now it only works if using --no-sync (or --keep or --stdout).

  - <libgen.h> and dirname() should be available on all POSIX systems,
    and aren't needed on non-POSIX systems.

  - fsync() is available on all POSIX systems. The directory syncing
    could be changed to fdatasync() although at least on ext4 it
    doesn't seem to make a performance difference in xz's usage.
    fdatasync() would need a build system check to support (old)
    special cases, for example, MINIX 3.3.0 doesn't have fdatasync()
    and Solaris 10 needs -lrt.

  - On native Windows, _commit() is used to replace fsync(). Directory
    syncing isn't done and shouldn't be needed. (In Cygwin, fsync() on
    directories is a no-op.)

  - DJGPP has fsync() for files. ;-)

Using fsync() was considered somewhere around 2009 and again in 2016 but
those times the idea was rejected. For comparison, GNU gzip 1.7 (2016)
added the option --synchronous which enables fsync().

Co-authored-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Fixes: https://bugs.debian.org/814089
Link: https://www.mail-archive.com/xz-devel@tukaani.org/msg00282.html
Closes: https://github.com/tukaani-project/xz/pull/151
2025-01-05 20:16:08 +02:00
Lasse Collin
2e28c71457
xz: Use "goto" for error handling in io_open_dest_real() 2025-01-05 20:16:01 +02:00
Lasse Collin
7510721767
liblzma: Always validate the first digit of a preset string
lzma_str_to_filters() may call parse_lzma12_preset() in two ways. The
call from str_to_filters() detects the string type from the first
character(s) and as a side-effect it validates the first digit of
the preset string. So this change makes no difference there.

However, the call from parse_options() doesn't pre-validate the string.
parse_lzma12_preset() will return an invalid value which is passed to
lzma_lzma_preset() which safely rejects it. The bug still affects the
the error message:

    $ xz --filters=lzma2:preset=X
    xz: Error in --filters=FILTERS option:
    xz: lzma2:preset=X
    xz:               ^
    xz: Unsupported preset

After the fix:

    $ xz --filters=lzma2:preset=X
    xz: Error in --filters=FILTERS option:
    xz: lzma2:preset=X
    xz:              ^
    xz: Unsupported preset

The ^ now correctly points to the X and not past it because the X itself
is the problematic character.

Fixes: cedeeca2ea6ada5b0411b2ae10d7a859e837f203
2025-01-05 12:58:22 +02:00
Lasse Collin
52ff324337
xz: Fix getopt_long argument type in --filters*
Forgetting the argument (or not using = to separate the option from
the argument) resulted in lzma_str_to_filters() being called with NULL
as input string argument. The function handles it fine but xz passes
the NULL to printf() too:

    $ xz --filters
    xz: Error in --filters=FILTERS option:
    xz: (null)
    xz: ^
    xz: Unexpected NULL pointer argument(s) to lzma_str_to_filters()

Now it's correct:

    $ xz --filters
    xz: option '--filters' requires an argument

The --filters-help option doesn't take any arguments.

Fixes: 9ded880a0221f4d1256845fc4ab957ffd377c760
Fixes: d6af7f347077b22403133239592e478931307759
Fixes: a165d7df1964121eb9df715e6f836a31c865beef
2025-01-05 11:41:40 +02:00
Lasse Collin
2655c81b5e
xzdec: Don't leave Landlock file descriptor open for no reason
This fix is similar to 48ff3f06521ca326996ab9a04d1b342098960427.

Fixes: d74fb5f060b76db709b50f5fd37490394e52f975
2025-01-04 20:05:03 +02:00
Lasse Collin
35df4c2bc0
xz: Make --single-stream imply --keep
Suggested by xx on #tukaani on 2024-04-12.
2025-01-04 20:02:18 +02:00
Lasse Collin
6f412814a8
Update AUTHORS
The contributions have been rewritten.
2025-01-04 19:57:17 +02:00
Lasse Collin
5651d15303
xz: Avoid printf formats like %2$s
It's a POSIX feature that isn't in standard C. It's not available on
Windows. Even MinGW-w64 with __USE_MINGW_ANSI_STDIO doesn't support
it even though it supports POSIX %'d for thousand separators.

Gettext's <libintl.h> provides overrides for printf and other functions
which do support the %2$s formats. Translations use them. But xz should
work on Windows without <libintl.h> too.

Fixes: 3e9177fd206d20d6d8acc7d203c25a9ae0549229
2025-01-04 17:37:46 +02:00
Lasse Collin
63b246c90e
tuklib_mbstr_wrap: Add printf format attribute
It's supported by GCC 3.x already.
2025-01-04 17:37:46 +02:00
Lasse Collin
a7313c01d9
xz: Translate a Windows-specific string
Originally I thought that native Windows builds wouldn't be translated
but nowadays at least MSYS2 ships such binaries.
2025-01-04 17:37:39 +02:00
Lasse Collin
00eb6073c0
xz: Use my_landlock.h
A slightly silly thing is that xz may now query the ABI version up to
three times. We could call my_landlock_ruleset_attr_forbid_all() only
once and cache the result but it didn't seem worth doing.
2025-01-02 15:43:38 +02:00
Lasse Collin
0fc5a625d7
xzdec: Use my_landlock.h 2025-01-02 15:43:38 +02:00
Lasse Collin
38cb8ec9fd
Add my_landlock.h with helper functions to use Linux Landlock
This supports up to Landlock ABI version 6. The current code in
xz and xzdec only support up to ABI version 4.
2025-01-02 15:43:38 +02:00
Lasse Collin
672da29bb3
liblzma: Silence warnings from "clang -Wimplicit-fallthrough" 2025-01-02 15:43:38 +02:00
Lasse Collin
1a8a1ad9a1
Build: Use -Wimplicit-fallthrough=5 when supported
Now that we have the FALLTHROUGH macro, use the strictest mode with
GCC so that comment-based fallthrough markings are no longer accepted.

In GCC, -Wextra includes -Wimplicit-fallthrough=3 and
-Wimplicit-fallthrough is the same as -Wimplicit-fallthrough=3.
Thus, the strict mode requires specifying -Wimplicit-fallthrough=5.

Clang has -Wimplicit-fallthrough which is *not* enabled by -Wextra.
Clang doesn't have a variant that takes an argument. Thus we need
to check for -Wimplicit-fallthrough. Do it before checking for
-Wimplicit-fallthrough=5 so that the latter overrides the former
when using GCC.
2025-01-02 15:43:37 +02:00
Lasse Collin
94adc996e4
Replace "Fall through" comments with FALLTHROUGH 2025-01-02 15:43:37 +02:00
Lasse Collin
f31c3a6647
sysdefs.h: Add FALLTHROUGH macro 2025-01-02 15:43:37 +02:00
Lasse Collin
e34dbd6a0a
xzdec: Fix language in a comment 2025-01-02 15:43:37 +02:00
Lasse Collin
16821252c5
Windows: Make NLS require UCRT and gettext-runtime >= 0.23.1
Also remove the recently-added workaround from tuklib_gettext.h.
Requiring a new enough gettext-runtime is cleaner. I guess it's
mostly MSYS2 where xz is built with translation support, so once
MSYS2 has Gettext >= 0.23.1, this requirement shouldn't be a problem
in practice.
2025-01-02 15:35:25 +02:00
Lasse Collin
aa1807ed94
windows/build-with-cmake.bat: Fix ENABLE_NLS to XZ_NLS
Fixes: 29f77c7b707f2458fb047e77497354b195e05b14
2025-01-02 15:35:16 +02:00
Lasse Collin
ea21c76aa2
Build: Use git log --pretty=medium when creating ChangeLog
It's the default in git-log. Specifying it explicitly is good in case
a user has set format.pretty to a different value.
2024-12-30 11:21:57 +02:00
Lasse Collin
08050c0788
Windows: Update MinGW-w64 + CMake instructions to recommend UCRT 2024-12-30 10:51:33 +02:00
Lasse Collin
653732bd6f
xz man page: Describe the source file deletion in -z and -d options
The DESCRIPTION section always explained it, and the OPTIONS section
only described the differences to the default behavior. However, new
users in a hurry may skip reading DESCRIPTION. The default behavior
is a bit dangerous, thus it's good to repeat in --compress and
--decompress docs that source file is removed after successful operation.

Fixes: https://github.com/tukaani-project/xz/issues/150
2024-12-30 10:51:26 +02:00
Lasse Collin
bb79f79b27
Build: Set libtool -version-info so that it matches with CMake
In the past, they haven't been in sync in development versions
although they (of course) have been in stable releases.
2024-12-29 10:54:45 +02:00
Lasse Collin
cf54f70e14
CMake/macOS: Use GNU Libtool compatible shared library versioning
Because this increases the Mach-O compatibility_version, this commit
shouldn't cause any ABI compatibility trouble for existing CMake users
on macOS. This is assuming that they won't later downgrade to an older
liblzma version that was built with CMake before this commit.

Meson allows customising the Mach-O versioning too. So the three
build systems can be configured to be compatible.
2024-12-29 10:51:53 +02:00
Lasse Collin
94e1791668
CMake: Edit a comment 2024-12-29 10:51:53 +02:00
Lasse Collin
6b50590725
version.sh: Omit an unwanted dot from development versions
It printed 5.7.0.alpha instead of 5.7.0alpha.

Fixes: e7a42cda7c827e016619e8cab15e2faf5d4181ae
2024-12-29 10:51:47 +02:00
Lasse Collin
f7a248f56e
CMake: Remove a duplicate word from a comment 2024-12-27 21:39:28 +02:00
Lasse Collin
8b7c55d148
INSTALL: Document CMAKE_DLL_NAME_WITH_SOVERSION 2024-12-27 21:39:22 +02:00
Lasse Collin
260d5d3620
xz: Fix comments 2024-12-27 09:14:56 +02:00
Dexter Castor Döpping
bf6da9a573
CMake: Disable unity builds project-wide
liblzma and xz can't be compiled as a unity/jumbo build because of
redeclarations and type name reuse. The CMake documentation recommends
setting UNITY_BUILD to false in this case.

This is especially important if we're compiled as a subproject and the
consumer wants to use CMAKE_UNITY_BUILD=ON for the rest of their code
base.

Closes: https://github.com/tukaani-project/xz/pull/158
2024-12-22 20:06:24 +02:00
Lasse Collin
f8c328eed1
Windows: Workaround a UTF-8 issue in Gettext's libintl_setlocale()
See the comment. In this package, locale is set at program startup and
not changed later, so the point (2) in the comment isn't a problem.

Fixes: 46ee0061629fb075d61d83839e14dd193337af59
2024-12-20 16:33:34 +02:00
Lasse Collin
0353390609
Revert "Windows: Use UTF-8 locale when active code page is UTF-8"
This reverts commit 0d0b574cc45045d6150d397776340c068df59e2a.
2024-12-20 16:33:34 +02:00
Lasse Collin
4b319e05af
xzdec: Use setlocale() instead of tuklib_gettext_setlocale()
xzdec isn't translated and doesn't need libintl on Windows even
when NLS is enabled, thus libintl_setlocale() cannot interfere
with the locale settings. Thus, standard setlocale() works perfectly.

In the commit 78868b6e, the explanation in the commit message is wrong.

Fixes: 78868b6ed63fa4c89f73e3dfed27abfb8b0d46db
2024-12-20 16:33:34 +02:00
Lasse Collin
34b80e282e
Windows: Revert the setlocale(LC_ALL, ".UTF8") documentation
Only leave the FindFileFirstA() notes from 20dfca81, reverting
the incorrect setlocale() notes. On Windows, Gettext's <libintl.h>
overrides setlocale() with libintl_setlocale() wrapper. I hadn't
noticed this, and thus my conclusions were wrong.

Fixes: 20dfca8171dad4c64785ac61d5b68972c444877b
2024-12-20 16:33:28 +02:00
Lasse Collin
5794cda064
tuklib_mbstr_wrap: Silence a warning from Clang
Fixes: ca529c3f41a4a19a59e2e252e6dd9255f130c634
2024-12-18 17:50:58 +02:00
Lasse Collin
16c9796ef9
Update THANKS 2024-12-18 17:09:32 +02:00
Lasse Collin
3b5c8a1fca
Update TODO
Fixes: 5f6dddc6c911df02ba660564e78e6de80947c947
2024-12-18 17:09:32 +02:00
Lasse Collin
22a35e64ce
lzmainfo: Use tuklib_mbstr_nonprint 2024-12-18 17:09:32 +02:00
Lasse Collin
03111595ee
xzdec: Use tuklib_mbstr_nonprint 2024-12-18 17:09:32 +02:00
Lasse Collin
d22f96921f
xz: Use tuklib_mbstr_nonprint
Call tuklib_mask_nonprint() on filenames and also on a few other
strings from the command line too.

The filename printed by "xz --robot --list" (in list.c) is also masked.
It's good to get rid of tabs and newlines which would desync the output
but masking other chars wouldn't be strictly necessary. It might matter
with sensible filenames if LC_CTYPE is "C" (when iswprint() might reject
non-ASCII chars) and a script wants to read a filename from xz's output.
Hopefully it's an unusual enough corner case to not be a real problem.
2024-12-18 17:09:32 +02:00
Lasse Collin
40e5733055
Add tuklib_mbstr_nonprint to mask non-printable characters
Malicious filenames or other untrusted strings may affect the state of
the terminal when such strings are printed as part of (error) messages.
Add functions that mask such characters.

It's not enough to handle only single-byte control characters.
In multibyte locales, some control characters are multibyte too, for
example, terminals interpret C1 control characters (U+0080 to U+009F)
that are two bytes as UTF-8.

Instead of checking for control characters with iswcntrl(), this
uses iswprint() to detect printable characters. This is much stricter.
On Windows it's actually too strict as it rejects some characters that
definitely are printable.

Gnulib's quotearg would do a lot more but I hope this simpler method
is good enough here.

Thanks to Ryan Colyer for the discussion about the problems of
the earlier single-byte-only method.

Thanks to Christian Weisgerber for reporting a bug in an earlier
version of this code.

Thanks to Jeroen Roovers for a typo fix.

Closes: https://github.com/tukaani-project/xz/pull/118
2024-12-18 17:09:32 +02:00
Lasse Collin
36190c8c4b
Translations: Add preliminary Georgian translation
Most of the auto-wrapped strings are translated already. A few
strings have changed since this was created though. This file
isn't in the Translation Project *yet* because these strings
are still very new.

Closes: https://github.com/tukaani-project/xz/pull/145
2024-12-18 17:09:31 +02:00
Lasse Collin
4a0c4f92b8
xz: Make one string simpler for translators
Leading spaces in the string can get miscounted by translators.
2024-12-18 17:09:31 +02:00
Lasse Collin
3fcf547e92
lzmainfo: Sync the translatable strings with xz 2024-12-18 17:09:31 +02:00
Lasse Collin
3e9177fd20
xz: Use automatic word wrapping for help texts
--long-help is now one line longer because --lzma1 is now on its
own line.
2024-12-18 17:09:31 +02:00
Lasse Collin
a0eecc9eb2
po/Makevars: Add --keyword=W_:... to XGETTEXT_OPTIONS
The text was copied from tuklib_gettext.h.

Also rearrange the --keyword options to be last on the line.
2024-12-18 17:09:31 +02:00
Lasse Collin
ca529c3f41
Add tuklib_mbstr_wrap for automatic word wrapping
Automatic word wrapping makes translators' work easier and reduces
errors like misaligned columns or overlong lines. Right-to-left
languages and languages that don't use spaces between words will
still need extra effort. (xz hasn't been translated to any RTL
language so far.)
2024-12-18 17:09:31 +02:00
Lasse Collin
314b83ceba
Build: Sort filenames to ASCII order in Makefile.am 2024-12-18 17:09:31 +02:00
Lasse Collin
df399c5255
tuklib_mbstr_width: Add tuklib_mbstr_width_mem()
It's a new function split from tuklib_mbstr_width().
It's useful with partial strings that aren't terminated with \0.
2024-12-18 17:09:30 +02:00
Lasse Collin
51081efae4
tuklib_mbstr_width: Update a comment about shift states 2024-12-18 17:09:30 +02:00
Lasse Collin
7ff1b0ac53
tuklib_mbstr_width: Don't mention shift states in the API docs
It is assumed that this code won't be used with charsets that use
locking shift states.
2024-12-18 17:09:30 +02:00
Lasse Collin
3c16105936
tuklib_mbstr_width: Use stricter return value checking
This should make no difference in practice (at least if mbrtowc()
isn't broken).
2024-12-18 17:09:30 +02:00
Lasse Collin
b797c44c42
tuklib_mbstr_width: Change the behavior when wcwidth() is not available
If wcwidth() isn't available (Windows), previously it was assumed
that one byte == one column in the terminal. Now it is assumed that
one multibyte character == one column. This works better with UTF-8.
Languages that only use single-width characters without any combining
characters should work correctly with this.

In xz, none of po/*.po contain combining characters and only ko.po,
zh_CN.po, and zh_TW.po contain fullwidth characters. Thus, "only"
those three translations in xz are broken on Windows with the
UTF-8 code page. Broken means that column headings in xz -lvv and
(only in the master branch) strings in --long-help are misaligned,
so it's not a huge problem. I don't know if those three languages
displayed perfectly before the UTF-8 change because I hadn't tested
translations with native Windows builds before.

Fixes: 46ee0061629fb075d61d83839e14dd193337af59
2024-12-18 17:09:30 +02:00
Lasse Collin
78868b6ed6
xzdec: Use setlocale() via tuklib_gettext_setlocale()
xzdec isn't translated and didn't have locale-specific behavior
in the past. On Windows with UTF-8 in the application manifest,
setting the locale makes a difference though:

  - Without any setlocale() call, non-ASCII filenames don't display
    properly in Command Prompt unless one first uses "chcp 65001"
    to set the console code page to UTF-8.

  - setlocale(LC_ALL, "") is enough to make non-ASCII filenames
    print correctly in Command Prompt without using "chcp 65001",
    assuming that the non-UTF-8 code page (like 850) supports
    those non-ASCII characters.

  - setlocale(LC_ALL, ".UTF8") is even better because then mbrtowc() and
    such functions use an UTF-8 locale instead of a legacy code page.
    The tuklib_gettext_setlocale() macro takes care of this (without
    enabling any translations).

Fixes: 46ee0061629fb075d61d83839e14dd193337af59
2024-12-18 17:09:30 +02:00
Lasse Collin
0d0b574cc4
Windows: Use UTF-8 locale when active code page is UTF-8
XZ Utils 5.6.3 set the active code page to UTF-8 to fix CVE-2024-47611.
This wasn't paired with UCRT-specific setlocale(LC_ALL, ".UTF8"), thus
non-ASCII characters from translations became mojibake.

Fixes: 46ee0061629fb075d61d83839e14dd193337af59
2024-12-18 17:09:30 +02:00
Lasse Collin
20dfca8171
Windows: Document the need for setlocale(LC_ALL, ".UTF8")
Also warn about unpaired surrogates and (somewhat UTF-8-specific)
MAX_PATH issue in FindFirstFileA().

Fixes: 46ee0061629fb075d61d83839e14dd193337af59
2024-12-18 17:09:29 +02:00
Lasse Collin
4e936f2340
xzdec: Call tuklib_progname_init() early enough
If the early pledge() call on OpenBSD fails, it calls my_errorf()
which requires the "progname" variable.

Fixes: d74fb5f060b76db709b50f5fd37490394e52f975
2024-12-18 17:09:29 +02:00
Lasse Collin
61feaf681b
CMake: Bump maximum policy version to 3.31
With CMake 3.31, there were a few warnings from
CMP0177 "install() DESTINATION paths are normalized".
These occurred because the install(FILES) command in
my_install_man_lang() is called with a DESTINATION path
that contains two consecutive slashes, for example,
"share/man//man1". Such a path is for the English man pages.
With translated man pages, the language code goes between
the slashes. The warning was probably triggered because the
extra slash gets removed by the normalization.
2024-12-18 17:09:29 +02:00
Lasse Collin
b0bb84dd7b
Update THANKS 2024-12-18 17:09:29 +02:00
Dexter Castor Döpping
bee0c044d3
liblzma: Fix incorrect macro name in a comment
Fixes: 33b8a24b6646a9dbfd8358405aec466b13078559
Closes: https://github.com/tukaani-project/xz/pull/155
2024-12-18 17:09:29 +02:00
Lasse Collin
2cfa1ad0a9
license-check.sh: Add an exception for doc/SHA256SUMS
Fixes: 36b531022f24a2ab57a2dfb9e5052f1c176e9d9a
2024-12-18 17:09:21 +02:00
Lasse Collin
36b531022f
doc/SHA256SUMS: Add the list of SHA-256 hashes of release files
The release files are signed but verifying the signatures cannot
catch certain types of attacks:

1. A malicious maintainer could make more than one variant of
   a package. One could be for general distribution. Another
   with malicious content could be targeted to specific users,
   for example, distributing the malicious version on a mirror
   controlled by the attacker.

2. If the signing key of an honest maintainer was compromised
   without being detected, a similar situation as described
   above could occur.

SHA256SUMS could be put on the project website but having it in
the Git repository makes it obvious that old lines aren't modified
when the file is updated.

Hashes of uncompressed files are included too. This way tarballs
can be recompressed and the hashes can still be verified.
2024-12-01 21:38:17 +02:00
Lasse Collin
fe9e66993f Docs: Remove .github/SECURITY.md
One of the reasons to have this file in the xz repository was to
show vulnerability reporting info in the Security section on GitHub.
On 2024-11-25, I added SECURITY.md to the tukaani-project organization
on GitHub:

    https://github.com/tukaani-project/.github/blob/main/SECURITY.md

GitHub shows that file in all projects in the organization unless
overridden by a project-specific SECURITY.md. Thus, removing
the file from the xz repo makes GitHub show the organization-wide
text instead.

Maintaining a single copy for the whole GitHub organization makes
things simpler. It's also nicer to have fewer GitHub-specific files
in the xz repo. Information how to report bugs (including security
issues) is available in README and on the home page too.

The OpenSSF Scorecard tool didn't find .github/SECURITY.md from the
xz repository. There was a suggestion to move the file to the top-level
directory where Scorecard should find it. However, Scorecard does find
the organization-wide SECURITY.md. Thus, the file isn't needed in the
xz repository to score points in the Scorecard game:

    https://scorecard.dev/viewer/?uri=github.com/tukaani-project/xz

Closes: https://github.com/tukaani-project/xz/issues/148
Closes: https://github.com/tukaani-project/xz/pull/149
2024-11-30 12:05:59 +02:00
Lasse Collin
b361772736 Translations: Update the Chinese (traditional) translation 2024-11-30 10:27:14 +02:00
Lasse Collin
c15115f7ed liblzma: Optimize the loop conditions in BCJ filters
Compilers cannot optimize the addition "i + 4" away since theoretically
it could overflow.
2024-11-26 19:17:42 +02:00
Lasse Collin
9f69e71e78 Update THANKS 2024-11-25 16:26:54 +02:00
Mark Wielaard
48ff3f0652 xz: Landlock: Fix a file descriptor leak 2024-11-25 12:28:44 +02:00
Sam James
dbca3d078e CI: update FreeBSD, NetBSD, OpenBSD, Solaris actions
Checked the changes and they're all innocuous. This should hopefully
fix the "externally managed" pip error in these jobs that started
recently.
2024-10-02 10:10:54 +03:00
Lasse Collin
a94b85bea3 Add NEWS for 5.6.3 2024-10-01 20:06:54 +03:00
Lasse Collin
be4bf94446 cmake/tuklib_large_file_support.cmake: Add a missing include
v5.2 didn't build with CMake. Other branches had
include(CMakePushCheckState) in top-level CMakeLists.txt
which made the build work.

Fixes: 597f49b61475438a43a417236989b2acc968a686
2024-10-01 14:49:41 +03:00
Lasse Collin
1ebbe915d4 Update THANKS 2024-10-01 12:10:23 +03:00
Lasse Collin
74702ee00e Tests/Windows: Add the application manifest to the test programs
This ensures that the test programs get executed the same way as
the binaries that are installed.
2024-10-01 12:10:23 +03:00
Lasse Collin
7ddf2273e0 license-check.sh: Add an exception for w32_application.manifest
The file gets embedded as is into executables, thus it cannot
hold a license identifier.
2024-10-01 12:10:23 +03:00
Lasse Collin
46ee006162 Windows: Embed an application manifest in the EXE files
IMPORTANT: This includes a security fix to command line tool
           argument handling.

Some toolchains embed an application manifest by default to declare
UAC-compliance. Some also declare compatibility with Vista/8/8.1/10/11
to let the app access features newer than those of Vista.

We want all the above but also two more things:

  - Declare that the app is long path aware to support paths longer
    than 259 characters (this may also require a registry change).

  - Force the code page to UTF-8. This allows the command line tools
    to access files whose names contain characters that don't exist
    in the current legacy code page (except unpaired surrogates).
    The UTF-8 code page also fixes security issues in command line
    argument handling which can be exploited with malicious filenames.
    See the new file w32_application.manifest.comments.txt.

Thanks to Orange Tsai and splitline from DEVCORE Research Team
for discovering this issue.

Thanks to Vijay Sarvepalli for reporting the issue to me.

Thanks to Kelvin Lee for testing with MSVC and helping with
the required build system fixes.
2024-10-01 12:10:23 +03:00
Lasse Collin
dad1530915 Windows: Set DLL name accurately in StringFileInfo on Cygwin and MSYS2
Now the information in the "Details" tab in the file properties
dialog matches the naming convention of Cygwin and MSYS2. This
is only a cosmetic change.
2024-09-30 16:55:23 +03:00
Lasse Collin
8940ecb96f common_w32res.rc: White space edits
LANGUAGE and VS_VERSION_INFO begin new statements so put an empty line
between them.
2024-09-29 01:27:16 +03:00
Lasse Collin
c3b9dad07d CMake: Add the resource files to the Cygwin and MSYS2 builds
Autotools-based build has always done this so this is for consistency.

However, the CMake build won't create the DEF file when building
for Cygwin or MSYS2 because in that context it should be useless.
(If Cygwin or MSYS2 is used to host building of normal Windows
binaries then the DEF file is still created.)
2024-09-29 01:26:45 +03:00
Lasse Collin
da4f275bd1 CMake: Fix Windows resource file dependencies
If common_w32res.rc is modified, the resource files need to be rebuilt.
In contrast, the liblzma*.map files truly are link dependencies.
2024-09-29 01:26:13 +03:00
Lasse Collin
1c673c0aac CMake: Checking for CYGWIN covers MSYS2 too
On MSYS2, both CYGWIN and MSYS are set.
2024-09-29 01:26:13 +03:00
Lasse Collin
6aaa0173b8 Translations: Add the SPDX license identifier to pt_BR.po 2024-09-28 09:38:13 +03:00
Lasse Collin
dc7b9f24b7 Windows/CMake: Use the correct resource file for lzmadec.exe
CMakeLists.txt was using xzdec_w32res.rc for both xzdec and lzmadec.

Fixes: 998d0b29536094a89cf385a3b894e157db1ccefe
2024-09-25 21:31:06 +03:00
Lasse Collin
b834ae5f80 Translations: Update the Brazilian Portuguese translation 2024-09-25 21:29:59 +03:00
Lasse Collin
eceb023d4c Update THANKS 2024-09-17 01:26:02 +03:00
Tobias Stoeckmann
76cfd0a9bb lzmainfo: Avoid integer overflow
The MB output can overflow with huge numbers. Most likely these are
invalid .lzma files anyway, but let's avoid garbage output.

lzmadec was adapted from LZMA Utils. The original code with this bug
was written in 2005, over 19 years ago.

Co-authored-by: Lasse Collin <lasse.collin@tukaani.org>
Closes: https://github.com/tukaani-project/xz/pull/144
2024-09-17 01:26:02 +03:00
Tobias Stoeckmann
78355aebb7 xzdec: Remove unused short option -M
"xzdec -M123" exited with exit status 1 without printing
any messages. The "M:" entry should have been removed when
the memory usage limiter support was removed from xzdec.

Fixes: 792331bdee706aa852a78b171040ebf814c6f3ae
Closes: https://github.com/tukaani-project/xz/pull/143
[ Lasse: Commit message edits ]
2024-09-16 23:33:29 +03:00
Lasse Collin
e5758db7bd Update THANKS 2024-09-10 13:54:47 +03:00
Firas Khalil Khana
80ffa38f56 Build: Fix a typo in autogen.sh
Fixes: e9be74f5b129fe8a5388d588e68b1b7f5168a310
Closes: https://github.com/tukaani-project/xz/pull/141
2024-09-10 13:43:00 +03:00
Lasse Collin
68c54e45d0 Translations: Update Chinese (simplified) translation
Differences to the zh_CN.po file from the Translation Project:

  - Two uses of \v were fixed.

  - Missing "OPTS" translation in --riscv[=OPTS] was copied from
    previous lines.

  - "make update-po" was run to remove line numbers from comments.
2024-09-02 20:08:40 +03:00
Lasse Collin
2230692aa1 Translations: Update the Catalan translation
Differences to the ca.po file from the Translation Project:

  - An overlong line translating --filters-help was wrapped.

  - "make update-po" was used to remove line numbers from the comments
    to match the changes in fccebe2b4fd513488fc920e4dac32562ed3c7637
    and 093490b58271e9424ce38a7b1b38bcf61b9c86c6. xz.pot in the TP
    is older than these commits.
2024-09-02 19:40:50 +03:00
Lasse Collin
3e7723ce26 Update THANKS 2024-09-02 17:33:50 +03:00
Lasse Collin
d3e0e679b2 CMake: Don't install lzmadec.1 symlinks if XZ_TOOL_LZMADEC=OFF
Thanks-to: 榆柳松 (ZhengSen Wang) <wzhengsen@gmail.com>
Fixes: fb50c6ba1d4c9405e5b12b5988b01a3002638c5d
Closes: https://github.com/tukaani-project/xz/pull/134
2024-09-02 17:33:42 +03:00
Lasse Collin
acdf21033a CMake: Fix the build when XZ_TOOL_LZMADEC=OFF
Co-developed-by: 榆柳松 (ZhengSen Wang) <wzhengsen@gmail.com>
Fixes: fb50c6ba1d4c9405e5b12b5988b01a3002638c5d
Fixes: https://github.com/tukaani-project/xz/pull/134
2024-09-02 17:33:06 +03:00
Lasse Collin
5e37598750 Update THANKS 2024-08-22 11:01:07 +03:00
Yifeng Li
6cd7c86078 liblzma: Fix x86-64 movzw compatibility in range_decoder.h
Support for instruction "movzw" without suffix in "GNU as" was
added in commit [1] and stabilized in binutils 2.27, released
in August 2016. Earlier systems don't accept this instruction
without a suffix, making range_decoder.h's inline assembly
unable to build on old systems such as Ubuntu 16.04, creating
error messages like:

    lzma_decoder.c: Assembler messages:
    lzma_decoder.c:371: Error: no such instruction: `movzw 2(%r11),%esi'
    lzma_decoder.c:373: Error: no such instruction: `movzw 4(%r11),%edi'
    lzma_decoder.c:388: Error: no such instruction: `movzw 6(%r11),%edx'
    lzma_decoder.c:398: Error: no such instruction: `movzw (%r11,%r14,4),%esi'

Change "movzw" to "movzwl" for compatibility.

[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=c07315e0c610e0e3317b4c02266f81793df253d2

Suggested-by: Lasse Collin <lasse.collin@tukaani.org>
Tested-by: Yifeng Li <tomli@tomli.me>
Signed-off-by: Yifeng Li <tomli@tomli.me>
Fixes: 3182a330c1512cc1f5c87b5c5a272578e60a5158
Fixes: https://github.com/tukaani-project/xz/issues/121
Closes: https://github.com/tukaani-project/xz/pull/136
2024-08-22 10:59:08 +03:00
Lasse Collin
bf901dee5d Build: Comment that elf_aux_info(3) will be available on OpenBSD >= 7.6 2024-07-19 20:06:24 +03:00
Lasse Collin
f7103c2c2a Revert "liblzma: Add ARM64 CRC32 instruction support detection on OpenBSD"
This reverts commit dc03f6290f5b9bd3d50c7e12e58dee870889d599.

OpenBSD 7.6 will support elf_aux_info(3), and the detection code used
on FreeBSD will work on OpenBSD 7.6 too. Keep things simpler and drop
the OpenBSD-specific sysctl() method.

Thanks to Christian Weisgerber.
2024-07-19 20:06:24 +03:00
Lasse Collin
7c292dd0bf liblzma: Tweak a comment 2024-07-13 22:10:37 +03:00
Lasse Collin
6408edac55 CMake: Bump maximum policy version to 3.30 2024-07-11 22:17:56 +03:00
Lasse Collin
9231c39ffb CMake: Require CMake 3.20 or later
This allows a few cleanups.
2024-07-11 20:11:38 +03:00
Lasse Collin
028185dd48 Update THANKS 2024-07-09 14:27:51 +03:00
Lasse Collin
baecfa1426 xz: Remove the TODO comment about --recursive
It won't be implemented. find + xargs is more flexible, for example,
it allows compressing small files in parallel. An example for that
has been included in the xz man page since 2010.
2024-07-06 14:04:48 +03:00
Lasse Collin
f691d58fae Document --disable-loongarch-crc32 in INSTALL 2024-07-06 14:04:16 +03:00
Lasse Collin
b3e53122f4 CMake: Link xz against Threads::Threads if using pthreads
The liblzma target was recently changed to link against Threads::Threads
with the PRIVATE keyword. I had forgotten that xz itself depends on
pthreads too due to pthread_sigmask(). Thus, the build broke when
building shared liblzma and pthread_sigmask() wasn't in libc.

Thanks to Peter Seiderer for the bug report.

Fixes: ac05f1b0d7cda1e7ae79775a8dfecc54601d7f1c
Fixes: https://github.com/tukaani-project/xz/issues/129#issuecomment-2204522994
2024-07-03 20:45:48 +03:00
Lasse Collin
5742ec1fc7 Update THANKS 2024-07-02 22:49:33 +03:00
Lasse Collin
2d13d10357 CMake: Improve NLS error messages 2024-07-02 22:41:48 +03:00
Lasse Collin
628d8d2c4f CMake: Update the comment at the top of CMakeLists.txt
While po/*.gmo files won't be used from the release tarball,
the generated translated man pages will be used still. Those
are text files and po4a has slightly more dependencies than
gettext tools so installing po4a might be a bit more challenging
in some situations.
2024-07-02 22:41:48 +03:00
Lasse Collin
b4b23c94fd CMake: Drop support for pre-generated po/*.gmo files
When a release tarball is created using Autotools, the tarball includes
po/*.gmo files which are binary files generated from po/*.po. Other
tarball creation methods don't and won't create the .gmo files.

It feels clearer if CMake will never install pre-generated binary files
from the source package. If people are able to install CMake, they
likely are able to install gettext tools as well (assuming they want
translations).
2024-07-02 22:41:00 +03:00
Lasse Collin
fb99f8e8c5 CMake: Make XZ_NLS handling more robust
If a user set XZ_NLS=ON but find_package(Intl) failed or CMake version
wasn't at least 3.20, the configuration would fail in a cryptic way.

If XZ_NLS is enabled, require that CMake is new enough and that either
gettext tools or pre-generated .gmo files are available. Otherwise fail
the configuration. Previously missing gettext tools and .gmo files would
only result in a warning.

Missing man page translations are still only a warning.

Thanks to Peter Seiderer for the bug report.

Fixes: https://github.com/tukaani-project/xz/issues/129
Closes: https://github.com/tukaani-project/xz/pull/130
2024-07-02 22:40:37 +03:00
Lasse Collin
ec6157570e CI: Add gettext as a dependency to CMake builds 2024-07-02 22:40:37 +03:00
Lasse Collin
24f0f7e399 CMake: Fix ENABLE_NLS comment too
Fixes: 29f77c7b707f2458fb047e77497354b195e05b14
2024-07-02 22:39:46 +03:00
Lasse Collin
a0df067613 CMake: The compile definition is ENABLE_NLS, not XZ_NLS
The CMake variables were renamed and accidentally also
the compile definition was renamed. As a result, translation
support wasn't actually enabled in the executables.

Fixes: 29f77c7b707f2458fb047e77497354b195e05b14
2024-07-02 18:39:43 +03:00
Lasse Collin
45d08abc33 Update AUTHORS and THANKS 2024-07-01 17:33:20 +03:00
Xi Ruoyao
7baf6835cf liblzma: Speed up CRC32 calculation on 64-bit LoongArch
The crc.w.{b/h/w/d}.w instructions in LoongArch can calculate the CRC32
result for 1/2/4/8 bytes in a single operation. Using these is much
faster compared to the generic method.

Optimized CRC32 is enabled unconditionally on 64-bit LoongArch because
the LoongArch specification says that CRC32 instructions shall be
implemented for 64-bit processors. Optimized CRC32 isn't enabled for
32-bit LoongArch processors because not enough information is available
about them.

Co-authored-by: Lasse Collin <lasse.collin@tukaani.org>

Closes: https://github.com/tukaani-project/xz/pull/86
2024-07-01 17:09:57 +03:00
Lasse Collin
0ed8936685 liblzma: ARM64 CRC32: Align the buffer faster
Instead of doing it byte by byte, use the 1/2/4-byte CRC32 instructions.
2024-06-28 14:20:49 +03:00
Sam James
7e99856f66 CI: Speed up Valgrind job by using --trace-children-skip-by-arg=...
This addresses the issue I mentioned in
6c095a98fbec70b790253a663173ecdb669108c4 and speeds up the Valgrind
job a bit, because non-xz tools aren't run unnecessarily with
Valgrind by the script tests.
2024-06-28 14:18:35 +03:00
Lasse Collin
2402e8a1ae Build: Prepend, not append, PTHREAD_CFLAGS to LIBS
It shouldn't make any difference because LIBS should be empty
at that point in configure. But prepending is the correct way
because in general the libraries being added might require other
libraries that come later on the command line.
2024-06-26 15:48:56 +03:00
Lasse Collin
7bb46f2b7b Build: Use AC_LINK_IFELSE to handle implicit function declarations
It's more robust in case the compiler allows pre-C99 implicit function
declarations. If an x86 intrinsic is missing and gets treated as
implicit function, the linking step will very probably fail. This
isn't the only way to workaround implicit function declarations but
it might be the simplest and cleanest.

The problem hasn't been observed in the wild.

There are a couple more AC_COMPILE_IFELSE uses in configure.ac.
Of these, Landlock check calls prctl() and in theory could have
the same problem. In practice it doesn't as the check program
looks for several other things too. However, it was changed to
AC_LINK_IFELSE still to look more correct.

Similarly, m4/tuklib_cpucores.m4 and m4/tuklib_physmem.m4 were
updated although they haven't given any trouble either. They
have worked all these years because those check programs rely
on specific headers and types: if headers or types are missing,
compilation will fail. Using the linker makes these checks more
similar to the ones in cmake/tuklib_*.cmake which always link.
2024-06-26 15:48:56 +03:00
Lasse Collin
35eb57355a Build: Use AC_LINK_IFELSE instead of -Werror
AC_COMPILE_IFELSE needed -Werror because Clang <= 14 would merely
warn about the unsupported attribute and implicit function declaration.
Changing to AC_LINK_IFELSE handles the implicit declaration because
the symbol __crc32d is unlikely to exist in libc.

Note that the other part of the check is that #include <arm_acle.h>
must work. If the header is missing, most compilers give an error
and the linking step won't be attempted.

Avoiding -Werror makes the check more robust in case CFLAGS contains
warning flags that break -Werror anyway (but this isn't the only check
in configure.ac that has this problem). Using AC_LINK_IFELSE also makes
the check more similar to how it is done in CMakeLists.txt.
2024-06-26 15:48:56 +03:00
Lasse Collin
5a728813c3 Build: Sync the compile check changes from CMakeLists.txt
It's nice to keep these in sync. The use of main() will later allow
AC_LINK_IFELSE usage too which may avoid the more fragile -Werror.
2024-06-26 15:48:56 +03:00
Lasse Collin
5279828635 CMake: Not experimental anymore
While the CMake support has gotten a lot less testing than
the Autotools-based build, the supported features should now
be equal. The output may differ slightly, for example,
liblzma.pc may have

    Libs.private: -pthread -lpthread

with Autotools on GNU/Linux. CMake doesn't put any options
in Libs.private because on modern glibc the pthread functions
are in libc. The options options aren't required to link static
liblzma into an application.

Autotools-based build doesn't generate or install
lib/cmake/liblzma-*.cmake files. This means that on most
platforms one cannot rely on

    find_package(liblzma 5.2.5 REQUIRED CONFIG)

or such finding those files.
2024-06-26 15:48:56 +03:00
Lasse Collin
de215a0517 CMake: Use configure_file() to copy a file
I had missed this simpler method before. It does create a dependency
so that if .in.h changes the copying is done again.
2024-06-25 16:13:39 +03:00
Lasse Collin
e620f35097 CMake: Always add pthread flags into CMAKE_REQUIRED_LIBRARIES
It was weird to add CMAKE_THREAD_LIBS_INIT in CMAKE_REQUIRED_LIBRARIES
only if CLOCK_MONOTONIC is available. Alternative would be to remove
the thread libs from CMAKE_REQUIRED_LIBRARIES after the check for
pthread_condattr_setclock() but keeping the libs should be fine too.
Then it's ready in case more pthread functions were wanted some day.
2024-06-25 15:56:39 +03:00
Sam James
068a70e549 CMake: Tweak comments
Co-authored-by: Lasse Collin <lasse.collin@tukaani.org>
2024-06-25 14:55:15 +03:00
Lasse Collin
3c95c93bca CMake: Edit white space for consistency 2024-06-25 14:54:53 +03:00
Lasse Collin
114cba69db CMake: Fix three checks if building with -flto
In CMake, check_c_source_compiles() always links too. With
link-time optimization, unused functions may get omitted if
main() doesn't depend on them. Consider the following which
tries to check if somefunction() is available when <someheader.h>
has been included:

    #include <someheader.h>
    int foo(void) { return somefunction(); }
    int main(void) { return 0; }

LTO may omit foo() completely because the program as a whole doesn't
need it and then the program will link even if the symbol somefunction
isn't available in libc or other library being linked in, and then
the test may pass when it shouldn't.

What happens if <someheader.h> doesn't declare somefunction()?
Shouldn't the test fail in the compilation phase already? It should
but many compilers don't follow the C99 and later standards that
prohibit implicit function declarations. Instead such compilers
assume that somefunction() exists, compilation succeeds (with a
warning), and then linker with LTO omits the call to somefunction().

Change the tests so that they are part of main(). If compiler accepts
implicitly declared functions, LTO cannot omit them because it has to
assume that they might have side effects and thus linking will fail.
On the other hand, if the functions/intrinsics being used are supported,
they might get optimized away but in that case it's fine because they
really are supported.

It is fine to use __attribute__((target(...))) for main(). At least
it works with GCC 4.9 to 14.1 on x86-64.

Reported-by: Sam James <sam@gentoo.org>
2024-06-25 14:54:53 +03:00
Lasse Collin
78e882205e CMake: Use MATCHES instead of multiple STREQUAL 2024-06-25 14:54:53 +03:00
Lasse Collin
d3f20382fc CMake: Improve the comment about LIBS 2024-06-25 14:54:53 +03:00
Lasse Collin
33ec377729 CMake: Fix a typo in a message
It was spotted with codespell.
2024-06-24 20:01:25 +03:00
Lasse Collin
2a47be823c Document CMake options in INSTALL 2024-06-24 19:59:04 +03:00
Lasse Collin
3faf4e8079 CI: Don't omit crc32 from the list with CMake anymore
XZ_CHECKS accepts it but works without too.
2024-06-24 18:15:58 +03:00
Lasse Collin
1bf83cded2 CI: Workaround buggy config.guess on Ubuntu 22.04LTS and 24.04LTS
Check for the wrong triplet from config.guess and override it with
the --build option on the configure command line. Then i386 assembly
autodetection will work.

These Ubuntu versions (and as of writing, also Debian unstable)
ship config.guess version 2022-01-09 which contains a bug that
was fixed in version 2022-05-08. It results in a wrong configure
triplet when using CC="gcc -m32" to build i386 binaries.

Upstream fix:
https://git.savannah.gnu.org/cgit/config.git/commit/?id=f56a7140386d08a531bcfd444d632b28c61a6329

More information:
https://mail.gnu.org/archive/html/config-patches/2022-05/msg00003.html
2024-06-24 18:15:58 +03:00
Lasse Collin
dbcdabf68f CI: Use CC="gcc -m32" to get i386 compiler on x86-64
The old method put it in CFLAGS which is a wrong place because
config.guess doesn't read CFLAGS.
2024-06-24 18:15:58 +03:00
Lasse Collin
0c1e6d900b CI: Let CMake use the CC environment variable
CC from environment is used to initialize CMAKE_C_COMPILER so
setting CMAKE_C_COMPILER explicitly isn't needed.

The syntax in ci_build.bash was broken in case one wished to put
spaces in CC.
2024-06-24 18:15:58 +03:00
Lasse Collin
a3d6eb797c CMake: Add autodetection for 32-bit x86 CRC assembly usage 2024-06-24 18:15:58 +03:00
Lasse Collin
dbc14f213e CMake: Move option(XZ_ASM_I386) downwards a few lines 2024-06-23 23:09:14 +03:00
Lasse Collin
e5c2b07b48 DOS: Update Makefile and config.h for the CRC changes 2024-06-23 23:09:14 +03:00
Lasse Collin
fe77c4e130 liblzma: Tidy up crc_common.h
Prefix ARM64_RUNTIME_DETECTION with CRC_ and reorder it to be with
the other ARM64-specific lines. That macro isn't used outside this
file.

ARM64 CLMUL implementation doesn't exist yet and thus CRC64_ARM64_CLMUL
isn't used anywhere yet.

It's not ideal that the single-letter CRC utility macros are here
as they pollute the namespace of the LZ encoder files. Those could
be moved their own crc_macros.h like they were in 5.2.x but in practice
this is fine enough already.
2024-06-23 23:09:14 +03:00
Lasse Collin
7484d37538 liblzma: Move lzma_crcXX_table[][] declarations to crc_common.h
LZ encoder needs lzma_crc32_table[0] but otherwise those tables
are private to the CRC code. In contrast, the other things in
check.h are needed in several places.
2024-06-23 15:37:46 +03:00
Lasse Collin
85b081f5d4 liblzma: Make 32-bit x86 CRC assembly co-exist with CLMUL
Now runtime detection of CLMUL support can pick between the CLMUL and
the generic assembly implementations. Whatever overhead this has for
builds that omit CLMUL completely isn't important because builds for
any non-ancient system is likely to include the CLMUL code too.

Handle the CRC tables in crcXX_fast.c files because now these files
are built even when assembly code is used.

If 32-bit x86 assembly is enabled then it will always be built even
if compiler flags were such that CLMUL would be allowed unconditionally.
That is, runtime detection will be used anyway. This keeps the build
rules simpler.

In LZ encoder, build and use lzma_lz_hash_table[256] if CLMUL CRC
is used without runtime detection. Previously this wasn't needed
because crc32_table.c included the lzma_crc32_table[][] in the build
unless encoder support had been disabled. Including an 8 KiB table
was silly when only 1 KiB is actually used. So now liblzma is 7 KiB
smaller if CLMUL is enabled without runtime detection.
2024-06-23 14:36:44 +03:00
Lasse Collin
6667d503b5 liblzma: CRC: Rename crcXX_generic to lzma_crcXX_generic
This prepares for the possibility that lzma_crc32_generic and
lzma_crc64_generic are extern functions.
2024-06-23 14:36:44 +03:00
Lasse Collin
1dca581ff2 CMake: Define HAVE_CRC_X86_ASM when 32-bit x86 CRC assembly is used 2024-06-23 14:36:44 +03:00
Lasse Collin
f76837acb6 Build: Define HAVE_CRC_X86_ASM when 32-bit x86 CRC assembly is used
This makes it easier to determine when the CRC tables are needed.
2024-06-23 14:36:44 +03:00
Lasse Collin
9ce0866b07 CI: Update to the new renamed options in CMakeLists.txt 2024-06-21 00:47:27 +03:00
Lasse Collin
0232e66d5b CMake: Add XZ_EXTERNAL_SHA256 2024-06-20 21:53:07 +03:00
Lasse Collin
4535b80cae CMake: Move threading detection a few lines up
It feels clearer this way, and when support for external SHA-256
is added, this will keep the order of the library detection the
same as in configure.ac (check for pthreads before libmd) although
it shouldn't matter in practice.
2024-06-20 21:53:07 +03:00
Lasse Collin
94d062dbac CMake: Move the sandbox code out of the liblzma section
Sandboxing is for the command line tools, not liblzma.
No functional changes.
2024-06-20 21:53:07 +03:00
Lasse Collin
75ce4797d4 CMake: Keep existing options in LIBS when adding -lrt
This makes no difference yet because -lrt is currently the only option
that might be added to LIBS.
2024-06-20 21:53:07 +03:00
Lasse Collin
47aaa92516 CMake: Don't install scripts if the xz tool isn't built
The scripts need the xz tool.
2024-06-20 21:53:07 +03:00
Lasse Collin
fb50c6ba1d CMake: Add XZ_TOOL_XZDEC and XZ_TOOL_LZMADEC 2024-06-20 21:53:07 +03:00
Lasse Collin
def767f7d1 CMake: Add XZ_TOOL_LZMAINFO 2024-06-20 21:53:07 +03:00
Lasse Collin
5600e370fb CMake: Add XZ_TOOL_XZ 2024-06-20 21:53:07 +03:00
Lasse Collin
6a3c4aaa43 Windows: Drop Visual Studio 2013 support
This simplifies things a little. Building liblzma with VS2013 probably
still worked but building the command line tools was not supported.

Microsoft ended support for VS2013 on 2024-04.
2024-06-20 21:53:07 +03:00
Lasse Collin
5d5c92b262 CMake: Add XZ_TOOL_SCRIPTS 2024-06-20 21:53:07 +03:00
Lasse Collin
d274a2bc00 CMake: Add XZ_DOC 2024-06-20 21:53:07 +03:00
Lasse Collin
188143a50a CMake: Refactor XZ_SYMBOL_VERSIONING to match configure.ac
Make the available options and their behavior match
--enable-symbol-versions in configure.ac.

Don't enable symbol versions on Linux if not using glibc. Previously
the generic variant was selected on Microblaze or if using NVHPC
without checking that libc is glibc.

Leave the cache variable to "auto" or "yes" if that was specified
instead of setting it to the autodetected value by default. A downside
is that one cannot easily see which variant the autodetection code
has selected. The same applies to XZ_SANDBOX and XZ_THREADS though.
2024-06-20 21:53:03 +03:00
Lasse Collin
cc52ef8ed3 CMake: Use the same option list for XZ_THREADS as in configure.ac
Also clarify that "yes" will fail if no threading support is found.
If no threading is wanted, it has to be disabled manually.

configure.ac doesn't behave this way at the moment. Instead it
assumes pthreads to be present if not targeting Windows. If pthreads
actually are missing, the build fails later.
2024-06-20 15:12:19 +03:00
Lasse Collin
37f7af3452 CMake: Use the same option list for XZ_SANDBOX as in configure.ac
It's simpler to document this way.
2024-06-20 15:00:05 +03:00
Lasse Collin
c715dec8e8 CMake: Fix indentation 2024-06-20 15:00:05 +03:00
Lasse Collin
ea379f2f18 CMake: Add warning options for GCC and Clang
The list was copied from configure.ac and should be kept in sync.
(Pretend that the deleted comment in CMakeLists.txt didn't exist.)

There is no need to add equivalent of --enable-werror as CMake >= 3.24
supports -DCMAKE_COMPILE_WARNING_AS_ERROR=ON.
2024-06-20 15:00:05 +03:00
Lasse Collin
7422333819 CMake: Use \040 instead of \x20 for a space
This is for consistency with 4c81c9611f8b2e1ad65eb7fa166afc570c58607e
where \040 has to be used because \0x20F gets interpret at three hex
digits. Octals escapes are never longer than three digits.
2024-06-20 15:00:05 +03:00
Lasse Collin
e8854b6bdc CMake: Add XZ_ASSUME_RAM 2024-06-20 15:00:05 +03:00
Lasse Collin
e1127e75cb CMake: Rename liblzma_INSTALL_CMAKEDIR to XZ_INSTALL_CMAKEDIR 2024-06-20 15:00:05 +03:00
Lasse Collin
96abfe98c1 CMake: Refactor ADDITIONAL_CHECK_TYPES to XZ_CHECKS
Now "crc32" is in the list too for completeness but it doesn't
actually have any effect. The description of the cache variable
says that "crc32 is always built" so it should be clear enough.
2024-06-20 15:00:05 +03:00
Lasse Collin
679500ffe0 CMake: Rename the cache variable POSIX_SHELL to XZ_POSIX_SHELL
We still need the variable POSIX_SHELL for configure_file()
but it doesn't need to be a cache variable.
2024-06-20 15:00:05 +03:00
Lasse Collin
e5c0eb2e50 CMake: Rename ENCODERS and DECODERS to use XZ_ prefix 2024-06-20 15:00:05 +03:00
Lasse Collin
e7785e2061 CMake: Rename MATCH_FINDERS to XZ_MATCH_FINDERS 2024-06-20 15:00:05 +03:00
Lasse Collin
63294806b4 CMake: Rename SYMBOL_VERSIONING to XZ_SYMBOL_VERSIONING 2024-06-20 15:00:05 +03:00
Lasse Collin
ad245b1336 CMake: Rename ENABLE_THREADS to XZ_THREADS 2024-06-20 15:00:05 +03:00
Lasse Collin
4250d4de32 CMake: Rename ENABLE_SANDBOX to XZ_SANDBOX 2024-06-20 15:00:05 +03:00
Lasse Collin
0fdcd0c582 CMake: Rename ENABLE_X86_ASM to XZ_ASM_I386 2024-06-20 15:00:05 +03:00
Lasse Collin
e017d5526e CMake: Rename CREATE_XZ_SYMLINKS to XZ_TOOL_SYMLINKS
This only affects the names unxz and xzcat. The xz-prefixed script
symlinks (xzfgrep and such) are always created if scripts are enabled.
2024-06-20 15:00:05 +03:00
Lasse Collin
04cac14fcb CMake: Rename CREATE_LZMA_SYMLINKS to XZ_TOOL_LZMA_SYMLINKS
Update the description too.

It affects creation of not only the legacy lzma, unlzma, lzcat symlinks
but also lzgrep and other legacy names for the scripts. The last
LZMA Utils release was made in 2008 but these names are still used
in some places to handle .lzma files.
2024-06-20 15:00:05 +03:00
Lasse Collin
612ccebf88 CMake: Rename ALLOW_ARM64_CRC32 to XZ_ARM64_CRC32
Update description too.
2024-06-20 15:00:05 +03:00
Lasse Collin
3dcc12290d CMake: Rename ALLOW_CLMUL_CRC to XZ_CLMUL_CRC
Update description too.
2024-06-20 15:00:05 +03:00
Lasse Collin
4b8faa7244 CMake: Rename ENABLE_DOXYGEN to XZ_DOXYGEN 2024-06-20 15:00:05 +03:00
Lasse Collin
b56273ae57 CMake: Rename LZIP_DECODER to XZ_LZIP_DECODER 2024-06-20 15:00:05 +03:00
Lasse Collin
2343992fcb CMake: Rename MICROLZMA_ENCODER/DECODER to XZ_MICROLZMA_ENCODER/DECODER 2024-06-20 15:00:05 +03:00
Lasse Collin
96f0a6632c CMake: Rename ENABLE_SMALL to XZ_SMALL 2024-06-20 15:00:05 +03:00
Lasse Collin
29f77c7b70 CMake: Rename ENABLE_NLS to XZ_NLS
Also update the description to mention that this affects installation
of translated man pages too.

Prefixing the cache variables with the project name helps if
the package is used as a subproject in another package.
It also makes the package-specific options group more nicely
in ccmake and cmake-gui.
2024-06-20 14:59:33 +03:00
Lasse Collin
ac05f1b0d7 CMake: Link Threads::Threads as PRIVATE to liblzma
This way pthread options aren't passed to the linker when linking
against shared liblzma but they are still passed when linking against
static liblzma. (Also, one never needs the include path of the
threading library to use liblzma since liblzma's API headers
don't #include <pthread.h>. But <pthread.h> tends to be in the
default include path so here this change makes no difference.)

One cannot mix target_link_libraries() calls that use the scope
(PRIVATE, PUBLIC, or INTERFACE) keyword and calls that don't use it.
The calls without the keyword are like PUBLIC except perhaps when
they aren't, or something like that... It seems best to always
specify a scope keyword as the meanings of those three keywords
at least are clear.
2024-06-17 18:20:21 +03:00
Lasse Collin
82986d8c69 CMake: Add empty lines 2024-06-17 18:20:21 +03:00
Lasse Collin
2aecffe0f0 CMake: Use CMAKE_THREAD_LIBS_INIT in liblzma.pc only with pthreads
This shouldn't make much difference in practice as on Windows
no flags are needed anyway and unitialized variable (when threading
is disabled) expands to empty. But it's clearer this way.
2024-06-17 18:20:21 +03:00
Lasse Collin
664918bd36 Update THANKS 2024-06-17 18:20:14 +03:00
Lasse Collin
5ca96a9348 CMake: Use native newlines in liblzma.pc
vcpkg doesn't specify the newline type so it should be fine to
use native newlines in liblzma.pc on Windows.
2024-06-17 18:01:39 +03:00
Lasse Collin
ebd155c3a1 CMake: Use relative paths in liblzma.pc if possible
Now liblzma.pc can be relocatable only if using CMake >= 3.20
but that should be OK as now we shouldn't get broken liblzma.pc
if CMAKE_INSTALL_LIBDIR or CMAKE_INSTALL_INCLUDEDIR contain an
absolute path.

Thanks to Eli Schwartz.
2024-06-17 18:01:39 +03:00
Lasse Collin
7a366d93cf Revert "CMake: Set only "prefix" as an absolute path in liblzma.pc"
This reverts commit 5d1c649ba9eb7a5b9371252ebfbc2911dc774e69.

While CMAKE_INSTALL_<dir> tend to be relative paths, they don't need
to be. Thus the commit was broken. A fancier method is required.

Thanks to Eli Schwartz for the bug report and explanation.
2024-06-17 18:01:39 +03:00
Lasse Collin
30a2d5d510 liblzma: CRC CLMUL: Omit is_arch_extension_supported() when not needed
On E2K the function compiles only due to compiler emulation but the
function is never used. It's cleaner to omit the function when it's
not needed even though it's a "static inline" function.

Thanks to Ilya Kurdyukov.
2024-06-17 15:00:55 +03:00
Lasse Collin
54eaea5ea4 liblzma: x86 CLMUL CRC: Rewrite
It's faster with both tiny and large buffers and doesn't require
disabling any sanitizers. With large buffers the extra speed is
from folding four 16-byte chunks in parallel.

The 32-bit x86 with MSVC reportedly still needs a workaround.
Now the simpler "__asm mov ebx, ebx" trick is enough but it
needs to be in lzma_crc64() instead of crc64_arch_optimized().
Thanks to Iouri Kharon for testing and the fix.

Thanks to Ilya Kurdyukov for testing the speed with aligned and
unaligned buffers on a few x86 processors and on E2K v6.

Thanks to Sam James for general feedback.

Fixes: https://github.com/tukaani-project/xz/issues/112
Fixes: https://github.com/tukaani-project/xz/issues/122
2024-06-17 15:00:49 +03:00
Lasse Collin
c0e7eaae8d sysdefs.h: Add alignas 2024-06-16 12:59:20 +03:00
Lasse Collin
20014c2614 liblzma: Use a single macro to select CLMUL CRC to build
This way it's clearer that two things cannot be selected
at the same time.
2024-06-16 12:59:17 +03:00
Lasse Collin
d8fb098617 liblzma: CRC32 CLMUL: Refactor the constants and simplify
By using modulus scaled constants, the final reduction can
be simplified.
2024-06-16 12:56:54 +03:00
Lasse Collin
ef652ac391 liblzma: CRC64 CLMUL: Refactor the constants
Now it refers to crc_clmul_consts_gen.c. vfold8 was renamed to mu_p
and the p no longer has the lowest bit set (it makes no difference
as the output bits it affects are ignored).
2024-06-16 12:56:54 +03:00
Lasse Collin
9f5fc17e32 liblzma: Add crc_clmul_consts_gen.c
It's a standalone program that prints the required constants.
It's won't be a part of the normal build of the package.
2024-06-16 12:56:54 +03:00
Lasse Collin
71b147aab7 liblzma: Remove CRC_USE_GENERIC_FOR_SMALL_INPUTS
It was already commented out.
2024-06-16 12:56:54 +03:00
Lasse Collin
f99a7be406 liblzma: Remove crc_attr_no_sanitize_address
It's not enough to silence the address sanitizer. Also memory and
thread sanitizers would need to be silenced. They, at least currently,
aren't smart enough to see that the extra bytes are discarded from
the xmm registers by later instructions.

Valgrind is smarter, possibly because this kind of code isn't weird
to write in assembly. Agner Fog's optimizing_assembly.pdf even mentions
this idea of doing an aligned read and then discarding the extra
bytes. The sanitizers don't instrument assembly code but Valgrind
checks all code.

It's better to change the implementation to avoid the sanitization
attributes which also look scary in the code. (Somehow they can look
more scary than __asm__ which is implictly unsanitized.)

See also:
https://github.com/tukaani-project/xz/issues/112
https://github.com/tukaani-project/xz/issues/122
2024-06-16 12:56:54 +03:00
Lasse Collin
ead4d15199 Revert "Build: Temporarily disable CRC CLMUL to silence OSS Fuzz"
This reverts commit 9f1a6d6f9a258886933a22239a5b81af34b28199.
2024-06-16 12:56:54 +03:00
Lasse Collin
2178acf8a4 CMake: Prefer C11 with a fallback to C99
There is no need to make a similar change in configure.ac.
With Autoconf 2.72, the deprecated macro AC_PROG_CC_C99
is an alias for AC_PROG_CC which prefers a C11 compiler.
2024-06-12 14:28:37 +03:00
Lasse Collin
c97e9c12fe Update THANKS 2024-06-12 14:20:21 +03:00
Lasse Collin
89e9f12e03 Tests: Improve the CRC32 test
A similar one was already there for CRC64 but nowadays also CRC32
has a CLMUL implementation, so it's good to test it better too.
2024-06-11 22:44:44 +03:00
Lasse Collin
c7164b1927 xz: Fix white space 2024-06-11 22:42:26 +03:00
Lasse Collin
0a32d2072c liblzma: Fix a typo in a comment
Thanks to Sam James for spotting it.

Fixes: f644473a211394447824ea00518d0a214ff3f7f2
2024-06-11 22:42:04 +03:00
Lasse Collin
afd9b4d282 liblzma: Fix a comment indentation 2024-06-10 23:19:27 +03:00
Lasse Collin
50e6bff274 liblzma: Fix white space 2024-06-10 23:19:27 +03:00
Lasse Collin
caea7844d3 tuklib: __STDC_VERSION__ in C23 is 202311 2024-06-10 23:19:27 +03:00
RainRat
9e73918a4f Fix typos
Closes: https://github.com/tukaani-project/xz/pull/124
2024-06-07 16:01:27 +03:00
Lasse Collin
04b23addf3 tuklib_integer: Fix building on OpenBSD/sparc64 that uses GCC 4.2
GCC 4.2 doesn't have __builtin_bswap16() and friends so tuklib_integer.h
tries to use OS-specific byte swap methods instead. On OpenBSD those
macros are swap16/32/64 instead of bswap16/32/64 like on other *BSDs
and Darwin.

An alternative to "#ifdef __OpenBSD__" could be "#ifdef swap16" as it
is a macro. But since OpenBSD seems to be a special case under this
special case of "*BSDs and Darwin", checking for __OpenBSD__ seems
the more conservative choice now.

Thanks to Christian Weisgerber and Brad Smith who both submitted
the same patch a few hours apart.

Co-authored-by: Christian Weisgerber <naddy@mips.inka.de>
Co-authored-by: Brad Smith <brad@comstyle.com>
Closes: https://github.com/tukaani-project/xz/pull/126
2024-06-07 15:47:20 +03:00
Lasse Collin
dc03f6290f liblzma: Add ARM64 CRC32 instruction support detection on OpenBSD
The C code is from Christian Weisgerber, I merely reordered the OSes.
Then I added the build system checks without testing them.

Also thanks to Brad Smith who submitted a similar patch on GitHub
a few hours after Christian had sent his via email.

Co-authored-by: Christian Weisgerber <naddy@mips.inka.de>
Closes: https://github.com/tukaani-project/xz/pull/125
2024-06-07 15:06:59 +03:00
Lasse Collin
f5c2ae58ec Update THANKS 2024-06-05 13:55:43 +03:00
Lasse Collin
e5491dfab9 CMake: Include the "alpha" or "beta" suffix in PACKAGE_VERSION
This way the version string gets into xzgrep and other scripts
in full and also into liblzma.pc.

For the project() command, a suffixless string is required though.
2024-06-05 13:42:47 +03:00
Lasse Collin
1d3c61575f CMake: Fix wrong version variable
liblzma_VERSION has never existed in the repository. xz_VERSION from
the project() command was used for liblzma SOVERSION so use xz_VERSION
here too.

The wrong variable did no harm in practice as PROJECT_VERSION
was used as the fallback. It has the same value as xz_VERSION.

Fixes: 7e3493d40eac0c3fa3d5124097745a70e15c41f6
2024-06-05 13:30:28 +03:00
Lasse Collin
5d1c649ba9 CMake: Set only "prefix" as an absolute path in liblzma.pc
CMake provides variables that are relative to CMAKE_INSTALL_PREFIX
so use them instead of repeating the full path.
2024-06-05 12:59:59 +03:00
Lasse Collin
e0d6d05ce0 CMake: Fix liblzma filename in Windows environments
This is a mess because liblzma DLL outside Cygwin and MSYS2
is liblzma.dll instead of lzma.dll to avoid a conflict with
lzma.dll from LZMA SDK.

On Cygwin the name was "liblzma-5.dll" while "cyglzma-5.dll"
would have been correct (and match what Libtool produces).
MSYS2 likely was broken too as it uses the "msys-" prefix.

This change has no effect with MinGW-w64 because with that
the "lib" prefix was correct already.

With MSVC builds this is a small breaking change that requires developers
to adjust the library name when linking against liblzma. The liblzma.dll
name is kept as is but the import library and static library are now
lzma.lib instead of liblzma.lib. This is helpful when using pkgconf
because "pkgconf --msvc-syntax --libs liblzma" outputs "lzma.lib"
(it's converted from "-llzma" in liblzma.pc). It would be easy to
keep the liblzma.lib naming but the pkgconf compatibility seems worth
it in the long run. The lzma.lib name is compatible with MinGW-w64
too as -llzma will find also lzma.lib.

vcpkg had been patching CMakeLists.txt this way since 2022 but I
learned this only recently. The reasoning for the patch makes sense,
and while this is a small breaking change with MSVC, it seems like
a decent compromise as it keeps the DLL name the same.

2022 patch in vcpkg: 0707a17ecf/ports/liblzma/win_output_name.patch
See the discussion: https://github.com/microsoft/vcpkg/pull/39024

Thanks to Vincent Torri for confirming the naming issue on Cygwin.
2024-06-04 23:59:29 +03:00
Lasse Collin
e7a42cda7c Fix version.sh compatiblity with Solaris
The ancient /bin/tr on Solaris doesn't support '\n'.
With /usr/xpg4/bin/tr it works but it might not be in PATH.

Another problem was that sed was given input that didn't have a newline
at the end. Text files must end with a newline to be portable.

Fix both problems:

  - Handle multiline input within sed itself to avoid one tr invocation.
    The default sed even on Solaris does understand \n.

  - Use octals in tr -d. \012 works for ASCII "line feed", it's even
    used as an example in the Solaris man page. But we must strip
    also ASCII "carriage return" \015 and EBCDIC "next line" \025.
    The EBCDIC case got handled with \n previously. Stripping \012
    and \015 on EBCDIC system won't matter as those control chars
    won't be present in the string in the first place.

An awk-based solution could be an alternative but it might need
special casing on Solaris to used nawk instead of awk. The changes
in this commit are smaller and should have a smaller risk for
regressions. It's also possible that version.sh will be dropped
entirely at some point.
2024-06-03 23:06:10 +03:00
Lasse Collin
a61c9ab475 CI: Don't require po4a on Solaris 2024-06-03 23:05:31 +03:00
Lasse Collin
5229bdf533 CI: Use set -e on Solaris too 2024-06-03 23:04:32 +03:00
Lasse Collin
afa938e429 CMake: Install liblzma.pc even with MSVC
I had misunderstood that it wouldn't be useful with MSVC.
vcpkg had been installing liblzma.pc with custom rules since 2020,
years before liblzma.pc support was added to CMakeLists.txt.

See:
eb895b95aa/ports/liblzma/portfile.cmake
https://github.com/microsoft/vcpkg/pull/39024#issuecomment-2145064670
2024-06-03 17:44:50 +03:00
Sam James
35f8649f08 ci: don't pin official GH actions via commit, just tag
There's no real value in doing it via commit for official GH actions. We
can keep using pinned commits for unofficial actions. It's hassle for no
gain.

Maybe going forward we can limit this further by only being paranoid
for the jobs with any access to tokens.
2024-06-03 12:32:34 +03:00
Christoph Junghans
e885dae37f ci: set -e on openbsd
Closes: https://github.com/tukaani-project/xz/pull/116
2024-06-03 12:32:34 +03:00
Christoph Junghans
21b02dd128 ci: set -e on netbsd 2024-06-03 12:32:34 +03:00
Christoph Junghans
8641f0c24c ci: actually fail on FreeBSD
Without "set -e" the job will always be successful.

See vmactions/freebsd-vm#72
2024-06-03 12:32:34 +03:00
Andrew Murray
ef616683ef Updated actions
Closes: https://github.com/tukaani-project/xz/pull/115
2024-06-03 12:32:34 +03:00
Sam James
57b440d316 ci: add po4a 2024-06-03 12:32:34 +03:00
Sam James
08cdf4be9a ci: add Solaris
Inspired by 3f2a38b011.

It runs on Solaris 5.11 via a VirtualBox VM.
2024-06-03 12:32:34 +03:00
Sam James
b69768c8bd xz: list: suppress -Wformat-nonliteral for Solaris
Solaris' GCC can't understand that our use is fine, unlike modern compilers:
```
list.c: In function 'print_totals_basic':
list.c:1191:4: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
  uint64_to_str(totals.files, 0));
  ^~~~~~~~~~~~~
cc1: all warnings being treated as errors
```

It's presumably because of older gettext missing format attributes.

This is with `gcc (GCC) 7.3.0`.
2024-06-03 12:32:34 +03:00
Lasse Collin
bb90e1f66d license-check.sh: Fix reporting of unclear license info
The main feature was broken because an old variable name hadn't
been updated to match the rest of the script.
2024-06-03 11:44:28 +03:00
Lasse Collin
b8d134e61e Update THANKS 2024-05-31 21:36:26 +03:00
Lasse Collin
162587d3fb Translations: Run po4a/update-po
Now the files are in the new formatting without source file
line numbers. Future updates should keep the diffs much smaller.
2024-05-29 23:36:48 +03:00
Lasse Collin
50cd8ed002 Translations: Run "make -C po update-po"
In the past this wasn't done before releases; the Git repository
just contained the files from the Translation Project. But this
way it is clearer when comparing release tarballs against the
Git repository. In future releases this might no longer be necessary
within a stable branch as the .po files won't change so easily anymore
when creating a tarball.
2024-05-29 23:36:48 +03:00
Lasse Collin
16dbd865c8 Add NEWS for 5.6.2 2024-05-29 21:00:30 +03:00
Lasse Collin
a0eeb5f936 Add NEWS for 5.4.7 2024-05-29 21:00:30 +03:00
Lasse Collin
9b476fb93a Add NEWS for 5.2.13 2024-05-29 21:00:30 +03:00
Lasse Collin
9284f1aea3 Build: Update po/*.po files only when needed
When po/xz.pot doesn't exist, running "make" or "make dist" will
create it. Then the .po files will be updated but only if they
actually would change more than the POT-Creation-Date line.
Then the .gmo files would be generated from the .po files.
This is the case before and after this commit.

However, "make dist" and thus "make mydist" did a forced update
to the files, updating them even if the only change was the
POT-Creation-Date line. This had pros and cons: It made it clear
that the .po file really is in sync with the recent strings in
the package. On the other hand, it added noise in form of changed
files in the source tree and distribution tarballs. It can be
ignored with something like "diff -I'^"POT-Creation-Date: '" but
it's still a minor annoyance *if* there's not enough value in
having the most recent timestamp.

Setting DIST_DEPENDS_ON_UPDATE_PO = no means that such forced
update won't happen in "make dist" anymore. However, the "mydist"
target will use xz.pot-update target which is the same target that
is run when xz.pot doesn't exist at all yet. Thus "mydist" will
ensure that the translations are up to date, without noise from
changes that would affect only the POT-Creation-Date line.

Note that po4a always uses msgmerge with --update, so POT-Creation-Date
in the man page translations is never the only change in .po files.
In that sense this commit makes the message translations behave more
similarly to the man page translations.

Distribution tarballs will still have non-reproducible POT-Creation-Date
in po/xz.pot and po4a/xz-man.pot but those are just two files. Even they
could be made reproducible from a Git timestamp if desired.
2024-05-29 16:33:24 +03:00
Lasse Collin
4beba1cd62 po4a/update-po: Disable wrapping in .pot and .po files
The .po files from the Translation Project come with unwrapped
strings so this matches it.

This may reduce the noise in diffs too. When the beginning of
a paragraph had changed, the rest of the lines got rewrapped
in msgsid. Now it's just one very long line that changes when
a paragraph has been edited.

The --add-location=file option was removed as redundant. The line
numbers don't exist in the .pot file due to --porefs file and thus
they cannot get copied to the .po files either.
2024-05-28 21:10:33 +03:00
Lasse Collin
b14c130a58 Update contact info in README 2024-05-28 18:36:53 +03:00
Lasse Collin
75f5f2e014 Translations: Use --package-name=xz-man with po4a
This is to match reality. See the added comment.
2024-05-28 13:25:07 +03:00
Lasse Collin
eb217d016c Translations: Omit --package-name from po/Makevars
This is closer to the reality in the po/*.po files.
2024-05-28 13:03:40 +03:00
Lasse Collin
d28a4b2520 license-check.sh: Use '--' with slightly untrusted filenames
Names from git ls-files should be safe but if one runs it on
a tree without the .git dir and there are extra files, it's
safer to have the end of arguments marked with '--'.
2024-05-28 12:18:09 +03:00
Lasse Collin
fda0ec862a license-check.sh: Use xargs -0 instead of -d
Neither are in POSIX but -0 is much more portable in practice.

Despite the old comment, the grep usage should be portable already.
2024-05-28 12:18:09 +03:00
Lasse Collin
9114267038 Translations: Omit man page line numbers from .pot and .po files 2024-05-28 01:17:45 +03:00
Lasse Collin
093490b582 Translations: Use the xgettext option --add-location=file 2024-05-28 01:06:30 +03:00
Lasse Collin
fccebe2b4f Translations: Use the msgmerge option --add-location=file
This way the PO file diffs are less noisy but the locations of the
strings are still present at file level, just without line numbers.

The option is available since gettext 0.19 (2014).
configure.ac requires 0.19.6.
2024-05-28 00:43:53 +03:00
Lasse Collin
f361d9ae85 Build: Use $(SHELL) instead of sh to run scripts in Makefile.am 2024-05-27 12:22:08 +03:00
Lasse Collin
a26dece347 Translations: Change the home page URLs in man page translations
Since the source strings have changed, these would get marked as
fuzzy and the original string would be used instead. The original
and translated strings are identical in this case so it wouldn't
matter. But patching the translations helps still because then
po4a will show the correct translation percentage.
2024-05-23 17:25:13 +03:00
Lasse Collin
24387c234b CMake: Add manual support for 32-bit x86 assembly files
One has to pass -DENABLE_X86_ASM=ON to cmake to enable the
CRC assembly code. Autodetection isn't done. Looking at
CMAKE_SYSTEM_PROCESSOR might not work as it comes from uname
unless cross-compilation is done using a CMake toolchain file.

On top of this, if the code is run on modern processors that support
the CLMUL instruction, then the C code should be faster (but then
one should also be using a x86-64 build if possible).
2024-05-23 15:32:43 +03:00
Lasse Collin
0fb3c9c3f6 CMake: Rename USE_DOXYGEN to ENABLE_DOXYGEN
It's more consistent with the other option() uses.
2024-05-23 14:26:45 +03:00
Lasse Collin
6bbec3bda0 Mention license-check.sh in COPYING 2024-05-22 15:21:53 +03:00
Lasse Collin
62733592a1 Use more confident language in COPYING 2024-05-22 15:21:53 +03:00
Lasse Collin
a119a4209e Build: Run license-check.sh in "mydist" and "dist-hook"
In mydist the point is to check using the file list from the Git
repository. In dist-hook it is to check that the TARBALL_IGNORE
patterns work when the .git dir or the "git" command aren't available.

Refuse to create a distribution tarball if license issues are found.
2024-05-22 15:21:53 +03:00
Lasse Collin
f3434ecfcb Add build-aux/license-check.sh
This helps in spotting files that lack SPDX license identifier
and which haven't been explicitly white listed either. The script
requires the .git directory to be present as only the files that
are in the Git repository are checked.

XZ Utils isn't FSFE REUSE compliant for now.
2024-05-22 15:21:53 +03:00
Lasse Collin
9ae2ebc1e5 Add SPDX license identifiers to files under tests/ossfuzz 2024-05-22 15:18:42 +03:00
Lasse Collin
9000d70eb9 Add SPDX license identifier to .codespellrc 2024-05-22 15:18:42 +03:00
Lasse Collin
903c16fcfa Move entries po4a/.gitignore to the top level .gitignore
The po4a directory is in EXTRA_DIST and thus all files there
are included in the package. .gitignore doesn't belong in the
package so keep that file out of the po4a directory.
2024-05-22 15:12:09 +03:00
Lasse Collin
56f1d5ed68 Tests: Make the config.h grep patterns Meson compatible
Now the test scripts detect both

    #define HAVE_DECODER_ARM
    #define HAVE_DECODER_ARM 1

as support for the ARM filter without confusing it with these:

    #define HAVE_DECODER_ARM64
    #define HAVE_DECODER_ARM64 1

Previously only the ones ending with " 1" were accepted for
the macros where this kind of confusion was possible.

This should help with Meson support because Meson's built-in
features produce config.h entries that are either

    #define FOO 1
    #define FOO 0

or:

    #define FOO
    #undef FOO

The former method has a benefit that one can use "#if FOO" and -Wundef
will catch if a #define is missing (for example, it helps catching
typos). But XZ Utils has to use the latter since it has been
convenient with Autoconf's default behavior.[*] While it's easy to
emulate the Autoconf style (#define FOO 1 vs. no #define at all)
in Meson, it results in clumsy code. Thus it's better to change
the few places in the tests where this difference matters.

[*] While most checks in Autoconf default to the second style above,
    a few things use the first style (like AC_CHECK_DECLS). The mix
    of both styles is the most confusing as one has to remember which
    macro needs #ifdef and which #if. Currently HAVE_VISIBILITY is
    only such config.h entry that is 1 or 0. It comes unmodified
    from Gnulib's visibility.m4.
2024-05-20 16:55:00 +03:00
Lasse Collin
9d997d6f9d CMake: Add comments 2024-05-20 16:55:00 +03:00
Lasse Collin
d35368b33e CMake: Remove the note that some tests aren't run
They are now in the common build configurations.
2024-05-20 16:55:00 +03:00
Lasse Collin
dc232d5846 CMake: Add support for test_files.sh 2024-05-20 16:55:00 +03:00
Lasse Collin
a7e9230af9 Tests: Make test_files.sh more flexible
Add a new optional argument to specify the directory of the xz and
xzdec executables.

If ../config.h doesn't exist, assume that all encoders and decoders
are available.
2024-05-20 16:55:00 +03:00
Lasse Collin
b40e6efbb4 CMake: Add support for test_compress.sh tests 2024-05-20 16:55:00 +03:00
Lasse Collin
ac3222d2cb Tests: Make test_compress.sh more flexible
Add a new optional second argument: directory of the xz and xzdec
executables. This is need with the CMake build where the binaries
end up in the top-level build directory.

If ../config.h doesn't exist, assume that all encoders and decoders
are available. This will make this script usable from CMake in the
most common build configuration.

NOTE: Since the existence of ../config.h is checked, the working
directory of the test script must be a subdir in the build tree!
Otherwise ../config.h would look outside the build tree.

Use the default check type instead of forcing CRC32 or CRC64.
Now the script doesn't need to check if CRC64 is available.
2024-05-20 16:55:00 +03:00
Lasse Collin
006040b29c CMake: Prepare to support the test_*.sh tests
This is a bit hacky since the scripts grep config.h to know which
features were built but the CMake build doesn't create config.h.
So instead those test scripts will be run only when all relevant
features have been enabled.
2024-05-20 16:55:00 +03:00
Lasse Collin
6167607a6e Tests: test_suffix.sh: Add a comment 2024-05-20 16:55:00 +03:00
Lasse Collin
4e9023857d Fix typos
Thanks to xx on #tukaani.
2024-05-18 00:34:07 +03:00
Lasse Collin
b14d08fbbc liblzma: Fix white space
Thanks to xx on #tukaani.
2024-05-18 00:24:50 +03:00
Lasse Collin
9f1a6d6f9a Build: Temporarily disable CRC CLMUL to silence OSS Fuzz
The code makes aligned 16-byte reads which may read up to 15 bytes
before the beginning or past the end of the buffer if the buffer
is misaligned. The unneeded bytes are then ignored. It cannot cross
page boundaries and thus cannot cause access violations.

This inherently trips address sanitizer which was already disabled
with __attribute__((__no_sanitize_address__)). However, it also
trips memory sanitizer if the extra bytes are uninitialized because
memory sanitizer doesn't see that those bytes then get ignored by
byte shuffling in the xmm registers.

The plan is to change the code so that all sanitizers pass but it's
not finished yet (performance shouldn't get worse) so as a temporary
measure to keep OSS Fuzz happy, the CLMUL CRC is now disabled even
though I think think the code is fine to use (and easy enough to review
the memory accesses in it too).
2024-05-15 23:14:17 +03:00
Lasse Collin
142e670a41 xz: Document the static function get_chains_memusage() 2024-05-13 18:00:41 +03:00
Lasse Collin
78e984399a xz: Rename filters_memusage_max() to get_chains_memusage() 2024-05-13 18:00:41 +03:00
Lasse Collin
54c3db0a83 xz: Rename filter_memusages to chains_memusages 2024-05-13 18:00:41 +03:00
Lasse Collin
d9e1ae79ec xz: Simplify the memory usage scaling code
This is closer to what it was before the --filtersX support was added,
just extended to support for scaling all filter chains. The method
before this commit was an extended version of the original too but
it was done in a more complex way for no clear reason. In case of
an error, the complex version printed fewer informative messages
(a good thing) but it's not a sigificant benefit.

In the limit is too low even for single-threaded mode, the required
amount of memory is now reported like in 5.4.x instead of like in
5.5.1alpha - 5.6.1 which showed the original non-scaled usage. It
had been a FIXME in the old code but it's not clear what message
makes the most sense.

Fixes: 5f0c5a04388f8334962c70bc37a8c2ff8f605e0a
2024-05-13 18:00:41 +03:00
Lasse Collin
0ee56983d1 xz: Edit comments 2024-05-13 18:00:41 +03:00
Lasse Collin
ec82a49c35 xz: Rename chain_idx to chain_num 2024-05-13 18:00:41 +03:00
Lasse Collin
a731a6993c xz: Edit coding style 2024-05-13 18:00:41 +03:00
Lasse Collin
32eb176b89 xz: Edit comments
Fixes: 5f0c5a04388f8334962c70bc37a8c2ff8f605e0a
2024-05-13 15:41:48 +03:00
Lasse Collin
b90339f4da xz: Fix grammar in a comment
Fixes: cb3111e3ed84152912b5138d690c8d9f00c6ef02
2024-05-13 15:41:48 +03:00
Lasse Collin
4c0bdaf13d xz: Rename filter_memusages to encoder_memusages 2024-05-13 15:41:46 +03:00
Lasse Collin
b54aa023e0 xz: Edit coding style 2024-05-13 15:41:05 +03:00
Lasse Collin
49f67d3d3f xz: Rename filters_index to chain_num
The reason is the same as in bd0782c1f13e52cd0fd8415208e30e47004a4c68.
2024-05-13 15:41:05 +03:00
Lasse Collin
ff9e8b3d06 xz: Replace a few uint32_t with "unsigned" to reduce the number of casts
These hold only tiny values.
2024-05-13 15:41:05 +03:00
Lasse Collin
b5e6c1113b xz: Rename filters_used_mask to chains_used_mask
The reason is the same as in bd0782c1f13e52cd0fd8415208e30e47004a4c68.
2024-05-13 15:41:05 +03:00
Lasse Collin
32500dfaad xz: Move the setting of "check" in coder_set_compression_settings()
It's more logical to do it in the beginning instead of in the middle
of the filter chain handling.

Fixes: d6af7f347077b22403133239592e478931307759
2024-05-13 15:41:05 +03:00
Lasse Collin
ad146b1f42 xz: Rename "filters" to "chains"
The convention is that

    lzma_filter filters[LZMA_FILTERS_MAX + 1];

contains the filters of a single filter chain.
It was so here as well before the commit
d6af7f347077b22403133239592e478931307759.
It changes "filters" to a ten-element array of filter chains.
It's clearer to call this array-of-arrays "chains".

This also renames "filter_idx" to "chain_idx" which is used
as an index as in chains[chain_idx].
2024-05-13 15:40:58 +03:00
Lasse Collin
5a4ae4e4d0 xz: Clean up a comment 2024-05-13 15:39:39 +03:00
Lasse Collin
2de80494ed xz: Add clarifying assertions 2024-05-13 15:39:39 +03:00
Lasse Collin
1eaad004bf xz: Add a clarifying assertion
Fixes: 5f0c5a04388f8334962c70bc37a8c2ff8f605e0a
2024-05-13 15:39:39 +03:00
Lasse Collin
605094329b xz: Clarify a comment 2024-05-13 15:39:39 +03:00
Lasse Collin
8fac2577f2 xz: Use the info collected in parse_block_list()
This is slightly simpler and it avoids looping through
the opt_block_list array.
2024-05-13 15:39:39 +03:00
Lasse Collin
81d350dab8 xz: Remember the filter chains and the largest Block in parse_block_list() 2024-05-13 15:39:39 +03:00
Lasse Collin
46ab56968f xz: Update a comment and initialization of filters_used_mask 2024-05-13 15:39:39 +03:00
Lasse Collin
e89293a0ba xz: parse_block_list: Edit integer type casting 2024-05-13 15:39:39 +03:00
Lasse Collin
87011e40c1 xz: Make filter_memusages a local variable 2024-05-13 15:39:12 +03:00
Lasse Collin
347b412a93 xz: Remove unused code and simplify
opt_mode == MODE_COMPRESS isn't possible when HAVE_ENCODERS isn't
defined. Thus, when *encoding*, the message about *decoder* memory
usage is possible to show only when both encoder and decoder have
been built.

Since the message is shown only at V_DEBUG, skip the memusage
calculation if verbosity level isn't high enough.

Fixes: 5f0c5a04388f8334962c70bc37a8c2ff8f605e0a
2024-05-13 15:31:15 +03:00
Lasse Collin
31358c057c xz: Fix integer type from uint64_t to uint32_t
lzma_options_lzma.dict_size is uint32_t so use it here too.

Fixes: 5f0c5a04388f8334962c70bc37a8c2ff8f605e0a
2024-05-11 00:29:24 +03:00
Lasse Collin
3f71e0f3a1 debug/translation.bash: Remove an outdated test command
Since 5.3.5beta, "xz --lzma2=mf=bt4,nice=2" works even though bt4 needs
at least nice=4. It is rounded up internally by liblzma when needed.

Fixes: 5cd9f0df78cc4f8a7807bf6104adea13034fbb45
2024-05-08 21:44:48 +03:00
Lasse Collin
b05a516830 Fix the date of NEWS for 5.4.5 2024-05-07 20:41:28 +03:00
Lasse Collin
6d336aeb97 Build: Update visibility.m4 from Gnulib
This fixes the syntax of the "serial" line and renames
a temporary variable.
2024-05-07 16:21:15 +03:00
Lasse Collin
ab51e8ee61 po4a/update-po: Delete the *.po.authors files
These are temporary files that are needed only when running po4a.
The top-level Makefile.am puts the whole po4a directory into
distribution tarball (it's simpler) so deleting these temporary
files is needed to prevent them from getting into tarballs.
2024-05-07 15:05:21 +03:00
Lasse Collin
e4780244a1 xz: Edit comments and coding style 2024-05-07 13:12:17 +03:00
Lasse Collin
fe4d8b0c80 xz: Omit an incorrect comment
It likely was a leftover from a development version of the code.

Fixes: 183819bfd9efac8c184d9bf123325719b7eee30f
2024-05-06 23:09:13 +03:00
Lasse Collin
9bef5b8d17 xz: Add braces to a for-statement and to an if-statement
No functional changes.

Fixes: 5f0c5a04388f8334962c70bc37a8c2ff8f605e0a
Fixes: 479fd58d60622331fcbe48fddf756927b9f80d9a
2024-05-06 23:04:31 +03:00
Lasse Collin
de06b9f0c0 liblzma: Omit an unneeded array from the x86 filter
Fixes: 6aa2a6deeba04808a0fe4461396e7fb70277f3d4
2024-05-06 23:00:09 +03:00
Lasse Collin
7da488cb93 CMake: Add test_suffix.sh to the tests 2024-05-06 22:56:31 +03:00
Lasse Collin
a805594ed0 Test: Add CMake support to test_suffix.sh
It needs to find the xz executable from a different directory
and work without config.h.
2024-05-06 22:55:54 +03:00
Lasse Collin
50e1948938 Update INSTALL about MINIX 3
The latest stable is 3.3.0 and it's from 2014.
Don't mention the older versions in INSTALL.
3.3.0 ships with Clang already.

Testing with 3.4.0beta6 shows that tuklib_physmem
works too so omit comments about that from INSTALL.
Visibility warnigns weren't a problem either.

Thus it's enough to mention the need for --disable-threads
as configure doesn't autodetect the lack of pthreads.
2024-05-06 20:45:34 +03:00
Lasse Collin
68d18aea14 Windows: Remove the "doc/api" line from README-Windows.txt
Fixes: 252aa1d67bc015eeba462803ab72edeb7744d864
2024-05-02 23:00:16 +03:00
Lasse Collin
8ede961374 Build: Don't copy doc/api from source tree to distribution tarball
It was copied if it existed. This was intentional when autogen.sh
still built liblzma API docs with Doxygen.

Fixes: d3a77ebc04bf1db8d52de2d9b0f07877bc4fd139
2024-05-02 22:59:04 +03:00
Sam James
9a6761aa35 ci: add SPDX headers
I've checked over each of these and they're straightforward applications
of the relevant Github Actions.
2024-05-02 20:29:59 +03:00
Yaroslav Halchenko
81efe6119f codespell: Ignore the THANKS file and debbugs.gnu.org URL
This way "codespell -i 0" is silent.

This is the first commit from
https://github.com/tukaani-project/xz/pull/93
with trivial edits by Lasse Collin.
2024-05-01 13:51:17 +03:00
Lasse Collin
905bfc74fe Add .gitattributes to clean up git-archive output 2024-04-30 22:26:11 +03:00
Lasse Collin
3334c71d3d xzdec: Support Landlock ABI version 4
This was added to xz in 02e3505991233901575b7eabc06b2c6c62a96899
but I forgot to do the same in xzdec.

The Landlock sandbox in xzdec could be stricter as now it's
active only for the last file being decompressed. In xz,
read-only sandbox is used for multi-file case. On the other hand,
xz doesn't go to the strictest mode when processing the last file
when more than one file was specified; xzdec does.
2024-04-30 22:24:13 +03:00
Lasse Collin
278563ef8f liblzma: Fix incorrect function type error from sanitizer
Clang 17 with -fsanitize=address,undefined:

    src/liblzma/common/filter_common.c:366:8: runtime error:
        call to function encoder_find through pointer to incorrect
        function type 'const lzma_filter_coder *(*)(unsigned long)'
    src/liblzma/common/filter_encoder.c:187: note:
        encoder_find defined here

Use a wrapper function to get the correct type neatly.
This reduces the number of casts needed too.

This issue could be a problem with control flow integrity (CFI)
methods that check the function type on indirect function calls.

Fixes: 3b34851de1eaf358cf9268922fa0eeed8278d680
2024-04-30 22:22:45 +03:00
Lasse Collin
77c8f60547 xz: Avoid arithmetic on a null pointer
It's undefined behavior. The result wasn't ever used as it occurred
in the last iteration of a loop.

Clang 17 with -fsanitize=address,undefined:

    $ src/xz/xz --block-list=123
    src/xz/args.c:164:12: runtime error: applying non-zero offset 1
        to null pointer

Fixes: 88ccf47205d7f3aa314d358c72ef214f10f68b43
Co-authored-by: Sam James <sam@gentoo.org>
2024-04-30 21:41:11 +03:00
Lasse Collin
64503cc2b7 CMake: Support building liblzma API docs using Doxygen
This is disabled by default to match the default in Autotools.
Use -DUSE_DOXYGEN=ON to enable Doxygen usage.

This uses the update-doxygen script, thus this is under if(UNIX)
although Doxygen itself can run on Windows too.
2024-04-30 17:09:08 +03:00
Lasse Collin
0a7f5a80d8 CMake: List API headers in LIBLZMA_API_HEADERS variable
This way the same list will be usable in more than one location.
2024-04-30 17:09:08 +03:00
Lasse Collin
541406bee3 PACKAGERS: Document the optional Doxygen usage
Also add a note that packagers should check the licensing
of the Doxygen output.
2024-04-30 17:09:08 +03:00
Lasse Collin
e21efdf96f Build: Add --enable-doxygen to generate and install API docs
It requires Doxygen. This option is disabled by default.
2024-04-30 17:09:08 +03:00
Lasse Collin
0ece09a575 Doxygen: update-doxygen: Support out-of-tree builds
Also, now $0 is used to refer to the script itself.
2024-04-30 17:09:08 +03:00
Lasse Collin
2c519f641f Doxygen: Simplify Doxyfile and add SPDX license identifier
This omits all comments and a few non-default options that weren't
needed. Now it contains no copyrighted content from Doxygen itself.
2024-04-30 17:09:08 +03:00
Lasse Collin
bdba39a575 Doxygen: Don't strip JavaScript anymore
The stripping method worked well with Doxygen 1.8 and 1.9 but
it doesn't work with Doxygen 1.10 anymore. Since we won't ship
pre-generated liblzma API docs anymore, the extra bloat and
extra license info of the JavaScript files won't affect the
upstream source package anymore.
2024-04-30 17:09:08 +03:00
Lasse Collin
d3a77ebc04 Build: Remove old Doxygen rules from top-level Makefile.am 2024-04-30 17:09:08 +03:00
Lasse Collin
fd7faa4c33 Update COPYING to match the autogen.sh and mydist changes 2024-04-30 17:09:08 +03:00
Lasse Collin
b2bc55d8a0 Build: Don't run update-doxygen as part of "make mydist" 2024-04-30 17:09:08 +03:00
Lasse Collin
e9be74f5b1 autogen.sh: Don't generated Doxygen docs anymore 2024-04-30 17:09:08 +03:00
Lasse Collin
252aa1d67b windows/build.bash: Omit Doxygen docs from the package
They will be omitted from the source tarball and I don't want
to make Doxygen a dependency of build.bash.
2024-04-30 17:09:08 +03:00
Lasse Collin
634095364d README: Don't mention PDF man pages anymore 2024-04-28 18:34:45 +03:00
Lasse Collin
dc684bf76e Build: Omit PDF man pages from the package
pdf-local rule was added to create the PDFs still with "make pdf".
The install rules are missing but that likely doesn't matter at all.
2024-04-28 18:34:45 +03:00
Lasse Collin
e3531ab412 windows/build.bash: Don't copy PDF man pages to the package 2024-04-28 18:34:45 +03:00
Lasse Collin
710a4573ef Tests: test_index: Fix failures when features are disabled
Fixes: cd88423e76d54eb72aea037364f3ebb21f122503
2024-04-28 01:34:50 +03:00
Lasse Collin
aaff75c348 CMake: Keep the build working if the "tests" directory is missing
This moves the tests section as is from CMakeLists.txt into
tests/tests.cmake. CMakeLists.txt now includes tests/tests.cmake
if the latter file exists.

Now it's possible to delete the whole "tests" directory and
building with CMake will still work normally, just without
the tests. This way the tests are readily available for those
who want them, and those who won't run the tests anyway have
a straightforward way to ensure that nothing from the "tests"
directory can affect the build process.
2024-04-27 20:21:30 +03:00
Lasse Collin
a5f2aa5618 Tests: Remove x86 and SPARC BCJ tests
These are very old but the exact test file isn't easy to reproduce
as it was compiled from a short C program (bcj_test.c) long ago.
These tests weren't very good anyway, just a little better than nothing.
2024-04-27 20:21:30 +03:00
Lasse Collin
d879686469 Tests: test_index: Edit a misleading test 2024-04-27 18:30:40 +03:00
Lasse Collin
612005bbdb Tests: test_index: Use minimal values to test integer overflow 2024-04-27 16:46:01 +03:00
Lasse Collin
4ad88b2544 Tests: test_index: Test lzma_index_buffer_decode() more 2024-04-27 15:13:39 +03:00
Lasse Collin
575b11b0d2 Tests: test_index: Test that *i = NULL is done on LZMA_PROG_ERROR
On LZMA_DATA_ERROR from lzma_index_buffer_decode(), *i = NULL was
already done but this adds a test for that case too.
2024-04-27 15:08:29 +03:00
Lasse Collin
2c970debdb Tests: test_index: Test lzma_index_buffer_encode() with empty output buf 2024-04-27 15:01:25 +03:00
Lasse Collin
cd88423e76 Tests: test_index: Replace if-statements with tuktest assertions 2024-04-27 14:59:55 +03:00
Lasse Collin
7f865577a6 Tests: test_index: Make it clear that my_alloc() has no integer overflows
liblzma guarantees that the product of the allocation size arguments
will fit in size_t.

Putting the pre-increment in the if-statement was clearly wrong
although in practice it didn't matter here as the function is
called only a couple of times.
2024-04-27 14:56:16 +03:00
Lasse Collin
12313a3b65 Tests: test_index: Verify also iter.block.number_in_stream 2024-04-27 14:51:52 +03:00
Lasse Collin
ad2654010d Tests: test_index: Check cases that aren't a multiple of 4 bytes 2024-04-27 14:51:06 +03:00
Lasse Collin
2524fcf2b6 Tests: test_index: Edit comments and white space 2024-04-27 14:40:25 +03:00
Lasse Collin
71eed2520e liblzma: index_decoder: Fix missing initializations on LZMA_PROG_ERROR
If the arguments to lzma_index_decoder() or lzma_index_buffer_decode()
were such that LZMA_PROG_ERROR was returned, the lzma_index **i
argument wasn't touched even though the API docs say that *i = NULL
is done if an error occurs. This obviously won't be done even now
if i == NULL but otherwise it is best to do it due to the wording
in the API docs.

In practice this matters very little: The problem can occur only
if the functions are called with invalid arguments, that is,
the calling application must already have a bug.
2024-04-27 14:33:38 +03:00
Lasse Collin
0478473953 CMake: Bump maximum policy version to 3.29 2024-04-26 18:25:18 +03:00
Sam James
a607e2b40d ci: add NetBSD 2024-04-25 14:08:52 +03:00
Sam James
72c210336d ci: add FreeBSD 2024-04-25 14:08:52 +03:00
Sam James
b526ec2dbf ci: add OpenBSD 2024-04-25 14:08:52 +03:00
Sam James
c7ef767c49 liblzma: outqueue: add header guard
Reported by github's codeql.
2024-04-25 14:04:24 +03:00
Sam James
55dcae3056 liblzma: easy_preset: add header guard
Reported by github's codeql.
2024-04-25 14:04:24 +03:00
Lasse Collin
4ffc60f323 tuklib_integer: Rename bswapXX to byteswapXX
The __builtin_bswapXX from GCC and Clang are preferred when
they are available. This can allow compilers to emit the x86 MOVBE
instruction instead of doing a load + byteswap as two instructions
(which would happen if the byteswapping is done in inline asm).

bswap16, bswap32, and bswap64 exist in system headers on *BSDs
and Darwin. #defining bswap16 on NetBSD results in a warning about
macro redefinition. It's safest to avoid this namespace conflict
completely.

No OS supported by tuklib_integer.h uses byteswapXX names and
a web search doesn't immediately find any obvious danger of
namespace conflicts. So let's try these still-pretty-short names
for the macros.

Thanks to Sam James for pointing out the compiler warning on
NetBSD 10.0.
2024-04-25 14:00:57 +03:00
Lasse Collin
08ab0966a7 liblzma: API doc cleanups 2024-04-24 01:20:58 +03:00
Lasse Collin
3ac8a9bb4c Tests: test_filter_str: Add a few assertions 2024-04-23 16:35:33 +03:00
Lasse Collin
26c69be805 Tests: test_filter_str: Move one assertion and add a comment 2024-04-23 16:35:08 +03:00
Lasse Collin
4f6af853bc Tests: test_filter_str: Tweak comments and white space 2024-04-23 16:26:06 +03:00
Lasse Collin
c92663aa1b Tests: test_filter_str: Add missing RISC-V case
Fixes: 89ea1a22f4ed3685b053b7260bc5acf6c75d1664
2024-04-23 16:25:22 +03:00
Lasse Collin
b0366df1d7 Tests: test_filter_str: Test *error_pos more thoroughly 2024-04-22 23:01:53 +03:00
Lasse Collin
70d12dd069 liblzma: lzma_str_to_filters: Set *error_pos on all errors
The API docs clearly say that if error_pos isn't NULL then *error
is always set on any error. However, it wasn't touched if str == NULL
or filters == NULL or unsupported flags were specified.

Fixes: cedeeca2ea6ada5b0411b2ae10d7a859e837f203
2024-04-22 22:03:04 +03:00
Lasse Collin
ed8e552395 liblzma: Clean up white space 2024-04-22 20:31:25 +03:00
Lasse Collin
2f06920f20 Tests: test_filter_flags: Edit comments and style 2024-04-22 18:35:19 +03:00
Lasse Collin
b101e1d1db Tests: Fix C99/C11 compatibility when features are disabled
The array could become empty and then the initializer would be
simply {} which is allowed only in GNU-C and C23.
2024-04-22 16:39:44 +03:00
Lasse Collin
f8f3a220ac DOS: Omit useless defines from config.h 2024-04-21 20:32:16 +03:00
Lasse Collin
fc1921b04b Build: Omit useless checks for fcntl.h, limits.h, and sys/time.h 2024-04-21 20:27:50 +03:00
Lasse Collin
6aa2a6deeb liblzma: Silence a warning from Coverity static analysis
It is logical why it cannot know for sure that the value has
to be at most 4 if it is less than 16.

The x86 filter is based on a very old LZMA SDK version. Newer
ones have quite a different implementation for the same filter.

Thanks to Sam James.
2024-04-20 12:09:37 +03:00
Lasse Collin
e89d3e83b4 Update .gitignore 2024-04-19 23:18:19 +03:00
Lasse Collin
86fc4ee859 Tests: test_lzip_decoder: Tweak coding style and comments 2024-04-19 20:53:24 +03:00
Lasse Collin
38be573a27 Tests: test_lzip_decoder: Remove redundant initializations 2024-04-19 20:51:36 +03:00
Lasse Collin
d7e4bc53ea Tests: test_lzip_decoder: Remove unneeded tuktest_malloc() calls 2024-04-19 20:47:24 +03:00
Lasse Collin
eeca8f7c5b xz: Fix white space error.
Thanks to xx on #tukaani.
2024-04-15 20:35:07 +03:00
Sam James
462ca94099 xz: add missing noreturn for message_filters_help
Fixes: a165d7df1964121eb9df715e6f836a31c865beef
2024-04-14 17:26:54 +03:00
Sam James
863f13d282 xz: signals: suppress -Wsign-conversion on macOS
On macOS, we get:
```
signals.c: In function 'signals_init':
signals.c:76:17: error: conversion to 'sigset_t' {aka 'unsigned int'} from 'int' may change the sign of the result [-Werror=sign-conversion]
   76 |                 sigaddset(&hooked_signals, sigs[i]);
      |                 ^~~~~~~~~
signals.c:81:17: error: conversion to 'sigset_t' {aka 'unsigned int'} from 'int' may change the sign of the result [-Werror=sign-conversion]
   81 |                 sigaddset(&hooked_signals, message_progress_sigs[i]);
      |                 ^~~~~~~~~
signals.c:86:9: error: conversion to 'sigset_t' {aka 'unsigned int'} from 'int' may change the sign of the result [-Werror=sign-conversion]
   86 |         sigaddset(&hooked_signals, SIGTSTP);
      |         ^~~~~~~~~
```

We use `int` for `hooked_signals` but we can't just cast to whatever
`sigset_t` is because `sigset_t` is an opaque type. It's an unsigned int
on macOS. On macOS, `sigaddset` is implemented as a macro.

Just suppress -Wsign-conversion for `signals_init` for macOS given
there's no real nice way of fixing this.
2024-04-14 17:26:43 +03:00
Lasse Collin
fcbd0d1999 Tests: test_microlzma: Add a "FIXME?" about LZMA_FINISH handling 2024-04-13 22:39:10 +03:00
Lasse Collin
0fe2dfa683 Tests: test_microlzma: Tweak comments, coding style, and minor details
A few lines were reordered, a few ARRAY_SIZE were changed to sizeof,
and a few uint32_t were changed to size_t. No real functional changes
were intended.
2024-04-13 21:01:10 +03:00
Ryan Carsten Schmidt
97f0ee0f1f
CI: Use only the active CPUs on macOS
hw.ncpu counts all CPUs including inactive ones. hw.activecpu counts
only the active CPUs.
2024-04-12 19:31:13 -05:00
Sam James
73f629e321 ci: rename ci_build.sh -> ci_build.bash
We discussed the name and it's less cognitive load to just call it '.bash'
so you don't have an immediate question about if bashisms are OK.
2024-04-11 00:15:35 +03:00
Sam James
8709407a9e ci: build in parallel by default 2024-04-11 00:15:35 +03:00
Sam James
65bf7e0a1c ci: default to -O2
We need this for when we're passing sanitizer flags or -gdwarf-4 for Clang
with Valgrind. Just always start with -O2 if CFLAGS isn't set in the
environment and append what was passed on the command line.
2024-04-11 00:15:35 +03:00
Sam James
bc899f9e07 ci: make automake's test runner verbose on failures
This is a lot easier to work with than the save-logs thing the action
tries to do...
2024-04-11 00:15:35 +03:00
Sam James
b5e3470442 ci: make UBSAN abort on errors
Unfortunately, UBSAN doesn't do this by default. See also the change
I made in Meson for this in October [0].

[0] 7b7d2e060b
2024-04-11 00:15:35 +03:00
Sam James
6c095a98fb ci: test Valgrind
Using `--trace-children=yes` has a trade-off here, as it makes
`test_scripts.sh` pretty slow when calling various non-xz utilities.

But I also feel like it's not useless to have Valgrind used there and it's
not easy to exclude Valgrind just for that one test...

I did consider using AX_VALGRIND_CHECK [0][1] but I couldn't get it working
immediately with some conditionally-built tests and I wondered if it was
worth spending time on at least while we're debating xz's future build
system situation.

[0] https://www.gnu.org/software/autoconf-archive/ax_valgrind_check.html
[1] https://tecnocode.co.uk/2014/12/23/automatically-valgrinding-code-with-ax_valgrind_check/
2024-04-11 00:15:35 +03:00
Lasse Collin
6286c1900c liblzma: CRC: Simplify table omission macros
A macro is useful to prevent a single #if directive from
getting too ugly but only one macro is needed for all archs.
2024-04-10 23:33:17 +03:00
Lasse Collin
45da936c87 liblzma: ARM64 CRC: Fix omission of CRC32 table
The macro name had an odd typo so the table wasn't omitted
when it should have.

Fixes: 1940f0ec28f08c0ac72c1413d9706fb82eabe6ad
2024-04-10 23:12:23 +03:00
Lasse Collin
308a9af854 Build: If ARM64 feature detection func is found, stop looking for others
This can speed up configure a tiny bit.

Fixes: c5f6d79cc9515a7f22d7ea4860c6cc394b295732
2024-04-10 23:12:23 +03:00
Lasse Collin
fc43cecd32 liblzma: ARM64 CRC32: Change style of the macOS code to match FreeBSD
I didn't test this but it shouldn't change any functionality.

Fixes: 761f5b69a4c778c8bcb09279b845b07c28790575
2024-04-10 23:12:23 +03:00
Lasse Collin
1024cd4cd9 liblzma: ARM64 CRC32: Add error checking to FreeBSD-specific code
Also add parenthesis to the return statement.

I didn't test this.

Fixes: 761f5b69a4c778c8bcb09279b845b07c28790575
2024-04-10 23:12:23 +03:00
Lasse Collin
2337f7021c liblzma: ARM64 CRC32: Use negation instead of subtracting from 8
Subtracting from 0 is negation, this just keeps warnings away.

Fixes: 761f5b69a4c778c8bcb09279b845b07c28790575
2024-04-10 23:12:11 +03:00
Lasse Collin
d8fffd01aa liblzma: ARM64 CRC32: Tweak coding style and comments 2024-04-10 22:53:53 +03:00
Lasse Collin
780d2c236d Update SECURITY.md. 2024-04-09 21:55:01 +03:00
Lasse Collin
986865ea2f CI: Remove ifunc support. 2024-04-09 18:22:27 +03:00
Lasse Collin
689ae24273 liblzma: Remove ifunc support.
This is *NOT* done for security reasons even though the backdoor
relied on the ifunc code. Instead, the reason is that in this
project ifunc provides little benefits but it's quite a bit of
extra code to support it. The only case where ifunc *might* matter
for performance is if the CRC functions are used directly by an
application. In normal compression use it's completely irrelevant.
2024-04-09 18:22:27 +03:00
Lasse Collin
6b4c859059 tests/files/README: Update the main heading. 2024-04-09 18:22:27 +03:00
Lasse Collin
2a851e06b8 tests/files/README: Explain how to recreate the ARM64 test files. 2024-04-09 18:22:27 +03:00
Lasse Collin
3d09b721b9 debug: Add generator for the ARM64 test file data. 2024-04-09 18:22:27 +03:00
Lasse Collin
31ef676567 xz man page: Use .ft CR instead of CW to silence warnings from groff. 2024-04-09 18:22:27 +03:00
Lasse Collin
780cbf29d5 Fix NEWS for 5.6.0 and 5.6.1. 2024-04-09 18:22:27 +03:00
Lasse Collin
bfd0c7c478 Remove the XZ logo. 2024-04-09 18:22:27 +03:00
Lasse Collin
77a294d98a Update maintainer and author info.
The other maintainer suddenly disappeared.
2024-04-09 18:22:27 +03:00
Lasse Collin
8dd03d4484 Docs: Update .xz file format specification to 1.2.1.
This only reverts the XZ URL changes.
2024-04-09 18:22:27 +03:00
Lasse Collin
17aa2e1a79 Update website URLs back to tukaani.org.
The XZ projects were moved back to their original URLs.
2024-04-09 18:22:27 +03:00
Lasse Collin
2739db9810 xzdec: Tweak coding style and comments. 2024-04-09 18:22:27 +03:00
Lasse Collin
408b6adb2a tests/ossfuzz: Tiny fix to a comment. 2024-04-09 18:22:27 +03:00
Lasse Collin
db4dd74a34 Update THANKS. 2024-04-09 18:22:27 +03:00
Lasse Collin
e93e13c8b3 Remove the backdoor found in 5.6.0 and 5.6.1 (CVE-2024-3094).
While the backdoor was inactive (and thus harmless) without inserting
a small trigger code into the build system when the source package was
created, it's good to remove this anyway:

  - The executable payloads were embedded as binary blobs in
    the test files. This was a blatant violation of the
    Debian Free Software Guidelines.

  - On machines that see lots bots poking at the SSH port, the backdoor
    noticeably increased CPU load, resulting in degraded user experience
    and thus overwhelmingly negative user feedback.

  - The maintainer who added the backdoor has disappeared.

  - Backdoors are bad for security.

This reverts the following without making any other changes:

6e636819 Tests: Update two test files.
a3a29bbd Tests: Test --single-stream can decompress bad-3-corrupt_lzma2.xz.
0b4ccc91 Tests: Update RISC-V test files.
8c9b8b20 liblzma: Fix typos in crc32_fast.c and crc64_fast.c.
82ecc538 liblzma: Fix false Valgrind error report with GCC.
cf44e4b7 Tests: Add a few test files.
3060e107 Tests: Use smaller dictionary size in RISC-V test files.
e2870db5 Tests: Add two RISC-V Filter test files.

The RISC-V test files also have real content that tests the filter
but the real content would fit into much smaller files. A generator
program would need to be available as well.

Thanks to Andres Freund for finding and reporting it and making
it public quickly so others could act without a delay.
See: https://www.openwall.com/lists/oss-security/2024/03/29/4
2024-04-09 17:57:39 +03:00
Lasse Collin
f9cf4c05ed CMake: Fix sabotaged Landlock sandbox check.
It never enabled it.
2024-03-30 14:36:28 +02:00
Jia Tan
af071ef770 Docs: Simplify SECURITY.md. 2024-03-26 03:38:12 +08:00
Lasse Collin
0b99783d63 liblzma: memcmplen.h: Add a comment why subtraction is used. 2024-03-22 17:46:30 +02:00
Lasse Collin
8a25ba024d INSTALL: Document arguments of --enable-symbol-versions. 2024-03-15 18:04:10 +02:00
Lasse Collin
49324b711f Build: Use only the generic symbol versioning with NVIDIA HPC Compiler.
This does the previous commit with CMake.

AC_EGREP_CPP uses AC_REQUIRE so the outermost if-commands must
be changed to AS_IF to ensure that things wont break some day.
See 5a5bd7f871818029d5ccbe189f087f591258c294.
2024-03-15 18:04:10 +02:00
Lasse Collin
c273123ed0 CMake: Use only the generic symbol versioning with NVIDIA HPC Compiler.
It doesn't support the __symver__ attribute or __asm__(".symver ...").
The generic symbol versioning can still be used since it only needs
linker support.
2024-03-15 18:04:10 +02:00
Lasse Collin
df7f487648 Update THANKS. 2024-03-15 18:04:10 +02:00
Lasse Collin
3217b82b3e liblzma: Minor comment edits. 2024-03-15 18:03:47 +02:00
Sergey Kosukhin
096bc0e3f8 liblzma: Fix building with NVHPC (NVIDIA HPC SDK).
NVHPC compiler has several issues that make it impossible to
build liblzma:
  - the compiler cannot handle unions that contain pointers that
    are not the first members;
  - the compiler cannot handle the assembler code in range_decoder.h
    (LZMA_RANGE_DECODER_CONFIG has to be set to zero);
  - the compiler fails to produce valid code for delta_decode if the
    vectorization is enabled, which results in failed tests.

This introduces NVHPC-specific workarounds that address the issues.
2024-03-15 17:30:50 +02:00
Lasse Collin
2ad7fad670 CMake: Disable symbol versioning on non-glibc Linux.
This better matches what configure.ac does. For example, musl has
only basic symbol versioning support:

https://wiki.musl-libc.org/functional-differences-from-glibc.html#Symbol_versioning

configure.ac tries to enable symbol versioning only with glibc
so now CMake does the same.
2024-03-15 17:30:50 +02:00
Lasse Collin
82f0c0d39e CMake: Make symbol versioning configurable. 2024-03-15 17:30:50 +02:00
Lasse Collin
45d33bfc45 Build: Style tweaks to configure.ac.
The AC_MSG_ERROR line is overlong anyway as are a few other
AC_MSG_ERROR lines already.
2024-03-13 22:00:23 +02:00
Sergey Kosukhin
f56ed6fac6 Build: Let the users override the symbol versioning variant.
There are cases when the users want to decide themselves whether
they want to have the generic (even on GNU/Linux) or the linux
(even if we do not recommend that) symbol versioning variant.
The former might be needed to circumvent compiler issues (i.e.
the compiler does not support all features that are required
for the linux versioning), the latter might help in overriding
the assumptions made in the configure script.
2024-03-13 21:59:55 +02:00
Jia Tan
a4f2e20d84 Add NEWS for 5.6.1 2024-03-09 11:27:27 +08:00
Jia Tan
f01be8ad75 Translations: Add missing --riscv option to man page translations. 2024-03-09 10:43:20 +08:00
Jia Tan
6e636819e8 Tests: Update two test files.
The original files were generated with random local to my machine.
To better reproduce these files in the future, a constant seed was used
to recreate these files.
2024-03-09 10:18:29 +08:00
Jia Tan
a3a29bbd5d Tests: Test --single-stream can decompress bad-3-corrupt_lzma2.xz.
The first stream in this file is valid, so this tests that xz properly
stops after decompressing it.
2024-03-09 10:08:32 +08:00
Jia Tan
0b4ccc9145 Tests: Update RISC-V test files.
This increases code coverage and tests for possible shifting bugs.
2024-03-09 10:05:32 +08:00
Jia Tan
8c9b8b2063 liblzma: Fix typos in crc32_fast.c and crc64_fast.c. 2024-03-09 09:52:32 +08:00
Jia Tan
b93a8d7631 Tests: Replace HAVE_MICROLZMA usage in CMake and Autotools builds.
This reverts commit adaacafde6661496ca2814b1e94a3ba5186428cb.
2024-03-09 09:49:55 +08:00
Jia Tan
82ecc53819 liblzma: Fix false Valgrind error report with GCC.
With GCC and a certain combination of flags, Valgrind will falsely
trigger an invalid write. This appears to be due to the omission of
instructions to properly save, set up, and restore the frame pointer.

The IFUNC resolver is a leaf function since it only calls a function
that is inlined. So sometimes GCC omits the frame pointer instructions
in the resolver unless this optimization is explictly disabled.

This fixes https://bugzilla.redhat.com/show_bug.cgi?id=2267598.
2024-03-09 09:20:57 +08:00
Lasse Collin
3007e74ef2 liblzma: Fix a typo in a comment in the RISC-V filter. 2024-03-05 23:23:16 +02:00
Jia Tan
72d2933bfa liblzma: Use attribute no_profile_instrument_function with ifunc.
Thanks to Sam James for determining this was the attribute needed to
workaround the GCC bug and for his version of the patch in Gentoo.
2024-03-05 01:54:30 +08:00
Jia Tan
e5faaebbcf Build: Require attribute no_profile_instrument_function for ifunc usage.
Using __attribute__((__no_profile_instrument_function__)) on the ifunc
resolver works around a bug in GCC -fprofile-generate:
it adds profiling code even to ifunc resolvers which can make
the ifunc resolver crash at program startup. This attribute
was not introduced until GCC 7 and Clang 13, so ifunc won't
be used with prior versions of these compilers.

This bug was brought to our attention by:

    https://bugs.gentoo.org/925415

And was reported to upstream GCC by:

    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11411
2024-03-05 01:54:30 +08:00
Lasse Collin
7eeadd279a liblzma: Fix a comment in the RISC-V filter. 2024-03-04 19:23:18 +02:00
Lasse Collin
5f3d059529 CMake: Warn if translated man pages are missing. 2024-02-29 16:37:19 +02:00
Lasse Collin
4cd1042ee7 CMake: Warn if gettext tools and pre-created .gmo files are missing.
It's only done with CMake >= 3.20 and if library support
for translation was already found.

Sort of fixes: https://github.com/tukaani-project/xz/issues/82
2024-02-29 16:37:19 +02:00
Lasse Collin
a94b42362c xz: Add comments. 2024-02-28 18:26:25 +02:00
Jia Tan
bbf112e323 xz: Change logging level for thread reduction to highest verbosity only.
Now that multi threaded encoding is the default, users do not need to
see a warning message everytime the number of threads is reduced. On
some machines, this could happen very often. It is not unreasonable for
users to need to set double verbose mode to see this kind of
information.

To see these warning messages -vv or --verbose --verbose must be passed
to set xz into the highest possible verbosity mode.

These warnings had caused automated testing frameworks to fail when they
expected no output to stderr.

Thanks to Sebastian Andrzej Siewior for reporting this and for the
initial version of the patch.
2024-02-29 00:05:50 +08:00
Lasse Collin
649f644744 Fix sorting in THANKS. 2024-02-26 23:06:13 +02:00
Jia Tan
1255b7d849 Update THANKS. 2024-02-26 23:40:50 +08:00
Chien Wong
eee579fff5 xz: Add missing RISC-V on the filter list in the man page
Signed-off-by: Chien Wong <m@xv97.com>
2024-02-26 23:36:04 +08:00
Jia Tan
328c52da8a Build: Fix Linux Landlock feature test in Autotools and CMake builds.
The previous Linux Landlock feature test assumed that having the
linux/landlock.h header file was enough. The new feature tests also
requires that prctl() and the required Landlock system calls are
supported.
2024-02-26 23:27:44 +08:00
Jia Tan
eb8ad59e9b Tests: Add test_microlzma to .gitignore and CMakeLists.txt. 2024-02-26 20:06:10 +08:00
Jia Tan
9eed1b9a3a Tests: Correct license header in test_microlzma.c. 2024-02-26 19:56:25 +08:00
Jia Tan
8bf9f72ee1 Fix typos in NEWS and CMakeLists. 2024-02-25 21:41:55 +08:00
Jia Tan
5d8d915ebe Bump version and soname for 5.7.0alpha.
Like 5.5.0alpha, 5.7.0alpha won't be released, it's just to mark that
the branch is not stable.

Once again there is no API/ABI stability for new features in devel
versions. The major soname won't be bumped even if API/ABI of new
features breaks between devel releases.
2024-02-24 16:30:06 +08:00
249 changed files with 43938 additions and 27722 deletions

View File

@ -1,9 +1,12 @@
# SPDX-License-Identifier: 0BSD
[codespell]
# Skip all translation files and a few other autogenerated files.
# The autotool files should have their typos fixed in the upstream, but
# until then we will blacklist them here.
skip = *.po,*.pot,./po4a/man,./doc/api,./configure,./autom4te.cache,./m4/libtool.m4,./build-aux/depcomp,./build-aux/ltmain.sh,./build-aux/config.guess,./build-aux/config.rpath,./m4/po.m4,./build-aux/config.sub
# THANKS contains names, some do trigger codespell.
skip = *.po,*.pot,./po4a/man,./doc/api,./configure,./autom4te.cache,./m4/libtool.m4,./build-aux/depcomp,./build-aux/ltmain.sh,./build-aux/config.guess,./build-aux/config.rpath,./m4/po.m4,./build-aux/config.sub,THANKS
# Ignore false positive matching words. Ideally codespell would allow
# ignoring words for specific files, but that does not appear to be
@ -22,3 +25,6 @@ builtin = clear,rare,informal,usage,names
# Always default to highest interactive level to avoid accidentally
# changing a false positive or picking the wrong replacement.
interactive = 3
# Ignore a URL with debbugs.
ignore-regex = \bhttps://debbugs\.gnu\.org\b

8
.gitattributes vendored Normal file
View File

@ -0,0 +1,8 @@
.gitattributes export-ignore
.gitignore export-ignore
/.codespellrc export-ignore
/.github export-ignore
/build-aux/ci_build.bash export-ignore
/doc/SHA256SUMS export-ignore

29
.github/SECURITY.md vendored
View File

@ -1,29 +0,0 @@
# Security Policy
## Supported Versions
We provide security updates to the development branch and the stable
branches. Security patches for old releases are available on the
[project website](https://xz.tukaani.org/xz-utils/).
## Reporting a Vulnerability
If you discover a security vulnerability in this project, please
report it privately. **Do not disclose it as a public issue.** This gives
us time to work with you to fix the issue before public exposure, reducing
the chance that the exploit will be used before a patch is released.
You may submit a report by emailing us at
[xz@tukaani.org](mailto:xz@tukaani.org), or through
[Security Advisories](https://github.com/tukaani-project/xz/security/advisories/new).
While both options are available, we prefer email. In any case, please
provide a clear description of the vulnerability including:
- Affected versions of XZ Utils
- Estimated severity (low, moderate, high, critical)
- Steps to recreate the vulnerability
- All relevant files (core dumps, build logs, input files, etc.)
This project is maintained by a team of volunteers on a reasonable-effort
basis. As such, please give us 90 days to work on a fix before
public exposure.

View File

@ -26,7 +26,7 @@ jobs:
build_system: [autotools, cmake]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 #v4.1.0
- uses: actions/checkout@v4.1.6
########################
# Install Dependencies #
@ -37,7 +37,7 @@ jobs:
if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
run: |
sudo apt-get update
sudo apt-get install -y autoconf automake build-essential po4a autopoint gcc-multilib doxygen musl-tools
sudo apt-get install -y autoconf automake build-essential po4a autopoint gcc-multilib doxygen musl-tools valgrind
# Install Autotools on Mac
- name: Install Dependencies
@ -49,12 +49,12 @@ jobs:
if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'cmake' }}
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake musl-tools
sudo apt-get install -y build-essential cmake gettext musl-tools
# Install CMake on Mac
- name: Install Dependencies
if: ${{ matrix.os == 'macos-latest' && matrix.build_system == 'cmake' }}
run: brew install cmake
run: brew install cmake gettext
##################
# Build and Test #
@ -70,90 +70,93 @@ jobs:
# done first.
- name: Build 32-bit
if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
run: ./build-aux/ci_build.sh -b autotools -p build -f "-m32"
run: ./build-aux/ci_build.bash -b autotools -p build -m "gcc -m32"
- name: Test 32-bit
if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
run: |
./build-aux/ci_build.sh -b autotools -p test -f "-m32" -n 32_bit
./build-aux/ci_build.bash -b autotools -p test -m "gcc -m32" -n 32_bit
cd ../xz_build && make distclean
# ifunc must be disabled for this test because __attribute__ ifunc is
# incompatible with -fsanitize=address.
#
# The sandbox must also be disabled because it will prevent access to
# The sandbox must be disabled because it will prevent access to
# the /proc/ filesystem on Linux, which is used by the sanitizer's
# instrumentation.
- name: Build with -fsanitize=address,undefined
if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
run: ./build-aux/ci_build.sh -b autotools -p build -f "-fsanitize=address,undefined" -d ifunc,sandbox
run: ./build-aux/ci_build.bash -b autotools -p build -f "-fsanitize=address,undefined" -d sandbox
- name: Test with -fsanitize=address,undefined
if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
run: |
./build-aux/ci_build.sh -b autotools -p test -f "-fsanitize=address,undefined" -d ifunc,sandbox
export UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1
./build-aux/ci_build.bash -b autotools -p test -f "-fsanitize=address,undefined" -d sandbox
cd ../xz_build && make distclean
- name: Build with Valgrind
if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
run: ./build-aux/ci_build.bash -b autotools -p build -d sandbox
- name: Test with Valgrind
if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
run: |
./build-aux/ci_build.bash -b autotools -p test -d sandbox -w "valgrind --quiet --trace-children=yes --trace-children-skip-by-arg=ls,cp,sed,grep,bash,sh --exit-on-first-error=yes --error-exitcode=1"
cd ../xz_build && make distclean
# musl libc has some slight differences compared to glibc, including
# the lack of ifunc support. This tests if the ifunc detection
# functions properly since musl-gcc can compile with ifunc support,
# but will fail at runtime.
- name: Build with musl libc
if: ${{ matrix.os == 'ubuntu-latest'}}
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -p build -m "/usr/bin/musl-gcc"
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -p build -m "/usr/bin/musl-gcc"
- name: Test with musl libc
if: ${{ matrix.os == 'ubuntu-latest'}}
run: |
./build-aux/ci_build.sh -b ${{ matrix.build_system }} -p test -m "/usr/bin/musl-gcc"
./build-aux/ci_build.bash -b ${{ matrix.build_system }} -p test -m "/usr/bin/musl-gcc"
- name: Clean up musl libc run
if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
run: cd ../xz_build && make distclean
- name: Build with full features
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -p build
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -p build
- name: Test with full features
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -p test -n full_features
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -p test -n full_features
- name: Build without encoders
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -d encoders,shared -p build
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d encoders,shared -p build
- name: Test without encoders
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -d encoders,shared -p test -n no_encoders
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d encoders,shared -p test -n no_encoders
- name: Build without decoders
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -d decoders,shared -p build
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d decoders,shared -p build
- name: Test without decoders
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -d decoders,shared -p test -n no_decoders
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d decoders,shared -p test -n no_decoders
- name: Build without threads
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -d threads,shared -p build
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d threads,shared -p build
- name: Test without threads
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -d threads,shared -p test -n no_threads
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d threads,shared -p test -n no_threads
- name: Build without BCJ filters
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -d bcj,shared,nls -p build
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d bcj,shared,nls -p build
- name: Test without BCJ filters
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -d bcj,shared,nls -p test -n no_bcj
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d bcj,shared,nls -p test -n no_bcj
- name: Build without Delta filters
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -d delta,shared,nls -p build
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d delta,shared,nls -p build
- name: Test without Delta filters
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -d delta,shared,nls -p test -n no_delta
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d delta,shared,nls -p test -n no_delta
- name: Build without sha256 check
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -c crc32,crc64 -d shared,nls -p build
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -c crc32,crc64 -d shared,nls -p build
- name: Test without sha256 check
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -c crc32,crc64 -d shared,nls -p test -n no_sha256
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -c crc32,crc64 -d shared,nls -p test -n no_sha256
- name: Build without crc64 check
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -c crc32,sha256 -d shared,nls -p build
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -c crc32,sha256 -d shared,nls -p build
- name: Test without crc64 check
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -c crc32,sha256 -d shared,nls -p test -n no_crc64
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -c crc32,sha256 -d shared,nls -p test -n no_crc64
- name: Build small
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -d small -p build
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d small -p build
- name: Test small
run: ./build-aux/ci_build.sh -b ${{ matrix.build_system }} -d small -p test -n small
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d small -p test -n small
# Attempt to upload the test logs as artifacts if any step has failed
- uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 #v4.0.0
- uses: actions/upload-artifact@v4.3.3
if: ${{ failure() }}
with:
name: ${{ matrix.os }} ${{ matrix.build_system }} Test Logs

32
.github/workflows/freebsd.yml vendored Normal file
View File

@ -0,0 +1,32 @@
# SPDX-License-Identifier: 0BSD
name: FreeBSD
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
FreeBSD-test:
runs-on: ubuntu-latest
name: Test xz on FreeBSD
steps:
- uses: actions/checkout@v4.1.6
- name: Test in FreeBSD
id: test
uses: vmactions/FreeBSD-vm@d7b8fcc7711aa41ad45e8d9b737cf90f035a7e3d #v1.1.3
with:
usesh: true
prepare: |
pkg install -y autoconf automake gmake gettext-tools gtar libtool m4 po4a
run: |
set -e
export LC_ALL=C LANG=C
uname -a
./autogen.sh
./configure --enable-werror
make
make check VERBOSE=1

89
.github/workflows/msvc.yml vendored Normal file
View File

@ -0,0 +1,89 @@
# SPDX-License-Identifier: 0BSD
# Author: Lasse Collin
name: Windows-MSVC
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
MSVC:
strategy:
fail-fast: false
matrix:
os: [ windows-2019, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4.2.2
- name: Configure Win32
run: >
cmake
-A Win32
-B build-msvc-win32
- name: Build Win32 Debug
run: >
cmake
--build build-msvc-win32
--config Debug
- name: Test Win32 Debug
run: >
ctest
--test-dir build-msvc-win32
--build-config Debug
--output-on-failure
- name: Build Win32 Release
run: >
cmake
--build build-msvc-win32
--config Release
# This fails with VS 2019 without b5a5d9e3f702.
- name: Test Win32 Release
run: >
ctest
--test-dir build-msvc-win32
--build-config Release
--output-on-failure
- name: Configure x64
run: >
cmake
-A x64
-B build-msvc-x64
- name: Build x64 Debug
run: >
cmake
--build build-msvc-x64
--config Debug
- name: Test x64 Debug
run: >
ctest
--test-dir build-msvc-x64
--build-config Debug
--output-on-failure
- name: Build x64 Release
run: >
cmake
--build build-msvc-x64
--config Release
- name: Test x64 Release
run: >
ctest
--test-dir build-msvc-x64
--build-config Release
--output-on-failure

32
.github/workflows/netbsd.yml vendored Normal file
View File

@ -0,0 +1,32 @@
# SPDX-License-Identifier: 0BSD
name: NetBSD
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
NetBSD-test:
runs-on: ubuntu-latest
name: Test xz on NetBSD
steps:
- uses: actions/checkout@v4.1.6
- name: Test in NetBSD
id: test
uses: vmactions/NetBSD-vm@dd0161ecbb6386e562fd098acf367633501487a4 #v1.1.3
with:
usesh: true
prepare: |
/usr/sbin/pkg_add -v autoconf automake gmake gettext-tools gtar-base libtool-base m4 po4a
run: |
set -e
export LC_ALL=C LANG=C
uname -a
./autogen.sh
./configure --enable-werror
make
make check VERBOSE=1

35
.github/workflows/openbsd.yml vendored Normal file
View File

@ -0,0 +1,35 @@
# SPDX-License-Identifier: 0BSD
name: OpenBSD
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
OpenBSD-test:
runs-on: ubuntu-latest
name: Test xz on OpenBSD
steps:
- uses: actions/checkout@v4.1.6
- name: Test in OpenBSD
id: test
uses: vmactions/OpenBSD-vm@ebafa4eac4adf5e7d04e5bbb4aa764b75dd160df #v1.1.2
with:
usesh: true
prepare: |
/usr/sbin/pkg_add -I -v autoconf-2.71 automake-1.16.5 gmake gettext-tools gtar libtool m4
run: |
set -e
export LC_ALL=C LANG=C
export AUTOCONF_VERSION=2.71
export AUTOMAKE_VERSION=1.16
uname -a
# OpenBSD ports lack po4a
./autogen.sh --no-po4a
./configure --enable-werror
make
make check VERBOSE=1

32
.github/workflows/solaris.yml vendored Normal file
View File

@ -0,0 +1,32 @@
# SPDX-License-Identifier: 0BSD
name: Solaris
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
solaris-test:
runs-on: ubuntu-latest
name: Test xz on Solaris
steps:
- uses: actions/checkout@v4.1.6
- name: Test in Solaris
id: test
uses: vmactions/solaris-vm@960d7483ffd6ac03397964cf6423a2f41332c9c8 #v1.0.9
with:
usesh: true
prepare: |
pkg install bash libtool automake gnu-m4 tree wget gcc autoconf //solaris/text/gawk pkg://solaris/text/gnu-diffutils pkg://solaris/text/gnu-grep pkg://solaris/text/gnu-sed
run: |
set -e
export LC_ALL=C LANG=C
uname -a
./autogen.sh --no-po4a
./configure --enable-werror
make
make check VERBOSE=1

View File

@ -39,7 +39,7 @@ jobs:
# Rely on the msys2 GitHub Action to set up the msys2 environment.
- name: Setup MSYS2
uses: msys2/setup-msys2@27b3aa77f672cb6b3054121cfd80c3d22ceebb1d #v2.20.1
uses: msys2/setup-msys2@cc11e9188b693c2b100158c3322424c4cc1dadea #v2.22.0
with:
msystem: ${{ matrix.msys2_env }}
update: true
@ -55,7 +55,7 @@ jobs:
# text file and will not match the output from xzgrep.
run: git config --global core.autocrlf false
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 #v4.1.0
- uses: actions/checkout@v4.1.6
########################
@ -87,29 +87,29 @@ jobs:
##################
- name: Build with full features
run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -p build
run: ./build-aux/ci_build.bash -a "--no-po4a" -b ${{ matrix.build_system }} -p build
- name: Test with full features
run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -p test -n full_features
run: ./build-aux/ci_build.bash -a "--no-po4a" -b ${{ matrix.build_system }} -p test -n full_features
- name: Build without threads
run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -d threads,shared -p build
run: ./build-aux/ci_build.bash -a "--no-po4a" -b ${{ matrix.build_system }} -d threads,shared -p build
- name: Test without threads
run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -d threads,shared -p test -n no_threads
run: ./build-aux/ci_build.bash -a "--no-po4a" -b ${{ matrix.build_system }} -d threads,shared -p test -n no_threads
- name: Build without encoders
run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -d encoders,shared -p build
run: ./build-aux/ci_build.bash -a "--no-po4a" -b ${{ matrix.build_system }} -d encoders,shared -p build
- name: Test without encoders
run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -d encoders,shared -p test -n no_encoders
run: ./build-aux/ci_build.bash -a "--no-po4a" -b ${{ matrix.build_system }} -d encoders,shared -p test -n no_encoders
- name: Build without decoders
run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -d decoders,shared -p build
run: ./build-aux/ci_build.bash -a "--no-po4a" -b ${{ matrix.build_system }} -d decoders,shared -p build
- name: Test without decoders
run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -d decoders,shared -p test -n no_decoders
run: ./build-aux/ci_build.bash -a "--no-po4a" -b ${{ matrix.build_system }} -d decoders,shared -p test -n no_decoders
- name: Build with only crc32 check
run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -c crc32 -d shared,nls -p build
run: ./build-aux/ci_build.bash -a "--no-po4a" -b ${{ matrix.build_system }} -c crc32 -d shared,nls -p build
- name: Test with only crc32 check
run: ./build-aux/ci_build.sh -a "--no-po4a" -b ${{ matrix.build_system }} -c crc32 -d shared,nls -p test -n crc32_only
run: ./build-aux/ci_build.bash -a "--no-po4a" -b ${{ matrix.build_system }} -c crc32 -d shared,nls -p test -n crc32_only
###############
@ -117,7 +117,7 @@ jobs:
###############
# Upload the test logs as artifacts if any step has failed.
- uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 #v4.0.0
- uses: actions/upload-artifact@v4.3.3
if: ${{ failure() }}
with:
name: ${{ matrix.msys2_env }} ${{ matrix.build_system }} Test Logs

26
.gitignore vendored
View File

@ -15,7 +15,6 @@ Makefile.in
/ABOUT-NLS
/autom4te.cache
/Doxyfile
/aclocal.m4
/config.h
/config.h.in
@ -41,6 +40,10 @@ coverage
/doc/internal
/doc/api
/po4a/man
/po4a/xz-man.pot
/po4a/*.po.authors
/src/liblzma/liblzma.pc
/src/lzmainfo/lzmainfo
/src/xz/xz
@ -67,6 +70,7 @@ coverage
/tests/test_index
/tests/test_index_hash
/tests/test_lzip_decoder
/tests/test_microlzma
/tests/test_memlimit
/tests/test_stream_flags
/tests/test_vli
@ -93,21 +97,17 @@ coverage
/DartConfiguration.tcl
/liblzma-config-version.cmake
/liblzma-config.cmake
/lzcat
/lzcat.1
/lzma
/lzma.1
/Testing
/tests_bin/
/unlzma
/unlzma.1
/unxz
/unxz.1
/xz
/xzcat
/xzcat.1
/xzdec
/lzmadec
/lzmainfo
/xzdiff
/xzgrep
/xzless
/xzmore
/liblzma.pc
/*.gmo
/windows/*/.vs
/windows/*/liblzma.vcxproj.user
/.vscode/

11
AUTHORS
View File

@ -2,8 +2,8 @@
Authors of XZ Utils
===================
XZ Utils is developed and maintained by Lasse Collin
<lasse.collin@tukaani.org> and Jia Tan <jiat0218@gmail.com>.
XZ Utils is developed and maintained by
Lasse Collin <lasse.collin@tukaani.org>.
Major parts of liblzma are based on code written by Igor Pavlov,
specifically the LZMA SDK <https://7-zip.org/sdk.html>. Without
@ -24,12 +24,17 @@ Authors of XZ Utils
by Michał Górny.
Architecture-specific CRC optimizations were contributed by
Ilya Kurdyukov, Hans Jansen, and Chenxi Mao.
Ilya Kurdyukov, Chenxi Mao, and Xi Ruoyao.
Other authors:
- Jonathan Nieder
- Joachim Henke
Special author: Jia Tan was a co-maintainer in 2022-2024. He and
the team behind him inserted a backdoor (CVE-2024-3094) into
XZ Utils 5.6.0 and 5.6.1 releases. He suddenly disappeared when
this was discovered.
Many people have contributed improvements or reported bugs.
Most of these people are mentioned in the file THANKS.

File diff suppressed because it is too large Load Diff

52
COPYING
View File

@ -3,8 +3,7 @@ XZ Utils Licensing
==================
Different licenses apply to different files in this package. Here
is a rough summary of which licenses apply to which parts of this
package (but check the individual files to be sure!):
is a summary of which licenses apply to which parts of this package:
- liblzma is under the BSD Zero Clause License (0BSD).
@ -25,20 +24,6 @@ XZ Utils Licensing
lzma-file-format.xt are in the public domain but may
be distributed under the terms of 0BSD too.
- Doxygen-generated HTML version of the liblzma API documentation:
While Doxygen is under the GNU GPLv2, the license information
in Doxygen includes the following exception:
Documents produced by doxygen are derivative works
derived from the input used in their production;
they are not affected by this license.
Note: The JavaScript files (under the MIT license) have
been removed from the Doxygen output.
- The XZ logo (xz-logo.png) included in the Doxygen-generated
documentation is under the Creative Commons BY-SA 4.0 license.
- Translated messages and man pages are under 0BSD except that
some old translations are in the public domain.
@ -51,8 +36,15 @@ XZ Utils Licensing
These files don't affect the licensing of the binaries being
built.
- The extra directory contain files that are under various
free software licenses.
- The 'extra' directory contains files that are under various
free software licenses. These aren't built or installed as
part of XZ Utils.
The following command may be helpful in finding per-file license
information. It works on xz.git and on a clean file tree extracted
from a release tarball.
sh build-aux/license-check.sh -v
For the files under the BSD Zero Clause License (0BSD), if
a copyright notice is needed, the following is sufficient:
@ -65,35 +57,13 @@ XZ Utils Licensing
it is not legally required by the license terms. Here is an example
of a good notice to put into "about box" or into documentation:
This software includes code from XZ Utils
<https://xz.tukaani.org/xz-utils/>.
This software includes code from XZ Utils <https://tukaani.org/xz/>.
The following license texts are included in the following files:
- COPYING.0BSD: BSD Zero Clause License
- COPYING.LGPLv2.1: GNU Lesser General Public License version 2.1
- COPYING.GPLv2: GNU General Public License version 2
- COPYING.GPLv3: GNU General Public License version 3
- COPYING.CC-BY-SA-4.0: Creative Commons Attribution-ShareAlike 4.0
International Public License
A note about old XZ Utils releases:
XZ Utils releases 5.4.6 and older and 5.5.1alpha have a
significant amount of code put into the public domain and
that obviously remains so. The switch from public domain to
0BSD for newer releases was made in Febrary 2024 because
public domain has (real or perceived) legal ambiguities in
some jurisdictions.
There is very little *practical* difference between public
domain and 0BSD. The main difference likely is that one
shouldn't claim that 0BSD-licensed code is in the public
domain; 0BSD-licensed code is copyrighted but available under
an extremely permissive license. Neither 0BSD nor public domain
require retaining or reproducing author, copyright holder, or
license notices when distributing the software. (Compare to,
for example, BSD 2-Clause "Simplified" License which does have
such requirements.)
If you have questions, don't hesitate to ask for more information.
The contact information is in the README file.

View File

@ -1,427 +0,0 @@
Attribution-ShareAlike 4.0 International
=======================================================================
Creative Commons Corporation ("Creative Commons") is not a law firm and
does not provide legal services or legal advice. Distribution of
Creative Commons public licenses does not create a lawyer-client or
other relationship. Creative Commons makes its licenses and related
information available on an "as-is" basis. Creative Commons gives no
warranties regarding its licenses, any material licensed under their
terms and conditions, or any related information. Creative Commons
disclaims all liability for damages resulting from their use to the
fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and
conditions that creators and other rights holders may use to share
original works of authorship and other material subject to copyright
and certain other rights specified in the public license below. The
following considerations are for informational purposes only, are not
exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are
intended for use by those authorized to give the public
permission to use material in ways otherwise restricted by
copyright and certain other rights. Our licenses are
irrevocable. Licensors should read and understand the terms
and conditions of the license they choose before applying it.
Licensors should also secure all rights necessary before
applying our licenses so that the public can reuse the
material as expected. Licensors should clearly mark any
material not subject to the license. This includes other CC-
licensed material, or material used under an exception or
limitation to copyright. More considerations for licensors:
wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public
licenses, a licensor grants the public permission to use the
licensed material under specified terms and conditions. If
the licensor's permission is not necessary for any reason--for
example, because of any applicable exception or limitation to
copyright--then that use is not regulated by the license. Our
licenses grant only permissions under copyright and certain
other rights that a licensor has authority to grant. Use of
the licensed material may still be restricted for other
reasons, including because others have copyright or other
rights in the material. A licensor may make special requests,
such as asking that all changes be marked or described.
Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More considerations
for the public:
wiki.creativecommons.org/Considerations_for_licensees
=======================================================================
Creative Commons Attribution-ShareAlike 4.0 International Public
License
By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution-ShareAlike 4.0 International Public License ("Public
License"). To the extent this Public License may be interpreted as a
contract, You are granted the Licensed Rights in consideration of Your
acceptance of these terms and conditions, and the Licensor grants You
such rights in consideration of benefits the Licensor receives from
making the Licensed Material available under these terms and
conditions.
Section 1 -- Definitions.
a. Adapted Material means material subject to Copyright and Similar
Rights that is derived from or based upon the Licensed Material
and in which the Licensed Material is translated, altered,
arranged, transformed, or otherwise modified in a manner requiring
permission under the Copyright and Similar Rights held by the
Licensor. For purposes of this Public License, where the Licensed
Material is a musical work, performance, or sound recording,
Adapted Material is always produced where the Licensed Material is
synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright
and Similar Rights in Your contributions to Adapted Material in
accordance with the terms and conditions of this Public License.
c. BY-SA Compatible License means a license listed at
creativecommons.org/compatiblelicenses, approved by Creative
Commons as essentially the equivalent of this Public License.
d. Copyright and Similar Rights means copyright and/or similar rights
closely related to copyright including, without limitation,
performance, broadcast, sound recording, and Sui Generis Database
Rights, without regard to how the rights are labeled or
categorized. For purposes of this Public License, the rights
specified in Section 2(b)(1)-(2) are not Copyright and Similar
Rights.
e. Effective Technological Measures means those measures that, in the
absence of proper authority, may not be circumvented under laws
fulfilling obligations under Article 11 of the WIPO Copyright
Treaty adopted on December 20, 1996, and/or similar international
agreements.
f. Exceptions and Limitations means fair use, fair dealing, and/or
any other exception or limitation to Copyright and Similar Rights
that applies to Your use of the Licensed Material.
g. License Elements means the license attributes listed in the name
of a Creative Commons Public License. The License Elements of this
Public License are Attribution and ShareAlike.
h. Licensed Material means the artistic or literary work, database,
or other material to which the Licensor applied this Public
License.
i. Licensed Rights means the rights granted to You subject to the
terms and conditions of this Public License, which are limited to
all Copyright and Similar Rights that apply to Your use of the
Licensed Material and that the Licensor has authority to license.
j. Licensor means the individual(s) or entity(ies) granting rights
under this Public License.
k. Share means to provide material to the public by any means or
process that requires permission under the Licensed Rights, such
as reproduction, public display, public performance, distribution,
dissemination, communication, or importation, and to make material
available to the public including in ways that members of the
public may access the material from a place and at a time
individually chosen by them.
l. Sui Generis Database Rights means rights other than copyright
resulting from Directive 96/9/EC of the European Parliament and of
the Council of 11 March 1996 on the legal protection of databases,
as amended and/or succeeded, as well as other essentially
equivalent rights anywhere in the world.
m. You means the individual or entity exercising the Licensed Rights
under this Public License. Your has a corresponding meaning.
Section 2 -- Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License,
the Licensor hereby grants You a worldwide, royalty-free,
non-sublicensable, non-exclusive, irrevocable license to
exercise the Licensed Rights in the Licensed Material to:
a. reproduce and Share the Licensed Material, in whole or
in part; and
b. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where
Exceptions and Limitations apply to Your use, this Public
License does not apply, and You do not need to comply with
its terms and conditions.
3. Term. The term of this Public License is specified in Section
6(a).
4. Media and formats; technical modifications allowed. The
Licensor authorizes You to exercise the Licensed Rights in
all media and formats whether now known or hereafter created,
and to make technical modifications necessary to do so. The
Licensor waives and/or agrees not to assert any right or
authority to forbid You from making technical modifications
necessary to exercise the Licensed Rights, including
technical modifications necessary to circumvent Effective
Technological Measures. For purposes of this Public License,
simply making modifications authorized by this Section 2(a)
(4) never produces Adapted Material.
5. Downstream recipients.
a. Offer from the Licensor -- Licensed Material. Every
recipient of the Licensed Material automatically
receives an offer from the Licensor to exercise the
Licensed Rights under the terms and conditions of this
Public License.
b. Additional offer from the Licensor -- Adapted Material.
Every recipient of Adapted Material from You
automatically receives an offer from the Licensor to
exercise the Licensed Rights in the Adapted Material
under the conditions of the Adapter's License You apply.
c. No downstream restrictions. You may not offer or impose
any additional or different terms or conditions on, or
apply any Effective Technological Measures to, the
Licensed Material if doing so restricts exercise of the
Licensed Rights by any recipient of the Licensed
Material.
6. No endorsement. Nothing in this Public License constitutes or
may be construed as permission to assert or imply that You
are, or that Your use of the Licensed Material is, connected
with, or sponsored, endorsed, or granted official status by,
the Licensor or others designated to receive attribution as
provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not
licensed under this Public License, nor are publicity,
privacy, and/or other similar personality rights; however, to
the extent possible, the Licensor waives and/or agrees not to
assert any such rights held by the Licensor to the limited
extent necessary to allow You to exercise the Licensed
Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this
Public License.
3. To the extent possible, the Licensor waives any right to
collect royalties from You for the exercise of the Licensed
Rights, whether directly or through a collecting society
under any voluntary or waivable statutory or compulsory
licensing scheme. In all other cases the Licensor expressly
reserves any right to collect such royalties.
Section 3 -- License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the
following conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified
form), You must:
a. retain the following if it is supplied by the Licensor
with the Licensed Material:
i. identification of the creator(s) of the Licensed
Material and any others designated to receive
attribution, in any reasonable manner requested by
the Licensor (including by pseudonym if
designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of
warranties;
v. a URI or hyperlink to the Licensed Material to the
extent reasonably practicable;
b. indicate if You modified the Licensed Material and
retain an indication of any previous modifications; and
c. indicate the Licensed Material is licensed under this
Public License, and include the text of, or the URI or
hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any
reasonable manner based on the medium, means, and context in
which You Share the Licensed Material. For example, it may be
reasonable to satisfy the conditions by providing a URI or
hyperlink to a resource that includes the required
information.
3. If requested by the Licensor, You must remove any of the
information required by Section 3(a)(1)(A) to the extent
reasonably practicable.
b. ShareAlike.
In addition to the conditions in Section 3(a), if You Share
Adapted Material You produce, the following conditions also apply.
1. The Adapter's License You apply must be a Creative Commons
license with the same License Elements, this version or
later, or a BY-SA Compatible License.
2. You must include the text of, or the URI or hyperlink to, the
Adapter's License You apply. You may satisfy this condition
in any reasonable manner based on the medium, means, and
context in which You Share Adapted Material.
3. You may not offer or impose any additional or different terms
or conditions on, or apply any Effective Technological
Measures to, Adapted Material that restrict exercise of the
rights granted under the Adapter's License You apply.
Section 4 -- Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that
apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
to extract, reuse, reproduce, and Share all or a substantial
portion of the contents of the database;
b. if You include all or a substantial portion of the database
contents in a database in which You have Sui Generis Database
Rights, then the database in which You have Sui Generis Database
Rights (but not its individual contents) is Adapted Material,
including for purposes of Section 3(b); and
c. You must comply with the conditions in Section 3(a) if You Share
all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not
replace Your obligations under this Public License where the Licensed
Rights include other Copyright and Similar Rights.
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
c. The disclaimer of warranties and limitation of liability provided
above shall be interpreted in a manner that, to the extent
possible, most closely approximates an absolute disclaimer and
waiver of all liability.
Section 6 -- Term and Termination.
a. This Public License applies for the term of the Copyright and
Similar Rights licensed here. However, if You fail to comply with
this Public License, then Your rights under this Public License
terminate automatically.
b. Where Your right to use the Licensed Material has terminated under
Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided
it is cured within 30 days of Your discovery of the
violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any
right the Licensor may have to seek remedies for Your violations
of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the
Licensed Material under separate terms or conditions or stop
distributing the Licensed Material at any time; however, doing so
will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
License.
Section 7 -- Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different
terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the
Licensed Material not stated herein are separate from and
independent of the terms and conditions of this Public License.
Section 8 -- Interpretation.
a. For the avoidance of doubt, this Public License does not, and
shall not be interpreted to, reduce, limit, restrict, or impose
conditions on any use of the Licensed Material that could lawfully
be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is
deemed unenforceable, it shall be automatically reformed to the
minimum extent necessary to make it enforceable. If the provision
cannot be reformed, it shall be severed from this Public License
without affecting the enforceability of the remaining terms and
conditions.
c. No term or condition of this Public License will be waived and no
failure to comply consented to unless expressly agreed to by the
Licensor.
d. Nothing in this Public License constitutes or may be interpreted
as a limitation upon, or waiver of, any privileges and immunities
that apply to the Licensor or You, including from the legal
processes of any jurisdiction or authority.
=======================================================================
Creative Commons is not a party to its public
licenses. Notwithstanding, Creative Commons may elect to apply one of
its public licenses to material it publishes and in those instances
will be considered the “Licensor.” The text of the Creative Commons
public licenses is dedicated to the public domain under the CC0 Public
Domain Dedication. Except for the limited purpose of indicating that
material is shared under a Creative Commons public license or as
otherwise permitted by the Creative Commons policies published at
creativecommons.org/policies, Creative Commons does not authorize the
use of the trademark "Creative Commons" or any other trademark or logo
of Creative Commons without its prior written consent including,
without limitation, in connection with any unauthorized modifications
to any of its public licenses or any other arrangements,
understandings, or agreements concerning use of licensed material. For
the avoidance of doubt, this paragraph does not form part of the
public licenses.
Creative Commons may be contacted at creativecommons.org.

226
INSTALL
View File

@ -16,7 +16,7 @@ XZ Utils Installation
1.2.8. DOS
1.2.9. z/OS
1.3. Adding support for new platforms
2. configure options
2. configure and CMake options
2.1. Static vs. dynamic linking of liblzma
2.2. Optimizing xzdec and lzmadec
3. xzgrep and other scripts
@ -76,6 +76,11 @@ XZ Utils Installation
you use CC=xlc instead, you must disable threading support
with --disable-threads (usually not recommended).
If building a 32-bit executable, the address space available to xz
might be limited to 256 MiB by default. To increase the address
space to 2 GiB, pass LDFLAGS=-Wl,-bmaxdata:0x80000000 as an argument
to configure.
1.2.2. IRIX
@ -90,21 +95,15 @@ XZ Utils Installation
1.2.3. MINIX 3
The default install of MINIX 3 includes Amsterdam Compiler Kit (ACK),
which doesn't support C99. Install GCC to compile XZ Utils.
Version 3.3.0 and later are supported.
MINIX 3.1.8 and older have bugs in /usr/include/stdint.h, which has
to be patched before XZ Utils can be compiled correctly. See
<http://gforge.cs.vu.nl/gf/project/minix/tracker/?action=TrackerItemEdit&tracker_item_id=537>.
Multithreading isn't supported because MINIX 3 doesn't have
pthreads. The option --disable-threads must be passed to configure
as this isn't autodetected.
MINIX 3.2.0 and later use a different libc and aren't affected by
the above bug.
XZ Utils doesn't have code to detect the amount of physical RAM and
number of CPU cores on MINIX 3.
See section 5.4 in this file about symbol visibility warnings (you
may want to pass gl_cv_cc_visibility=no to configure).
Note that disabling threads causes "make check" to show a few tests
as skipped ("SKIP"). It's only due to a few threading-dependent
subtests are skipped. See the matching tests/test_*.log files.
1.2.4. OpenVMS
@ -219,19 +218,53 @@ XZ Utils Installation
in C89 or C++.
2. configure options
--------------------
2. configure and CMake options
------------------------------
In most cases, the defaults are what you want. Many of the options
below are useful only when building a size-optimized version of
liblzma or command line tools.
configure options are those that begin with two dashes "--"
or "gl_".
CMake options begin with "XZ_", "TUKLIB_", or "CMAKE_". To use
them on the command line, prefix them with "-D", for example,
"cmake -DCMAKE_COMPILE_WARNING_AS_ERROR=ON".
CMAKE_BUILD_TYPE=TYPE
CMake only:
For release builds, CMAKE_BUILD_TYPE=Release is fine.
On targets where CMake defaults to -O3, the default
value is overridden to -O2.
Empty value (CMAKE_BUILD_TYPE=) is fine if using custom
optimization options. *In this package* the empty build
type also disables debugging code just like "Release"
does. To enable debugging code with empty build type,
use -UNDEBUG in the CFLAGS environment variable or in
the CMAKE_C_FLAGS CMake variable to override -DNDEBUG.
Non-standard build types like "None" do NOT disable
debugging code! Such non-standard build types should
be avoided for production builds!
--enable-encoders=LIST
--disable-encoders
Specify a comma-separated LIST of filter encoders to
build. See "./configure --help" for exact list of
available filter encoders. The default is to build all
supported encoders.
XZ_ENCODERS=LIST
Specify a LIST of filter encoders to build. In the
configure option the list is comma separated.
CMake lists are semicolon separated.
To see the exact list of available filter encoders:
- Autotools: ./configure --help
- CMake: Configure the tree normally first, then use
"cmake -LH ." to list the cache variables.
The default is to build all supported encoders.
If LIST is empty or --disable-encoders is used, no filter
encoders will be built and also the code shared between
@ -243,10 +276,12 @@ XZ Utils Installation
--enable-decoders=LIST
--disable-decoders
XZ_DECODERS=LIST
This is like --enable-encoders but for decoders. The
default is to build all supported decoders.
--enable-match-finders=LIST
XZ_MATCH_FINDERS=LIST
liblzma includes two categories of match finders:
hash chains and binary trees. Hash chains (hc3 and hc4)
are quite fast but they don't provide the best compression
@ -263,9 +298,11 @@ XZ Utils Installation
or LZMA2 filter encoders are being built.
--enable-checks=LIST
XZ_CHECKS=LIST
liblzma support multiple integrity checks. CRC32 is
mandatory, and cannot be omitted. See "./configure --help"
for exact list of available integrity check types.
mandatory, and cannot be omitted. Supported check
types are "crc32", "crc64", and "sha256". By default
all supported check types are enabled.
liblzma and the command line tools can decompress files
which use unsupported integrity check type, but naturally
@ -276,6 +313,7 @@ XZ Utils Installation
it is known to not cause problems.
--enable-external-sha256
XZ_EXTERNAL_SHA256=ON
Try to use SHA-256 code from the operating system libc
or similar base system libraries. This doesn't try to
use OpenSSL or libgcrypt or such libraries.
@ -312,6 +350,8 @@ XZ Utils Installation
time xz --test foo.xz
--disable-microlzma
XZ_MICROLZMA_ENCODER=OFF
XZ_MICROLZMA_DECODER=OFF
Don't build MicroLZMA encoder and decoder. This omits
lzma_microlzma_encoder() and lzma_microlzma_decoder()
API functions from liblzma. These functions are needed
@ -319,6 +359,7 @@ XZ Utils Installation
erofs-utils but they may be used by others too.
--disable-lzip-decoder
XZ_LZIP_DECODER=OFF
Disable decompression support for .lz (lzip) files.
This omits the API function lzma_lzip_decoder() from
liblzma and .lz support from the xz tool.
@ -327,6 +368,10 @@ XZ Utils Installation
--disable-xzdec
--disable-lzmadec
--disable-lzmainfo
XZ_TOOL_XZ=OFF
XZ_TOOL_XZDEC=OFF
XZ_TOOL_LZMADEC=OFF
XZ_TOOL_LZMAINFO=OFF
Don't build and install the command line tool mentioned
in the option name.
@ -336,23 +381,40 @@ XZ Utils Installation
a dangling man page symlink lzmadec.1 -> xzdec.1 is
created.
XZ_TOOL_SYMLINKS=OFF
Don't create the unxz and xzcat symlinks. (There is
no "configure" option to disable these symlinks.)
--disable-lzma-links
XZ_TOOL_SYMLINKS_LZMA=OFF
Don't create symlinks for LZMA Utils compatibility.
This includes lzma, unlzma, and lzcat. If scripts are
installed, also lzdiff, lzcmp, lzgrep, lzegrep, lzfgrep,
lzmore, and lzless will be omitted if this option is used.
--disable-scripts
XZ_TOOL_SCRIPTS=OFF
Don't install the scripts xzdiff, xzgrep, xzmore, xzless,
and their symlinks.
--disable-doc
XZ_DOC=OFF
Don't install the documentation files to $docdir
(often /usr/doc/xz or /usr/local/doc/xz). Man pages
will still be installed. The $docdir can be changed
with --docdir=DIR.
--enable-doxygen
XZ_DOXYGEN=ON
Enable generation of the HTML version of the liblzma API
documentation using Doxygen. The resulting files are
installed to $docdir/api. This option assumes that
the 'doxygen' tool is available.
NOTE: --disable-doc or XZ_DOC=OFF don't affect this.
--disable-assembler
XZ_ASM_I386=OFF
This disables CRC32 and CRC64 assembly code on
32-bit x86. This option currently does nothing
on other architectures (not even on x86-64).
@ -365,7 +427,16 @@ XZ Utils Installation
pre-i686 systems, you may want to disable the assembler
code.
The assembly code is compatible with only certain OSes
and toolchains (it's not compatible with MSVC).
Since XZ Utils 5.7.1alpha, the 32-bit x86 assembly code
co-exists with the modern CLMUL code: CLMUL is used if
support for it is detected at runtime. On old processors
the assembly code is used.
--disable-clmul-crc
XZ_CLMUL_CRC=OFF
Disable the use of carryless multiplication for CRC
calculation even if compiler support for it is detected.
The code uses runtime detection of SSSE3, SSE4.1, and
@ -378,6 +449,7 @@ XZ Utils Installation
detection isn't used and the generic code is omitted.
--disable-arm64-crc32
XZ_ARM64_CRC32=OFF
Disable the use of the ARM64 CRC32 instruction extension
even if compiler support for it is detected. The code will
detect support for the instruction at runtime.
@ -387,7 +459,16 @@ XZ Utils Installation
and later) then runtime detection isn't used and the
generic code is omitted.
--disable-loongarch-crc32
XZ_LOONGARCH_CRC32=OFF
Disable the use of the 64-bit LoongArch CRC32
instruction extension even if compiler support for
it is detected. There is no runtime detection because
all 64-bit LoongArch processors should support
the CRC32 instructions.
--enable-unaligned-access
TUKLIB_FAST_UNALIGNED_ACCESS=ON
Allow liblzma to use unaligned memory access for 16-bit,
32-bit, and 64-bit loads and stores. This should be
enabled only when the hardware supports this, that is,
@ -435,6 +516,7 @@ XZ Utils Installation
how unaligned access is done in the C code.
--enable-unsafe-type-punning
TUKLIB_USE_UNSAFE_TYPE_PUNNING=ON
This enables use of code like
uint8_t *buf8 = ...;
@ -451,6 +533,7 @@ XZ Utils Installation
GCC 3 and early 4.x on x86, GCC < 6 on ARMv6 and ARMv7).
--enable-small
XZ_SMALL=ON
Reduce the size of liblzma by selecting smaller but
semantically equivalent version of some functions, and
omit precomputed lookup tables. This option tends to
@ -467,6 +550,7 @@ XZ Utils Installation
flag(s) to CFLAGS manually.
--enable-assume-ram=SIZE
XZ_ASSUME_RAM=SIZE
On the most common operating systems, XZ Utils is able to
detect the amount of physical memory on the system. This
information is used by the options --memlimit-compress,
@ -483,6 +567,7 @@ XZ Utils Installation
src/common/tuklib_physmem.c for details.
--enable-threads=METHOD
XZ_THREADS=METHOD
Threading support is enabled by default so normally there
is no need to specify this option.
@ -518,15 +603,8 @@ XZ Utils Installation
calls any liblzma functions from more than
one thread, something bad may happen.
--enable-ifunc
Use __attribute__((__ifunc__())) in liblzma. This is
enabled by default on GNU/Linux and FreeBSD.
The ifunc attribute is incompatible with
-fsanitize=address. --disable-ifunc must be used
if any -fsanitize= option is specified in CFLAGS.
--enable-sandbox=METHOD
XZ_SANDBOX=METHOD
There is limited sandboxing support in the xz and xzdec
tools. If built with sandbox support, xz uses it
automatically when (de)compressing exactly one file to
@ -561,23 +639,71 @@ XZ Utils Installation
sandboxing. If no Landlock support
is found, configure will give an error.
--enable-symbol-versions
Use symbol versioning for liblzma. This is enabled by
default on GNU/Linux, other GNU-based systems, and
FreeBSD.
--enable-symbol-versions[=VARIANT]
XZ_SYMBOL_VERSIONING=VARIANT
Use symbol versioning for liblzma shared library.
This is enabled by default on GNU/Linux (glibc only),
other GNU-based systems, and FreeBSD.
Symbol versioning is never used for static liblzma. This
option is ignored when not building a shared library.
Supported VARIANTs:
no Disable symbol versioning. This is the
same as using --disable-symbol-versions.
auto Autodetect between "no", "linux",
and "generic".
yes Autodetect between "linux" and
"generic". This forces symbol
versioning to be used when
building a shared library.
generic Generic version is the default for
FreeBSD and GNU/Linux on MicroBlaze.
This is also used on GNU/Linux when
building with NVIDIA HPC Compiler
because the compiler doesn't support
the features required for the "linux"
variant below.
linux Special version for GNU/Linux (glibc
only). This adds a few extra symbol
versions for compatibility with binaries
that have been linked against a liblzma
version that has been patched with
"xz-5.2.2-compat-libs.patch" from
RHEL/CentOS 7. That patch was used
by some build tools outside of
RHEL/CentOS 7 too.
--enable-debug
This enables the assert() macro and possibly some other
run-time consistency checks. It makes the code slower, so
you normally don't want to have this enabled.
In CMake, the build type (CMAKE_BUILD_TYPE) controls if
-DNDEBUG is passed to the compiler. *In this package*,
an empty build type disables debugging code too.
Non-standard build types like "None" do NOT disable
debugging code!
To enable debugging code with empty build type in CMake,
use -UNDEBUG in the CFLAGS environment variable or in
the CMAKE_C_FLAGS CMake variable to override -DNDEBUG.
--enable-werror
CMAKE_COMPILE_WARNING_AS_ERROR=ON (CMake >= 3.24)
If building with GCC, make all compiler warnings an error,
that abort the compilation. This may help catching bugs,
and should work on most systems. This has no effect on the
resulting binaries.
--enable-path-for-scripts=PREFIX
(CMake determines this from the path of XZ_POSIX_SHELL)
If PREFIX isn't empty, PATH=PREFIX:$PATH will be set in
the beginning of the scripts (xzgrep and others).
The default is empty except on Solaris the default is
@ -594,6 +720,36 @@ XZ Utils Installation
the PATH for the scripts. It is described in section 3.2
and is supported in this xz version too.
gl_cv_posix_shell=/path/to/bin/sh
XZ_POSIX_SHELL=/path/to/bin/sh
POSIX shell to use for xzgrep and other scripts.
- configure should autodetect this well enough.
Typically it's /bin/sh but in some cases, like
Solaris, something else is used.
- CMake build uses /bin/sh except on Solaris the
default is /usr/xpg4/bin/sh.
CMAKE_DLL_NAME_WITH_SOVERSION=ON
CMake on native Windows (not Cygwin) only:
This changes the filename liblzma.dll to liblzma-5.dll.
The unversioned filename liblzma.dll has been used
since XZ Utils 5.0.0 when creating binary packages
using the included windows/build.bash. The same
unversioned filename is the default with CMake.
However, there are popular builds that, very
understandably and reasonably, use the versioned
filename produced by GNU Libtool.
This option should usually be left to its default value
(OFF). It can be set to ON if the liblzma DLL filename
must be compatible with the versioned filename
produced by GNU Libtool. For example, binaries
distributed in MSYS2 use a versioned DLL filename.
2.1. Static vs. dynamic linking of liblzma
@ -762,7 +918,7 @@ XZ Utils Installation
The configure script determines if assembler code can be used by
looking at the configure triplet; there is currently no check if
the assembler code can actually actually be built. The x86 assembler
the assembler code can actually be built. The x86 assembler
code should work on x86 GNU/Linux, *BSDs, Solaris, Darwin, MinGW,
Cygwin, and DJGPP. On other x86 systems, there may be problems and
the assembler code may need to be disabled with the configure option.

View File

@ -36,18 +36,6 @@ dist_examples_DATA = \
doc/examples/04_compress_easy_mt.c \
doc/examples/11_file_info.c \
doc/examples/Makefile
# Install the Doxygen generated documentation if they were built.
install-data-local:
if test -d "$(srcdir)/doc/api" ; then \
$(MKDIR_P) "$(DESTDIR)$(docdir)/api" && \
$(INSTALL_DATA) "$(srcdir)"/doc/api/* \
"$(DESTDIR)$(docdir)/api"; \
fi
# Remove the Doxygen generated documentation when uninstalling.
uninstall-local:
rm -rf "$(DESTDIR)$(docdir)/api"
endif
EXTRA_DIST = \
@ -58,7 +46,6 @@ EXTRA_DIST = \
po4a \
windows \
CMakeLists.txt \
COPYING.CC-BY-SA-4.0 \
COPYING.GPLv2 \
COPYING.GPLv3 \
COPYING.LGPLv2.1 \
@ -66,14 +53,15 @@ EXTRA_DIST = \
PACKAGERS \
TODO \
autogen.sh \
build-aux/license-check.sh \
build-aux/manconv.sh \
build-aux/version.sh \
doc/xz-logo.png \
po/xz.pot-header
ACLOCAL_AMFLAGS = -I m4
# List of man pages to convert to PDF and plain text in the dist-hook target.
# List of man pages to convert to plain text in the dist-hook target
# or to PDF in the pdf-local target.
manfiles = \
src/xz/xz.1 \
src/xzdec/xzdec.1 \
@ -83,47 +71,53 @@ manfiles = \
src/scripts/xzless.1 \
src/scripts/xzmore.1
# Create ChangeLog from output of "git log --date=iso --stat".
# Convert the man pages to PDF and plain text (ASCII only) formats.
# Create ChangeLog using "git log".
# Convert the man pages to plain text (ASCII only) format.
dist-hook:
if test -d "$(srcdir)/.git" && type git > /dev/null 2>&1; then \
( cd "$(srcdir)" && git log --date=iso --stat \
( cd "$(srcdir)" && git log --pretty=medium --date=iso --stat \
b69da6d4bb6bb11fc0cf066920791990d2b22a06^..HEAD ) \
> "$(distdir)/ChangeLog"; \
fi
if type groff > /dev/null 2>&1 && type ps2pdf > /dev/null 2>&1; then \
if type groff > /dev/null 2>&1; then \
dest="$(distdir)/doc/man" && \
$(MKDIR_P) "$$dest/pdf-a4" "$$dest/pdf-letter" "$$dest/txt" && \
$(MKDIR_P) "$$dest/txt" && \
for FILE in $(manfiles); do \
BASE=`basename $$FILE .1` && \
sh "$(srcdir)/build-aux/manconv.sh" pdf a4 \
< "$(srcdir)/$$FILE" \
> "$$dest/pdf-a4/$$BASE-a4.pdf" && \
sh "$(srcdir)/build-aux/manconv.sh" pdf letter \
< "$(srcdir)/$$FILE" \
> "$$dest/pdf-letter/$$BASE-letter.pdf" && \
sh "$(srcdir)/build-aux/manconv.sh" ascii \
$(SHELL) "$(srcdir)/build-aux/manconv.sh" ascii \
< "$(srcdir)/$$FILE" \
> "$$dest/txt/$$BASE.txt"; \
done; \
fi
if test -d "$(srcdir)/doc/api" ; then \
$(MKDIR_P) "$(distdir)/doc/api" && \
$(INSTALL_DATA) "$(srcdir)"/doc/api/* \
"$(distdir)/doc/api"; \
fi
cd "$(distdir)" && $(SHELL) "build-aux/license-check.sh"
# This works with GNU tar and gives cleaner package than normal 'make dist'.
# This also ensures that the man page translations are up to date (dist-hook
# This also ensures that the translations are up to date (dist-hook
# would be too late for that).
mydist:
sh "$(srcdir)/src/liblzma/validate_map.sh"
cd "$(srcdir)/po4a" && sh update-po
cd "$(srcdir)/doxygen" && sh update-doxygen
$(SHELL) "$(srcdir)/src/liblzma/validate_map.sh"
cd po && $(MAKE) xz.pot-update
cd "$(srcdir)/po4a" && $(SHELL) update-po
VERSION=$(VERSION); \
if test -d "$(srcdir)/.git" && type git > /dev/null 2>&1; then \
SNAPSHOT=`cd "$(srcdir)" && git describe --abbrev=4 | cut -b2-`; \
$(SHELL) "$(srcdir)/build-aux/license-check.sh" || exit 1; \
SNAPSHOT=`cd "$(srcdir)" && git describe --abbrev=8 | cut -b2-`; \
test -n "$$SNAPSHOT" && VERSION=$$SNAPSHOT; \
fi; \
TAR_OPTIONS='--owner=0 --group=0 --numeric-owner --mode=u+rw,go+r-w' \
TAR_OPTIONS='--owner=0 --group=0 --numeric-owner --mode=u+rw,go+r-w --sort=name' \
LC_COLLATE=C \
$(MAKE) VERSION="$$VERSION" dist-gzip
# NOTE: This only creates the PDFs. The install rules are missing.
pdf-local:
dest="doc/man" && \
$(MKDIR_P) "$$dest/pdf-a4" "$$dest/pdf-letter" && \
for FILE in $(manfiles); do \
BASE=`basename $$FILE .1` && \
$(SHELL) "$(srcdir)/build-aux/manconv.sh" pdf a4 \
< "$(srcdir)/$$FILE" \
> "$$dest/pdf-a4/$$BASE-a4.pdf" && \
$(SHELL) "$(srcdir)/build-aux/manconv.sh" pdf letter \
< "$(srcdir)/$$FILE" \
> "$$dest/pdf-letter/$$BASE-letter.pdf"; \
done

776
NEWS
View File

@ -2,8 +2,576 @@
XZ Utils Release Notes
======================
5.8.1 (2025-04-03)
IMPORTANT: This includes a security fix for CVE-2025-31115 which
affects XZ Utils from 5.3.3alpha to 5.8.0. No new 5.4.x or 5.6.x
releases will be made, but the fix is in the v5.4 and v5.6 branches
in the xz Git repository. A standalone patch for all affected
versions is available as well.
* Multithreaded .xz decoder (lzma_stream_decoder_mt()):
- Fix a bug that could at least result in a crash with
invalid input. (CVE-2025-31115)
- Fix a performance bug: Only one thread was used if the whole
input file was provided at once to lzma_code(), the output
buffer was big enough, timeout was disabled, and LZMA_FINISH
was used. There are no bug reports about this, thus it's
possible that no real-world application was affected.
* Avoid <stdalign.h> even with C11/C17 compilers. This fixes the
build with Oracle Developer Studio 12.6 on Solaris 10 when the
compiler is in C11 mode (the header doesn't exist).
* Autotools: Restore compatibility with GNU make versions older
than 4.0 by creating the package using GNU gettext 0.23.1
infrastructure instead of 0.24.
* Update Croatian translation.
5.8.0 (2025-03-25)
This bumps the minor version of liblzma because new features were
added. The API and ABI are still backward compatible with liblzma
5.6.x, 5.4.x, 5.2.x, and 5.0.x.
* liblzma on 32/64-bit x86: When possible, use SSE2 intrinsics
instead of memcpy() in the LZMA/LZMA2 decoder. In typical cases,
this may reduce decompression time by 0-5 %. However, when built
against musl libc, over 15 % time reduction was observed with
highly compressed files.
* CMake: Make the feature test macros match the Autotools-based
build on NetBSD, Darwin, and mingw-w64.
* Update the Croatian, Italian, Portuguese, and Romanian
translations.
* Update the German, Italian, Korean, Romanian, Serbian, and
Ukrainian man page translations.
Summary of changes in the 5.7.x development releases:
* Mark the following LZMA Utils script aliases as deprecated:
lzcmp, lzdiff, lzless, lzmore, lzgrep, lzegrep, and lzfgrep.
* liblzma:
- Improve LZMA/LZMA2 encoder speed on 64-bit PowerPC (both
endiannesses) and those 64-bit RISC-V processors that
support fast unaligned access.
- Add low-level APIs for RISC-V, ARM64, and x86 BCJ filters
to lzma/bcj.h. These are primarily for erofs-utils.
- x86/x86-64/E2K CLMUL CRC code was rewritten.
- Use the CRC32 instructions on LoongArch.
* xz:
- Synchronize the output file and its directory using fsync()
before deleting the input file. No syncing is done when xz
isn't going to delete the input file.
- Add --no-sync to disable the sync-before-delete behavior.
- Make --single-stream imply --keep.
* xz, xzdec, lzmainfo: When printing messages, replace
non-printable characters with question marks.
* xz and xzdec on Linux: Support Landlock ABI versions 5 and 6.
* CMake: Revise the configuration variables and some of their
options, and document them in the file INSTALL. CMake support
is no longer experimental. (It was already not experimental
when building for native Windows.)
* Add build-aux/license-check.sh.
5.7.2beta (2025-03-08)
* On the man pages, mark the following LZMA Utils script aliases as
deprecated: lzcmp, lzdiff, lzless, lzmore, lzgrep, lzegrep, and
lzfgrep. The commands that start with xz* instead of lz* have
identical behavior.
The LZMA Utils aliases lzma, unlzma, and lzcat aren't deprecated
because some of these aliases are still in common use. lzmadec
and lzmainfo aren't deprecated either.
* xz: In the ENVIRONMENT section of the man page, warn about
problems that some uses of XZ_DEFAULTS and XZ_OPT may create.
* Windows (native builds, not Cygwin): In xz, xzdec, and lzmadec,
avoid an error message on broken pipe.
* Autotools: Fix out-of-tree builds when using the bundled
getopt_long.
* Translations:
- Updated: Chinese (traditional), Croatian, Finnish, Georgian,
German, Korean, Polish, Romanian, Serbian, Spanish, Swedish,
Turkish, and Ukrainian
- Added: Dutch
* Man page translations:
- Updated: German, Korean, Romanian, and Ukrainian
- Added: Italian and Serbian
5.7.1alpha (2025-01-23)
* All fixes from 5.6.4.
* liblzma:
- Improve LZMA/LZMA2 encoder speed on 64-bit PowerPC (both
endiannesses) and those 64-bit RISC-V processors that
support fast unaligned access.
- x86/x86-64/E2K CLMUL CRC code was rewritten. It's faster and
doesn't cause false positives from sanitizers. Attributes
like __attribute__((__no_sanitize_address__)) are no longer
present.
- On 32-bit x86, CLMUL CRC and the old (but still good)
assembly versions now co-exist with runtime detection.
Both Autotools and CMake build systems handle this
automatically now.
- Use the CRC32 instructions on LoongArch to make CRC32
calculation faster.
- Add low-level APIs for RISC-V, ARM64, and x86 BCJ filters
to lzma/bcj.h. These are primarily for erofs-utils.
- Minor tweaks to ARM64 CRC32 code and BCJ filters were made.
* xz:
- Synchronize the output file and its directory before deleting
the input file using fsync(). This reduces the probability of
data loss after a system crash. However, it can be a major
performance hit if processing many small files.
NOTE: No syncing is done when xz isn't going to delete
the input file.
- Add a new option --no-sync to disable the sync-before-delete
behavior. It's useful when compressing many small files and
one doesn't worry about data loss in case of a system crash.
- Make --single-stream imply --keep.
- Use automatic word wrapping for the text in --help and
similar situations to hopefully make the strings easier for
majority of translators (no need to count spaces anymore).
* xz, xzdec, lzmainfo: When printing messages, replace
non-printable characters with question marks. This way
malicious filenames cannot be used to send escape sequences
to a terminal. This change is also applied to filenames shown
in "xz --robot --list".
* xz and xzdec on Linux: Add support for Landlock ABI versions 5
and 6.
* CMake updates:
- Increase the minimum required CMake version to 3.20.
- Revise the configuration variables and some of their options.
Document them in the file INSTALL.
- Attempt to produce liblzma.pc so that the paths are based on
${prefix}, which makes it simpler to override the paths
if the liblzma files have been moved.
- To enable translations, gettext-tools is now required. The
CMake build no longer supports installing pre-compiled
message catalog binary files (po/*.gmo).
- Apple: Use Mach-O shared library versioning that is
compatible with GNU Libtool. This should make it easier to
switch between the build systems on Apple OSes that enforce
the correct compatibility_version (macOS >= 12 doesn't?).
This change is backward compatible: binaries linked against
old CMake-built liblzma will run with liblzma that uses
Libtool style versioning.
- Windows (not Cygwin): Document CMAKE_DLL_NAME_WITH_SOVERSION
(CMake >= 3.27) in the file INSTALL. This option should
usually be left to its default value (OFF). It can be set
to ON if the liblzma DLL filename must be compatible with
the versioned filename produced by GNU Libtool. For example,
binaries distributed in MSYS2 use a versioned DLL filename.
- CMake support is no longer experimental. (It was already
not experimental when building for native Windows.)
* Windows: Building liblzma with Visual Studio 2013 is no longer
supported. Visual Studio 2015 or later (with CMake) can be used
to build liblzma and the command line tools.
* Add preliminary Georgian translation. This already contains
translations of most of the strings that are now automatically
word wrapped.
* Add build-aux/license-check.sh. Without arguments, it checks that
no license information has been forgotten. With the -v argument,
it shows the license info (or the lack of it) for each file.
If the .git directory is available, only the files in the
repository are checked. Without the .git directory, a clean tree
from an extracted release tarball is expected.
5.6.4 (2025-01-23)
* liblzma: Fix LZMA/LZMA2 encoder on big endian ARM64.
* xz:
- Fix --filters= and --filters1= ... --filters9= options
parsing. They require an argument, thus "xz --filters lzma2"
should work in addition to "xz --filters=lzma2".
- On the man page, note in the --compress and --decompress
options that the default behavior is to delete the input
file unless writing to standard output. It was already
documented in the DESCRIPTION section but new users in
a hurry might miss it.
* Windows (native builds, not Cygwin): Fix regressions introduced
in XZ Utils 5.6.3 which caused non-ASCII characters to display
incorrectly. Only builds with translation support were affected
(--enable-nls or ENABLE_NLS=ON). The following changes affect
builds that have translations enabled:
- Require UCRT because MSVCRT doesn't support UTF-8
locales and thus translations won't be readable on
Windows 10 version 1903 and later. (MSVCRT builds
are still possible with --disable-nls or ENABLE_NLS=OFF.)
- Require gettext-runtime >= 0.23.1 because older versions
don't autodetect the use of the UTF-8 code page. This
resulted in garbled non-ASCII characters even with UCRT.
- Partially fix alignment issues in xz --verbose --list
with translated messages. Chinese (simplified),
Chinese (traditional), and Korean column headings
are misaligned still because Windows and MinGW-w64
don't provide wcwidth() and XZ Utils doesn't include
a replacement function either.
* CMake: Explicitly disable unity builds. This prevents build
failures when another project uses XZ Utils via CMake's
FetchContent module, and that project enables unity builds.
* Update Chinese (traditional) and Serbian translations.
5.6.3 (2024-10-01)
IMPORTANT: This includes a Windows-specific security fix to
the command line tools (CVE-2024-47611). liblzma isn't affected
by this issue.
* liblzma:
- Fix x86-64 inline assembly compatibility with GNU Binutils
older than 2.27.
- Fix the build with GCC 4.2 on OpenBSD/sparc64.
* xzdec: Display an error instead of failing silently if the
unsupported option -M is specified.
* lzmainfo: Fix integer overflows when rounding the dictionary and
uncompressed sizes to the nearest mebibyte.
* Windows (except Cygwin and MSYS2): Add an application manifest to
xz, xzdec, lzmadec, and lzmainfo executables:
- Declare them compatible with Vista/7/8/8.1/10/11. This way
the programs won't needlessly use Operating System Context
of Vista when running on later Windows versions. This setting
doesn't mean that the executables cannot run on even older
versions if otherwise built that way.
- Declare them as UAC-compliant. MSVC added this by default
already but it wasn't done with MinGW-w64, at least not
with all toolchain variants.
- Declare them long path aware. This makes long path names
work on Windows 10 and 11 if the feature has been enabled
in the Windows registry.
- Use the UTF-8 code page on Windows 10 version 1903 and later.
* Now command line tools can access files whose names
contain characters that don't exist in the current
legacy code page.
* The options --files and --files0 now expect file lists
to be in UTF-8 instead of the legacy code page.
* This fixes a security issue: If a command line contains
Unicode characters (for example, filenames) that don't
exist in the current legacy code page, the characters are
converted to similar-looking characters with best-fit
mapping. Some best-fit mappings result in ASCII
characters that change the meaning of the command line,
which can be exploited with malicious filenames to do
argument injection or directory traversal attacks.
UTF-8 avoids best-fit mappings and thus fixes the issue.
(CVE-2024-47611)
Forcing the process code page to UTF-8 is possible only
on Windows 10 version 1903 and later. The command line
tools remain vulnerable if used on an old older
version of Windows.
This issue was discovered by Orange Tsai and splitline
from DEVCORE Research Team.
A related smaller issue remains: Windows filenames may
contain unpaired surrogates (invalid UTF-16). These are
converted to the replacement character U+FFFD in the
UTF-8 code page. Thus, filenames with different unpaired
surrogates appear identical and aren't distinguishable
from filenames that contain the actual replacement
character U+FFFD.
* When building with MinGW-w64, it is recommended to use
UCRT version instead of the old MSVCRT. For example,
non-ASCII characters from filenames won't print
correctly in messages to console with MSVCRT with
the UTF-8 code page (a cosmetic issue). liblzma-only
builds are still fine with MSVCRT.
- Cygwin and MSYS2 process command line options differently and
the above issues don't exist. There is no need to replace the
default application manifest on Cygwin and MSYS2.
* Autotools-based build:
- Fix feature checks with link-time optimization (-flto).
- Solaris: Fix a compatibility issue in version.sh. It matters
if one wants to regenerate configure by running autoconf.
* CMake:
- Use paths relative to ${prefix} in liblzma.pc when possible.
This is done only with CMake >= 3.20.
- MSVC: Install liblzma.pc as it can be useful with MSVC too.
- Windows: Fix liblzma filename prefix, for example:
* Cygwin: The DLL was incorrectly named liblzma-5.dll.
Now it is cyglzma-5.dll.
* MSVC: Rename import library from liblzma.lib to lzma.lib
while keeping liblzma.dll name as is. This helps with
"pkgconf --msvc-syntax --libs liblzma" because it mungles
"-llzma" in liblzma.pc to "lzma.lib".
* MinGW-w64: No changes.
- Windows: Use the correct resource file for lzmadec.exe.
Previously the resource file for xzdec.exe was used for both.
Autotools-based build isn't affected.
- Prefer a C11 compiler over a C99 compiler but accept both.
- Link Threads::Threads against liblzma using PRIVATE so that
-pthread and such flags won't unnecessarily get included in
the usage requirements of shared liblzma. That is,
target_link_libraries(foo PRIVATE liblzma::liblzma) no
longer adds -pthread if using POSIX threads and linking
against shared liblzma. The threading flags are still added
if linking against static liblzma.
* Updated translations: Catalan, Chinese (simplified), and
Brazilian Portuguese.
5.6.2 (2024-05-29)
* Remove the backdoor (CVE-2024-3094).
* Not changed: Memory sanitizer (MSAN) has a false positive
in the CRC CLMUL code which also makes OSS Fuzz unhappy.
Valgrind is smarter and doesn't complain.
A revision to the CLMUL code is coming anyway and this issue
will be cleaned up as part of it. It won't be backported to
5.6.x or 5.4.x because the old code isn't wrong. There is
no reason to risk introducing regressions in old branches
just to silence a false positive.
* liblzma:
- lzma_index_decoder() and lzma_index_buffer_decode(): Fix
a missing output pointer initialization (*i = NULL) if the
functions are called with invalid arguments. The API docs
say that such an initialization is always done. In practice
this matters very little because the problem can only occur
if the calling application has a bug and these functions
return LZMA_PROG_ERROR.
- lzma_str_to_filters(): Fix a missing output pointer
initialization (*error_pos = 0). This is very similar
to the fix above.
- Fix C standard conformance with function pointer types.
- Remove GNU indirect function (IFUNC) support. This is *NOT*
done for security reasons even though the backdoor relied on
this code. The performance benefits of IFUNC are too tiny in
this project to make the extra complexity worth it.
- FreeBSD on ARM64: Add error checking to CRC32 instruction
support detection.
- Fix building with NVIDIA HPC SDK.
* xz:
- Fix a C standard conformance issue in --block-list parsing
(arithmetic on a null pointer).
- Fix a warning from GNU groff when processing the man page:
"warning: cannot select font 'CW'"
* xzdec: Add support for Linux Landlock ABI version 4. xz already
had the v3-to-v4 change but it had been forgotten from xzdec.
* Autotools-based build system (configure):
- Symbol versioning variant can now be overridden with
--enable-symbol-versions. Documentation in INSTALL was
updated to match.
- Add new configure option --enable-doxygen to enable
generation and installation of the liblzma API documentation
using Doxygen. Documentation in INSTALL and PACKAGERS was
updated to match.
CMake:
- Fix detection of Linux Landlock support. The detection code
in CMakeLists.txt had been sabotaged.
- Disable symbol versioning on non-glibc Linux to match what
the Autotools build does. For example, symbol versioning
isn't enabled with musl.
- Symbol versioning variant can now be overridden by setting
SYMBOL_VERSIONING to "OFF", "generic", or "linux".
- Add support for all tests in typical build configurations.
Now the only difference to the tests coverage to Autotools
is that CMake-based build will skip more tests if features
are disabled. Such builds are only for special cases like
embedded systems.
- Separate the CMake code for the tests into tests/tests.cmake.
It is used conditionally, thus it is possible to
rm -rf tests
and the CMake-based build will still work normally except
that no tests are then available.
- Add a option ENABLE_DOXYGEN to enable generation and
installation of the liblzma API documentation using Doxygen.
* Documentation:
- Omit the Doxygen-generated liblzma API documentation from the
package. Instead, the generation and installation of the API
docs can be enabled with a configure or CMake option if
Doxygen is available.
- Remove the XZ logo which was used in the API documentation.
The logo has been retired and isn't used by the project
anymore. However, it's OK to use it in contexts that refer
to the backdoor incident.
- Remove the PDF versions of the man pages from the source
package. These existed primarily for users of operating
systems which don't come with tools to render man page
source files. The plain text versions are still included
in doc/man/txt. PDF files can still be generated to doc/man,
if the required tools are available, using "make pdf" after
running "configure".
- Update home page URLs back to their old locations on
tukaani.org.
- Update maintainer info.
* Tests:
- In tests/files/README, explain how to recreate the ARM64
test files.
- Remove two tests that used tiny x86 and SPARC object files
as the input files. The matching .c file was included but
the object files aren't easy to reproduce. The test cases
weren't great anyway; they were from the early days (2009)
of the project when the test suite had very few tests.
- Improve a few tests.
5.6.1 (2024-03-09)
IMPORTANT: This fixed bugs in the backdoor (CVE-2024-3094) (someone
had forgot to run Valgrind).
* liblzma: Fixed two bugs relating to GNU indirect function (IFUNC)
with GCC. The more serious bug caused a program linked with
liblzma to crash on start up if the flag -fprofile-generate was
used to build liblzma. The second bug caused liblzma to falsely
report an invalid write to Valgrind when loading liblzma.
* xz: Changed the messages for thread reduction due to memory
constraints to only appear under the highest verbosity level.
* Build:
- Fixed a build issue when the header file <linux/landlock.h>
was present on the system but the Landlock system calls were
not defined in <sys/syscall.h>.
- The CMake build now warns and disables NLS if both gettext
tools and pre-created .gmo files are missing. Previously,
this caused the CMake build to fail.
* Minor improvements to man pages.
* Minor improvements to tests.
5.6.0 (2024-02-24)
IMPORTANT: This added a backdoor (CVE-2024-3094). It's enabled only
in the release tarballs.
This bumps the minor version of liblzma because new features were
added. The API and ABI are still backward compatible with liblzma
5.4.x and 5.2.x and 5.0.x.
@ -23,7 +591,7 @@ XZ Utils Release Notes
* Sandboxing support in xz:
- Landlock is now used even when xz needs to create files.
In this case the sandbox is has to be more permissive than
In this case the sandbox has to be more permissive than
when no files need to be created. A similar thing was
already in use with pledge(2) since 5.3.4alpha.
@ -289,6 +857,95 @@ XZ Utils Release Notes
* Added basic Codespell support to help catch typo errors.
5.4.7 (2024-05-29)
* Not changed: Memory sanitizer (MSAN) has a false positive
in the CRC CLMUL code which also makes OSS Fuzz unhappy.
Valgrind is smarter and doesn't complain.
A revision to the CLMUL code is coming anyway and this issue
will be cleaned up as part of it. It won't be backported to
5.6.x or 5.4.x because the old code isn't wrong. There is
no reason to risk introducing regressions in old branches
just to silence a false positive.
* liblzma:
- lzma_index_decoder() and lzma_index_buffer_decode(): Fix
a missing output pointer initialization (*i = NULL) if the
functions are called with invalid arguments. The API docs
say that such an initialization is always done. In practice
this matters very little because the problem can only occur
if the calling application has a bug and these functions
return LZMA_PROG_ERROR.
- lzma_str_to_filters(): Fix a missing output pointer
initialization (*error_pos = 0). This is very similar
to the fix above.
- Fix C standard conformance with function pointer types.
This newly showed up with Clang 17 with -fsanitize=undefined.
There are no bug reports about this.
- Fix building with NVIDIA HPC SDK.
* xz:
- Fix a C standard conformance issue in --block-list parsing
(arithmetic on a null pointer).
- Fix a warning from GNU groff when processing the man page:
"warning: cannot select font 'CW'"
- Fix outdated threading related information on the man page.
* xzless:
- With "less" version 451 and later, use "||-" instead of "|-"
in the environment variable LESSOPEN. This way compressed
files that contain no uncompressed data are shown correctly
as empty.
- With "less" version 632 and later, use --show-preproc-errors
to make "less" show a warning on decompression errors.
* Autotools-based build system (configure):
- Symbol versioning variant can now be overridden with
--enable-symbol-versions. Documentation in INSTALL was
updated to match.
CMake:
- Linux on MicroBlaze is handled specially now. This matches
the changes made to the Autotools-based build in XZ Utils
5.4.2 and 5.2.11.
- Disable symbol versioning on non-glibc Linux to match what
the Autotools build does. For example, symbol versioning
isn't enabled with musl.
- Symbol versioning variant can now be overridden by setting
SYMBOL_VERSIONING to "OFF", "generic", or "linux".
* Documentation:
- Clarify the description of --disable-assembler in INSTALL.
The option only affects 32-bit x86 assembly usage.
- Add doc/examples/11_file_info.c. It was added to the
Git repository in 2017 but forgotten to be added into
distribution tarballs.
- Don't install the TODO file as part of the documentation.
The file is out of date.
- Update home page URLs back to their old locations on
tukaani.org.
- Update maintainer info.
5.4.6 (2024-01-26)
* Fixed a bug involving internal function pointers in liblzma not
@ -311,7 +968,7 @@ XZ Utils Release Notes
* Added a new test.
5.4.5 (2023-11-31)
5.4.5 (2023-11-01)
* liblzma:
@ -1113,6 +1770,121 @@ XZ Utils Release Notes
(FreeBSD >= 10).
5.2.13 (2024-05-29)
* liblzma:
- lzma_index_append(): Fix an assertion failure that could be
triggered by a large unpadded_size argument. It was verified
that there was no other bug than the assertion failure.
- lzma_index_decoder() and lzma_index_buffer_decode(): Fix
a missing output pointer initialization (*i = NULL) if the
functions are called with invalid arguments. The API docs
say that such an initialization is always done. In practice
this matters very little because the problem can only occur
if the calling application has a bug and these functions
return LZMA_PROG_ERROR.
- Fix C standard conformance with function pointer types.
This newly showed up with Clang 17 with -fsanitize=undefined.
There are no bug reports about this.
- Fix building with NVIDIA HPC SDK.
- Fix building with Windows Vista threads and --enable-small.
(CMake build doesn't support ENABLE_SMALL in XZ Utils 5.2.x.)
* xz:
- Fix a C standard conformance issue in --block-list parsing
(arithmetic on a null pointer).
- Fix a warning from GNU groff when processing the man page:
"warning: cannot select font 'CW'"
- Windows: Handle special files such as "con" or "nul". Earlier
the following wrote "foo" to the console and deleted the input
file "con_xz":
echo foo | xz > con_xz
xz --suffix=_xz --decompress con_xz
- Windows: Fix an issue that prevented reading from or writing
to non-terminal character devices like NUL.
* xzless:
- With "less" version 451 and later, use "||-" instead of "|-"
in the environment variable LESSOPEN. This way compressed
files that contain no uncompressed data are shown correctly
as empty.
- With "less" version 632 and later, use --show-preproc-errors
to make "less" show a warning on decompression errors.
* Build systems:
- Add a new line to liblzma.pc for MSYS2 (Windows):
Cflags.private: -DLZMA_API_STATIC
When compiling code that will link against static liblzma,
the LZMA_API_STATIC macro needs to be defined on Windows.
- Autotools (configure):
* Symbol versioning variant can now be overridden with
--enable-symbol-versions. Documentation in INSTALL was
updated to match.
- CMake:
* Fix a bug that prevented other projects from including
liblzma multiple times using find_package().
* Fix a bug where configuring CMake multiple times resulted
in HAVE_CLOCK_GETTIME and HAVE_CLOCK_MONOTONIC not being
defined.
* Fix the build with MinGW-w64-based Clang/LLVM 17.
llvm-windres now has more accurate GNU windres emulation
so the GNU windres workaround from 5.4.1 is needed with
llvm-windres version 17 too.
* The import library on Windows is now properly named
"liblzma.dll.a" instead of "libliblzma.dll.a"
* Add large file support by default for platforms that
need it to handle files larger than 2 GiB. This includes
MinGW-w64, even 64-bit builds.
* Linux on MicroBlaze is handled specially now. This
matches the changes made to the Autotools-based build
in XZ Utils 5.4.2 and 5.2.11.
* Disable symbol versioning on non-glibc Linux to match
what the Autotools build does. For example, symbol
versioning isn't enabled with musl.
* Symbol versioning variant can now be overridden by
setting SYMBOL_VERSIONING to "OFF", "generic", or
"linux".
* Documentation:
- Clarify the description of --disable-assembler in INSTALL.
The option only affects 32-bit x86 assembly usage.
- Don't install the TODO file as part of the documentation.
The file is out of date.
- Update home page URLs back to their old locations on
tukaani.org.
- Update maintainer info.
5.2.12 (2023-05-04)
* Fixed a build system bug that prevented building liblzma as a

View File

@ -44,8 +44,8 @@ Information to packagers of XZ Utils
lzmadec binary for compatibility with LZMA Utils
liblzma liblzma.so.*
liblzma-devel liblzma.so, liblzma.a, API headers
liblzma-doc Doxygen-generated liblzma API docs (HTML),
example programs
liblzma-doc Example programs and, if enabled at build time,
Doxygen-generated liblzma API docs (HTML)
2. Package description
@ -170,13 +170,14 @@ Information to packagers of XZ Utils
can be replaced with a symlink if your distro ships with shared
copies of the common license texts.
The Doxygen-generated documentation (HTML) for the liblzma API
headers is included in the source release and will be installed by
"make install" to $docdir/api. All JavaScript is removed to
simplify license compliance and to reduce the install size. If the
liblzma API documentation is not desired, either run configure with
--disable-doc or remove the doc/api directory before running
"make install".
The Doxygen-generated liblzma API documentation (HTML) is built and
installed if the configure option --enable-doxygen is used (it's
disabled by default). This requires that Doxygen is available. The
API documentation is installed by "make install" to $docdir/api.
NOTE: The files generated by Doxygen include content from
Doxygen itself. Check the license info before distributing
the Doxygen-generated files.
6. Extra files

129
README
View File

@ -10,6 +10,7 @@ XZ Utils
2. Version numbering
3. Reporting bugs
4. Translations
4.1. Testing translations
5. Other implementations of the .xz format
6. Contact information
@ -79,8 +80,6 @@ XZ Utils
COPYING.GPLv2 GNU General Public License version 2
COPYING.GPLv3 GNU General Public License version 3
COPYING.LGPLv2.1 GNU Lesser General Public License version 2.1
COPYING.CC-BY-SA-4.0 Creative Commons Attribution-ShareAlike 4.0
International Public License
AUTHORS The main authors of XZ Utils
THANKS Incomplete list of people who have helped making
@ -97,9 +96,9 @@ XZ Utils
The command-line tools are documented as man pages. In source code
releases (and possibly also in some binary packages), the man pages
are also provided in plain text (ASCII only) and PDF formats in the
directory "doc/man" to make the man pages more accessible to those
whose operating system doesn't provide an easy way to view man pages.
are also provided in plain text (ASCII only) format in the directory
"doc/man" to make the man pages more accessible to those whose
operating system doesn't provide an easy way to view man pages.
1.3. Documentation for liblzma
@ -205,77 +204,47 @@ XZ Utils
https://translationproject.org/html/translators.html
Below are notes and testing instructions specific to xz
translations.
Updates to translations won't be accepted by methods that bypass
the Translation Project because there is a risk of duplicate work:
translation updates made in the xz repository aren't seen by the
translators in the Translation Project. If you have found bugs in
a translation, please report them to the Language-Team address
which can be found near the beginning of the PO file.
Testing can be done by installing xz into a temporary directory:
If you find language problems in the original English strings,
feel free to suggest improvements. Ask if something is unclear.
4.1. Testing translations
Testing can be done by installing xz into a temporary directory.
If building from Git repository (not tarball), generate the
Autotools files:
./autogen.sh
Create a subdirectory for the build files. The tmp-build directory
can be deleted after testing.
mkdir tmp-build
cd tmp-build
../configure --disable-shared --enable-debug --prefix=$PWD/inst
Edit the .po file in the po directory. Then build and install to
the "tmp-build/inst" directory, and use translations.bash to see
how some of the messages look. Repeat these steps if needed:
./configure --disable-shared --prefix=/tmp/xz-test
# <Edit the .po file in the po directory.>
make -C po update-po
make install
bash debug/translation.bash | less
bash debug/translation.bash | less -S # For --list outputs
make -j"$(nproc)" install
bash ../debug/translation.bash | less
bash ../debug/translation.bash | less -S # For --list outputs
Repeat the above as needed (no need to re-run configure though).
To test other languages, set the LANGUAGE environment variable
before running translations.bash. The value should match the PO file
name without the .po suffix. Example:
Note especially the following:
- The output of --help and --long-help must look nice on
an 80-column terminal. It's OK to add extra lines if needed.
- In contrast, don't add extra lines to error messages and such.
They are often preceded with e.g. a filename on the same line,
so you have no way to predict where to put a \n. Let the terminal
do the wrapping even if it looks ugly. Adding new lines will be
even uglier in the generic case even if it looks nice in a few
limited examples.
- Be careful with column alignment in tables and table-like output
(--list, --list --verbose --verbose, --info-memory, --help, and
--long-help):
* All descriptions of options in --help should start in the
same column (but it doesn't need to be the same column as
in the English messages; just be consistent if you change it).
Check that both --help and --long-help look OK, since they
share several strings.
* --list --verbose and --info-memory print lines that have
the format "Description: %s". If you need a longer
description, you can put extra space between the colon
and %s. Then you may need to add extra space to other
strings too so that the result as a whole looks good (all
values start at the same column).
* The columns of the actual tables in --list --verbose --verbose
should be aligned properly. Abbreviate if necessary. It might
be good to keep at least 2 or 3 spaces between column headings
and avoid spaces in the headings so that the columns stand out
better, but this is a matter of opinion. Do what you think
looks best.
- Be careful to put a period at the end of a sentence when the
original version has it, and don't put it when the original
doesn't have it. Similarly, be careful with \n characters
at the beginning and end of the strings.
- Read the TRANSLATORS comments that have been extracted from the
source code and included in xz.pot. Some comments suggest
testing with a specific command which needs an .xz file. You
may use e.g. any tests/files/good-*.xz. However, these test
commands are included in translations.bash output, so reading
translations.bash output carefully can be enough.
- If you find language problems in the original English strings,
feel free to suggest improvements. Ask if something is unclear.
- The translated messages should be understandable (sometimes this
may be a problem with the original English messages too). Don't
make a direct word-by-word translation from English especially if
the result doesn't sound good in your language.
Thanks for your help!
export LANGUAGE=fi
5. Other implementations of the .xz format
@ -290,21 +259,23 @@ XZ Utils
XZ Embedded is a limited implementation written for use in the Linux
kernel, but it is also suitable for other embedded use.
https://xz.tukaani.org/xz-embedded/
https://tukaani.org/xz/embedded.html
XZ for Java is a complete implementation written in pure Java.
https://xz.tukaani.org/xz-for-java/
https://tukaani.org/xz/java.html
6. Contact information
----------------------
If you have questions, bug reports, patches etc. related to XZ Utils,
the project maintainers Lasse Collin and Jia Tan can be reached via
<xz@tukaani.org>.
XZ Utils in general:
- Home page: https://tukaani.org/xz/
- Email to maintainer(s): xz@tukaani.org
- IRC: #tukaani on Libera Chat
- GitHub: https://github.com/tukaani-project/xz
You might find Lasse also from #tukaani on Libera Chat (IRC).
The nick is Larhzu. The channel tends to be pretty quiet,
so just ask your question and someone might wake up.
Lead maintainer:
- Email: Lasse Collin <lasse.collin@tukaani.org>
- IRC: Larhzu on Libera Chat

63
THANKS
View File

@ -20,6 +20,7 @@ has been important. :-) In alphabetical order:
- Jakub Bogusz
- Adam Borowski
- Maarten Bosmans
- Roel Bouckaert
- Lukas Braune
- Benjamin Buch
- Trent W. Buck
@ -29,24 +30,36 @@ has been important. :-) In alphabetical order:
- Frank Busse
- Daniel Mealha Cabrita
- Milo Casagrande
- Cristiano Ceglia
- Marek Černocký
- Tomer Chachamu
- Aziz Chaudhry
- Vitaly Chikunov
- Antoine Cœur
- Elijah Almeida Coimbra
- Felix Collin
- Ryan Colyer
- Marcus Comstedt
- Vincent Cruz
- Gabi Davar
- Ron Desmond
- İhsan Doğan
- Chris Donawa
- Andrew Dudman
- Markus Duft
- İsmail Dönmez
- Dexter Castor Döpping
- Paul Eggert
- Robert Elz
- Gilles Espinasse
- Denis Excoffier
- Vincent Fazio
- Michael Felt
- Sean Fenian
- Michael Fox
- Andres Freund
- Mike Frysinger
- Collin Funk
- Daniel Richard G.
- Tomasz Gajc
- Bjarni Ingi Gislason
@ -55,10 +68,14 @@ has been important. :-) In alphabetical order:
- Matthew Good
- Michał Górny
- Jason Gorski
- Alexander M. Greenham
- Juan Manuel Guerrero
- Gabriela Gutierrez
- Diederik de Haas
- Jan Terje Hansen
- Tobias Lahrmann Hansen
- Joachim Henke
- Lizandro Heredia
- Christian Hesse
- Vincenzo Innocente
- Peter Ivanov
@ -68,14 +85,19 @@ has been important. :-) In alphabetical order:
- Hans Jansen
- Jouk Jansen
- Jun I Jin
- Christoph Junghans
- Kiyoshi Kanazawa
- Joona Kannisto
- Per Øyvind Karlsen
- Firas Khalil Khana
- Iouri Kharon
- Kim Jinyeong
- Thomas Klausner
- Richard Koch
- Anton Kochkov
- Harri K. Koskinen
- Ville Koskinen
- Sergey Kosukhin
- Marcin Kowalczyk
- Jan Kratochvil
- Christian Kujau
@ -90,6 +112,7 @@ has been important. :-) In alphabetical order:
- Cary Lewis
- Wim Lewis
- Xin Li
- Yifeng Li
- Eric Lindblad
- Lorenzo De Liso
- H.J. Lu
@ -97,65 +120,88 @@ has been important. :-) In alphabetical order:
- Chenxi Mao
- Gregory Margo
- Julien Marrec
- Pierre-Yves Martin
- Ed Maste
- Martin Matuška
- Scott McAllister
- Chris McCrohan
- Derwin McGeary
- Ivan A. Melnikov
- Jim Meyering
- Arkadiusz Miskiewicz
- Nathan Moinvaziri
- Étienne Mollier
- Conley Moorhous
- Dirk Müller
- Rainer Müller
- Andrew Murray
- Rafał Mużyło
- Adrien Nader
- Evan Nemerson
- Alexander Neumann
- Hongbo Ni
- Jonathan Nieder
- Asgeir Storesund Nilsen
- Andre Noll
- Ruarí Ødegaard
- Peter O'Gorman
- Dimitri Papadopoulos Orfanos
- Daniel Packard
- Filip Palian
- Peter Pallinger
- Kai Pastor
- Keith Patton
- Rui Paulo
- Igor Pavlov
- Diego Elio Pettenò
- Elbert Pol
- Guiorgy Potskhishvili
- Mikko Pouru
- Frank Prochnow
- Rich Prohaska
- Trần Ngọc Quân
- Pavel Raiskup
- Matthieu Rakotojaona
- Ole André Vadla Ravnås
- Eric S. Raymond
- Robert Readman
- Bernhard Reutner-Fischer
- Markus Rickert
- Cristian Rodríguez
- Jeroen Roovers
- Christian von Roques
- Boud Roukema
- Torsten Rupp
- Stephen Sachs
- Jukka Salmi
- Agostino Sarubbo
- Vijay Sarvepalli
- Alexandre Sauvé
- Benno Schulenberg
- Andreas Schwab
- Eli Schwartz
- Peter Seiderer
- Bhargava Shastry
- Dan Shechter
- Stuart Shelton
- Sebastian Andrzej Siewior
- Andrej Skenderija
- Ville Skyttä
- Brad Smith
- Bruce Stark
- Pippijn van Steenhoven
- Tobias Stoeckmann
- Martin Storsjö
- Jonathan Stott
- Dan Stromberg
- Jia Tan
- Douglas Thor
- Vincent Torri
- Alexey Tourbin
- Paul Townsend
- Mohammed Adnène Trojette
- Alexey Tourbin
- Orange Tsai
- Taiki Tsunekawa
- Mathieu Vachon
- Maksym Vatsyk
- Loganaden Velvindron
- Patrick J. Volkerding
@ -165,14 +211,27 @@ has been important. :-) In alphabetical order:
- Christian Weisgerber
- Dan Weiss
- Bert Wesarg
- Mark Wielaard
- Fredrik Wikstrom
- Jim Wilcoxson
- Ralf Wildenhues
- Charles Wilson
- Lars Wirzenius
- Vincent Wixsom
- Pilorz Wojciech
- Chien Wong
- Xi Ruoyao
- Ryan Young
- Andreas Zieringer
- 榆柳松 (ZhengSen Wang)
Companies:
- Google
- Sandfly Security
Other credits:
- cleemy desu wayo working with Trend Micro Zero Day Initiative
- Orange Tsai and splitline from DEVCORE Research Team
Also thanks to all the people who have participated in the Tukaani project.

25
TODO
View File

@ -5,12 +5,7 @@ XZ Utils To-Do List
Known bugs
----------
The test suite is too incomplete.
If the memory usage limit is less than about 13 MiB, xz is unable to
automatically scale down the compression settings enough even though
it would be possible by switching from BT2/BT3/BT4 match finder to
HC3/HC4.
The test suite is incomplete.
XZ Utils compress some files significantly worse than LZMA Utils.
This is due to faster compression presets used by XZ Utils, and
@ -19,9 +14,6 @@ Known bugs
compress extremely well, so going from compression ratio of 0.003
to 0.004 means big relative increase in the compressed file size.
xz doesn't quote unprintable characters when it displays file names
given on the command line.
tuklib_exit() doesn't block signals => EINTR is possible.
If liblzma has created threads and fork() gets called, liblzma
@ -41,9 +33,6 @@ Missing features
be mostly useful when using a preset dictionary in LZMA2, but
it may have other uses too. Compare to deflateCopy() in zlib.
Support LZMA_FINISH in raw decoder to indicate end of LZMA1 and
other streams that don't have an end of payload marker.
Adjust dictionary size when the input file size is known.
Maybe do this only if an option is given.
@ -67,9 +56,9 @@ Missing features
Support LZMA_FULL_FLUSH for lzma_stream_decoder() to stop at
Block and Stream boundaries.
lzma_strerror() to convert lzma_ret to human readable form?
This is tricky, because the same error codes are used with
slightly different meanings, and this cannot be fixed anymore.
Error codes from lzma_code() aren't very specific. A more detailed
error message (string) could be provided too. It could be returned
by a new function or use a currently-reserved member of lzma_stream.
Make it possible to adjust LZMA2 options in the middle of a Block
so that the encoding speed vs. compression ratio can be optimized
@ -97,9 +86,3 @@ Documentation
Document the LZMA1 and LZMA2 algorithms.
Miscellaneous
------------
Try to get the media type for .xz registered at IANA.

View File

@ -17,14 +17,12 @@ ${AUTOCONF:-autoconf}
${AUTOHEADER:-autoheader}
${AUTOMAKE:-automake} -acf --foreign
# Generate the translated man pages and the doxygen documentation if the
# "po4a" and "doxygen" tools are available.
# Generate the translated man pages if the "po4a" tool is available.
# This is *NOT* done by "autoreconf -fi" or when "make" is run.
# Pass --no-po4a or --no-doxygen to this script to skip these steps.
# It can be useful when you know that po4a or doxygen aren't available and
# Pass --no-po4a to this script to skip this step.
# It can be useful when you know that po4a isn't available and
# don't want autogen.sh to exit with non-zero exit status.
generate_po4a="y"
generate_doxygen="y"
for arg in "$@"
do
@ -32,10 +30,6 @@ do
"--no-po4a")
generate_po4a="n"
;;
"--no-doxygen")
generate_doxygen="n"
;;
esac
done
@ -45,10 +39,4 @@ if test "$generate_po4a" != "n"; then
cd ..
fi
if test "$generate_doxygen" != "n"; then
cd doxygen
sh update-doxygen
cd ..
fi
exit 0

View File

@ -18,7 +18,7 @@ USAGE="Usage: $0
-a [autogen flags]
-b [autotools|cmake]
-c [crc32|crc64|sha256]
-d [encoders|decoders|bcj|delta|threads|shared|nls|small|ifunc|clmul|sandbox]
-d [encoders|decoders|bcj|delta|threads|shared|nls|small|clmul|sandbox]
-f [CFLAGS]
-l [destdir]
-m [compiler]
@ -41,7 +41,6 @@ THREADS="y"
SHARED="y"
NATIVE_LANG_SUPPORT="y"
SMALL="n"
IFUNC="y"
CLMUL="y"
SANDBOX="y"
SRC_DIR="$ABS_DIR/../"
@ -49,12 +48,15 @@ DEST_DIR="$SRC_DIR/../xz_build"
PHASE="all"
ARTIFACTS_DIR_NAME="output"
[[ -z ${CPU_COUNT} ]] && { CPU_COUNT=$(nproc 2>/dev/null || sysctl -n hw.activecpu); }
[[ -z ${MAKEFLAGS} ]] && export MAKEFLAGS="-j${CPU_COUNT} -l${CPU_COUNT}"
[[ -z ${CFLAGS} ]] && export CFLAGS="-O2"
###################
# Parse arguments #
###################
while getopts a:b:c:d:l:m:n:s:p:f:h opt; do
while getopts a:b:c:d:l:m:n:s:p:f:w:h opt; do
# b option can have either value "autotools" OR "cmake"
case ${opt} in
h)
@ -87,7 +89,6 @@ while getopts a:b:c:d:l:m:n:s:p:f:h opt; do
shared) SHARED="n";;
nls) NATIVE_LANG_SUPPORT="n";;
small) SMALL="y";;
ifunc) IFUNC="n";;
clmul) CLMUL="n";;
sandbox) SANDBOX="n";;
*) echo "Invalid disable value: $disable_arg"; exit 1 ;;
@ -107,9 +108,11 @@ while getopts a:b:c:d:l:m:n:s:p:f:h opt; do
p) PHASE="$OPTARG"
;;
f)
CFLAGS="$OPTARG"
CFLAGS+=" $OPTARG"
export CFLAGS
;;
w) WRAPPER="$OPTARG"
;;
esac
done
@ -163,15 +166,7 @@ then
CHECK_TYPE_TEMP=""
for crc in $(echo "$CHECK_TYPE" | sed "s/,/ /g"); do
case "$crc" in
# Remove "crc32" from cmake build, if specified.
crc32)
if [ "$BUILD_SYSTEM" = "cmake" ]
then
continue
fi
;;
crc64) ;;
sha256) ;;
crc32 | crc64 | sha256) ;;
*) echo "Invalid check type: $crc"; exit 1 ;;
esac
@ -211,10 +206,18 @@ then
add_extra_option "$SHARED" "" "--disable-shared"
add_extra_option "$NATIVE_LANG_SUPPORT" "" "--disable-nls"
add_extra_option "$SMALL" "--enable-small" ""
add_extra_option "$IFUNC" "" "--disable-ifunc"
add_extra_option "$CLMUL" "" "--disable-clmul-crc"
add_extra_option "$SANDBOX" "" "--enable-sandbox=no"
# Workaround a bug in too old config.guess. Version with
# timestamp='2022-05-08' would be needed but the autotools-dev
# package has 2022-01-09 in Ubuntu 22.04LTS and 24.04LTS. The
# bug breaks i386 assembler usage autodetection.
if "$SRC_DIR/build-aux/config.guess" | grep -q x86_64-pc-linux-gnux32
then
EXTRA_OPTIONS="$EXTRA_OPTIONS --build=i686-pc-linux-gnu"
fi
# Run configure script
"$SRC_DIR"/configure --enable-werror --enable-checks="$CHECK_TYPE" $EXTRA_OPTIONS --config-cache
@ -227,26 +230,22 @@ then
add_to_filter_list "$BCJ" ";x86;powerpc;ia64;arm;armthumb;arm64;sparc;riscv"
add_to_filter_list "$DELTA" ";delta"
add_extra_option "$THREADS" "-DENABLE_THREADS=ON" "-DENABLE_THREADS=OFF"
add_extra_option "$THREADS" "-DXZ_THREADS=yes" "-DXZ_THREADS=no"
# Disable MicroLZMA if encoders are not configured.
add_extra_option "$ENCODERS" "-DENCODERS=$FILTER_LIST" "-DENCODERS= -DMICROLZMA_ENCODER=OFF"
add_extra_option "$ENCODERS" "-DXZ_ENCODERS=$FILTER_LIST" "-DXZ_ENCODERS= -DXZ_MICROLZMA_ENCODER=OFF"
# Disable MicroLZMA and lzip decoders if decoders are not configured.
add_extra_option "$DECODERS" "-DDECODERS=$FILTER_LIST" "-DDECODERS= -DMICROLZMA_DECODER=OFF -DLZIP_DECODER=OFF"
add_extra_option "$DECODERS" "-DXZ_DECODERS=$FILTER_LIST" "-DXZ_DECODERS= -DXZ_MICROLZMA_DECODER=OFF -DXZ_LZIP_DECODER=OFF"
# CMake disables the shared library by default.
add_extra_option "$SHARED" "-DBUILD_SHARED_LIBS=ON" ""
add_extra_option "$SMALL" "-DHAVE_SMALL=ON" ""
if test -n "$CC" ; then
EXTRA_OPTIONS="$EXTRA_OPTIONS -DCMAKE_C_COMPILER=$CC"
fi
add_extra_option "$SMALL" "-DXZ_SMALL=ON" ""
# Remove old cache file to clear previous settings.
rm -f "CMakeCache.txt"
cmake "$SRC_DIR/CMakeLists.txt" -B "$DEST_DIR" $EXTRA_OPTIONS -DADDITIONAL_CHECK_TYPES="$CHECK_TYPE" -G "Unix Makefiles"
cmake "$SRC_DIR/CMakeLists.txt" -B "$DEST_DIR" $EXTRA_OPTIONS -DXZ_CHECKS="$CHECK_TYPE" -G "Unix Makefiles"
cmake --build "$DEST_DIR"
;;
esac
@ -263,7 +262,7 @@ then
autotools)
cd "$DEST_DIR"
# If the tests fail, copy the test logs into the artifacts folder
if make check
if make check VERBOSE=1 LOG_COMPILER="$WRAPPER"
then
:
else
@ -274,7 +273,7 @@ then
;;
cmake)
cd "$DEST_DIR"
if make test
if ${WRAPPER} make CTEST_OUTPUT_ON_FAILURE=1 test
then
:
else

177
build-aux/license-check.sh Normal file
View File

@ -0,0 +1,177 @@
#!/bin/sh
# SPDX-License-Identifier: 0BSD
###############################################################################
#
# Look for missing license info in xz.git
#
# The project doesn't conform to the FSFE REUSE specification for now.
# Instead, this script helps in finding files that lack license info.
# Pass -v as an argument to get license info from all files in xz.git or,
# when .git isn't available, from files extracted from a release tarball
# (in case of a release tarball, the tree must be clean of any extra files).
#
# NOTE: This relies on non-POSIX xargs -0. It's supported on GNU and *BSDs.
#
###############################################################################
#
# Author: Lasse Collin
#
###############################################################################
# Print good files too if -v is passed as an argument.
VERBOSE=false
case $1 in
'')
;;
-v)
VERBOSE=true
;;
*)
echo "Usage: $0 [-v]"
exit 1
;;
esac
# Use the C locale so that sorting is always the same.
LC_ALL=C
export LC_ALL
# String to match the SPDX license identifier tag.
# Spell it here in a way that doesn't match regular grep patterns.
SPDX_LI='SPDX''-License-''Identifier'':'
# Pattern for files that don't contain SPDX tags but they are under
# a free license that isn't 0BSD.
PAT_UNTAGGED_MISC='^COPYING\.
^INSTALL\.generic$'
# Pattern for files that are 0BSD but don't contain SPDX tags.
# (The two file format specification files are public domain but
# they can be treated as 0BSD too.)
PAT_UNTAGGED_0BSD='^(.*/)?\.gitattributes$
^(.*/)?\.gitignore$
^\.github/SECURITY\.md$
^AUTHORS$
^COPYING$
^ChangeLog$
^INSTALL$
^NEWS$
^PACKAGERS$
^(.*/)?README$
^THANKS$
^TODO$
^(.*/)?[^/]+\.txt$
^doc/SHA256SUMS$
^po/LINGUAS$
^src/common/w32_application\.manifest$
^tests/xzgrep_expected_output$
^tests/files/[^/]+\.(lz|lzma|xz)$'
# Pattern for files that must be ignored when Git isn't available. This is
# useful when this script is run right after extracting a release tarball.
PAT_TARBALL_IGNORE='^(m4/)?[^/]*\.m4$
^(.*/)?Makefile\.in(\.in)?$
^(po|po4a)/.*[^.]..$
^ABOUT-NLS$
^build-aux/(config\..*|ltmain\.sh|[^.]*)$
^config\.h\.in$
^configure$'
# Go to the top source dir.
cd "$(dirname "$0")/.." || exit 1
# Get the list of files to check from git if possible.
# Otherwise list the whole source tree. This script should pass
# if it is run right after extracting a release tarball.
if test -d .git && type git > /dev/null 2>&1; then
FILES=$(git ls-files) || exit 1
IS_TARBALL=false
else
FILES=$(find . -type f) || exit 1
FILES=$(printf '%s\n' "$FILES" | sed 's,^\./,,')
IS_TARBALL=true
fi
# Sort to keep the order consistent.
FILES=$(printf '%s\n' "$FILES" | sort)
# Find the tagged files.
TAGGED=$(printf '%s\n' "$FILES" \
| tr '\n' '\000' | xargs -0r grep -l "$SPDX_LI" --)
# Find the tagged 0BSD files.
TAGGED_0BSD=$(printf '%s\n' "$TAGGED" \
| tr '\n' '\000' | xargs -0r grep -l "$SPDX_LI 0BSD" --)
# Find the tagged non-0BSD files, that is, remove the 0BSD-tagged files
# from the list of tagged files.
TAGGED_MISC=$(printf '%s\n%s\n' "$TAGGED" "$TAGGED_0BSD" | sort | uniq -u)
# Remove the tagged files from the list.
FILES=$(printf '%s\n%s\n' "$FILES" "$TAGGED" | sort | uniq -u)
# Find the intentionally-untagged files.
UNTAGGED_0BSD=$(printf '%s\n' "$FILES" | grep -E "$PAT_UNTAGGED_0BSD")
UNTAGGED_MISC=$(printf '%s\n' "$FILES" | grep -E "$PAT_UNTAGGED_MISC")
# Remove the intentionally-untagged files from the list.
FILES=$(printf '%s\n' "$FILES" | grep -Ev \
-e "$PAT_UNTAGGED_0BSD" -e "$PAT_UNTAGGED_MISC")
# FIXME: Allow untagged translations if they have a public domain notice.
# These are old translations that haven't been updated after 2024-02-14.
# Eventually these should go away.
PD_PO=$(printf '%s\n' "$FILES" | grep '\.po$' | tr '\n' '\000' \
| xargs -0r grep -Fl '# This file is put in the public domain.' --)
if test -n "$PD_PO"; then
# Remove the public domain .po files from the list.
FILES=$(printf '%s\n%s\n' "$FILES" "$PD_PO" | sort | uniq -u)
fi
# Remove generated files from the list which don't have SPDX tags but which
# can be present in release tarballs. This step is skipped when the file list
# is from "git ls-files".
GENERATED=
if $IS_TARBALL; then
GENERATED=$(printf '%s\n' "$FILES" | grep -E "$PAT_TARBALL_IGNORE")
FILES=$(printf '%s\n' "$FILES" | grep -Ev "$PAT_TARBALL_IGNORE")
fi
if $VERBOSE; then
printf '# Tagged 0BSD files:\n%s\n\n' "$TAGGED_0BSD"
printf '# Intentionally untagged 0BSD:\n%s\n\n' "$UNTAGGED_0BSD"
# FIXME: Remove when no longer needed.
if test -n "$PD_PO"; then
printf '# Old public domain translations:\n%s\n\n' "$PD_PO"
fi
printf '# Tagged non-0BSD files:\n%s\n\n' "$TAGGED_MISC"
printf '# Intentionally untagged miscellaneous: \n%s\n\n' \
"$UNTAGGED_MISC"
if test -n "$GENERATED"; then
printf '# Generated files whose license was NOT checked:\n%s\n\n' \
"$GENERATED"
fi
fi
# Look for files with an unknown license and set the exit status accordingly.
STATUS=0
if test -n "$FILES"; then
printf '# ERROR: Licensing is unclear:\n%s\n' "$FILES"
STATUS=1
fi
exit "$STATUS"

View File

@ -17,6 +17,5 @@ sed -n 's/LZMA_VERSION_STABILITY_ALPHA/alpha/
s/LZMA_VERSION_STABILITY_STABLE//
s/^#define LZMA_VERSION_[MPS][AIT][AJNT][A-Z]* //p' \
src/liblzma/api/lzma/version.h \
| tr '\n' '|' \
| sed 's/|/./; s/|/./; s/|//g' \
| tr -d '\r\n'
| sed 'N; N; N; s/\n/./; s/\n/./; s/\n//g' \
| tr -d '\012\015\025'

View File

@ -26,23 +26,29 @@ endfunction()
# This is an over-simplified version of AC_USE_SYSTEM_EXTENSIONS in Autoconf
# or gl_USE_SYSTEM_EXTENSIONS in gnulib.
macro(tuklib_use_system_extensions TARGET_OR_ALL)
if(NOT WIN32)
# FIXME? The Solaris-specific __EXTENSIONS__ should be conditional
# even on Solaris. See gnulib: git log m4/extensions.m4.
# FIXME? gnulib and autoconf.git has lots of new stuff.
tuklib_add_definitions("${TARGET_OR_ALL}"
_GNU_SOURCE
__EXTENSIONS__
_POSIX_PTHREAD_SEMANTICS
_TANDEM_SOURCE
_ALL_SOURCE
#
# NOTE: This is a macro because the changes to CMAKE_REQUIRED_DEFINITIONS
# must be visible in the calling scope.
macro(tuklib_use_system_extensions)
if(NOT MSVC)
add_compile_definitions(
_GNU_SOURCE # glibc, musl, mingw-w64
_NETBSD_SOURCE # NetBSD, MINIX 3
_OPENBSD_SOURCE # Also NetBSD!
__EXTENSIONS__ # Solaris
_POSIX_PTHREAD_SEMANTICS # Solaris
_DARWIN_C_SOURCE # macOS
_TANDEM_SOURCE # HP NonStop
_ALL_SOURCE # AIX, z/OS
)
list(APPEND CMAKE_REQUIRED_DEFINITIONS
-D_GNU_SOURCE
-D_NETBSD_SOURCE
-D_OPENBSD_SOURCE
-D__EXTENSIONS__
-D_POSIX_PTHREAD_SEMANTICS
-D_DARWIN_C_SOURCE
-D_TANDEM_SOURCE
-D_ALL_SOURCE
)

View File

@ -9,6 +9,7 @@
#############################################################################
include("${CMAKE_CURRENT_LIST_DIR}/tuklib_common.cmake")
include(CMakePushCheckState)
include(CheckCSourceCompiles)
include(CheckIncludeFile)
@ -76,6 +77,7 @@ function(tuklib_cpucores_internal_check)
#
# We test sysctl() first and intentionally break the sysctl() test on QNX
# so that sysctl() is never used on QNX.
cmake_push_check_state()
check_include_file(sys/param.h HAVE_SYS_PARAM_H)
if(HAVE_SYS_PARAM_H)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_PARAM_H)
@ -103,6 +105,7 @@ function(tuklib_cpucores_internal_check)
}
"
TUKLIB_CPUCORES_SYSCTL)
cmake_pop_check_state()
if(TUKLIB_CPUCORES_SYSCTL)
if(HAVE_SYS_PARAM_H)
set(TUKLIB_CPUCORES_DEFINITIONS

View File

@ -14,6 +14,7 @@
#############################################################################
include("${CMAKE_CURRENT_LIST_DIR}/tuklib_common.cmake")
include(CMakePushCheckState)
include(CheckCSourceCompiles)
function(tuklib_large_file_support TARGET_OR_ALL)

View File

@ -18,4 +18,8 @@ function(tuklib_mbstr TARGET_OR_ALL)
# NOTE: wcwidth() requires _GNU_SOURCE or _XOPEN_SOURCE on GNU/Linux.
check_symbol_exists(wcwidth wchar.h HAVE_WCWIDTH)
tuklib_add_definition_if("${TARGET_OR_ALL}" HAVE_WCWIDTH)
# NOTE: vasprintf() requires _GNU_SOURCE on GNU/Linux.
check_symbol_exists(vasprintf stdio.h HAVE_VASPRINTF)
tuklib_add_definition_if("${TARGET_OR_ALL}" HAVE_VASPRINTF)
endfunction()

View File

@ -12,6 +12,7 @@
#############################################################################
include("${CMAKE_CURRENT_LIST_DIR}/tuklib_common.cmake")
include(CMakePushCheckState)
include(CheckCSourceCompiles)
include(CheckIncludeFile)
@ -76,11 +77,11 @@ function(tuklib_physmem_internal_check)
endif()
# sysctl()
cmake_push_check_state()
check_include_file(sys/param.h HAVE_SYS_PARAM_H)
if(HAVE_SYS_PARAM_H)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_PARAM_H)
endif()
check_c_source_compiles("
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
@ -96,6 +97,7 @@ function(tuklib_physmem_internal_check)
}
"
TUKLIB_PHYSMEM_SYSCTL)
cmake_pop_check_state()
if(TUKLIB_PHYSMEM_SYSCTL)
if(HAVE_SYS_PARAM_H)
set(TUKLIB_PHYSMEM_DEFINITIONS

View File

@ -17,7 +17,7 @@
AC_PREREQ([2.69])
AC_INIT([XZ Utils], m4_esyscmd([/bin/sh build-aux/version.sh]),
[xz@tukaani.org], [xz], [https://xz.tukaani.org/xz-utils/])
[xz@tukaani.org], [xz], [https://tukaani.org/xz/])
AC_CONFIG_SRCDIR([src/liblzma/common/common.h])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
@ -304,13 +304,8 @@ AC_ARG_ENABLE([microlzma], AS_HELP_STRING([--disable-microlzma],
for example, erofs-utils.]),
[], [enable_microlzma=yes])
case $enable_microlzma in
yes)
AC_DEFINE([HAVE_MICROLZMA], [1],
[Define to 1 if MicroLZMA support is enabled.])
AC_MSG_RESULT([yes])
;;
no)
AC_MSG_RESULT([no])
yes | no)
AC_MSG_RESULT([$enable_microlzma])
;;
*)
AC_MSG_RESULT([])
@ -363,8 +358,13 @@ if test "x$enable_assembler" = xyes; then
esac
fi
case $enable_assembler in
x86 | no)
AC_MSG_RESULT([$enable_assembler])
x86)
AC_DEFINE([HAVE_CRC_X86_ASM], [1], [Define to 1 if
the 32-bit x86 CRC assembly files are used.])
AC_MSG_RESULT([x86])
;;
no)
AC_MSG_RESULT([no])
;;
*)
AC_MSG_RESULT([])
@ -394,6 +394,16 @@ AC_ARG_ENABLE([arm64-crc32], AS_HELP_STRING([--disable-arm64-crc32],
[], [enable_arm64_crc32=yes])
################################
# LoongArch CRC32 instructions #
################################
AC_ARG_ENABLE([loongarch-crc32], AS_HELP_STRING([--disable-loongarch-crc32],
[Do not use LoongArch CRC32 instructions even if support for
them is detected.]),
[], [enable_loongarch_crc32=yes])
#####################
# Size optimization #
#####################
@ -521,10 +531,18 @@ AM_CONDITIONAL([COND_SCRIPTS], [test x$enable_scripts != xno])
AC_ARG_ENABLE([doc], [AS_HELP_STRING([--disable-doc],
[do not install documentation files to docdir
(man pages will still be installed)])],
(man pages are still installed and,
if --enable-doxygen is used,
liblzma API documentation is installed too)])],
[], [enable_doc=yes])
AM_CONDITIONAL([COND_DOC], [test x$enable_doc != xno])
AC_ARG_ENABLE([doxygen], [AS_HELP_STRING([--enable-doxygen],
[generate HTML version of the liblzma API documentation
using Doxygen and install the result to docdir])],
[], [enable_doxygen=no])
AM_CONDITIONAL([COND_DOXYGEN], [test x$enable_doxygen != xno])
##############
# Sandboxing #
@ -624,12 +642,38 @@ AM_PROG_CC_C_O
AM_PROG_AS
AC_USE_SYSTEM_EXTENSIONS
# If using GCC or compatible compiler, verify that CFLAGS doesn't contain
# something that makes -Werror unhappy. It's important to check this after
# the above check for system extensions. It adds macros that can trigger,
# for example, -Wunused-macros.
if test "$GCC" = yes && test "x$SKIP_WERROR_CHECK" != xyes ; then
AC_MSG_CHECKING([if the -Werror option is usable])
OLD_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[extern int foo; int foo;]])], [
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
AC_MSG_ERROR([
CFLAGS contains something that makes -Werror complain (see config.log).
This would break certain checks in 'configure'. It is strongly
recommended to modify CFLAGS to fix this. If you want to use noisy
warning options, for example, -Weverything, it is still possible to
add them later when running 'make': make CFLAGS+=-Weverything
In case you really want to continue with the current CFLAGS, pass
'SKIP_WERROR_CHECK=yes' as an argument to 'configure'.
])
])
CFLAGS=$OLD_CFLAGS
fi
AS_CASE([$enable_threads],
[posix], [
echo
echo "POSIX threading support:"
AX_PTHREAD([:]) dnl We don't need the HAVE_PTHREAD macro.
LIBS="$LIBS $PTHREAD_LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"
dnl NOTE: PTHREAD_CC is ignored. It would be useful on AIX,
@ -714,61 +758,80 @@ fi
# --with-pic and --without-pic though. As long as neither --with-pic nor
# --without-pic is used then we can use #ifdef PIC to detect if the file is
# being built for a shared library.
if test "x$enable_symbol_versions" = xno ; then
AS_IF([test "x$enable_symbol_versions" = xno], [
enable_symbol_versions=no
AC_MSG_RESULT([no])
elif test "x$enable_shared" = xno ; then
], [test "x$enable_shared" = xno], [
enable_symbol_versions=no
AC_MSG_RESULT([no (not building a shared library)])
else
case "$host_cpu-$host_os" in
microblaze*)
# GCC 12 on MicroBlaze doesn't support __symver__
# attribute. It's simplest and safest to use the
# generic version on that platform since then only
# the linker script is needed. The RHEL/CentOS 7
# compatibility symbols don't matter on MicroBlaze.
enable_symbol_versions=generic
;;
*-linux*)
case "$pic_mode-$enable_static" in
default-*)
# Use symvers if PIC is defined.
have_symbol_versions_linux=2
;;
*-no)
# Not building static library.
# Use symvers unconditionally.
have_symbol_versions_linux=1
;;
*)
AC_MSG_RESULT([])
AC_MSG_ERROR([
], [
# "yes" means that symbol version are to be used but we need to
# autodetect which variant to use.
if test "x$enable_symbol_versions" = xyes ; then
case "$host_cpu-$host_os" in
microblaze*)
# GCC 12 on MicroBlaze doesn't support
# __symver__ attribute. It's simplest and
# safest to use the generic version on that
# platform since then only the linker script
# is needed. The RHEL/CentOS 7 compatibility
# symbols don't matter on MicroBlaze.
enable_symbol_versions=generic
;;
*-linux*)
# NVIDIA HPC Compiler doesn't support symbol
# versioning but the linker script can still
# be used.
AC_EGREP_CPP([use_generic_symbol_versioning],
[#ifdef __NVCOMPILER
use_generic_symbol_versioning
#endif],
[enable_symbol_versions=generic],
[enable_symbol_versions=linux])
;;
*)
enable_symbol_versions=generic
;;
esac
fi
if test "x$enable_symbol_versions" = xlinux ; then
case "$pic_mode-$enable_static" in
default-*)
# Use symvers if PIC is defined.
have_symbol_versions_linux=2
;;
*-no)
# Not building static library.
# Use symvers unconditionally.
have_symbol_versions_linux=1
;;
*)
AC_MSG_RESULT([])
AC_MSG_ERROR([
On GNU/Linux, building both shared and static library at the same time
is not supported if --with-pic or --without-pic is used.
Use either --disable-shared or --disable-static to build one type
of library at a time. If both types are needed, build one at a time,
possibly picking only src/liblzma/.libs/liblzma.a from the static build.])
;;
esac
enable_symbol_versions=linux
AC_DEFINE_UNQUOTED([HAVE_SYMBOL_VERSIONS_LINUX],
[$have_symbol_versions_linux],
[Define to 1 to if GNU/Linux-specific details
are unconditionally wanted for symbol
versioning. Define to 2 to if these are wanted
only if also PIC is defined (allows building
both shared and static liblzma at the same
time with Libtool if neither --with-pic nor
--without-pic is used). This define must be
used together with liblzma_linux.map.])
;;
*)
enable_symbol_versions=generic
;;
esac
;;
esac
AC_DEFINE_UNQUOTED([HAVE_SYMBOL_VERSIONS_LINUX],
[$have_symbol_versions_linux],
[Define to 1 to if GNU/Linux-specific details
are unconditionally wanted for symbol
versioning. Define to 2 to if these are wanted
only if also PIC is defined (allows building
both shared and static liblzma at the same
time with Libtool if neither --with-pic nor
--without-pic is used). This define must be
used together with liblzma_linux.map.])
elif test "x$enable_symbol_versions" != xgeneric ; then
AC_MSG_RESULT([])
AC_MSG_ERROR([unknown symbol versioning variant '$enable_symbol_versions'])
fi
AC_MSG_RESULT([yes ($enable_symbol_versions)])
fi
])
AM_CONDITIONAL([COND_SYMVERS_LINUX],
[test "x$enable_symbol_versions" = xlinux])
@ -789,6 +852,35 @@ AM_GNU_GETTEXT_REQUIRE_VERSION([0.19.6])
AM_GNU_GETTEXT_VERSION([0.19.6])
AM_GNU_GETTEXT([external])
# The command line tools use UTF-8 on native Windows. Non-ASCII characters
# display correctly only when using UCRT and gettext-runtime >= 0.23.1.
AS_CASE([$USE_NLS-$host_os],
[yes-mingw*], [
AC_MSG_CHECKING([for UCRT and gettext-runtime >= 0.23.1])
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <libintl.h>
#ifndef _UCRT
#error "Not UCRT"
#endif
#if LIBINTL_VERSION < 0x001701
#error "gettext-runtime < 0.23.1"
#endif
]])], [
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
AC_MSG_ERROR([
Translation support (--enable-nls) on native Windows requires
UCRT and gettext-runtime >= 0.23.1. Use --disable-nls to build
with MSVCRT or old gettext-runtime.])
])
]
)
###############################################################################
# Checks for header files.
@ -797,12 +889,6 @@ AM_GNU_GETTEXT([external])
echo
echo "System headers and functions:"
# There is currently no workarounds in this package if some of
# these headers are missing.
AC_CHECK_HEADERS([fcntl.h limits.h sys/time.h],
[],
[AC_MSG_ERROR([Required header file(s) are missing.])])
# immintrin.h allows the use of the intrinsic functions if they are available.
# cpuid.h may be used for detecting x86 processor features at runtime.
AC_CHECK_HEADERS([immintrin.h cpuid.h])
@ -840,13 +926,6 @@ AC_C_BIGENDIAN
# __attribute__((__constructor__)) can be used for one-time initializations.
# Use -Werror because some compilers accept unknown attributes and just
# give a warning.
#
# FIXME? Unfortunately -Werror can cause trouble if CFLAGS contains options
# that produce warnings for unrelated reasons. For example, GCC and Clang
# support -Wunused-macros which will warn about "#define _GNU_SOURCE 1"
# which will be among the #defines that Autoconf inserts to the beginning of
# the test program. There seems to be no nice way to prevent Autoconf from
# inserting the any defines to the test program.
AC_MSG_CHECKING([if __attribute__((__constructor__)) can be used])
have_func_attribute_constructor=no
OLD_CFLAGS="$CFLAGS"
@ -879,78 +958,6 @@ if test "x$enable_small$enable_threads$have_func_attribute_constructor" \
__attribute__((__constructor__))])
fi
# __attribute__((__ifunc__())) can be used to choose between different
# implementations of the same function at runtime. This is slightly more
# efficient than using __attribute__((__constructor__)) and setting
# a function pointer.
AC_ARG_ENABLE([ifunc], [AS_HELP_STRING([--enable-ifunc],
[Use __attribute__((__ifunc__())). Enabled by default on
GNU/Linux (glibc) and FreeBSD.])],
[], [enable_ifunc=auto])
# When enable_ifunc is 'auto', allow the use of __attribute__((__ifunc__()))
# if compiler support is detected and we are building for GNU/Linux (glibc)
# or FreeBSD. uClibc and musl don't support ifunc in their dynamic linkers
# but some compilers still accept the attribute when compiling for these
# C libraries, which results in broken binaries. That's why we need to
# check which libc is being used.
if test "x$enable_ifunc" = xauto ; then
OLD_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_MSG_CHECKING([if __attribute__((__ifunc__())) can be used])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
/*
* Force a compilation error when not using glibc on Linux
* or if we are not using FreeBSD. uClibc will define
* __GLIBC__ but does not support ifunc, so we must have
* an extra check to disable with uClibc.
*/
#if defined(__linux__)
# include <features.h>
# if !defined(__GLIBC__) || defined(__UCLIBC__)
compile error
# endif
#elif !defined(__FreeBSD__)
compile error
#endif
static void func(void) { return; }
static void (*resolve_func (void)) (void) { return func; }
void func_ifunc (void)
__attribute__((__ifunc__("resolve_func")));
/*
* 'clang -Wall' incorrectly warns that resolve_func is
* unused (-Wunused-function). Correct assembly output is
* still produced. This problem exists at least in Clang
* versions 4 to 17. The following silences the bogus warning:
*/
void make_clang_quiet(void);
void make_clang_quiet(void) { resolve_func()(); }
]])], [
enable_ifunc=yes
], [
enable_ifunc=no
])
AC_MSG_RESULT([$enable_ifunc])
CFLAGS="$OLD_CFLAGS"
fi
if test "x$enable_ifunc" = xyes ; then
AC_DEFINE([HAVE_FUNC_ATTRIBUTE_IFUNC], [1],
[Define to 1 if __attribute__((__ifunc__()))
is supported for functions.])
# ifunc explicitly does not work with -fsanitize=address.
# If configured, it will result in a liblzma build that will fail
# when liblzma is loaded at runtime (when the ifunc resolver
# executes).
AS_CASE([$CFLAGS], [*-fsanitize=*], [AC_MSG_ERROR([
CFLAGS contains '-fsanitize=' which is incompatible with ifunc.
Use --disable-ifunc when using '-fsanitize'.])])
fi
###############################################################################
# Checks for library functions.
@ -1066,11 +1073,15 @@ AC_CHECK_DECL([_mm_movemask_epi8],
#
# If everything above is supported, runtime detection will be used to keep the
# binaries working on systems that don't support the required extensions.
#
# NOTE: Use a check that links and not merely compiles to ensure that
# missing intrinsics don't get accepted with compilers that allow
# implicit function declarations.
AC_MSG_CHECKING([if _mm_clmulepi64_si128 is usable])
AS_IF([test "x$enable_clmul_crc" = xno], [
AC_MSG_RESULT([no, --disable-clmul-crc was used])
], [
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <immintrin.h>
// CLMUL works on older E2K instruction set but it is slow due to emulation.
@ -1084,10 +1095,11 @@ AS_IF([test "x$enable_clmul_crc" = xno], [
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__EDG__)
__attribute__((__target__("ssse3,sse4.1,pclmul")))
#endif
__m128i my_clmul(__m128i a)
int main(void)
{
const __m128i b = _mm_set_epi64x(1, 2);
return _mm_clmulepi64_si128(a, b, 0);
__m128i a = _mm_set_epi64x(1, 2);
a = _mm_clmulepi64_si128(a, a, 0);
return 0;
}
]])], [
AC_DEFINE([HAVE_USABLE_CLMUL], [1],
@ -1109,24 +1121,16 @@ AC_MSG_CHECKING([if ARM64 CRC32 instruction is usable])
AS_IF([test "x$enable_arm64_crc32" = xno], [
AC_MSG_RESULT([no, --disable-arm64-crc32 was used])
], [
# Set -Werror here because some versions of Clang (14 and older)
# do not report the unsupported __attribute__((__target__("+crc")))
# or __crc32d() as an error, only as a warning. This does not need
# to be done with CMake because tests will attempt to link and the
# error will be reported then.
OLD_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <arm_acle.h>
#include <stdint.h>
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__EDG__)
__attribute__((__target__("+crc")))
#endif
uint32_t my_crc(uint32_t a, uint64_t b)
int main(void)
{
return __crc32d(a, b);
return __crc32d(1, 2) != 0;
}
]])], [
AC_DEFINE([HAVE_ARM64_CRC32], [1],
@ -1137,19 +1141,52 @@ uint32_t my_crc(uint32_t a, uint64_t b)
enable_arm64_crc32=no
])
AC_MSG_RESULT([$enable_arm64_crc32])
CFLAGS="$OLD_CFLAGS"
])
# Check for ARM64 CRC32 instruction runtime detection.
# getauxval() is supported on Linux, elf_aux_info() on FreeBSD, and
# sysctlbyname("hw.optional.armv8_crc32", ...) is supported on Darwin
# (macOS, iOS, etc.). Note that sysctlbyname() is supported on FreeBSD,
# NetBSD, and possibly others too but the string is specific to Apple OSes.
# The C code is responsible for checking defined(__APPLE__) before using
# sysctlbyname("hw.optional.armv8_crc32", ...).
#
# - getauxval() is supported on Linux.
#
# - elf_aux_info() is supported on FreeBSD and OpenBSD >= 7.6.
#
# - sysctlbyname("hw.optional.armv8_crc32", ...) is supported on Darwin
# (macOS, iOS, etc.). Note that sysctlbyname() is supported on FreeBSD,
# NetBSD, and possibly others too but the string is specific to Apple
# OSes. The C code is responsible for checking defined(__APPLE__)
# before using sysctlbyname("hw.optional.armv8_crc32", ...).
#
AS_IF([test "x$enable_arm64_crc32" = xyes], [
AC_CHECK_FUNCS([getauxval elf_aux_info sysctlbyname])
AC_CHECK_FUNCS([getauxval elf_aux_info sysctlbyname], [break])
])
# LoongArch CRC32 intrinsics are in larchintrin.h.
# These are supported by at least GCC and Clang.
#
# Only 64-bit LoongArch is currently supported.
# It doesn't need runtime detection.
AC_MSG_CHECKING([if LoongArch CRC32 instructions are usable])
AS_IF([test "x$enable_loongarch_crc32" = xno], [
AC_MSG_RESULT([no, --disable-loongarch-crc32 was used])
], [
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#if !(defined(__loongarch__) && __loongarch_grlen >= 64)
# error
#endif
#include <larchintrin.h>
int main(void)
{
return __crc_w_w_w(1, 2);
}
]])], [
AC_DEFINE([HAVE_LOONGARCH_CRC32], [1], [Define to 1 if
64-bit LoongArch CRC32 instructions are supported.])
enable_loongarch_crc32=yes
], [
enable_loongarch_crc32=no
])
AC_MSG_RESULT([$enable_loongarch_crc32])
])
@ -1177,12 +1214,38 @@ AS_CASE([$enable_sandbox],
)
AS_CASE([$enable_sandbox],
[auto | landlock], [
AC_CHECK_HEADERS([linux/landlock.h], [
AC_MSG_CHECKING([if Linux Landlock is usable])
# A compile check is done here because some systems have
# linux/landlock.h, but do not have the syscalls defined
# in order to actually use Linux Landlock.
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <linux/landlock.h>
#include <sys/syscall.h>
#include <sys/prctl.h>
int main(void)
{
(void)prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0);
(void)SYS_landlock_create_ruleset;
(void)SYS_landlock_restrict_self;
(void)LANDLOCK_CREATE_RULESET_VERSION;
return 0;
}
]])], [
enable_sandbox=found
AS_CASE([$CFLAGS], [*-fsanitize=*], [AC_MSG_ERROR([
CFLAGS contains '-fsanitize=' which is incompatible with the Landlock
AS_CASE(["$CC $CFLAGS"], [*-fsanitize=*],
[AC_MSG_ERROR([
CC or CFLAGS contain '-fsanitize=' which is incompatible with the Landlock
sandboxing. Use --disable-sandbox when using '-fsanitize'.])])
AC_DEFINE([HAVE_LINUX_LANDLOCK], [1],
[Define to 1 if Linux Landlock is supported.
See configure.ac for details.])
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
])
]
)
@ -1256,6 +1319,8 @@ AS_IF([test "$GCC" = yes], [
-Wmissing-prototypes \
-Wmissing-declarations \
-Wredundant-decls \
-Wimplicit-fallthrough \
-Wimplicit-fallthrough=5 \
\
-Wc99-compat \
-Wc11-extensions \

View File

@ -11,7 +11,8 @@ noinst_PROGRAMS = \
memusage \
crc32 \
known_sizes \
hex2bin
hex2bin \
testfilegen-arm64
AM_CPPFLAGS = \
-I$(top_srcdir)/src/common \

116
debug/testfilegen-arm64.c Normal file
View File

@ -0,0 +1,116 @@
// SPDX-License-Identifier: 0BSD
///////////////////////////////////////////////////////////////////////////////
//
/// \file testfilegen-arm64.c
/// \brief Generates uncompressed test file for the ARM64 filter
//
// Author: Lasse Collin
//
///////////////////////////////////////////////////////////////////////////////
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
static uint32_t pc4 = 0;
static void
put32le(uint32_t v)
{
putchar((v >> 0) & 0xFF);
putchar((v >> 8) & 0xFF);
putchar((v >> 16) & 0xFF);
putchar((v >> 24) & 0xFF);
++pc4;
}
static void
putbl(uint32_t imm)
{
imm &= (1U << 26) - 1;
imm |= 0x25U << 26;
put32le(imm);
}
static void
putadrp32(uint32_t imm)
{
imm &= 0x1FFFFFU;
// fprintf(stderr, "ADRP 0x%08X\n", imm);
uint32_t instr = 0x90000000;
instr |= (pc4 * 5 + 11) & 0x1F;
instr |= (imm & 3) << 29;
instr |= (imm >> 2) << 5;
put32le(instr);
}
extern int
main(void)
{
putbl(0);
putbl(0x03FFFFFF);
putbl(0x03FFFFFE);
putbl(0x03FFFFFD);
putbl(3);
putbl(2);
putbl(1);
putbl(0);
putbl(0x02000001);
putbl(0x02000000);
putbl(0x01FFFFFF);
putbl(0x01FFFFFE);
putbl(0x01111117);
putbl(0x01111116);
putbl(0x01111115);
putbl(0x01111114);
putbl(0x02222227);
putbl(0x02222226);
putbl(0x02222225);
putbl(0x02222224);
putbl(0U - pc4);
putbl(0U - pc4);
putbl(0U - pc4);
putbl(0U - pc4);
putadrp32(0x00);
putadrp32(0x05);
putadrp32(0x15);
putadrp32(0x25);
for (unsigned rep = 0; rep < 2; ++rep) {
while ((pc4 << 2) & 4095)
put32le(0x55555555U);
for (unsigned i = 10; i <= 21; ++i) {
const uint32_t neg = (0x1FFF00 >> (21 - i)) & ~255U;
const uint32_t plus = 1U << (i - 1);
putadrp32(0x000000 | plus);
putadrp32(0x000005 | plus);
putadrp32(0x0000FE | plus);
putadrp32(0x0000FF | plus);
putadrp32(0x000000 | neg);
putadrp32(0x000005 | neg);
putadrp32(0x0000FE | neg);
putadrp32(0x0000FF | neg);
}
}
return 0;
}

View File

@ -10,8 +10,8 @@
# cover most of the cases where mistakes can easily happen.
#
# Give the path and filename of the xz executable as an argument. If no
# arguments are given, this script uses ../src/xz/xz (relative to the
# location of this script).
# arguments are given, this script uses src/xz/xz (relative to the current
# directory).
#
# You may want to pipe the output of this script to less -S to view the
# tables printed by xz --list on a 80-column terminal. On the other hand,
@ -32,10 +32,6 @@ if [ -n "$1" ]; then
[ "x${XZ:0:1}" != "x/" ] && XZ="$PWD/$XZ"
fi
# Locate top_srcdir and go there.
top_srcdir="$(cd -- "$(dirname -- "$0")" && cd .. && pwd)"
cd -- "$top_srcdir"
# If XZ wasn't already set, use the default location.
XZ=${XZ-"$PWD/src/xz/xz"}
if [ "$(type -t "$XZ" || true)" != "file" ]; then
@ -45,15 +41,20 @@ if [ "$(type -t "$XZ" || true)" != "file" ]; then
fi
XZ=$(type -p -- "$XZ")
# Locate top_srcdir and go there.
top_srcdir="$(cd -- "$(dirname -- "$0")" && cd .. && pwd)"
cd -- "$top_srcdir"
# Print the xz version and locale information.
echo "$XZ --version"
"$XZ" --version
echo
if [ -d .git ] && type git > /dev/null 2>&1; then
echo "Source code version in $PWD:"
git describe --abbrev=4
git describe --abbrev=8
fi
echo
echo "LANGUAGE=$LANGUAGE"
locale
echo
@ -78,17 +79,13 @@ for CMD in \
"xz --lzma2=foobarbaz=abcd" \
"xz --lzma2=mf=abcd" \
"xz --lzma2=preset=foobarbaz" \
"xz --lzma2=mf=bt4,nice=2" \
"xz --lzma2=nice=50000" \
"xz --help" \
"xz --long-help" \
"xz --filters-help" \
"xz --list good-*lzma2*" \
"xz --list good-1-check*" \
"xz --list --verbose good-*lzma2*" \
"xz --list --verbose good-1-check*" \
"xz --list --verbose --verbose good-*lzma2*" \
"xz --list --verbose --verbose good-1-check*" \
"xz --list --verbose --verbose unsupported-check.xz"
"xz --list good-1-check* unsupported-check.xz" \
"xz --list --verbose --verbose good-1-arm64-lzma2-1.xz good-1-block_header-1.xz good-1-check-sha256.xz good-2-lzma2.xz"
do
echo "-----------------------------------------------------------"
echo

243
doc/SHA256SUMS Normal file
View File

@ -0,0 +1,243 @@
61e82b90203cd44c3a712fee5e1efb2a3de62c673cfbe010928856ef2a29b907 xz-4.999.9beta.tar
330312c4397608d8b7be362cc7edbfeafa6101614bc2164d816ea767656aa15c xz-4.999.9beta.tar.bz2
fa3901d1c034842da47fec1a24a9b5a5bd435f5ecfbb444c168512e2daddb86f xz-4.999.9beta.tar.gz
d6649124c7046caea616f599716a559c971c97947e4533c8f25f683310154e8c xz-4.999.9beta.tar.xz
0cb40c62ab80536c9cda0125bad445994c0c48f7f9e7c5a3839dbe2be7e7dabc xz-5.0.0.tar
47a89e65c4690364a0123871a221e663d23a9fbd1ca756a804b10dd4006056d8 xz-5.0.0.tar.bz2
eba9211990a642fc2c35ea02618b710c7fa898d78ccca48b546a07bdde03c44d xz-5.0.0.tar.gz
2da61184b5da24b7dd9266416259dbf65212d1ef83726202427233e7fcfe5754 xz-5.0.0.tar.xz
2485450f5bdfcdef701454c0ae61eeab144e852a20a14e07b0f3cba2f2a758e9 xz-5.0.0-dos.zip
ba46384f060b2c6646f2b342cc9de0e220d057f1ee148b5002eafe7156f27412 xz-5.0.0-windows.zip
e4103c00b237a7dfc0f2419ea0aafb739822405facea7e4ecc8fd10dcd82c734 xz-5.0.0-windows.7z
e0aa4e3d504d7b27b9d6b76107d0f3656a06a3217dd5006c401aa83d18931b40 xz-5.0.1.tar
9b380f502d37085a60821484a3a13747454638927cc36033be64970512451ed8 xz-5.0.1.tar.bz2
3770b8872a4322b9502937b4781d523303bf193962c4822899fd3a210878fc80 xz-5.0.1.tar.gz
0bd2cb93c172f6cce144493004755aa565d751cb40945bbbb5b5d210c037fce4 xz-5.0.1.tar.xz
47337530220b8eb5951c6be1bcdcaee49b32b843e39ea97e0da4c2791e994a98 xz-5.0.1-dos.zip
73488c8d475d6634484a65e32aa3ccdc9e56de21b6e8872feaee0d52dc1cd879 xz-5.0.1-windows.zip
0505cc1a49b5fd38226a28f145dff6d34bc7f14ff5a1d78a3e08b6fa3398425e xz-5.0.1-windows.7z
574b8b84359c263c0bb3c35ee13d53fdf36fac2ea89f0a6234cb5bdc5ae6fe87 xz-5.0.2.tar
216df1ddbd591f0da63de31d4b0837eed6d019ccb0e36e57812764c69af645bc xz-5.0.2.tar.bz2
57e979baaa40147dde1bbb284e3618f8f18b6532c932648bd57b5aee674b98a7 xz-5.0.2.tar.gz
b334483005639a65a37bcc3c33971de2df94764c11a1c3329ce388abb1d95334 xz-5.0.2.tar.xz
8d65f9e9b625394f98846fc9a19e79dafeacd7a905aba2e0f28397df099d57c9 xz-5.0.2-windows.zip
4e89d87fe9a3d795ed79b93f9d70478107e45ee51047758d4812ac070f13a54a xz-5.0.2-windows.7z
74984834d91aadd516f26bcf60e4f82adb74044f9a3f367dca5488ee3c97b8d4 xz-5.0.3.tar
5a11b9e17bfcda62319c5a8c4a2062dc81607a316d3f6adff89422d81ec1eae9 xz-5.0.3.tar.bz2
10eb4df72dffb2fb14c3d2d82b450e72282ffcb9ee3908a8e5b392b8f09681bf xz-5.0.3.tar.gz
3544421e3447fd3f668fd89fb384ff9d312d2730cb860f6b8e09564028de8e32 xz-5.0.3.tar.xz
f7e741635976eead2dd5ff592cc98a04261d96df81b7db94a957a96cc2b13cce xz-5.0.3-windows.zip
0ed3c11430735e81ec65fb3588b2b8cf4bea6953ad4dda99d9aef4ee231a6036 xz-5.0.3-windows.7z
403df1a612036569a1bf54a171a609b6c11370f6b774bcb4940533a72edda1f9 xz-5.0.4.tar
5cd9b060d3a1ad396b3be52c9b9311046a1c369e6062aea752658c435629ce92 xz-5.0.4.tar.bz2
d67405798dad645965fe51cf4e40c23d1201fb234378d3c44f5a3787142b83b6 xz-5.0.4.tar.gz
b7fd25be1ebead021447960804f91006e3fc2f151d7a19948c6a27b4db09b5e9 xz-5.0.4.tar.xz
45e5771ebb88bc71805a3fc183bcb49d1e24b21aa6f762d94be6bc11426d9101 xz-5.0.4-dos.zip
7ed7d59f71bbfac959a4d4c6eb86733440a0ca115677522c6f5f43ab0e106edc xz-5.0.4-windows.zip
7be3642f91ba2fe3339bcb6c458cad303cd9d8ab085537c7b4e96e14c5025de9 xz-5.0.4-windows.7z
dd665d739d07ff4b1cae5ecadfad929928fc069d3a617cf682435beadb568e3c xz-5.0.5.tar
166c48d2842519bc4f96333bff9e265f8cdda44d38e40594ef3f9bbb52890490 xz-5.0.5.tar.bz2
5dcffe6a3726d23d1711a65288de2e215b4960da5092248ce63c99d50093b93a xz-5.0.5.tar.gz
3515c74d170d0f6ec00820de63106ad16c07bae55a59c174b4741242c76264a4 xz-5.0.5.tar.xz
f5463e2a45788773e33a8056c931d8973da5a00122056df417da24033088daff xz-5.0.5-windows.zip
8dbe3357a6ad39cc3076e4f5f0cef9a4ef67461559d4db02f1f06841b74dec44 xz-5.0.5-windows.7z
1a8c89616655bf05b04b6dfb62642db02e5fe368d53ee033990be5c26f194a15 xz-5.0.5-with-libtool-2.4.2.418.tar
0b6fa3b002c8e15fcc4417001ef0327cfdf6ad53656d7e545c6069ff7657b26d xz-5.0.5-with-libtool-2.4.2.418.tar.gz
ea314028ba6aa221de52e0bb4b149db4704a3317e6676adde2607debd026054f xz-5.0.6.tar
2f444375cd1d66c04247127e9b5101ce8fb2a8726449f211f05c84c143289408 xz-5.0.6.tar.bz2
b6cf4cdc1313556a00848e722625bce40d2cd552c052b0465791c64c9202c3f1 xz-5.0.6.tar.gz
9d4136392b6266219fd0f1068256c34180f106ee4214752136c58c0f4864391c xz-5.0.6.tar.xz
97ab44b55b252cb2e1b851f6dbdb9811011bad7a80eb42445b0ea63bb1444dc3 xz-5.0.7.tar
e8851dc749df2340dac6c9297cb2653eff684e73c3dedf690930119502edd616 xz-5.0.7.tar.bz2
f4d2165553b9d0d82fd08bc2eacddeb48ebeb862a5686a603f8c044a2e52c93f xz-5.0.7.tar.gz
55146936f33a432282e399ef702b2c3ab06644d9f091a811b39ff483fd190e24 xz-5.0.7.tar.xz
e4cb781440e29b2c1e1700730f3fdabf7ccc62317a61931609a098c384bfca96 xz-5.0.8.tar
2286f9d90bb0a0de34cba990df1b10cfad0777f00cb2883def26b8ec1b326bda xz-5.0.8.tar.bz2
cac71b31ed322a487f1da1f10dfcf47f8855f97ff2c23b92680c7ae7be58babb xz-5.0.8.tar.gz
1b5c105c1f372f128bf23ed7a1fd9acf473c88adefb3243d2ea762edca2a0b79 xz-5.0.8.tar.xz
812fb3369dde3c81d0765e1a7e00afa0dcfa2e5fa63fdb57e7582147220b2491 xz-5.1.1alpha.tar
54e59a83690a4a0ec88a7d7c3bdef90c6b196c892a93463863c71c24fe87951a xz-5.1.1alpha.tar.gz
90d7162c001d388d6ef082ccda7b7852c6adc367c492a8935cdf170e49a9ccda xz-5.1.1alpha.tar.xz
5d1f5b39d19d1e0b5e7e446b11add769ce68fef781173e116bf8e7d533a90dcb xz-5.1.2alpha.tar
70e792d2a67cfbb8f2dffd0feab6ca6e5a4a618d65070fb44a367629d1ba94e5 xz-5.1.2alpha.tar.gz
7a9c8dbede0b62e70c75cc0dc14135760a39e9fc6504f87091a59fea87461e18 xz-5.1.2alpha.tar.xz
b77cfbdea2f805b69c4c3db40da311555af3fe78271097cf5dec06f7919f07c9 xz-5.1.3alpha.tar
9f94506e301d5b6863921bba861a99ba00de384dafb4e5f409679a93e41613d4 xz-5.1.3alpha.tar.gz
0413632457df9c65b1ce9dcf78495152fc9307bea5c3267c9996eebf708bf2b6 xz-5.1.3alpha.tar.xz
1b70584fdf6c872d7a921dea53772b89962dc0b292b0e3ec0d7a0ca5c860242b xz-5.1.4beta.tar
7c47b9e2cfb5be93245d9fcf2bec5b459412b7628c333896dded373dcd0cf0e0 xz-5.1.4beta.tar.gz
9f9c6a97959afbbd1315626f253f2d3d48c47e01a921c7f160dab4fde10678b5 xz-5.1.4beta.tar.xz
2d066a7ed58c98cd91111d8408fb8896b8100a8ee7e519ce5ea2315c284ba5b0 xz-5.2.0.tar
f7357d7455a1670229b3cca021da71dd5d13b789db62743c20624bdffc9cc4a5 xz-5.2.0.tar.bz2
231ef369982240bb20ed7cffa52bb12a4a297ce6871f480ab85e8a7ba98bf3d6 xz-5.2.0.tar.gz
5962fe32e0b42c7065b4410b7d8ffbf2895e197e97d410c4fc374ea0d7610a14 xz-5.2.0.tar.xz
490fc2ad09fea7bc3772bb23432b3dce32d0ef81d413b3b974730436599d9ec5 xz-5.2.0-dos.zip
b49c05f82cd05fa67031e72138e40f422d8fd6e2c9ca106016dfd24fae0e629e xz-5.2.0-windows.zip
13dfe89a796f4c50f28fac9059d33241746b8e66c540e54d2ac44fd3ea1fd027 xz-5.2.0-windows.7z
a9ebc19a511b650c4b678802375505302992214f578a40ce78db089f99c3341f xz-5.2.1.tar
679148f497e0bff2c1adce42dee5a23f746e71321c33ebb0f641a302e30c2a80 xz-5.2.1.tar.bz2
b918b6648076e74f8d7ae19db5ee663df800049e187259faf5eb997a7b974681 xz-5.2.1.tar.gz
6ecdd4d80b12001497df0741d6037f918d270fa0f9a1ab4e2664bf4157ae323c xz-5.2.1.tar.xz
e4150f52b2e9937cbe54f0e85325a25a3dc2da68cf643310bd973c9b5c121131 xz-5.2.1-dos.zip
2447f5e70dd105900a2957d6c2fad2b5872a6482ba59c1fa0513d03e8b2d10f4 xz-5.2.1-windows.zip
afc018a5ab327aac5c8d6e60dc20aae844204b4e86cfac56ec7dd455921dc2ce xz-5.2.1-windows.7z
f96b347204dbb984f6e58ecc98f01f823742d403133a461dd8a52993b237bb8c xz-5.2.2.tar
6ff5f57a4b9167155e35e6da8b529de69270efb2b4cf3fbabf41a4ee793840b5 xz-5.2.2.tar.bz2
73df4d5d34f0468bd57d09f2d8af363e95ed6cc3a4a86129d2f2c366259902a2 xz-5.2.2.tar.gz
f341b1906ebcdde291dd619399ae944600edc9193619dd0c0110a5f05bfcc89e xz-5.2.2.tar.xz
1a88e9645eca0c3d95e00e8fc4b1a155fa3e527a60bec5a667ca56ed36dbb29b xz-5.2.3.tar
fd9ca16de1052aac899ad3495ad20dfa906c27b4a5070102a2ec35ca3a4740c1 xz-5.2.3.tar.bz2
71928b357d0a09a12a4b4c5fafca8c31c19b0e7d3b8ebb19622e96f26dbf28cb xz-5.2.3.tar.gz
7876096b053ad598c31f6df35f7de5cd9ff2ba3162e5a5554e4fc198447e0347 xz-5.2.3.tar.xz
afe73c260e38fdebdd14c9eaab71c19b206ff74cebbdc744b0fa35b77b243220 xz-5.2.3-windows.zip
30352e7f1f1605ff0758d10e951f4b3eda108538ecd500b831124dc480e603f3 xz-5.2.3-windows.7z
7f77d67aec8207e4fef28c58f19919e51ef469621a58eafd13bf1f80ce956312 xz-5.2.4.tar
3313fd2a95f43d88e44264e6b015e7d03053e681860b0d5d3f9baca79c57b7bf xz-5.2.4.tar.bz2
b512f3b726d3b37b6dc4c8570e137b9311e7552e8ccbab4d39d47ce5f4177145 xz-5.2.4.tar.gz
9717ae363760dedf573dad241420c5fea86256b65bc21d2cf71b2b12f0544f4b xz-5.2.4.tar.xz
9a5163623f435b6fa0844b6b884babd6bf4f8d876ae2d8134deeb296afd49c61 xz-5.2.4-windows.zip
efb267a5c7b267cd9e7bf18b29857738b06845178c74f424e3c502609fbf9862 xz-5.2.4-windows.7z
cdd92f155d202979dace48d16ea9e1a7c93d09eb2c2c0ac9a207e7544ed4703a xz-5.2.5.tar
5117f930900b341493827d63aa910ff5e011e0b994197c3b71c08a20228a42df xz-5.2.5.tar.bz2
f6f4910fd033078738bd82bfba4f49219d03b17eb0794eb91efbae419f4aba10 xz-5.2.5.tar.gz
3e1e518ffc912f86608a8cb35e4bd41ad1aec210df2a47aaa1f95e7f5576ef56 xz-5.2.5.tar.xz
601ccfa756da378429eb246b60c52d5e9c7f7b41e95e187c487004c093112789 xz-5.2.5.tar.zst
98c6cb1042284fe704ec30083f3fc87364ce9ed2ea51f62bbb0ee9d3448717ec xzgrep-ZDI-CAN-16587.patch
0b77f9ac5af53dec0b14773087f8f53e699ad6ce97cc8bfc3ea3cf89535dd335 xz-5.2.5-dos.zip
d83b82ca75dfab39a13dda364367b34970c781a9df4d41264db922ac3a8f622d xz-5.2.5-windows.zip
bee788dcc8f4a16e232a5a91c5625be1cfad36085eade6983013d1a92a308cfc xz-5.2.5-windows.7z
49305a2e5804ba438aa4690377e9b630646da6ae9f3edd0e3e727f92b47dc661 xz-5.2.6.tar
13e3402e301b6018f6a71ef0e497f714c6d11e214ae82dab156b81c2a64acb25 xz-5.2.6.tar.bz2
a2105abee17bcd2ebd15ced31b4f5eda6e17efd6b10f921a01cda4a44c91b3a0 xz-5.2.6.tar.gz
e076ba3439cb7cfc45b908c869f51a8c89f3c9ee9ee982fde28849c015e723a7 xz-5.2.6.tar.xz
2716b4067763de99b3901bcc71d3bda233798045cb8189735e611b165b8a7f4f xz-5.2.6.tar.zst
6fd6dad79e5b0d3b24a43bc3f79472b62a48d210f1aaa02fb06e5dfad89a4ebc xz-5.2.6-windows.zip
88242ad128b131ae7340370cc3c17f8d35e8b238a1db528185b28be2e6c164e1 xz-5.2.6-windows.7z
050958af3ccf032f0dba7104743e48ee6ddd9fdf5c21ec905b237e92b221c524 xz-5.2.7.tar
b65f1d0c2708e57716f4dd2216989a73847ac6fdb4168ffceb155767e22b834b xz-5.2.7.tar.bz2
06327c2ddc81e126a6d9a78b0be5014b976a2c0832f492dcfc4755d7facf6d33 xz-5.2.7.tar.gz
8712e9acb0b6b49a97d443458a3067dc5c08a025e02dc5f773176c51dd7cfc69 xz-5.2.7.tar.xz
709372e665270acf21a8ef55a8e34ca1f2421e7b5cc3146f4d45cc717fb2bea4 xz-5.2.7.tar.zst
30837d396bb50d5cec2c2431686de6f94c537c0551dc884e5cd3ab5551e65f1e xz-5.2.7-windows.zip
e9eb1dc1b8beaa5e3c535fbeaaab3780869b08fdfea0aa3ac09a804cc8a84c1a xz-5.2.7-windows.7z
96ebba68e4cc33dcd6e47a6326a39babeccc78ed17a08f5db0c11942d2c6fbc4 xz-5.2.8.tar
1f8a43d9fcf325d049a31fe4514dc8c44a6d00ce8860d48c4212d1e349d2a3ed xz-5.2.8.tar.bz2
ec5cda9f0b91336ab1b881d3d144e8203fcca604e607caca8ae678ddbc29207d xz-5.2.8.tar.gz
2424b2711b1d40d2129645d550363896c6853c97528f085f7765092fe68679d4 xz-5.2.8.tar.xz
c4092edd7ca1416be97364548cb86d7ef40b07c48a417a7254fb053b68098794 xz-5.2.8.tar.zst
f4c1eb727301b9a2acb1ae065562ad0beb7a6512639f8088af1afefcbbcc6260 xz-5.2.8-windows.zip
13390e4bd6023e27985cd25a61087e93a248858e7cd01755af8a84f5eef11feb xz-5.2.8-windows.7z
18d594e0c3ca307c89c809d636a8878e3d067f0c26983cbc7dc5a586377bc0bd xz-5.2.9.tar
b194507fba3a462a753c553149ccdaa168337bcb7deefddd067ba987c83dfce6 xz-5.2.9.tar.bz2
e982ea31b81543d7ee2b6fa34c2ad11760e1c50c6f4475add8ba0f2f005f07b4 xz-5.2.9.tar.gz
287ef163e7e57561e9de590b2a9037457af24f03a46bbd12bf84f3263679e8d2 xz-5.2.9.tar.xz
45cb9dd8785dbb60341450a28c39228cc86146119b4eac48e754a6650bc26931 xz-5.2.9.tar.zst
62ac7ba1e223616b365bd7bf1f2231b1c7e0aad111d53e675bef77ef1ac65c43 xz-5.2.9-windows.zip
19810e26e202ab2f0b28b70ca785320c006a72826f7bf80c9c9db65db24a23cc xz-5.2.9-windows.7z
33aa379c788ffe5af0765296fd9d31fd1fd6d409088ded09af7ff60035694521 xz-5.2.10.tar
01b71df61521d9da698ce3c33148bff06a131628ff037398c09482f3a26e5408 xz-5.2.10.tar.bz2
eb7a3b2623c9d0135da70ca12808a214be9c019132baaa61c9e1d198d1d9ded3 xz-5.2.10.tar.gz
d615974a17299eaa1bf3d0f3b7afa172624755c8885111b17659051869d6f072 xz-5.2.10.tar.xz
4cb110fa88b6062758c1c7600f5fc497cbe10372690a7964c611adc3399c8e4b xz-5.2.10.tar.zst
02232767320c7587a9f16f9c1c42a1d0bdc94f33d93aa327bb0f0fb67a5f0beb xz-5.2.11.tar
7859c47a5e909299e77d0e87e2bafc52fb1d09e35abac48b6426c1be213c5b37 xz-5.2.11.tar.bz2
0089d47b966bd9ab48f1d01baf7ce146a3b591716c7477866b807010de3d96ab xz-5.2.11.tar.gz
503b4a9fb405e70e1d3912e418fdffe5de27e713e58925fb67e12d20d03a77bc xz-5.2.11.tar.xz
1facb7ec3c0950a95e7d5396488fd5c9710c7fec353292962291b2c103777989 xz-5.2.11.tar.zst
4d8837034498dcbe64d3cff5f71b5fb6584c1af027eda7548831832efba1c0f4 xz-5.2.12.tar
fbedff8eb67e229f2e95eb1ff920b255e405c86c9e1a53d4a6861d9823acff18 xz-5.2.12.tar.bz2
61bda930767dcb170a5328a895ec74cab0f5aac4558cdda561c83559db582a13 xz-5.2.12.tar.gz
f79a92b84101d19d76be833aecc93e68e56065b61ec737610964cd4f6c54ff2e xz-5.2.12.tar.xz
88e6796dada9b65b50ec80a3815be3e4d4ee5fbee17541f112a070d875d59a5d xz-5.2.12.tar.zst
515f41be4b7bfd4d2d1ddb939ebd028b8e979bec9baf28b7886e04637a8e54f0 xz-5.2.13.tar
620cdbfc31adbc7e3e5cd8c3c3aa9ffed9335f0ddc42719cf9afce5136a978c1 xz-5.2.13.tar.bz2
2942a1a8397cd37688f79df9584947d484dd658db088d51b790317eb3184827b xz-5.2.13.tar.gz
03eca718652bc8a77f0d2e9ad7744755818aece15cebbc11a3a069cc604ecd84 xz-5.2.13.tar.xz
9bbcac67b776385b4345d287e90e345f6c841d4285502aa386515a49696abd5d xz-5.3.1alpha.tar
55a92fe16b1dbf2067dda6c0d8fcfff5639b0c8fe926f2a6aad4785699095ec2 xz-5.3.1alpha.tar.xz
fe96db09fa3cd289a2e67af8b4045213117e47fbf7fb882bed606556edcf7d5c xz-5.3.2alpha.tar
36f4fe561714385eea08945a910a31e6ea5d48611eb7af2fe7966dd030b502d2 xz-5.3.2alpha.tar.gz
35b7e753a0da827020bd3fe9c55b34d86b888f69a82a8c5d981e8f89e555360d xz-5.3.2alpha.tar.xz
ed8fe42c7f36f707f8b65f70f106c8c06e4cc68322f3277ab31aa17b57ea0927 xz-5.3.3alpha.tar
c6d4789a79bab565440784db2e132d6bf03b2e75dd6d66a8102cf002d8dfe926 xz-5.3.3alpha.tar.gz
8d50c45575cb943d14dfef2a3f5b1199cc86b5066273d322556cf16e7f75411f xz-5.3.3alpha.tar.xz
f3dfc690c1207efd3bcb362dcb5d63df21817c9780ea058c46ef0236febf43e0 xz-5.3.4alpha.tar
829e7bc21334b163be9155cb6148f4ca80a573dc453b90e6f1e3bf023764e5f9 xz-5.3.4alpha.tar.gz
e0358fb10e59dac8da9b58c14aae59ed9b5b56cc075fbdd884b44d87a35971e9 xz-5.3.4alpha.tar.xz
9ad807c4e203ff21b921944c441d5de509d21262f5db81deeae6f56fc97c54ea xz-5.3.5beta.tar
542bb3549b2a1988d5d9ce871a5db189d117eb51371c9c1e675f5a0b1870f692 xz-5.3.5beta.tar.gz
e08932f382bed9c293a13a3cb72e07464b6caad6d6ceafe9a7545bee501f857c xz-5.3.5beta.tar.xz
d2f31178627378b6a2567e028194a4e7c18164925ac0d0364d439a8226bb06a4 xz-5.4.0.tar
795ea0494c66d509b052ddc36dc63bd634e59ff2a0f39c16a3b5644dd01d87e6 xz-5.4.0.tar.bz2
7471ef5991f690268a8f2be019acec2e0564b7b233ca40035f339fe9a07f830b xz-5.4.0.tar.gz
5f260e3b43f75cf43ca43d107dd18209f7d516782956a74ddd53288e02a83a31 xz-5.4.0.tar.xz
3d16dc30760af691318cd4bebbae9f7a177ee9a270dbaa47cb58cb1d271cac36 xz-5.4.0.tar.zst
48f8a02005c1b0f49eb629daa6567dfeccaa9cb9b6725feaf8b7cd1955bd049d xz-5.4.0-dos.zip
749fe4d7c0ce95b5c9cf35e725ed78d6158477e140cf84cde2107ec8465a5e9b xz-5.4.1.tar
dd172acb53867a68012f94c17389401b2f274a1aa5ae8f84cbfb8b7e383ea8d3 xz-5.4.1.tar.bz2
e4b0f81582efa155ccf27bb88275254a429d44968e488fc94b806f2a61cd3e22 xz-5.4.1.tar.gz
5d9827aa1875b21c288f78864bb26d2650b436ea8d2cad364e4921eb6266a5a5 xz-5.4.1.tar.xz
9b3d36dd65ecffc9cfef093010061ffe1d48ee34eef0cff69b63cf82b2d099c4 xz-5.4.1.tar.zst
3db1ec993b96cfee143df08d780b642ace8b40bb14043537db8a9c951317fafc xz-5.4.2.tar
aa49909cbd9028c4666a35fa4975f9a6203ed98154fbb8223ee43ef9ceee97c3 xz-5.4.2.tar.bz2
87947679abcf77cc509d8d1b474218fd16b72281e2797360e909deaee1ac9d05 xz-5.4.2.tar.gz
3ee13d0f40148625306b90f9622f8c9660b8082884051b0cfe46f18492f88955 xz-5.4.2.tar.xz
cd43589df77eb776956c8082a0cbae1d0cd1a2637a6930ea93ba5759639511b1 xz-5.4.2.tar.zst
475e09077f4a0cd57306ea1d4cf9ccdfd5add1a2744cf75956725e7fb531ce36 xz-5.4.3.tar
9243a04598d7a70c1f567a0143a255581ac5c64b140fd55fd5cbc1e00b0e6f90 xz-5.4.3.tar.bz2
1c382e0bc2e4e0af58398a903dd62fff7e510171d2de47a1ebe06d1528e9b7e9 xz-5.4.3.tar.gz
92177bef62c3824b4badc524f8abcce54a20b7dbcfb84cde0a2eb8b49159518c xz-5.4.3.tar.xz
da51e1105e152e62a72fd81acd9a3e325609b4aed5631c50de3ea58a7f162ebb xz-5.4.3.tar.zst
a9ffcc046c96908caed200e2d11b27a4af66b1b4351880f9ba88657a6b6b690c xz-5.4.4.tar
0b6fcde1ac38e90433a2556f500c065950b9bcd2d602006efc334782bdfe6296 xz-5.4.4.tar.bz2
aae39544e254cfd27e942d35a048d592959bd7a79f9a624afb0498bb5613bdf8 xz-5.4.4.tar.gz
705d0d96e94e1840e64dec75fc8d5832d34f6649833bec1ced9c3e08cf88132e xz-5.4.4.tar.xz
610c4d79ea3a56bfd1df178578aa17e10a88d58a362b0a7b3fa47321469bae20 xz-5.4.4.tar.zst
3ee65a3efb5c96da5e50a0f16567a926258f83f472d2773d40c4d19c8873daad xz-5.4.5.tar
8ccf5fff868c006f29522e386fb4c6a1b66463fbca65a4cfc3c4bd596e895e79 xz-5.4.5.tar.bz2
135c90b934aee8fbc0d467de87a05cb70d627da36abe518c357a873709e5b7d6 xz-5.4.5.tar.gz
da9dec6c12cf2ecf269c31ab65b5de18e8e52b96f35d5bcd08c12b43e6878803 xz-5.4.5.tar.xz
9ab5561ce9fed7860695c14b955a0ebec2df9a00fb171862a25910546a1737cc xz-5.4.5.tar.zst
b32e1195788a00ca01ea43bc5ea67ecf5bdbaf35ea8faa272da0066e795cb7e2 xz-5.4.6.tar
913851b274e8e1d31781ec949f1c23e8dbcf0ecf6e73a2436dc21769dd3e6f49 xz-5.4.6.tar.bz2
aeba3e03bf8140ddedf62a0a367158340520f6b384f75ca6045ccc6c0d43fd5c xz-5.4.6.tar.gz
b92d4e3a438affcf13362a1305cd9d94ed47ddda22e456a42791e630a5644f5c xz-5.4.6.tar.xz
21326933d567a87a7d7484a22cd5723387a71b5934b131dc91ea7495a813bdf3 xz-5.4.6.tar.zst
f30cdc66bb071622b382106b0a06ef0e28263e5656a96d88ff55cf92786391f9 xz-5.4.7.tar
9976ed9cd0764e962d852d7d519ee1c3a7f87aca3b86e5d021a45650ba3ecb41 xz-5.4.7.tar.bz2
8db6664c48ca07908b92baedcfe7f3ba23f49ef2476864518ab5db6723836e71 xz-5.4.7.tar.gz
016182c70bb5c7c9eb3465030e3a7f6baa25e17b0e8c0afe92772e6021843ce2 xz-5.4.7.tar.xz
f4a16279ebe33a607a41536fd203dc9337bdd6395ef72130cff47dc8276fd9ff xz-5.6.2.tar
e12aa03cbd200597bd4ce11d97be2d09a6e6d39a9311ce72c91ac7deacde3171 xz-5.6.2.tar.bz2
8bfd20c0e1d86f0402f2497cfa71c6ab62d4cd35fd704276e3140bfb71414519 xz-5.6.2.tar.gz
a9db3bb3d64e248a0fae963f8fb6ba851a26ba1822e504dc0efd18a80c626caf xz-5.6.2.tar.xz
31f58851acdf0d24d15bce14782dafa5a447ee922eaa39859170277dc9a8fae7 xz-5213-547-562-libtool.patch
b55087b6e30fb0cb0175e89022dafd4acb46190a4ec6831cb3e21172fc815186 xz-5.6.3.tar
a95a49147b2dbb5487517acc0adcd77f9c2032cf00664eeae352405357d14a6c xz-5.6.3.tar.bz2
b1d45295d3f71f25a4c9101bd7c8d16cb56348bbef3bbc738da0351e17c73317 xz-5.6.3.tar.gz
db0590629b6f0fa36e74aea5f9731dc6f8df068ce7b7bafa45301832a5eebc3a xz-5.6.3.tar.xz
c06b09e74a64616c36ce7c65c8af442d62031135f948d04c704f46d8c2cc2fef xz-5.6.4.tar
176d510c30d80a23b8050bbc048f2ecaacb823ae48b6821727ed6591f0df9200 xz-5.6.4.tar.bz2
269e3f2e512cbd3314849982014dc199a7b2148cf5c91cedc6db629acdf5e09b xz-5.6.4.tar.gz
829ccfe79d769748f7557e7a4429a64d06858e27e1e362e25d01ab7b931d9c95 xz-5.6.4.tar.xz
e5403003b4698967680ca57c733e11fdc110426858091cc83c8df8f4322957ee xz-5.6.4-windows.zip
a69d83338facb6e9a45147384beb7d7d8ed53b5e2a41e8c059ae0d0260b356ac xz-5.6.4-windows.7z
31199267fba9588305c0df3de5d6d9898d00c4ee02f5eee19f79baa427628519 xz-5.7.1alpha.tar
ae655a4bec0820f750985ecd270d6802ae0a987bb1cb03d41d9afa37abc2e87c xz-5.7.1alpha.tar.gz
c859193b8619f6818326141ee041870d9b76ba83f55c3c94ebcfcb71e1f79e5d xz-5.7.1alpha.tar.xz
b75a932fa38515e5d3953242b1e3c2e7edd882504b24280f0e9776d596e9cc0d xz-5.7.2beta.tar
608ed92561c9f27a1eead76653c6f63c6a40d0a20ec91753ed508ba40f9703b3 xz-5.7.2beta.tar.gz
98a61e45e5917b93ce17d826ef2d11f9331951882b2558675cdf115cdf3f77c8 xz-5.7.2beta.tar.xz
bdff4615bf19c46042bced4d7b8c52bdacce61261b39db464d482692c948dd02 xz-5.8.0.tar
8c107270289807e2047f35d687b4d7a5bb029137f7c89ebdcfa909cb3b674440 xz-5.8.0.tar.bz2
b523c5e47d1490338c5121bdf2a6ecca2bcf0dce05a83ad40a830029cbe6679b xz-5.8.0.tar.gz
05ecad9e71919f4fca9f19fbbc979ea28e230188ed123dc6f06b98031ea14542 xz-5.8.0.tar.xz
397165cedccb8e16700b8fdd026c3fd7ff2d18923e28cfbf7d0c5f89cd6a50af xz-5.8.0-windows.zip
078caa9d406018d4d43df343455f57811e9ba69c1340670a85a0ae6341d42ba3 xz-5.8.0-windows.7z
ee188eabc3220684422f62df7a385541a86d2a5c385407f9d8fd94d49b251c4e xz-cve-2025-31115.patch
c9789682496d124fd214e665f6aa2f6d3d9e8527a7f0e120f9180c531d322bd6 xz-5.8.1.tar
5965c692c4c8800cd4b33ce6d0f6ac9ac9d6ab227b17c512b6561bce4f08d47e xz-5.8.1.tar.bz2
507825b599356c10dca1cd720c9d0d0c9d5400b9de300af00e4d1ea150795543 xz-5.8.1.tar.gz
0b54f79df85912504de0b14aec7971e3f964491af1812d83447005807513cd9e xz-5.8.1.tar.xz
62fdfde73d5c5d293bbb4a96211b29d09adbd56bc6736976e4c9fc9942ae3c67 xz-5.8.1-windows.zip
8ed1403fe6c971a2a6ac85fb7b27c8438b83175bc6f3bc49fec06540c904c84d xz-5.8.1-windows.7z

View File

@ -45,7 +45,7 @@ init_encoder(lzma_stream *strm)
}
// Now we could customize the LZMA2 options if we wanted. For example,
// we could set the the dictionary size (opt_lzma2.dict_size) to
// we could set the dictionary size (opt_lzma2.dict_size) to
// something else than the default (8 MiB) of the default preset.
// See lzma/lzma12.h for details of all LZMA2 options.
//

View File

@ -240,5 +240,5 @@ A: Give --enable-small to the configure script. Use also appropriate
If the result is still too big, take a look at XZ Embedded. It is
a separate project, which provides a limited but significantly
smaller XZ decoder implementation than XZ Utils. You can find it
at <https://xz.tukaani.org/xz-embedded/>.
at <https://tukaani.org/xz/embedded.html>.

View File

@ -40,11 +40,11 @@ The .lzma File Format
0.2. Changes
Last modified: 2024-01-16 18:00+0800
Last modified: 2024-04-08 17:35+0300
Compared to the previous version (2022-07-13 21:00+0300)
the section 2 was modified to change links from http to
https and to update XZ links.
From version 2011-04-12 11:55+0300 to 2022-07-13 21:00+0300:
The section 1.1.3 was modified to allow End of Payload Marker
with a known Uncompressed Size.
1. File Format
@ -166,8 +166,8 @@ The .lzma File Format
https://tukaani.org/lzma/
XZ Utils - The next generation of LZMA Utils
https://xz.tukaani.org/xz-utils/
https://tukaani.org/xz/
The .xz file format - The successor of the .lzma format
https://xz.tukaani.org/format/xz-file-format.txt
https://tukaani.org/xz/xz-file-format.txt

View File

@ -2,7 +2,7 @@
The .xz File Format
===================
Version 1.2.0 (2024-01-19)
Version 1.2.1 (2024-04-08)
0. Preface
@ -81,18 +81,22 @@ Version 1.2.0 (2024-01-19)
0.2. Getting the Latest Version
The latest official version of this document can be downloaded
from <https://xz.tukaani.org/format/xz-file-format.txt>.
from <https://tukaani.org/xz/xz-file-format.txt>.
Specific versions of this document have a filename
xz-file-format-X.Y.Z.txt where X.Y.Z is the version number.
For example, the version 1.0.0 of this document is available
at <https://xz.tukaani.org/format/xz-file-format-1.0.0.txt>.
at <https://tukaani.org/xz/xz-file-format-1.0.0.txt>.
0.3. Version History
Version Date Description
1.2.1 2024-04-08 The URLs of this specification and
XZ Utils were changed back to the
original ones in Sections 0.2 and 7.
1.2.0 2024-01-19 Added RISC-V filter and updated URLs in
Sections 0.2 and 7. The URL of this
specification was changed.
@ -1147,7 +1151,7 @@ Version 1.2.0 (2024-01-19)
https://tukaani.org/lzma/
XZ Utils - The next generation of LZMA Utils
https://xz.tukaani.org/xz-utils/
https://tukaani.org/xz/
[RFC-1952]
GZIP file format specification version 4.3

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -45,13 +45,15 @@ SRCS_C = \
../src/common/tuklib_cpucores.c \
../src/common/tuklib_exit.c \
../src/common/tuklib_mbstr_fw.c \
../src/common/tuklib_mbstr_nonprint.c \
../src/common/tuklib_mbstr_width.c \
../src/common/tuklib_mbstr_wrap.c \
../src/common/tuklib_open_stdxxx.c \
../src/common/tuklib_physmem.c \
../src/common/tuklib_progname.c \
../src/liblzma/check/check.c \
../src/liblzma/check/crc32_table.c \
../src/liblzma/check/crc64_table.c \
../src/liblzma/check/crc32_fast.c \
../src/liblzma/check/crc64_fast.c \
../src/liblzma/check/sha256.c \
../src/liblzma/common/alone_decoder.c \
../src/liblzma/common/alone_encoder.c \

View File

@ -12,6 +12,9 @@
/* Define to 1 if sha256 integrity check is enabled. */
#define HAVE_CHECK_SHA256 1
/* Define to 1 if the 32-bit x86 CRC assembly files are used. */
#define HAVE_CRC_X86_ASM 1
/* Define to 1 if any of HAVE_DECODER_foo have been defined. */
#define HAVE_DECODERS 1
@ -81,9 +84,6 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define to 1 if .lz (lzip) decompression support is enabled. */
#define HAVE_LZIP_DECODER 1
@ -108,15 +108,6 @@
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the 'utimes' function. */
#define HAVE_UTIMES 1
@ -145,7 +136,7 @@
#define PACKAGE_NAME "XZ Utils"
/* Define to the home page for this package. */
#define PACKAGE_URL "https://xz.tukaani.org/xz-utils/"
#define PACKAGE_URL "https://tukaani.org/xz/"
/* The size of 'size_t', as computed by sizeof. */
#define SIZEOF_SIZE_T 4

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +0,0 @@
<hr class="footer"/>
<p style="text-align: right;padding-right: 12px;">
XZ logo &copy; 2023 by Jia Tan is licensed under
<a href="COPYING.CC-BY-SA-4.0"
rel="license"
style="display:inline-block;">
CC BY-SA 4.0
</a>
</p>
</body>
</html>

View File

@ -3,14 +3,13 @@
#############################################################################
#
# Updates the Doxygen generated documentation files in the source tree.
# If the doxygen command is not installed, it will exit with an error.
# This script can generate Doxygen documentation for all source files or for
# just liblzma API header files.
# While it's possible to use the Doxyfile as is to generate liblzma API
# documentation, it is recommended to use this script because this adds
# the XZ Utils version number to the generated HTML.
#
# It is recommended to use this script to update the Doxygen-generated HTML
# files since this will include the package version in the output and,
# in case of liblzma API docs, strip JavaScript files from the output.
# Other features:
# - Generate documentation of the XZ Utils internals.
# - Set input and output paths for out-of-tree builds.
#
#############################################################################
#
@ -21,31 +20,67 @@
set -e
show_usage()
{
echo "Usage: $0 <api|internal> [ABS_TOP_SRCDIR ABS_OUTDIR]"
echo
echo "Supported modes:"
echo " - 'api' (default): liblzma API docs into doc/api"
echo " - 'internal': internal docs into doc/internal"
echo
echo "Absolute source and output dirs may be set" \
"to do an out-of-tree build."
echo "The output directory must already exist."
exit 1
}
case $1 in
api|internal)
;;
*)
show_usage
;;
esac
if type doxygen > /dev/null 2>&1; then
:
else
echo "doxygen/update-doxygen: 'doxygen' command not found." >&2
echo "doxygen/update-doxygen: Skipping Doxygen docs generation." >&2
echo "$0: 'doxygen' command not found" >&2
exit 1
fi
if test ! -f Doxyfile; then
cd `dirname "$0"` || exit 1
if test ! -f Doxyfile; then
echo "doxygen/update-doxygen: Cannot find Doxyfile" >&2
exit 1
fi
case $# in
1)
# One argument: Building inside the source tree
ABS_TOP_SRCDIR=`dirname "$0"`/..
ABS_OUTDIR=$ABS_TOP_SRCDIR/doc
;;
3)
# Three arguments: Possibly an out of tree build
ABS_TOP_SRCDIR=$2
ABS_OUTDIR=$3
;;
*)
show_usage
;;
esac
if test ! -f "$ABS_TOP_SRCDIR/doxygen/Doxyfile"; then
echo "$0: Source dir '$ABS_TOP_SRCDIR/doxygen/Doxyfile' not found" >&2
exit 1
fi
if test ! -d "$ABS_OUTDIR"; then
echo "$0: Output dir '$ABS_OUTDIR' not found" >&2
exit 1
fi
# Get the package version so that it can be included in the generated docs.
PACKAGE_VERSION=`cd .. && sh build-aux/version.sh` || exit 1
PACKAGE_VERSION=`cd "$ABS_TOP_SRCDIR" && sh build-aux/version.sh`
# If no arguments are specified, default to generating liblzma API header
# documentation only.
case $1 in
'' | api)
api)
# Remove old documentation before re-generating the new.
rm -rf ../doc/api
rm -rf "$ABS_OUTDIR/api"
# Generate the HTML documentation by preparing the Doxyfile
# in stdin and piping the result to the doxygen command.
@ -53,57 +88,27 @@ case $1 in
# override any earlier assignment. So, we can use this
# feature to override the tags that need to change between
# "api" and "internal" modes.
ABS_SRCDIR=$ABS_TOP_SRCDIR/src/liblzma/api
(
cat Doxyfile
cat "$ABS_TOP_SRCDIR/doxygen/Doxyfile"
echo "PROJECT_NUMBER = $PACKAGE_VERSION"
) | doxygen -
# As of Doxygen 1.8.0 - 1.9.6 and the Doxyfile options we use,
# the output is good without any JavaScript. Unfortunately
# Doxygen doesn't have an option to disable JavaScript usage
# completely so we strip it away with the hack below.
#
# Omitting the JavaScript code avoids some license hassle
# as jquery.js is fairly big, it contains more than jQuery
# itself, and doesn't include the actual license text (it
# only refers to the MIT license by name).
echo "Stripping JavaScript from Doxygen output..."
for F in ../doc/api/*.html
do
sed 's/<script [^>]*><\/script>//g
s/onclick="[^"]*"//g' \
"$F" > ../doc/api/tmp
mv -f ../doc/api/tmp "$F"
done
rm -f ../doc/api/*.js
echo "OUTPUT_DIRECTORY = $ABS_OUTDIR"
echo "STRIP_FROM_PATH = $ABS_SRCDIR"
echo "INPUT = $ABS_SRCDIR"
) | doxygen -q -
;;
internal)
# The docs from internal aren't for distribution so
# the JavaScript files aren't an issue here.
rm -rf ../doc/internal
rm -rf "$ABS_OUTDIR/internal"
(
cat Doxyfile
echo "PROJECT_NUMBER = $PACKAGE_VERSION"
cat "$ABS_TOP_SRCDIR/doxygen/Doxyfile"
echo 'PROJECT_NAME = "XZ Utils"'
echo 'STRIP_FROM_PATH = ../src'
echo 'INPUT = ../src'
echo "PROJECT_NUMBER = $PACKAGE_VERSION"
echo "OUTPUT_DIRECTORY = $ABS_OUTDIR"
echo "STRIP_FROM_PATH = $ABS_TOP_SRCDIR"
echo "INPUT = $ABS_TOP_SRCDIR/src"
echo 'HTML_OUTPUT = internal'
echo 'EXTRACT_PRIVATE = YES'
echo 'EXTRACT_STATIC = YES'
echo 'EXTRACT_LOCAL_CLASSES = YES'
echo 'SEARCHENGINE = YES'
) | doxygen -
;;
*)
echo "doxygen/update-doxygen: Error: mode argument '$1'" \
"is not supported." >&2
echo "doxygen/update-doxygen: Supported modes:" >&2
echo "doxygen/update-doxygen: - 'api' (default):" \
"liblzma API docs into doc/api" >&2
echo "doxygen/update-doxygen: - 'internal':"\
"internal docs into doc/internal" >&2
exit 1
) | doxygen -q -
;;
esac

View File

@ -8,10 +8,10 @@ dnl with or without modifications, as long as this notice is preserved.
# This version has been modified to reduce complexity since we only need
# GNU getopt_long and do not care about replacing getopt.
#
# Pass gl_replace_getopt=yes (or any non-empty value instead of "yes") as
# an argument to configure to force the use of the getopt_long replacement.
# Check for a POSIX compliant getopt function with GNU extensions (such as
# options with optional arguments) and the functions getopt_long,
# getopt_long_only.
AC_DEFUN([gl_FUNC_GETOPT_GNU],
[
AC_REQUIRE([gl_GETOPT_CHECK_HEADERS])
@ -23,8 +23,6 @@ AC_DEFUN([gl_FUNC_GETOPT_GNU],
AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
[
gl_replace_getopt=
if test -z "$gl_replace_getopt"; then
AC_CHECK_HEADERS([getopt.h], [], [gl_replace_getopt=yes])
fi

View File

@ -1,13 +1,14 @@
dnl SPDX-License-Identifier: FSFULLR
# posix-shell.m4
# serial 1
dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
# Find a POSIX-conforming shell.
# Copyright (C) 2007-2008 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# Written by Paul Eggert.
# If a POSIX-conforming shell can be found, set POSIX_SHELL and
@ -19,22 +20,22 @@ AC_DEFUN([gl_POSIX_SHELL],
AC_CACHE_CHECK([for a shell that conforms to POSIX], [gl_cv_posix_shell],
[gl_test_posix_shell_script='
func_return () {
(exit [$]1)
(exit [$]1)
}
func_success () {
func_return 0
func_return 0
}
func_failure () {
func_return 1
func_return 1
}
func_ret_success () {
return 0
return 0
}
func_ret_failure () {
return 1
return 1
}
subshell_umask_sanity () {
(umask 22; (umask 0); test $(umask) -eq 22)
(umask 22; (umask 0); test $(umask) -eq 22)
}
test "[$](echo foo)" = foo &&
func_success &&
@ -45,11 +46,11 @@ AC_DEFUN([gl_POSIX_SHELL],
subshell_umask_sanity
'
for gl_cv_posix_shell in \
"$CONFIG_SHELL" "$SHELL" /bin/sh /bin/bash /bin/ksh /bin/sh5 no; do
"$CONFIG_SHELL" "$SHELL" /bin/sh /bin/bash /bin/ksh /bin/sh5 no; do
case $gl_cv_posix_shell in
/*)
"$gl_cv_posix_shell" -c "$gl_test_posix_shell_script" 2>/dev/null \
&& break;;
"$gl_cv_posix_shell" -c "$gl_test_posix_shell_script" 2>/dev/null \
&& break;;
esac
done])

View File

@ -71,7 +71,7 @@ main(void)
# -lfreebsd-glue when linking and thus in the current form this would
# fail on GNU/kFreeBSD. The above test for sched_getaffinity() matches
# on GNU/kFreeBSD so the test below should never run on that OS.
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <sys/param.h>
#include <sys/cpuset.h>
@ -92,7 +92,7 @@ main(void)
#
# We test sysctl() first and intentionally break the sysctl() test on QNX
# so that sysctl() is never used on QNX.
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#ifdef __QNX__
compile error
#endif
@ -116,7 +116,7 @@ main(void)
}
]])], [tuklib_cv_cpucores_method=sysctl], [
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <unistd.h>
int
main(void)
@ -133,7 +133,7 @@ main(void)
}
]])], [tuklib_cv_cpucores_method=sysconf], [
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <sys/param.h>
#include <sys/pstat.h>

View File

@ -27,5 +27,5 @@
AC_DEFUN_ONCE([TUKLIB_MBSTR], [
AC_REQUIRE([TUKLIB_COMMON])
AC_FUNC_MBRTOWC
AC_CHECK_FUNCS([wcwidth])
AC_CHECK_FUNCS([wcwidth vasprintf])
])dnl

View File

@ -65,6 +65,11 @@ compile error
# Look for AIX-specific solution before sysconf(), because the test
# for sysconf() will pass on AIX but won't actually work
# (sysconf(_SC_PHYS_PAGES) compiles but always returns -1 on AIX).
#
# NOTE: There is no need to link the check program because it's not calling
# any functions and thus implicit function declarations aren't a problem.
# The unused reference to _system_configuration.physmem might get optimized
# away, and thus the linker might not see that symbol anyway.
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <sys/systemcfg.h>
@ -76,7 +81,7 @@ main(void)
}
]])], [tuklib_cv_physmem_method=aix], [
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <unistd.h>
int
main(void)
@ -88,7 +93,7 @@ main(void)
}
]])], [tuklib_cv_physmem_method=sysconf], [
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
@ -104,7 +109,7 @@ main(void)
}
]])], [tuklib_cv_physmem_method=sysctl], [
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <sys/sysinfo.h>
#include <machine/hal_sysinfo.h>
@ -118,7 +123,7 @@ main(void)
}
]])], [tuklib_cv_physmem_method=getsysinfo],[
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <sys/param.h>
#include <sys/pstat.h>
@ -133,7 +138,7 @@ main(void)
}
]])], [tuklib_cv_physmem_method=pstat_getstatic],[
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <invent.h>
int
main(void)
@ -150,7 +155,7 @@ main(void)
# different sysinfo() so we must check $host_os.
case $host_os in
linux*)
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <sys/sysinfo.h>
int
main(void)

View File

@ -1,7 +1,8 @@
dnl SPDX-License-Identifier: FSFULLR
# visibility.m4 serial 8
dnl Copyright (C) 2005, 2008, 2010-2023 Free Software Foundation, Inc.
# visibility.m4
# serial 9
dnl Copyright (C) 2005, 2008, 2010-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@ -33,18 +34,18 @@ AC_DEFUN([gl_VISIBILITY],
dnl user has put into $CC $CFLAGS $CPPFLAGS.
AC_CACHE_CHECK([whether the -Werror option is usable],
[gl_cv_cc_vis_werror],
[gl_save_CFLAGS="$CFLAGS"
[gl_saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]], [[]])],
[gl_cv_cc_vis_werror=yes],
[gl_cv_cc_vis_werror=no])
CFLAGS="$gl_save_CFLAGS"
CFLAGS="$gl_saved_CFLAGS"
])
dnl Now check whether visibility declarations are supported.
AC_CACHE_CHECK([for simple visibility declarations],
[gl_cv_cc_visibility],
[gl_save_CFLAGS="$CFLAGS"
[gl_saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fvisibility=hidden"
dnl We use the option -Werror and a function dummyfunc, because on some
dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning
@ -70,7 +71,7 @@ AC_DEFUN([gl_VISIBILITY],
[[]])],
[gl_cv_cc_visibility=yes],
[gl_cv_cc_visibility=no])
CFLAGS="$gl_save_CFLAGS"
CFLAGS="$gl_saved_CFLAGS"
])
if test $gl_cv_cc_visibility = yes; then
CFLAG_VISIBILITY="-fvisibility=hidden"

View File

@ -9,7 +9,9 @@ fr
hr
hu
it
ka
ko
nl
pl
pt
pt_BR

View File

@ -14,7 +14,7 @@ subdir = po
top_builddir = ..
# These options get passed to xgettext.
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --no-wrap --package-name='XZ Utils'
XGETTEXT_OPTIONS = --add-location=file --no-wrap --keyword=_ --keyword=N_ '--keyword=W_:1,"This is word wrapped at spaces. The Unicode character U+00A0 works as a non-breaking space. Tab (\t) is interpret as a zero-width space (the tab itself is not displayed); U+200B is NOT supported. Manual word wrapping with \n is supported but requires care."'
# This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
@ -63,7 +63,7 @@ USE_MSGCTXT = no
# Useful options are in particular:
# --previous to keep previous msgids of translated messages,
# --quiet to reduce the verbosity.
MSGMERGE_OPTIONS = --no-wrap
MSGMERGE_OPTIONS = --add-location=file --no-wrap
# These options get passed to msginit.
# If you want to disable line wrapping when writing PO files, add
@ -84,4 +84,8 @@ PO_DEPENDS_ON_POT = yes
# regenerate PO files on "make dist". Possible values are "yes" and
# "no". Set this to no if the POT file and PO files are maintained
# externally.
DIST_DEPENDS_ON_UPDATE_PO = yes
#
# NOTE: The the custom "mydist" target in ../Makefile.am updates xz.pot.
# An updated xz.pot will cause the .po files to be updated too but
# only when updating would change more than the POT-Creation-Date line.
DIST_DEPENDS_ON_UPDATE_PO = no

View File

@ -15,3 +15,4 @@ src/xz/suffix.c
src/xz/util.c
src/lzmainfo/lzmainfo.c
src/common/tuklib_exit.c
src/liblzma/common/string_conversion.c

1450
po/ca.po

File diff suppressed because it is too large Load Diff

1610
po/cs.po

File diff suppressed because it is too large Load Diff

1380
po/da.po

File diff suppressed because it is too large Load Diff

1213
po/de.po

File diff suppressed because it is too large Load Diff

1355
po/eo.po

File diff suppressed because it is too large Load Diff

1212
po/es.po

File diff suppressed because it is too large Load Diff

1222
po/fi.po

File diff suppressed because it is too large Load Diff

1358
po/fr.po

File diff suppressed because it is too large Load Diff

1316
po/hr.po

File diff suppressed because it is too large Load Diff

1355
po/hu.po

File diff suppressed because it is too large Load Diff

1424
po/it.po

File diff suppressed because it is too large Load Diff

1264
po/ka.po Normal file

File diff suppressed because it is too large Load Diff

1173
po/ko.po

File diff suppressed because it is too large Load Diff

1269
po/nl.po Normal file

File diff suppressed because it is too large Load Diff

1194
po/pl.po

File diff suppressed because it is too large Load Diff

1403
po/pt.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1219
po/ro.po

File diff suppressed because it is too large Load Diff

1403
po/sr.po

File diff suppressed because it is too large Load Diff

1213
po/sv.po

File diff suppressed because it is too large Load Diff

1196
po/tr.po

File diff suppressed because it is too large Load Diff

1201
po/uk.po

File diff suppressed because it is too large Load Diff

1339
po/vi.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

3
po4a/.gitignore vendored
View File

@ -1,3 +0,0 @@
/man
/xz-man.pot
/*.po.authors

1717
po4a/de.po

File diff suppressed because it is too large Load Diff

4512
po4a/fr.po

File diff suppressed because it is too large Load Diff

3901
po4a/it.po Normal file

File diff suppressed because it is too large Load Diff

1747
po4a/ko.po

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@
# to get a new .po file. After translating the .po file, run
# "update-po" again to generate the translated man pages.
[po4a_langs] de fr ko pt_BR ro uk
[po4a_langs] de fr it ko pt_BR ro sr uk
[po4a_paths] xz-man.pot $lang:$lang.po
[type: man] ../src/xz/xz.1 $lang:man/$lang/xz.1 add_$lang:?$lang.po.authors

File diff suppressed because it is too large Load Diff

1719
po4a/ro.po

File diff suppressed because it is too large Load Diff

3939
po4a/sr.po Normal file

File diff suppressed because it is too large Load Diff

1717
po4a/uk.po

File diff suppressed because it is too large Load Diff

View File

@ -54,13 +54,36 @@ done
# when nothing else has changed. This makes it slower but it's fine
# as long as this isn't run every time when "make" is run at the
# top level directory. (po4a isn't super-fast even without --force).
#
# Make diffing the .pot and .po files easier:
#
# --porefs file Put only the input filenames, not line numbers,
# into the .pot file. This way they won't get
# copied to the .po files either.
#
# --wrap-po newlines Wrap msgids only at \n in the .pot file.
#
# --msgmerge-opt "--no-wrap"
# Wrap msgids and msgstrs only at \n in the .po files.
#
# The values from --package-name and --package-version are used to create
# the Project-Id-Version field. It likely makes sense that its value isn't
# identical to the value in the program message translations. In practice
# it seems that the .po files from many (but not all) translators will use
# "xz-man" no matter what is specified here and in xz-man.pot. Thus it's
# best to use "xz-man" here to get the most consistent results.
set -x
po4a --force --verbose \
--package-name="XZ Utils" \
--porefs file --wrap-po newlines --msgmerge-opt "--no-wrap" \
--package-name="xz-man" \
--package-version="$PACKAGE_VERSION" \
--copyright-holder="The XZ Utils authors and contributors" \
po4a.conf
# Remove the *.po.authors files that were generated above.
# This way they won't get included in distribution tarballs.
rm -f *.po.authors
# Add the customized POT header which contains the SPDX license
# identifier and spells out the license name instead of saying
# "the same license as the XZ Utils package".

View File

@ -17,6 +17,7 @@ endif
EXTRA_DIST = \
common/common_w32res.rc \
common/my_landlock.h \
common/mythread.h \
common/sysdefs.h \
common/tuklib_common.h \
@ -27,12 +28,18 @@ EXTRA_DIST = \
common/tuklib_exit.h \
common/tuklib_gettext.h \
common/tuklib_integer.h \
common/tuklib_mbstr_fw.c \
common/tuklib_mbstr.h \
common/tuklib_mbstr_fw.c \
common/tuklib_mbstr_nonprint.c \
common/tuklib_mbstr_nonprint.h \
common/tuklib_mbstr_width.c \
common/tuklib_mbstr_wrap.c \
common/tuklib_mbstr_wrap.h \
common/tuklib_open_stdxxx.c \
common/tuklib_open_stdxxx.h \
common/tuklib_physmem.c \
common/tuklib_physmem.h \
common/tuklib_progname.c \
common/tuklib_progname.h
common/tuklib_progname.h \
common/w32_application.manifest \
common/w32_application.manifest.comments.txt

View File

@ -22,14 +22,15 @@
#define MY_PRODUCT PACKAGE_NAME " <" PACKAGE_URL ">"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
VS_VERSION_INFO VERSIONINFO
FILEVERSION MY_VERSION
PRODUCTVERSION MY_VERSION
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0
FILEOS VOS_NT_WINDOWS32
FILETYPE MY_TYPE
FILESUBTYPE 0x0L
FILEVERSION MY_VERSION
PRODUCTVERSION MY_VERSION
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0
FILEOS VOS_NT_WINDOWS32
FILETYPE MY_TYPE
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
@ -49,3 +50,8 @@ BEGIN
VALUE "Translation", 0x409, 1200
END
END
/* Omit the manifest on Cygwin and MSYS2 (both define __CYGWIN__). */
#if MY_TYPE == VFT_APP && !defined(__CYGWIN__)
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "w32_application.manifest"
#endif

141
src/common/my_landlock.h Normal file
View File

@ -0,0 +1,141 @@
// SPDX-License-Identifier: 0BSD
///////////////////////////////////////////////////////////////////////////////
//
/// \file my_landlock.h
/// \brief Linux Landlock sandbox helper functions
//
// Author: Lasse Collin
//
///////////////////////////////////////////////////////////////////////////////
#ifndef MY_LANDLOCK_H
#define MY_LANDLOCK_H
#include "sysdefs.h"
#include <linux/landlock.h>
#include <sys/syscall.h>
#include <sys/prctl.h>
/// \brief Initialize Landlock ruleset attributes to forbid everything
///
/// The supported Landlock ABI is checked at runtime and only the supported
/// actions are forbidden in the attributes. Thus, if the attributes are
/// used with my_landlock_create_ruleset(), it shouldn't fail.
///
/// \return On success, the Landlock ABI version is returned (a positive
/// integer). If Landlock isn't supported, -1 is returned.
static int
my_landlock_ruleset_attr_forbid_all(struct landlock_ruleset_attr *attr)
{
memzero(attr, sizeof(*attr));
const int abi_version = syscall(SYS_landlock_create_ruleset,
(void *)NULL, 0, LANDLOCK_CREATE_RULESET_VERSION);
if (abi_version <= 0)
return -1;
// ABI 1 except the few at the end
attr->handled_access_fs
= LANDLOCK_ACCESS_FS_EXECUTE
| LANDLOCK_ACCESS_FS_WRITE_FILE
| LANDLOCK_ACCESS_FS_READ_FILE
| LANDLOCK_ACCESS_FS_READ_DIR
| LANDLOCK_ACCESS_FS_REMOVE_DIR
| LANDLOCK_ACCESS_FS_REMOVE_FILE
| LANDLOCK_ACCESS_FS_MAKE_CHAR
| LANDLOCK_ACCESS_FS_MAKE_DIR
| LANDLOCK_ACCESS_FS_MAKE_REG
| LANDLOCK_ACCESS_FS_MAKE_SOCK
| LANDLOCK_ACCESS_FS_MAKE_FIFO
| LANDLOCK_ACCESS_FS_MAKE_BLOCK
| LANDLOCK_ACCESS_FS_MAKE_SYM
#ifdef LANDLOCK_ACCESS_FS_REFER
| LANDLOCK_ACCESS_FS_REFER // ABI 2
#endif
#ifdef LANDLOCK_ACCESS_FS_TRUNCATE
| LANDLOCK_ACCESS_FS_TRUNCATE // ABI 3
#endif
#ifdef LANDLOCK_ACCESS_FS_IOCTL_DEV
| LANDLOCK_ACCESS_FS_IOCTL_DEV // ABI 5
#endif
;
#ifdef LANDLOCK_ACCESS_NET_BIND_TCP
// ABI 4
attr->handled_access_net
= LANDLOCK_ACCESS_NET_BIND_TCP
| LANDLOCK_ACCESS_NET_CONNECT_TCP;
#endif
#ifdef LANDLOCK_SCOPE_SIGNAL
// ABI 6
attr->scoped
= LANDLOCK_SCOPE_ABSTRACT_UNIX_SOCKET
| LANDLOCK_SCOPE_SIGNAL;
#endif
// Disable flags that require a new ABI version.
switch (abi_version) {
case 1:
#ifdef LANDLOCK_ACCESS_FS_REFER
attr->handled_access_fs &= ~LANDLOCK_ACCESS_FS_REFER;
#endif
FALLTHROUGH;
case 2:
#ifdef LANDLOCK_ACCESS_FS_TRUNCATE
attr->handled_access_fs &= ~LANDLOCK_ACCESS_FS_TRUNCATE;
#endif
FALLTHROUGH;
case 3:
#ifdef LANDLOCK_ACCESS_NET_BIND_TCP
attr->handled_access_net = 0;
#endif
FALLTHROUGH;
case 4:
#ifdef LANDLOCK_ACCESS_FS_IOCTL_DEV
attr->handled_access_fs &= ~LANDLOCK_ACCESS_FS_IOCTL_DEV;
#endif
FALLTHROUGH;
case 5:
#ifdef LANDLOCK_SCOPE_SIGNAL
attr->scoped = 0;
#endif
FALLTHROUGH;
default:
// We only know about the features of the ABIs 1-6.
break;
}
return abi_version;
}
/// \brief Wrapper for the landlock_create_ruleset(2) syscall
///
/// Syscall wrappers provide argument type checking.
///
/// \note Remember to call `prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)` too!
static inline int
my_landlock_create_ruleset(const struct landlock_ruleset_attr *attr,
size_t size, uint32_t flags)
{
return syscall(SYS_landlock_create_ruleset, attr, size, flags);
}
/// \brief Wrapper for the landlock_restrict_self(2) syscall
static inline int
my_landlock_restrict_self(int ruleset_fd, uint32_t flags)
{
return syscall(SYS_landlock_restrict_self, ruleset_fd, flags);
}
#endif

View File

@ -200,7 +200,7 @@ mythread_join(mythread thread)
}
// Initiatlizes a mutex. Returns zero on success and non-zero on error.
// Initializes a mutex. Returns zero on success and non-zero on error.
static inline int
mythread_mutex_init(mythread_mutex *mutex)
{

View File

@ -23,17 +23,29 @@
# include <config.h>
#endif
// This #define ensures that C99 and POSIX compliant stdio functions are
// available with MinGW-w64 (both 32-bit and 64-bit). Modern MinGW-w64 adds
// this automatically, for example, when the compiler is in C99 (or later)
// mode when building against msvcrt.dll. It still doesn't hurt to be explicit
// that we always want this and #define this unconditionally.
// Choose if MinGW-w64's stdio replacement functions should be used.
// The default has varied slightly in the past so it's clearest to always
// set it explicitly.
//
// With Universal CRT (UCRT) this is less important because UCRT contains
// C99-compatible stdio functions. It's still nice to #define this as UCRT
// doesn't support the POSIX thousand separator flag in printf (like "%'u").
#ifdef __MINGW32__
// Modern MinGW-w64 enables the replacement functions even with UCRT
// when _GNU_SOURCE is defined. That's good because UCRT doesn't support
// the POSIX thousand separator flag in printf (like "%'u"). Otherwise
// XZ Utils works with the UCRT stdio functions.
//
// The replacement functions add over 20 KiB to each executable. For
// size-optimized builds (HAVE_SMALL), disable the replacements.
// Then thousand separators aren't shown in xz's messages but this is
// a minor downside compare to the slower speed of the HAVE_SMALL builds.
//
// The legacy MSVCRT is pre-C99 and it's best to always use the stdio
// replacements functions from MinGW-w64.
#if defined(__MINGW32__) && !defined(__USE_MINGW_ANSI_STDIO)
# define __USE_MINGW_ANSI_STDIO 1
# include <_mingw.h>
# if defined(_UCRT) && defined(HAVE_SMALL)
# undef __USE_MINGW_ANSI_STDIO
# define __USE_MINGW_ANSI_STDIO 0
# endif
#endif
// size_t and NULL
@ -156,17 +168,26 @@ typedef unsigned char _Bool;
# define __bool_true_false_are_defined 1
#endif
// We may need alignas from C11/C17/C23.
#if __STDC_VERSION__ >= 202311
// alignas is a keyword in C23. Do nothing.
#elif __STDC_VERSION__ >= 201112
// Oracle Developer Studio 12.6 lacks <stdalign.h>.
// For simplicity, avoid the header with all C11/C17 compilers.
# define alignas _Alignas
#elif defined(__GNUC__) || defined(__clang__)
# define alignas(n) __attribute__((__aligned__(n)))
#else
# define alignas(n)
#endif
#include <string.h>
// Visual Studio 2013 update 2 supports only __inline, not inline.
// MSVC v19.0 / VS 2015 and newer support both.
// MSVC v19.00 (VS 2015 version 14.0) and later should work.
//
// MSVC v19.27 (VS 2019 version 16.7) added support for restrict.
// Older ones support only __restrict.
#ifdef _MSC_VER
# if _MSC_VER < 1900 && !defined(inline)
# define inline __inline
# endif
# if _MSC_VER < 1927 && !defined(restrict)
# define restrict __restrict
# endif
@ -196,4 +217,13 @@ typedef unsigned char _Bool;
# define lzma_attr_alloc_size(x)
#endif
#if __STDC_VERSION__ >= 202311
# define FALLTHROUGH [[__fallthrough__]]
#elif (defined(__GNUC__) && __GNUC__ >= 7) \
|| (defined(__clang_major__) && __clang_major__ >= 10)
# define FALLTHROUGH __attribute__((__fallthrough__))
#else
# define FALLTHROUGH ((void)0)
#endif
#endif

View File

@ -56,6 +56,13 @@
# define TUKLIB_GNUC_REQ(major, minor) 0
#endif
#if defined(__GNUC__) || defined(__clang__)
# define tuklib_attr_format_printf(fmt_index, args_index) \
__attribute__((__format__(__printf__, fmt_index, args_index)))
#else
# define tuklib_attr_format_printf(fmt_index, args_index)
#endif
// tuklib_attr_noreturn attribute is used to mark functions as non-returning.
// We cannot use "noreturn" as the macro name because then C23 code that
// uses [[noreturn]] would break as it would expand to [[ [[noreturn]] ]].
@ -68,9 +75,7 @@
// __attribute__((nonnull(1)))
// extern void foo(const char *s);
//
// FIXME: Update __STDC_VERSION__ for the final C23 version. 202000 is used
// by GCC 13 and Clang 15 with -std=c2x.
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311
# define tuklib_attr_noreturn [[noreturn]]
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112
# define tuklib_attr_noreturn _Noreturn

View File

@ -40,4 +40,15 @@
#endif
#define N_(msgid) msgid
// Optional: Strings that are word wrapped using tuklib_mbstr_wrap may be
// marked with W_("foo) in the source code. xgettext can then add a comment
// to all such strings to inform translators. The following option needs to
// be added to XGETTEXT_OPTIONS in po/Makevars or in an equivalent place:
//
// '--keyword=W_:1,"This is word wrapped at spaces. The Unicode character U+00A0 works as a non-breaking space. Tab (\t) is interpret as a zero-width space (the tab itself is not displayed); U+200B is NOT supported. Manual word wrapping with \n is supported but requires care."'
//
// NOTE: The double-quotes in the --keyword argument above must be passed to
// xgettext as is, thus one needs the single-quotes in Makevars.
#define W_(msgid) _(msgid)
#endif

View File

@ -16,7 +16,7 @@
///
/// Endianness-converting integer operations (these can be macros!)
/// (XX = 16, 32, or 64; Y = b or l):
/// - Byte swapping: bswapXX(num)
/// - Byte swapping: byteswapXX(num)
/// - Byte order conversions to/from native (byteswaps if Y isn't
/// the native endianness): convXXYe(num)
/// - Unaligned reads: readXXYe(ptr)
@ -66,38 +66,47 @@
#if defined(HAVE___BUILTIN_BSWAPXX)
// GCC >= 4.8 and Clang
# define bswap16(n) __builtin_bswap16(n)
# define bswap32(n) __builtin_bswap32(n)
# define bswap64(n) __builtin_bswap64(n)
# define byteswap16(num) __builtin_bswap16(num)
# define byteswap32(num) __builtin_bswap32(num)
# define byteswap64(num) __builtin_bswap64(num)
#elif defined(HAVE_BYTESWAP_H)
// glibc, uClibc, dietlibc
# include <byteswap.h>
# ifdef HAVE_BSWAP_16
# define bswap16(num) bswap_16(num)
# define byteswap16(num) bswap_16(num)
# endif
# ifdef HAVE_BSWAP_32
# define bswap32(num) bswap_32(num)
# define byteswap32(num) bswap_32(num)
# endif
# ifdef HAVE_BSWAP_64
# define bswap64(num) bswap_64(num)
# define byteswap64(num) bswap_64(num)
# endif
#elif defined(HAVE_SYS_ENDIAN_H)
// *BSDs and Darwin
# include <sys/endian.h>
# ifdef __OpenBSD__
# define byteswap16(num) swap16(num)
# define byteswap32(num) swap32(num)
# define byteswap64(num) swap64(num)
# else
# define byteswap16(num) bswap16(num)
# define byteswap32(num) bswap32(num)
# define byteswap64(num) bswap64(num)
# endif
#elif defined(HAVE_SYS_BYTEORDER_H)
// Solaris
# include <sys/byteorder.h>
# ifdef BSWAP_16
# define bswap16(num) BSWAP_16(num)
# define byteswap16(num) BSWAP_16(num)
# endif
# ifdef BSWAP_32
# define bswap32(num) BSWAP_32(num)
# define byteswap32(num) BSWAP_32(num)
# endif
# ifdef BSWAP_64
# define bswap64(num) BSWAP_64(num)
# define byteswap64(num) BSWAP_64(num)
# endif
# ifdef BE_16
# define conv16be(num) BE_16(num)
@ -119,15 +128,15 @@
# endif
#endif
#ifndef bswap16
# define bswap16(n) (uint16_t)( \
#ifndef byteswap16
# define byteswap16(n) (uint16_t)( \
(((n) & 0x00FFU) << 8) \
| (((n) & 0xFF00U) >> 8) \
)
#endif
#ifndef bswap32
# define bswap32(n) (uint32_t)( \
#ifndef byteswap32
# define byteswap32(n) (uint32_t)( \
(((n) & UINT32_C(0x000000FF)) << 24) \
| (((n) & UINT32_C(0x0000FF00)) << 8) \
| (((n) & UINT32_C(0x00FF0000)) >> 8) \
@ -135,8 +144,8 @@
)
#endif
#ifndef bswap64
# define bswap64(n) (uint64_t)( \
#ifndef byteswap64
# define byteswap64(n) (uint64_t)( \
(((n) & UINT64_C(0x00000000000000FF)) << 56) \
| (((n) & UINT64_C(0x000000000000FF00)) << 40) \
| (((n) & UINT64_C(0x0000000000FF0000)) << 24) \
@ -160,23 +169,23 @@
# define conv64be(num) ((uint64_t)(num))
# endif
# ifndef conv16le
# define conv16le(num) bswap16(num)
# define conv16le(num) byteswap16(num)
# endif
# ifndef conv32le
# define conv32le(num) bswap32(num)
# define conv32le(num) byteswap32(num)
# endif
# ifndef conv64le
# define conv64le(num) bswap64(num)
# define conv64le(num) byteswap64(num)
# endif
#else
# ifndef conv16be
# define conv16be(num) bswap16(num)
# define conv16be(num) byteswap16(num)
# endif
# ifndef conv32be
# define conv32be(num) bswap32(num)
# define conv32be(num) byteswap32(num)
# endif
# ifndef conv64be
# define conv64be(num) bswap64(num)
# define conv64be(num) byteswap64(num)
# endif
# ifndef conv16le
# define conv16le(num) ((uint16_t)(num))
@ -234,7 +243,7 @@
// from the memcpy() method than from simple byte-by-byte shift-or code
// when reading a 32-bit integer:
//
// (1) It may be constructed on stack using using four 8-bit loads,
// (1) It may be constructed on stack using four 8-bit loads,
// four 8-bit stores to stack, and finally one 32-bit load from stack.
//
// (2) Especially with -Os, an actual memcpy() call may be emitted.
@ -624,7 +633,7 @@ write64le(uint8_t *buf, uint64_t num)
// aligned but some compilers have language extensions to do that. With
// such language extensions the memcpy() method gives excellent results.
//
// What to do on a strict-align system when no known language extentensions
// What to do on a strict-align system when no known language extensions
// are available? Falling back to byte-by-byte access would be safe but ruin
// optimizations that have been made specifically with aligned access in mind.
// As a compromise, aligned reads will fall back to non-compliant type punning

View File

@ -27,10 +27,7 @@ extern size_t tuklib_mbstr_width(const char *str, size_t *bytes);
///
/// This is somewhat similar to wcswidth() but works on multibyte strings.
///
/// \param str String whose width is to be calculated. If the
/// current locale uses a multibyte character set
/// that has shift states, the string must begin
/// and end in the initial shift state.
/// \param str String whose width is to be calculated.
/// \param bytes If this is not NULL, *bytes is set to the
/// value returned by strlen(str) (even if an
/// error occurs when calculating the width).
@ -38,8 +35,24 @@ extern size_t tuklib_mbstr_width(const char *str, size_t *bytes);
/// \return On success, the number of columns needed to display the
/// string e.g. in a terminal emulator is returned. On error,
/// (size_t)-1 is returned. Possible errors include invalid,
/// partial, or non-printable multibyte character in str, or
/// that str doesn't end in the initial shift state.
/// partial, or non-printable multibyte character in str.
#define tuklib_mbstr_width_mem TUKLIB_SYMBOL(tuklib_mbstr_width_mem)
extern size_t tuklib_mbstr_width_mem(const char *str, size_t len);
///<
/// \brief Get the number of columns needed for the multibyte buffer
///
/// This is like tuklib_mbstr_width() except that this takes the buffer
/// length in bytes as the second argument. This allows using the function
/// for buffers that aren't terminated with '\0'.
///
/// \param str String whose width is to be calculated.
/// \param len Number of bytes to read from str.
///
/// \return On success, the number of columns needed to display the
/// string e.g. in a terminal emulator is returned. On error,
/// (size_t)-1 is returned. Possible errors include invalid,
/// partial, or non-printable multibyte character in str.
#define tuklib_mbstr_fw TUKLIB_SYMBOL(tuklib_mbstr_fw)
extern int tuklib_mbstr_fw(const char *str, int columns_min);

Some files were not shown because too many files have changed in this diff Show More