]> git.ipfire.org Git - thirdparty/xz.git/log
thirdparty/xz.git
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)

11 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)

11 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)

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

(cherry picked from commit 5e375987509fab484b7bef0b90be92f241c58c91)

11 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)

11 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)

11 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)

11 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

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

(cherry picked from commit 028185dd4889e3d6235ff13560160ebca6985021)

11 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)

11 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)

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

(cherry picked from commit 5742ec1fc7f2cf1c82cfe3477bb90594a4658374)

11 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)

11 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)

11 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)

11 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)

11 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)

11 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)

11 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)

11 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)

11 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)

11 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)

11 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)

11 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)

11 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)

11 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)

11 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)

11 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)

11 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)

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

(cherry picked from commit 664918bd3635ea8e773f06022286ecb0c485166c)

11 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)

11 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)

11 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)

11 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)

11 months agoUpdate THANKS
Lasse Collin [Wed, 12 Jun 2024 11:20:21 +0000 (14:20 +0300)] 
Update THANKS

(cherry picked from commit c97e9c12fef4d1093ee2a75236742481361f50f5)

11 months agoTests: Improve the CRC32 test
Lasse Collin [Tue, 11 Jun 2024 08:15:49 +0000 (11:15 +0300)] 
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.

(cherry picked from commit 89e9f12e03324b8a186e807b268f34f92d1b2f41)

11 months agoxz: Fix white space
Lasse Collin [Tue, 11 Jun 2024 19:42:26 +0000 (22:42 +0300)] 
xz: Fix white space

(cherry picked from commit c7164b1927e3fe7cdba70ee4687e1a590a81043b)

11 months agoliblzma: Fix a typo in a comment
Lasse Collin [Tue, 11 Jun 2024 18:59:09 +0000 (21:59 +0300)] 
liblzma: Fix a typo in a comment

Thanks to Sam James for spotting it.

Fixes: f644473a211394447824ea00518d0a214ff3f7f2
(cherry picked from commit 0a32d2072c598de281058b26dc08920fbf0cd2a1)

11 months agoliblzma: Fix a comment indentation
Lasse Collin [Fri, 10 May 2024 12:52:26 +0000 (15:52 +0300)] 
liblzma: Fix a comment indentation

(cherry picked from commit afd9b4d282a10186808c3331dad4caf79c02d55f)

11 months agoliblzma: Fix white space
Lasse Collin [Thu, 9 May 2024 19:09:12 +0000 (22:09 +0300)] 
liblzma: Fix white space

(cherry picked from commit 50e6bff274568c568930e15094da8217e7d47d28)

11 months agoFix typos
RainRat [Wed, 5 Jun 2024 22:21:49 +0000 (15:21 -0700)] 
Fix typos

Closes: https://github.com/tukaani-project/xz/pull/124
(cherry picked from commit 9e73918a4f14be754a23f74dda45ca431939a4a0)

11 months agotuklib_integer: Fix building on OpenBSD/sparc64 that uses GCC 4.2
Lasse Collin [Fri, 7 Jun 2024 12:47:20 +0000 (15:47 +0300)] 
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
(cherry picked from commit 04b23addf3733873667675df2439725f076c2f36)

11 months agoUpdate THANKS
Lasse Collin [Wed, 5 Jun 2024 10:55:43 +0000 (13:55 +0300)] 
Update THANKS

(cherry picked from commit f5c2ae58ec68c665e62c790b842657afcb31474c)

11 months agoCMake: Fix wrong version variable
Lasse Collin [Wed, 5 Jun 2024 10:30:28 +0000 (13:30 +0300)] 
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
(cherry picked from commit 1d3c61575fda0be6b2d50c9e32a343349d5cd5c0)

11 months agoCMake: Fix liblzma filename in Windows environments
Lasse Collin [Tue, 4 Jun 2024 20:59:29 +0000 (23:59 +0300)] 
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: https://github.com/microsoft/vcpkg/blob/0707a17ecf1466d64cf1a3c1ee18c8ff02aadb2d/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.

(cherry picked from commit e0d6d05ce0d464e966c0669bbf869202a43cc2f7)

11 months agoFix version.sh compatiblity with Solaris
Lasse Collin [Mon, 3 Jun 2024 13:55:03 +0000 (16:55 +0300)] 
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.

(cherry picked from commit e7a42cda7c827e016619e8cab15e2faf5d4181ae)

11 months agoCI: Don't require po4a on Solaris
Lasse Collin [Mon, 3 Jun 2024 14:07:11 +0000 (17:07 +0300)] 
CI: Don't require po4a on Solaris

(cherry picked from commit a61c9ab4751f2710dcd5459c7d74bbf20781f0f9)

11 months agoCI: Use set -e on Solaris too
Lasse Collin [Mon, 3 Jun 2024 12:08:15 +0000 (15:08 +0300)] 
CI: Use set -e on Solaris too

(cherry picked from commit 5229bdf5335ce18ed54beb7e646e39927663be86)

11 months agoCMake: Install liblzma.pc even with MSVC
Lasse Collin [Mon, 3 Jun 2024 14:44:50 +0000 (17:44 +0300)] 
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:
https://github.com/microsoft/vcpkg/blob/eb895b95aac6fd7485373702f29f508c42a180a0/ports/liblzma/portfile.cmake
https://github.com/microsoft/vcpkg/pull/39024#issuecomment-2145064670
(cherry picked from commit afa938e429c1ce07d26d02999352fb014b62ff3d)

11 months agoci: don't pin official GH actions via commit, just tag
Sam James [Mon, 3 Jun 2024 05:16:23 +0000 (06:16 +0100)] 
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.

(cherry picked from commit 35f8649f08341639a627fd06350e938124ca3622)

11 months agoci: set -e on openbsd
Christoph Junghans [Tue, 30 Apr 2024 13:49:26 +0000 (07:49 -0600)] 
ci: set -e on openbsd

Closes: https://github.com/tukaani-project/xz/pull/116
(cherry picked from commit e885dae37ff5b1dbc760dabc1e03e866a7302ef2)

11 months agoci: set -e on netbsd
Christoph Junghans [Tue, 30 Apr 2024 13:48:58 +0000 (07:48 -0600)] 
ci: set -e on netbsd

(cherry picked from commit 21b02dd128cf9e8c76325ec124f70381862dcf19)

11 months agoci: actually fail on FreeBSD
Christoph Junghans [Thu, 25 Apr 2024 21:56:06 +0000 (14:56 -0700)] 
ci: actually fail on FreeBSD

Without "set -e" the job will always be successful.

See vmactions/freebsd-vm#72

(cherry picked from commit 8641f0c24c041136670c975b23408184b45431bc)

11 months agoUpdated actions
Andrew Murray [Wed, 24 Apr 2024 23:24:46 +0000 (09:24 +1000)] 
Updated actions

Closes: https://github.com/tukaani-project/xz/pull/115
(cherry picked from commit ef616683ef11f11ffdfbe0624da33905e28a70f9)

11 months agoci: add po4a
Sam James [Mon, 3 Jun 2024 01:49:40 +0000 (02:49 +0100)] 
ci: add po4a

(cherry picked from commit 57b440d316da9ac9cb312ee7e6890f5382556f10)

11 months agoci: add Solaris
Sam James [Sat, 13 Apr 2024 20:02:04 +0000 (21:02 +0100)] 
ci: add Solaris

Inspired by https://github.com/RsyncProject/rsync/commit/3f2a38b01184cae9a931280b534acf5a3dae2e94.

It runs on Solaris 5.11 via a VirtualBox VM.

(cherry picked from commit 08cdf4be9a673d78efe393b53dd73bf43c81dd95)

11 months agoxz: list: suppress -Wformat-nonliteral for Solaris
Sam James [Sun, 14 Apr 2024 07:08:00 +0000 (08:08 +0100)] 
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`.

(cherry picked from commit b69768c8bd1a34fde311935c551d061ba52d9a3f)

11 months agoUpdate THANKS
Lasse Collin [Fri, 31 May 2024 18:36:26 +0000 (21:36 +0300)] 
Update THANKS

(cherry picked from commit b8d134e61ede9f4a296226d97f5c20721fb4e8e2)

14 months agoBump version and soname for 5.6.2 v5.6.2
Lasse Collin [Wed, 29 May 2024 15:03:51 +0000 (18:03 +0300)] 
Bump version and soname for 5.6.2

14 months agoAdd NEWS for 5.6.2
Lasse Collin [Wed, 29 May 2024 15:03:04 +0000 (18:03 +0300)] 
Add NEWS for 5.6.2

14 months agoAdd NEWS for 5.4.7
Lasse Collin [Wed, 29 May 2024 15:03:04 +0000 (18:03 +0300)] 
Add NEWS for 5.4.7

14 months agoAdd NEWS for 5.2.13
Lasse Collin [Wed, 29 May 2024 15:03:04 +0000 (18:03 +0300)] 
Add NEWS for 5.2.13

14 months agoTranslations: Run po4a/update-po
Lasse Collin [Wed, 29 May 2024 14:47:13 +0000 (17:47 +0300)] 
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.

14 months agoTranslations: Run "make -C po update-po"
Lasse Collin [Wed, 29 May 2024 14:44:53 +0000 (17:44 +0300)] 
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.

14 months agoBuild: Update po/*.po files only when needed
Lasse Collin [Wed, 29 May 2024 13:33:24 +0000 (16:33 +0300)] 
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.

(cherry picked from commit 9284f1aea31f0eb23e2ea72f7218b271e2234762)

14 months agopo4a/update-po: Disable wrapping in .pot and .po files
Lasse Collin [Tue, 28 May 2024 18:10:33 +0000 (21:10 +0300)] 
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.

(cherry picked from commit 4beba1cd62d7f8f7a6f1e899b68292d94c53b599)

14 months agoUpdate contact info in README
Lasse Collin [Tue, 28 May 2024 15:36:53 +0000 (18:36 +0300)] 
Update contact info in README

(cherry picked from commit b14c130a58a649f9a73392eeb122cb252327c569)

14 months agoTranslations: Use --package-name=xz-man with po4a
Lasse Collin [Tue, 28 May 2024 10:25:07 +0000 (13:25 +0300)] 
Translations: Use --package-name=xz-man with po4a

This is to match reality. See the added comment.

(cherry picked from commit 75f5f2e014b0ee646963f36bc6a9c840fb272353)

14 months agoTranslations: Omit --package-name from po/Makevars
Lasse Collin [Tue, 28 May 2024 10:03:40 +0000 (13:03 +0300)] 
Translations: Omit --package-name from po/Makevars

This is closer to the reality in the po/*.po files.

(cherry picked from commit eb217d016cfbbba1babc19a61095b3ea25898af6)

14 months agoTranslations: Omit man page line numbers from .pot and .po files
Lasse Collin [Mon, 27 May 2024 22:17:45 +0000 (01:17 +0300)] 
Translations: Omit man page line numbers from .pot and .po files

(cherry picked from commit 9114267038deaecf4832a5cacb5acbe6591ac839)

14 months agoTranslations: Use the xgettext option --add-location=file
Lasse Collin [Mon, 27 May 2024 22:06:30 +0000 (01:06 +0300)] 
Translations: Use the xgettext option --add-location=file

(cherry picked from commit 093490b58271e9424ce38a7b1b38bcf61b9c86c6)

14 months agoTranslations: Use the msgmerge option --add-location=file
Lasse Collin [Mon, 27 May 2024 21:43:53 +0000 (00:43 +0300)] 
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.

(cherry picked from commit fccebe2b4fd513488fc920e4dac32562ed3c7637)

14 months agoBuild: Use $(SHELL) instead of sh to run scripts in Makefile.am
Lasse Collin [Mon, 27 May 2024 09:22:08 +0000 (12:22 +0300)] 
Build: Use $(SHELL) instead of sh to run scripts in Makefile.am

(cherry picked from commit f361d9ae85707a87eb28db400eb7229cec103d58)

14 months agoTranslations: Change the home page URLs in man page translations
Lasse Collin [Thu, 23 May 2024 14:25:13 +0000 (17:25 +0300)] 
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.

(cherry picked from commit a26dece34793a09aac2476f954d162d03e9cf62b)

14 months agoCMake: Add manual support for 32-bit x86 assembly files
Lasse Collin [Thu, 23 May 2024 12:15:18 +0000 (15:15 +0300)] 
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).

(cherry picked from commit 24387c234b4eed1ef9a7eaa107391740b4095568)

14 months agoCMake: Rename USE_DOXYGEN to ENABLE_DOXYGEN
Lasse Collin [Thu, 23 May 2024 11:26:45 +0000 (14:26 +0300)] 
CMake: Rename USE_DOXYGEN to ENABLE_DOXYGEN

It's more consistent with the other option() uses.

(cherry picked from commit 0fb3c9c3f684f5a25bd425ed079a20a79f0c969d)

14 months agoUse more confident language in COPYING
Lasse Collin [Wed, 22 May 2024 12:21:53 +0000 (15:21 +0300)] 
Use more confident language in COPYING

(cherry picked from commit 62733592a1cc6f0b41f46ef52e06d1a6fe1ff38a)

14 months agoAdd SPDX license identifiers to files under tests/ossfuzz
Lasse Collin [Mon, 29 Apr 2024 14:16:38 +0000 (17:16 +0300)] 
Add SPDX license identifiers to files under tests/ossfuzz

(cherry picked from commit 9ae2ebc1e504a1814b0788de95fb5c58c0328dde)

14 months agoAdd SPDX license identifier to .codespellrc
Lasse Collin [Mon, 29 Apr 2024 14:16:06 +0000 (17:16 +0300)] 
Add SPDX license identifier to .codespellrc

(cherry picked from commit 9000d70eb9815bd7f43ffddc1c3316c507aa0e05)

14 months agoMove entries po4a/.gitignore to the top level .gitignore
Lasse Collin [Wed, 22 May 2024 12:12:09 +0000 (15:12 +0300)] 
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.

(cherry picked from commit 903c16fcfa5bfad0cdb2a7383d941243bcb12e76)

14 months agoCMake: Add comments
Lasse Collin [Mon, 20 May 2024 13:55:00 +0000 (16:55 +0300)] 
CMake: Add comments

(cherry picked from commit 9d997d6f9d4f042412e45c7b7a23a14ad2e4f9aa)

14 months agoCMake: Remove the note that some tests aren't run
Lasse Collin [Mon, 20 May 2024 13:55:00 +0000 (16:55 +0300)] 
CMake: Remove the note that some tests aren't run

They are now in the common build configurations.

(cherry picked from commit d35368b33e54bad2f566df99fac29ffea38e34de)

14 months agoCMake: Add support for test_files.sh
Lasse Collin [Mon, 20 May 2024 13:55:00 +0000 (16:55 +0300)] 
CMake: Add support for test_files.sh

(cherry picked from commit dc232d584619b2819a9c52d6ad5d8b5d56b392ba)

14 months agoTests: Make test_files.sh more flexible
Lasse Collin [Mon, 20 May 2024 13:55:00 +0000 (16:55 +0300)] 
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.

(cherry picked from commit a7e9230af9d1f87f474fe38886eb977d4149dc9b)