1
0
mirror of https://git.tukaani.org/xz.git synced 2025-02-17 14:08:12 +00:00

2395 Commits

Author SHA1 Message Date
Lasse Collin
6e76a25df2 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.

(cherry picked from commit 4ffc60f32397371769b7d6b5e3ed8626292d58df)
2024-05-22 14:32:36 +03:00
Lasse Collin
0ca14871f3 liblzma: API doc cleanups
(cherry picked from commit 08ab0966a75b501aa7c717622223f0c13a113c75)
2024-05-22 14:32:36 +03:00
Lasse Collin
94a462850b Tests: test_filter_str: Add a few assertions
(cherry picked from commit 3ac8a9bb4cccbee88350696dc9c645c48d77c989)
2024-05-22 14:32:36 +03:00
Lasse Collin
72058ca22a Tests: test_filter_str: Move one assertion and add a comment
(cherry picked from commit 26c69be80523b05c84dea86c47c4ddd9a10945d7)
2024-05-22 14:32:36 +03:00
Lasse Collin
c59ebbe1c6 Tests: test_filter_str: Tweak comments and white space
(cherry picked from commit 4f6af853bc99904efb8b6c28a0af7b81a8476c1b)
2024-05-22 14:32:36 +03:00
Lasse Collin
ceda860934 Tests: test_filter_str: Add missing RISC-V case
Fixes: 89ea1a22f4ed3685b053b7260bc5acf6c75d1664
(cherry picked from commit c92663aa1bd576e0615498a4189acf0df12e84b9)
2024-05-22 14:32:36 +03:00
Lasse Collin
2234b7cc47 Tests: test_filter_str: Test *error_pos more thoroughly
(cherry picked from commit b0366df1d7ed26268101f9303a001c91c0806dfc)
2024-05-22 14:32:36 +03:00
Lasse Collin
3ba3ef57f9 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
(cherry picked from commit 70d12dd069bb9bb0d6bb1c8fafc4e6f77780263d)
2024-05-22 14:32:36 +03:00
Lasse Collin
57ad820e15 liblzma: Clean up white space
(cherry picked from commit ed8e552395701fbf046027cebc8be4a6755b263f)
2024-05-22 14:32:36 +03:00
Lasse Collin
ba0b5bfe7c Tests: test_filter_flags: Edit comments and style
(cherry picked from commit 2f06920f20b1ad63b7953dc09569e1d424998849)
2024-05-22 14:32:36 +03:00
Lasse Collin
d2ed675959 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.

(cherry picked from commit b101e1d1dbc81577c0c9aa0cb89cf2e46a15eb82)
2024-05-22 14:32:36 +03:00
Lasse Collin
9a70e93fef DOS: Omit useless defines from config.h
(cherry picked from commit f8f3a220ac8afcb8cb2812917d3b77e00c2eab0d)
2024-05-22 14:32:36 +03:00
Lasse Collin
dc4740f720 Build: Omit useless checks for fcntl.h, limits.h, and sys/time.h
(cherry picked from commit fc1921b04b8840caaa777c2bd5340d41b259da20)
2024-05-22 14:32:36 +03:00
Lasse Collin
6e210d5766 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.

(cherry picked from commit 6aa2a6deeba04808a0fe4461396e7fb70277f3d4)
2024-05-22 14:32:36 +03:00
Lasse Collin
4019b012f2 Update .gitignore
(cherry picked from commit e89d3e83b4496d0b5410870634970c0aa9721d59)
2024-05-22 14:32:36 +03:00
Lasse Collin
09a0311a1e Tests: test_lzip_decoder: Tweak coding style and comments
(cherry picked from commit 86fc4ee859709da0ff9617a1490f13ddac0a109b)
2024-05-22 14:32:36 +03:00
Lasse Collin
3117336a02 Tests: test_lzip_decoder: Remove redundant initializations
(cherry picked from commit 38be573a279bd7b608ee7d8509ec10884e6fb0d5)
2024-05-22 14:32:36 +03:00
Lasse Collin
f78081eb12 Tests: test_lzip_decoder: Remove unneeded tuktest_malloc() calls
(cherry picked from commit d7e4bc53eacfab9f3de95d8252bdfdc9419079c9)
2024-05-22 14:32:36 +03:00
Lasse Collin
7413383e42 xz: Fix white space error.
Thanks to xx on #tukaani.

(cherry picked from commit eeca8f7c5baf1ad69606bb734d5001763466d58f)
2024-05-22 14:32:36 +03:00
Sam James
eed2f26c0e xz: add missing noreturn for message_filters_help
Fixes: a165d7df1964121eb9df715e6f836a31c865beef
(cherry picked from commit 462ca9409940a19f743daee6b3bcc611277d0007)
2024-05-22 14:32:36 +03:00
Sam James
2633d8df61 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.

(cherry picked from commit 863f13d2828b99b0539ce73f9cf85bde32358034)
2024-05-22 14:32:36 +03:00
Lasse Collin
50fb269c7a Tests: test_microlzma: Add a "FIXME?" about LZMA_FINISH handling
(cherry picked from commit fcbd0d199933a69713cb293cbd7409a757d854cd)
2024-05-22 14:32:36 +03:00
Lasse Collin
3e2ff2d38c 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.

(cherry picked from commit 0fe2dfa68355d2b165544b2bc8babf77dcc2039e)
2024-05-22 14:32:36 +03:00
Ryan Carsten Schmidt
ebc8b8de19 CI: Use only the active CPUs on macOS
hw.ncpu counts all CPUs including inactive ones. hw.activecpu counts
only the active CPUs.

(cherry picked from commit 97f0ee0f1f903f4e7c4ea23e9b89d687025d2992)
2024-05-22 14:26:59 +03:00
Sam James
1e63f7d536 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.

(cherry picked from commit 73f629e321b74f68c9954728fa4f19261afccf46)
2024-05-22 14:26:59 +03:00
Sam James
aea54a4724 ci: build in parallel by default
(cherry picked from commit 8709407a9ef8e7e8aec117879400e4dd3e227ada)
2024-05-22 14:26:59 +03:00
Sam James
4381fcf00b 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.

(cherry picked from commit 65bf7e0a1ca6386f17608e8afb84ac470c18d23f)
2024-05-22 14:26:59 +03:00
Sam James
752ba5ed99 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...

(cherry picked from commit bc899f9e0700ad153bd65f4804c4de7515c8a847)
2024-05-22 14:26:59 +03:00
Sam James
cc21af1715 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

(cherry picked from commit b5e3470442531717b2457b40ab412740296af1bc)
2024-05-22 14:26:59 +03:00
Sam James
2d2d5f14b3 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/

(cherry picked from commit 6c095a98fbec70b790253a663173ecdb669108c4)
2024-05-22 14:26:59 +03:00
Lasse Collin
5d20a61205 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.

(cherry picked from commit 6286c1900c2d2ca33d9b1b397122c7bcdb9a4d59)
2024-05-22 14:26:03 +03:00
Lasse Collin
2a80827e23 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
(cherry picked from commit 45da936c879acf4f053a3055665bf1b10ded4462)
2024-05-22 14:26:03 +03:00
Lasse Collin
a541173771 Build: If ARM64 feature detection func is found, stop looking for others
This can speed up configure a tiny bit.

Fixes: c5f6d79cc9515a7f22d7ea4860c6cc394b295732
(cherry picked from commit 308a9af85400b0e2019f0f012c8354e831d06d65)
2024-05-22 14:26:03 +03:00
Lasse Collin
9223ad6e78 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
(cherry picked from commit fc43cecd32bf9d5f8caa599206b15c9569af1eb6)
2024-05-22 14:26:03 +03:00
Lasse Collin
32ceb2c36a liblzma: ARM64 CRC32: Add error checking to FreeBSD-specific code
Also add parenthesis to the return statement.

I didn't test this.

Fixes: 761f5b69a4c778c8bcb09279b845b07c28790575
(cherry picked from commit 1024cd4cd966b998fedec51e385e9ee9a49b3c57)
2024-05-22 14:26:03 +03:00
Lasse Collin
42915101e9 liblzma: ARM64 CRC32: Use negation instead of subtracting from 8
Subtracting from 0 is negation, this just keeps warnings away.

Fixes: 761f5b69a4c778c8bcb09279b845b07c28790575
(cherry picked from commit 2337f7021c860b026e3e849e60a9ae8d09ec0ea0)
2024-05-22 14:26:03 +03:00
Lasse Collin
42a9482b48 liblzma: ARM64 CRC32: Tweak coding style and comments
(cherry picked from commit d8fffd01aa1a3c18e437a222abd34699e23ff5e7)
2024-05-22 14:26:03 +03:00
Lasse Collin
38a3ec5a7e CI: Remove ifunc support.
(cherry picked from commit 986865ea2f9d1f8dbef4a130926df106b0f6d41a)
2024-05-22 14:12:43 +03:00
Lasse Collin
34d1252f09 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.

(cherry picked from commit 689ae2427342a2ea1206eb5ca08301baf410e7e0)
2024-05-22 14:12:43 +03:00
Lasse Collin
a594b39685 tests/files/README: Update the main heading.
(cherry picked from commit 6b4c859059a7eb9b0547590c081668e14ecf8af6)
2024-05-22 14:12:43 +03:00
Lasse Collin
fa76e3ef59 tests/files/README: Explain how to recreate the ARM64 test files.
(cherry picked from commit 2a851e06b891ce894f918faff32a6cca6fdecee6)
2024-05-22 14:12:43 +03:00
Lasse Collin
112fa0aba6 debug: Add generator for the ARM64 test file data.
(cherry picked from commit 3d09b721b94e18fe1f853a04799697f5de10b291)
2024-05-22 14:12:43 +03:00
Lasse Collin
1a1f3d0323 xz man page: Use .ft CR instead of CW to silence warnings from groff.
(cherry picked from commit 31ef676567c9d6fcc4ec9fc833c312f7a7c21c48)
2024-05-22 14:12:43 +03:00
Lasse Collin
9f9203f574 Fix NEWS for 5.6.0 and 5.6.1.
(cherry picked from commit 780cbf29d5a88db2b546e9b7b019c4c33ca72685)
2024-05-22 14:12:43 +03:00
Lasse Collin
12876b33c7 Remove the XZ logo.
(cherry picked from commit bfd0c7c478e93a1911b845459549ff94587b6ea2)
2024-05-22 14:12:43 +03:00
Lasse Collin
879295d91f Update maintainer and author info.
The other maintainer suddenly disappeared.

(cherry picked from commit 77a294d98a9d2d48f7e4ac273711518bf689f5c4)
2024-05-22 14:12:43 +03:00
Lasse Collin
859617d30d Docs: Update .xz file format specification to 1.2.1.
This only reverts the XZ URL changes.

(cherry picked from commit 8dd03d4484ccf80022722a16d0ed9b37f2b58072)
2024-05-22 14:12:43 +03:00
Lasse Collin
eeb74fba1f Update website URLs back to tukaani.org.
The XZ projects were moved back to their original URLs.

(cherry picked from commit 17aa2e1a796d3f758802df29afc89dcf335db567)
2024-05-22 14:12:39 +03:00
Lasse Collin
a7b9cd7000 xzdec: Tweak coding style and comments.
(cherry picked from commit 2739db981023373a2ddabc7b456c7e658bb4f582)
2024-05-22 14:12:13 +03:00
Lasse Collin
ebe9d6d8cb tests/ossfuzz: Tiny fix to a comment.
(cherry picked from commit 408b6adb2a07d07c6535f859571cca38837caaf3)
2024-05-22 14:12:13 +03:00