]> git.ipfire.org Git - thirdparty/xz.git/log
thirdparty/xz.git
3 months agoxz, xzdec: Capsicum sandbox: Fix incorrect use of cap_rights_clear() v5.6
Guillaume Outters [Fri, 25 Apr 2025 00:55:08 +0000 (02:55 +0200)] 
xz, xzdec: Capsicum sandbox: Fix incorrect use of cap_rights_clear()

cap_rights_clear() with no additional arguments acts as a no-op, so
instead of removing all capability rights from STDIN_FILENO, the same
rights were allowed for STDIN_FILENO as were allowed for src_fd.

Fixes: a0eecc235d3b ("xz: Make Capsicum sandbox more strict with stdin and stdout.")
(The commit message says "stdout". It should have said "stderr".)

(cherry picked from commit 5cc2e479eb447a444f5ab005fc36b7f275c75eb5)

4 months agoliblzma: mt dec: Fix lack of parallelization in single-shot decoding
Lasse Collin [Thu, 3 Apr 2025 11:34:42 +0000 (14:34 +0300)] 
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.")
(cherry picked from commit 0c80045ab82c406858d9d5bcea9f48ebc3d0a81d)

4 months agoliblzma: mt dec: Don't modify thr->in_size in the worker thread
Lasse Collin [Thu, 3 Apr 2025 11:34:42 +0000 (14:34 +0300)] 
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>
(cherry picked from commit 8188048854e8d11071b8a50d093c74f4c030acc9)

4 months agoliblzma: mt dec: Don't free the input buffer too early (CVE-2025-31115)
Lasse Collin [Thu, 3 Apr 2025 11:34:42 +0000 (14:34 +0300)] 
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>
(cherry picked from commit d5a2ffe41bb77b918a8c96084885d4dbe4bf6480)

4 months agoliblzma: mt dec: Simplify by removing the THR_STOP state
Lasse Collin [Thu, 3 Apr 2025 11:34:42 +0000 (14:34 +0300)] 
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>
(cherry picked from commit c0c835964dfaeb2513a3c0bdb642105152fe9f34)

4 months agoliblzma: mt dec: Fix a comment
Lasse Collin [Thu, 3 Apr 2025 11:34:42 +0000 (14:34 +0300)] 
liblzma: mt dec: Fix a comment

Reviewed-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Thanks-to: Sam James <sam@gentoo.org>
(cherry picked from commit 831b55b971cf579ee16a854f177c36b20d3c6999)

4 months agoliblzma: Add assertions to lzma_bufcpy()
Lasse Collin [Thu, 3 Apr 2025 11:34:30 +0000 (14:34 +0300)] 
liblzma: Add assertions to lzma_bufcpy()

(cherry picked from commit b9d168eee4fb6393b4fe207c0aeb5faee316ca1a)

6 months agoBump version and soname for 5.6.4 v5.6.4
Lasse Collin [Thu, 23 Jan 2025 09:45:07 +0000 (11:45 +0200)] 
Bump version and soname for 5.6.4

6 months agoAdd NEWS for 5.6.4
Lasse Collin [Thu, 23 Jan 2025 09:40:46 +0000 (11:40 +0200)] 
Add NEWS for 5.6.4

6 months agoNEWS: The security fix in 5.6.3 is known as CVE-2024-47611
Lasse Collin [Thu, 23 Jan 2025 09:40:46 +0000 (11:40 +0200)] 
NEWS: The security fix in 5.6.3 is known as CVE-2024-47611

(cherry picked from commit b3af3297e4d6cf0eafb48155aa97bb06c82a9228)

6 months agoTranslations: Run po4a/update-po
Lasse Collin [Thu, 23 Jan 2025 09:24:33 +0000 (11:24 +0200)] 
Translations: Run po4a/update-po

6 months agowindows/build.bash: Fix error message
Lasse Collin [Wed, 22 Jan 2025 14:55:09 +0000 (16:55 +0200)] 
windows/build.bash: Fix error message

Fixes: 1ee716f74085223c8fbcae1d5a384e6bf53c0f6a
(cherry picked from commit a04b9dd0c7c74fabd8c393d2dc68a221276d6e29)

6 months agoWindows: Disable MinGW-w64's stdio functions in size-optimized builds
Lasse Collin [Wed, 22 Jan 2025 13:03:55 +0000 (15:03 +0200)] 
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).

(cherry picked from commit 4eae859ae8ad7072eaa74aeaee79a2c3c12c55cb)

6 months agoUpdate THANKS
Lasse Collin [Sun, 19 Jan 2025 18:11:54 +0000 (20:11 +0200)] 
Update THANKS

(cherry picked from commit da359c360e986b21cd8d7b888c6a80f56b9d49c7)

6 months agoUpdate THANKS
Lasse Collin [Sun, 19 Jan 2025 17:40:32 +0000 (19:40 +0200)] 
Update THANKS

(cherry picked from commit f032373561cefaf07f92ffe3fbc471ec6770456e)

6 months agoBuild: Use --sort=name in TAR_OPTIONS
Lasse Collin [Wed, 8 Jan 2025 17:26:29 +0000 (19:26 +0200)] 
Build: Use --sort=name in TAR_OPTIONS

Use also LC_COLLATE=C to make the sorting locale-independent.
Sorting makes the file order reproducible.

(cherry picked from commit 950da11ce09c90412dcbca29689575037640667a)

6 months agoUpdate THANKS
Lasse Collin [Sun, 12 Jan 2025 11:06:17 +0000 (13:06 +0200)] 
Update THANKS

(cherry picked from commit 96336b0110d47756a9fd2a103fbf0a99e905fbed)

6 months agoliblzma: Fix the encoder breakage on big endian ARM64
Lasse Collin [Sun, 12 Jan 2025 10:59:20 +0000 (12:59 +0200)] 
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>
(cherry picked from commit 150356207c8d6a3e0af465b676430d19d62f884c)

6 months agoWindows: Update manifest comments about long UTF-8 filenames
Lasse Collin [Sun, 12 Jan 2025 09:04:27 +0000 (11:04 +0200)] 
Windows: Update manifest comments about long UTF-8 filenames

(cherry picked from commit b01b0958025a2da284b53a583f313f8140636cb5)

6 months agoWindows: Update build.bash and its README-Windows.txt to UCRT
Lasse Collin [Sun, 12 Jan 2025 08:47:58 +0000 (10:47 +0200)] 
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.

(cherry picked from commit 0dfc67d37ebb038be8a9b17b536d1b561d52e81a)

6 months agoTranslations: Update Serbian translation
Lasse Collin [Fri, 10 Jan 2025 11:11:40 +0000 (13:11 +0200)] 
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.

7 months agoliblzma: Always validate the first digit of a preset string
Lasse Collin [Sun, 5 Jan 2025 10:10:05 +0000 (12:10 +0200)] 
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
(cherry picked from commit 75107217670a97b7b772833669d88c3c2f188e37)

7 months agoxz: Fix getopt_long argument type in --filters*
Lasse Collin [Sun, 5 Jan 2025 09:40:34 +0000 (11:40 +0200)] 
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
(cherry picked from commit 52ff32433734d03befd85a5bf00fba77d6501455)

7 months agoxzdec: Don't leave Landlock file descriptor open for no reason
Lasse Collin [Sat, 4 Jan 2025 18:04:56 +0000 (20:04 +0200)] 
xzdec: Don't leave Landlock file descriptor open for no reason

This fix is similar to 48ff3f06521ca326996ab9a04d1b342098960427.

Fixes: d74fb5f060b76db709b50f5fd37490394e52f975
(cherry picked from commit 2655c81b5e92278b0fd51f6537c1116f8349b02a)

7 months agoliblzma: Silence warnings from "clang -Wimplicit-fallthrough"
Lasse Collin [Wed, 1 Jan 2025 16:46:50 +0000 (18:46 +0200)] 
liblzma: Silence warnings from "clang -Wimplicit-fallthrough"

(cherry picked from commit 672da29bb3a209a727ae46c0df948d7eea69f2e2)

7 months agoxzdec: Fix language in a comment
Lasse Collin [Wed, 1 Jan 2025 13:06:15 +0000 (15:06 +0200)] 
xzdec: Fix language in a comment

(cherry picked from commit e34dbd6a0ae7a560a5508d51fc0bd142c5a320dc)

7 months agoWindows: Make NLS require UCRT and gettext-runtime >= 0.23.1
Lasse Collin [Thu, 2 Jan 2025 11:35:48 +0000 (13:35 +0200)] 
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.

(cherry picked from commit 16821252c504071f5c2012e415e59cbf5fb79820)

7 months agoBuild: Use git log --pretty=medium when creating ChangeLog
Lasse Collin [Mon, 30 Dec 2024 09:21:57 +0000 (11:21 +0200)] 
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.

(cherry picked from commit ea21c76aa2406ba06ac154fe57741734c04f260f)

7 months agoWindows: Update MinGW-w64 + CMake instructions to recommend UCRT
Lasse Collin [Mon, 30 Dec 2024 08:51:33 +0000 (10:51 +0200)] 
Windows: Update MinGW-w64 + CMake instructions to recommend UCRT

(cherry picked from commit 08050c0788ce5bac0ffd572e9784a2749c4a13df)

7 months agoxz man page: Describe the source file deletion in -z and -d options
Lasse Collin [Mon, 30 Dec 2024 08:51:26 +0000 (10:51 +0200)] 
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
(cherry picked from commit 653732bd6f06d8f465bf353bf6e1c16f1405b906)

7 months agoxz: Fix comments
Lasse Collin [Thu, 26 Dec 2024 19:27:18 +0000 (21:27 +0200)] 
xz: Fix comments

(cherry picked from commit 260d5d36203955a7148ae1ab05d0931c942028d5)

7 months agoCMake: Disable unity builds project-wide
Dexter Castor Döpping [Sun, 22 Dec 2024 12:44:03 +0000 (13:44 +0100)] 
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
(cherry picked from commit bf6da9a573a780cd1a7fb1728ef55d09e58dad11)

7 months agoWindows: Workaround a UTF-8 issue in Gettext's libintl_setlocale()
Lasse Collin [Fri, 20 Dec 2024 06:51:18 +0000 (08:51 +0200)] 
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
(cherry picked from commit b40e3321a7fb9dfdf8ffb30e7e0788c2f0abc941)

7 months agoRevert "Windows: Use UTF-8 locale when active code page is UTF-8"
Lasse Collin [Fri, 20 Dec 2024 04:50:36 +0000 (06:50 +0200)] 
Revert "Windows: Use UTF-8 locale when active code page is UTF-8"

This reverts commit 0d0b574cc45045d6150d397776340c068df59e2a.

(cherry picked from commit bc4165da92b56668ddd1b7014b3488a0fad1733a)

7 months agoxzdec: Use setlocale() instead of tuklib_gettext_setlocale()
Lasse Collin [Thu, 19 Dec 2024 16:31:09 +0000 (18:31 +0200)] 
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
(cherry picked from commit d6796f9ce5359faaaed82926c1735aee3694430f)

7 months agoWindows: Revert the setlocale(LC_ALL, ".UTF8") documentation
Lasse Collin [Thu, 19 Dec 2024 17:36:15 +0000 (19:36 +0200)] 
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
(cherry picked from commit e607329a615759f1519016595dd38df7c89208f2)

7 months agotuklib_mbstr_width: Change the behavior when wcwidth() is not available
Lasse Collin [Mon, 16 Dec 2024 18:06:07 +0000 (20:06 +0200)] 
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
(cherry picked from commit b797c44c42ea54fe1c52722a2fca0c9618575598)

7 months agoxzdec: Use setlocale() via tuklib_gettext_setlocale()
Lasse Collin [Wed, 18 Dec 2024 12:23:13 +0000 (14:23 +0200)] 
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
(cherry picked from commit 78868b6ed63fa4c89f73e3dfed27abfb8b0d46db)

7 months agoWindows: Use UTF-8 locale when active code page is UTF-8
Lasse Collin [Tue, 17 Dec 2024 12:59:37 +0000 (14:59 +0200)] 
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
(cherry picked from commit 0d0b574cc45045d6150d397776340c068df59e2a)

7 months agoWindows: Document the need for setlocale(LC_ALL, ".UTF8")
Lasse Collin [Tue, 17 Dec 2024 13:01:29 +0000 (15:01 +0200)] 
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
(cherry picked from commit 20dfca8171dad4c64785ac61d5b68972c444877b)

7 months agoxzdec: Call tuklib_progname_init() early enough
Lasse Collin [Wed, 18 Dec 2024 12:12:22 +0000 (14:12 +0200)] 
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
(cherry picked from commit 4e936f234056e5831013ed922145b666b04bb1e3)

7 months agoCMake: Bump maximum policy version to 3.31
Lasse Collin [Sun, 15 Dec 2024 17:08:32 +0000 (19:08 +0200)] 
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.

(cherry picked from commit 61feaf681bd793dc5c919732b44bca7dcf2ed1b8)

7 months agoUpdate THANKS
Lasse Collin [Sun, 15 Dec 2024 16:35:27 +0000 (18:35 +0200)] 
Update THANKS

(cherry picked from commit b0bb84dd7bbdcc85243386a0051c7b2cb5fc6a18)

7 months agoliblzma: Fix incorrect macro name in a comment
Dexter Castor Döpping [Sun, 8 Dec 2024 17:24:29 +0000 (18:24 +0100)] 
liblzma: Fix incorrect macro name in a comment

Fixes: 33b8a24b6646a9dbfd8358405aec466b13078559
Closes: https://github.com/tukaani-project/xz/pull/155
(cherry picked from commit bee0c044d30a6ad3b3d94901c27e7519f6f46e27)

7 months agoTranslations: Update the Chinese (traditional) translation
Lasse Collin [Sat, 30 Nov 2024 08:27:14 +0000 (10:27 +0200)] 
Translations: Update the Chinese (traditional) translation

(cherry picked from commit b36177273602ebc83e9cc58517f63a7b6af33f70)

7 months agoUpdate THANKS
Lasse Collin [Mon, 25 Nov 2024 14:26:54 +0000 (16:26 +0200)] 
Update THANKS

(cherry picked from commit 9f69e71e78621fd056f5eaaad7cdcd9279310fb5)

7 months agoxz: Landlock: Fix a file descriptor leak
Mark Wielaard [Mon, 25 Nov 2024 10:28:44 +0000 (12:28 +0200)] 
xz: Landlock: Fix a file descriptor leak

(cherry picked from commit 48ff3f06521ca326996ab9a04d1b342098960427)

7 months agoCI: update FreeBSD, NetBSD, OpenBSD, Solaris actions
Sam James [Wed, 2 Oct 2024 02:04:03 +0000 (03:04 +0100)] 
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.

(cherry picked from commit dbca3d078ec581600600abebbb18769d3d713914)

10 months agocmake/tuklib_large_file_support.cmake: Add a missing include
Lasse Collin [Tue, 1 Oct 2024 11:49:41 +0000 (14:49 +0300)] 
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
(cherry picked from commit be4bf94446b6286a5dffdde85fc1d21448f4edff)

10 months agoBump version and soname for 5.6.3 v5.6.3
Lasse Collin [Tue, 1 Oct 2024 09:21:22 +0000 (12:21 +0300)] 
Bump version and soname for 5.6.3

10 months agoAdd NEWS for 5.6.3
Lasse Collin [Tue, 1 Oct 2024 09:17:39 +0000 (12:17 +0300)] 
Add NEWS for 5.6.3

10 months agoUpdate THANKS
Lasse Collin [Tue, 1 Oct 2024 09:10:23 +0000 (12:10 +0300)] 
Update THANKS

(cherry picked from commit 1ebbe915d4e0d877154261b5f8103719a6722975)

10 months agoTests/Windows: Add the application manifest to the test programs
Lasse Collin [Tue, 1 Oct 2024 09:10:23 +0000 (12:10 +0300)] 
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.

(cherry picked from commit 74702ee00ecfd080d8ab11118cd25dbe6c437ec0)

10 months agoWindows: Embed an application manifest in the EXE files
Lasse Collin [Tue, 1 Oct 2024 09:10:23 +0000 (12:10 +0300)] 
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.

(cherry picked from commit 46ee0061629fb075d61d83839e14dd193337af59)

10 months agoWindows: Set DLL name accurately in StringFileInfo on Cygwin and MSYS2
Lasse Collin [Sun, 29 Sep 2024 11:46:52 +0000 (14:46 +0300)] 
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.

(cherry picked from commit dad153091552b52a41b95ec4981c6951f1cae487)

10 months agocommon_w32res.rc: White space edits
Lasse Collin [Wed, 25 Sep 2024 12:47:55 +0000 (15:47 +0300)] 
common_w32res.rc: White space edits

LANGUAGE and VS_VERSION_INFO begin new statements so put an empty line
between them.

(cherry picked from commit 8940ecb96fe9f0f2a9cfb8b66fe9ed31ffbea904)

10 months agoCMake: Add the resource files to the Cygwin and MSYS2 builds
Lasse Collin [Sat, 28 Sep 2024 17:09:50 +0000 (20:09 +0300)] 
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.)

(cherry picked from commit c3b9dad07d3fd9319f88386b7095019bcea45ce1)

10 months agoCMake: Fix Windows resource file dependencies
Lasse Collin [Sat, 28 Sep 2024 12:19:14 +0000 (15:19 +0300)] 
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.

(cherry picked from commit da4f275bd1c18b897e5c2dd0043546de3accce0a)

10 months agoCMake: Checking for CYGWIN covers MSYS2 too
Lasse Collin [Sat, 28 Sep 2024 22:20:03 +0000 (01:20 +0300)] 
CMake: Checking for CYGWIN covers MSYS2 too

On MSYS2, both CYGWIN and MSYS are set.

(cherry picked from commit 1c673c0aac7f7dee8dda2c1140351c8417a71e47)

10 months agoTranslations: Add the SPDX license identifier to pt_BR.po
Lasse Collin [Sat, 28 Sep 2024 06:37:30 +0000 (09:37 +0300)] 
Translations: Add the SPDX license identifier to pt_BR.po

(cherry picked from commit 6aaa0173b839e28429d43a8b62d257ad2f3b4521)

10 months agoWindows/CMake: Use the correct resource file for lzmadec.exe
Lasse Collin [Wed, 25 Sep 2024 13:41:37 +0000 (16:41 +0300)] 
Windows/CMake: Use the correct resource file for lzmadec.exe

CMakeLists.txt was using xzdec_w32res.rc for both xzdec and lzmadec.

Fixes: 998d0b29536094a89cf385a3b894e157db1ccefe
(cherry picked from commit dc7b9f24b737e4e55bcbbdde6754883f991c2cfb)

10 months agoTranslations: Update the Brazilian Portuguese translation
Lasse Collin [Wed, 25 Sep 2024 18:29:59 +0000 (21:29 +0300)] 
Translations: Update the Brazilian Portuguese translation

(cherry picked from commit b834ae5f80911a3819d6cdb484f61b257174c544)

10 months agoUpdate THANKS
Lasse Collin [Mon, 16 Sep 2024 22:21:15 +0000 (01:21 +0300)] 
Update THANKS

(cherry picked from commit eceb023d4c129fd63ee881a2d8696eaf52ad1532)

10 months agolzmainfo: Avoid integer overflow
Tobias Stoeckmann [Mon, 16 Sep 2024 21:19:46 +0000 (23:19 +0200)] 
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
(cherry picked from commit 76cfd0a9bb33ae8e534b1f73f6359dc825589f2f)

10 months agoxzdec: Remove unused short option -M
Tobias Stoeckmann [Mon, 16 Sep 2024 20:04:40 +0000 (22:04 +0200)] 
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 ]

(cherry picked from commit 78355aebb7fb654302e5e33692ba109909dacaff)

10 months agoUpdate THANKS
Lasse Collin [Tue, 10 Sep 2024 10:54:47 +0000 (13:54 +0300)] 
Update THANKS

(cherry picked from commit e5758db7bd75587a2499e0771907521a4aa86908)

10 months agoBuild: Fix a typo in autogen.sh
Firas Khalil Khana [Tue, 10 Sep 2024 09:30:32 +0000 (12:30 +0300)] 
Build: Fix a typo in autogen.sh

Fixes: e9be74f5b129fe8a5388d588e68b1b7f5168a310
Closes: https://github.com/tukaani-project/xz/pull/141
(cherry picked from commit 80ffa38f56657257ed4d90d76f6bd2f2bcb8163c)

10 months agoTranslations: Update Chinese (simplified) translation
Lasse Collin [Mon, 2 Sep 2024 17:08:40 +0000 (20:08 +0300)] 
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.

(cherry picked from commit 68c54e45d042add64a4cb44bfc87ca74d29b87e2)

10 months agoTranslations: Update the Catalan translation
Lasse Collin [Mon, 2 Sep 2024 16:40:50 +0000 (19:40 +0300)] 
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.

(cherry picked from commit 2230692aa1bcebb586100183831e3daf1714d60a)

10 months agoUpdate THANKS
Lasse Collin [Thu, 22 Aug 2024 08:01:07 +0000 (11:01 +0300)] 
Update THANKS

(cherry picked from commit 5e375987509fab484b7bef0b90be92f241c58c91)

10 months agoliblzma: Fix x86-64 movzw compatibility in range_decoder.h
Yifeng Li [Thu, 22 Aug 2024 02:18:49 +0000 (02:18 +0000)] 
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
(cherry picked from commit 6cd7c8607843c337edfe2c472aa316602a393754)

10 months agoBuild: Comment that elf_aux_info(3) will be available on OpenBSD >= 7.6
Lasse Collin [Fri, 19 Jul 2024 17:02:43 +0000 (20:02 +0300)] 
Build: Comment that elf_aux_info(3) will be available on OpenBSD >= 7.6

(cherry picked from commit bf901dee5d4c46609645e50311c0cb2dfdcf9738)

10 months agoliblzma: Tweak a comment
Lasse Collin [Sat, 13 Jul 2024 19:10:37 +0000 (22:10 +0300)] 
liblzma: Tweak a comment

(cherry picked from commit 7c292dd0bf23cefcdf4b1509f3666322e08a7ede)

10 months agoCMake: Bump maximum policy version to 3.30
Lasse Collin [Thu, 11 Jul 2024 19:17:56 +0000 (22:17 +0300)] 
CMake: Bump maximum policy version to 3.30

10 months agoUpdate THANKS
Lasse Collin [Tue, 9 Jul 2024 11:27:51 +0000 (14:27 +0300)] 
Update THANKS

(cherry picked from commit 028185dd4889e3d6235ff13560160ebca6985021)

10 months agoxz: Remove the TODO comment about --recursive
Lasse Collin [Sat, 6 Jul 2024 11:04:48 +0000 (14:04 +0300)] 
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.

(cherry picked from commit baecfa142644eb5f5c6dd6f8e2f531c362fa3747)

10 months agoCMake: Link xz against Threads::Threads if using pthreads
Lasse Collin [Wed, 3 Jul 2024 17:45:48 +0000 (20:45 +0300)] 
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
(cherry picked from commit b3e53122f42796aaebd767bab920cf7bedf69966)

10 months agoUpdate THANKS
Lasse Collin [Tue, 2 Jul 2024 19:49:33 +0000 (22:49 +0300)] 
Update THANKS

(cherry picked from commit 5742ec1fc7f2cf1c82cfe3477bb90594a4658374)

10 months agoCI: Speed up Valgrind job by using --trace-children-skip-by-arg=...
Sam James [Fri, 28 Jun 2024 11:18:35 +0000 (14:18 +0300)] 
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.

(cherry picked from commit 7e99856f66c07852c4e0de7aa01951e9147d86b0)

10 months agoBuild: Prepend, not append, PTHREAD_CFLAGS to LIBS
Lasse Collin [Tue, 25 Jun 2024 13:00:22 +0000 (16:00 +0300)] 
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.

(cherry picked from commit 2402e8a1ae92676fa0d4cb1b761d7f62f005c098)

10 months agoBuild: Use AC_LINK_IFELSE to handle implicit function declarations
Lasse Collin [Tue, 25 Jun 2024 11:24:29 +0000 (14:24 +0300)] 
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.

(cherry picked from commit 7bb46f2b7b3989c1b589a247a251470f65e91cda)

10 months agoBuild: Use AC_LINK_IFELSE instead of -Werror
Lasse Collin [Mon, 24 Jun 2024 20:35:59 +0000 (23:35 +0300)] 
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.

(cherry picked from commit 35eb57355ad1c415a838d26192d5af84abb7cf39)

10 months agoBuild: Sync the compile check changes from CMakeLists.txt
Lasse Collin [Mon, 24 Jun 2024 20:34:34 +0000 (23:34 +0300)] 
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.

(cherry picked from commit 5a728813c378cc3c4c9c95793762452418d08f1b)

10 months agoCMake: Use configure_file() to copy a file
Lasse Collin [Tue, 25 Jun 2024 13:11:13 +0000 (16:11 +0300)] 
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.

(cherry picked from commit de215a0517645d16343f3a5336d3df884a4f665f)

10 months agoCMake: Always add pthread flags into CMAKE_REQUIRED_LIBRARIES
Lasse Collin [Tue, 25 Jun 2024 12:51:48 +0000 (15:51 +0300)] 
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.

(cherry picked from commit e620f35097c0ad20cd76d8258750aa706758ced9)

10 months agoCMake: Fix three checks if building with -flto
Lasse Collin [Mon, 24 Jun 2024 19:41:10 +0000 (22:41 +0300)] 
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>
(cherry picked from commit 114cba69dbb96003e676c8c87a2e9943b12d065f)

10 months agoCMake: Improve the comment about LIBS
Lasse Collin [Mon, 24 Jun 2024 18:06:18 +0000 (21:06 +0300)] 
CMake: Improve the comment about LIBS

(cherry picked from commit d3f20382fc1bd865eb70a65455d5022ed05caac8)

10 months agoCI: Workaround buggy config.guess on Ubuntu 22.04LTS and 24.04LTS
Lasse Collin [Mon, 24 Jun 2024 14:39:54 +0000 (17:39 +0300)] 
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

(cherry picked from commit 1bf83cded2955282fe1a868f08c83d4e5d6dca4a)

10 months agoCI: Use CC="gcc -m32" to get i386 compiler on x86-64
Lasse Collin [Mon, 24 Jun 2024 12:24:52 +0000 (15:24 +0300)] 
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.

(cherry picked from commit dbcdabf68fee9ed694b68c3a82e6adbeff20b679)

10 months agoCI: Let CMake use the CC environment variable
Lasse Collin [Mon, 24 Jun 2024 11:54:17 +0000 (14:54 +0300)] 
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.

(cherry picked from commit 0c1e6d900bac127464fb30a854776e1810ab5f16)

10 months agoCMake: Keep existing options in LIBS when adding -lrt
Lasse Collin [Thu, 20 Jun 2024 15:12:21 +0000 (18:12 +0300)] 
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.

(cherry picked from commit 75ce4797d49621710e6da95d8cb91541028c6d68)

10 months agoCMake: Fix indentation
Lasse Collin [Sat, 15 Jun 2024 15:07:04 +0000 (18:07 +0300)] 
CMake: Fix indentation

(cherry picked from commit c715dec8e800b65145918cfb0ee9bbc90faa8aad)

10 months agoCMake: Link Threads::Threads as PRIVATE to liblzma
Lasse Collin [Sat, 15 Jun 2024 20:34:29 +0000 (23:34 +0300)] 
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.

(cherry picked from commit ac05f1b0d7cda1e7ae79775a8dfecc54601d7f1c)

10 months agoCMake: Add empty lines
Lasse Collin [Sun, 16 Jun 2024 16:39:32 +0000 (19:39 +0300)] 
CMake: Add empty lines

(cherry picked from commit 82986d8c691a294c78b48d8391303e5c428b5437)

10 months agoCMake: Use CMAKE_THREAD_LIBS_INIT in liblzma.pc only with pthreads
Lasse Collin [Sun, 16 Jun 2024 16:37:36 +0000 (19:37 +0300)] 
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.

(cherry picked from commit 2aecffe0f0e14f3ef635e8cd7b405420f2385de2)

10 months agoUpdate THANKS
Lasse Collin [Mon, 17 Jun 2024 15:20:14 +0000 (18:20 +0300)] 
Update THANKS

(cherry picked from commit 664918bd3635ea8e773f06022286ecb0c485166c)

10 months agoCMake: Use native newlines in liblzma.pc
Lasse Collin [Sun, 16 Jun 2024 16:25:07 +0000 (19:25 +0300)] 
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.

(cherry picked from commit 5ca96a93488d0f5a530c78b274cac317453807ff)

10 months agoCMake: Use relative paths in liblzma.pc if possible
Lasse Collin [Sun, 16 Jun 2024 16:18:56 +0000 (19:18 +0300)] 
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.

(cherry picked from commit ebd155c3a1b87411edae06d3bdaa9659ec057522)

10 months agoliblzma: CRC CLMUL: Omit is_arch_extension_supported() when not needed
Lasse Collin [Sun, 16 Jun 2024 10:39:37 +0000 (13:39 +0300)] 
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.

(cherry picked from commit 30a2d5d51006301a3ddab5ef1f5ff0a9d74dce6f)

10 months agoCMake: Prefer C11 with a fallback to C99
Lasse Collin [Wed, 12 Jun 2024 11:26:44 +0000 (14:26 +0300)] 
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.

(cherry picked from commit 2178acf8a4d40a93e970cfcf9b807d5ef6c8da92)