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

1983 Commits

Author SHA1 Message Date
Lasse Collin
4506174d7f
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)
2024-10-01 19:15:44 +03:00
Lasse Collin
842deba404
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.

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)
2024-10-01 13:22:32 +03:00
Lasse Collin
061a1e4d2d Bump version and soname for 5.4.7 v5.4.7 2024-05-29 18:00:35 +03:00
Lasse Collin
626586c081 Add NEWS for 5.4.7 2024-05-29 18:00:35 +03:00
Lasse Collin
053ba970ce Add NEWS for 5.2.13 2024-05-29 18:00:35 +03:00
Lasse Collin
4612df9323 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)
2024-05-29 17:39:36 +03:00
Lasse Collin
642f488602 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.
2024-05-28 21:33:23 +03:00
Lasse Collin
b30e1a0d8b Translations: Run po4a/update-po and cleanup unused strings
The v5.4 branch won't get any translation updates so the fuzzy
strings and obsolete strings are all useless. Cleaning them up
makes the files smaller.

    ./update-po

    for I in *.po
    do
        msgattrib --clear-fuzzy --clear-previous --empty \
                  --no-obsolete --no-wrap "$I" > tmp
        mv tmp "$I"
    done

The po4a run gave "Parse error at" message from fr.po but
after the fr.po was rewritten the error is gone.
2024-05-28 21:19:22 +03:00
Lasse Collin
3b02ffd54c 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)
2024-05-28 21:19:22 +03:00
Lasse Collin
515e31c1a7 Update contact info in README
(cherry picked from commit b14c130a58a649f9a73392eeb122cb252327c569)
2024-05-28 18:42:00 +03:00
Lasse Collin
0968088a69 Translations: Use --package-name=xz-man with po4a
This is to match reality. See the added comment.

(cherry picked from commit 75f5f2e014b0ee646963f36bc6a9c840fb272353)
2024-05-28 17:17:52 +03:00
Lasse Collin
d6027d8777 Translations: Omit man page line numbers from .pot and .po files
(cherry picked from commit 9114267038deaecf4832a5cacb5acbe6591ac839)
2024-05-28 17:17:52 +03:00
Lasse Collin
451f6986a5 Translations: Update po/Makevars
Use the template from gettext 0.22.5.
Add --add-location=file to XGETTEXT_OPTIONS and MSGMERGE_OPTIONS.
Add --no-wrap to MSGINIT_OPTIONS.
2024-05-28 17:17:52 +03:00
Lasse Collin
15b88b362f liblzma: Omit an unneeded array from the x86 filter
Fixes: 6aa2a6deeba04808a0fe4461396e7fb70277f3d4
(cherry picked from commit de06b9f0c0a3f72569829ecadbc9c0a3ef099f57)
2024-05-27 17:00:15 +03:00
Lasse Collin
031715843d 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-27 17:00:15 +03:00
Lasse Collin
7e85728f9a Fix typos
Thanks to xx on #tukaani.

(cherry picked from commit 4e9023857d287f624562156b60dc23d2b64c0f10)
2024-05-22 00:12:07 +03:00
Lasse Collin
4686f0eecd liblzma: Fix white space
Thanks to xx on #tukaani.

(cherry picked from commit b14d08fbbc254485ace9ccfe7908674f608a62ae)
2024-05-22 00:12:07 +03:00
Lasse Collin
37c46f7b67 Update maintainer and author info.
The other maintainer suddenly disappeared.

(cherry picked from commit 77a294d98a9d2d48f7e4ac273711518bf689f5c4)
2024-05-22 00:12:07 +03:00
Lasse Collin
480d25e534 Add NEWS for 5.2.11 and 5.2.12 2024-05-22 00:12:07 +03:00
Lasse Collin
64e0a5f726 liblzma: Fix incorrect function type error from sanitizer
Clang 17 with -fsanitize=address,undefined:

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

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

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

Fixes: 3b34851de1eaf358cf9268922fa0eeed8278d680
(cherry picked from commit 278563ef8f2b8d98d7f2c85e1a64ec1bc21d26d8)
2024-05-22 00:12:07 +03:00
Lasse Collin
203d482599 xz: Avoid arithmetic on a null pointer
It's undefined behavior. The result wasn't ever used as it occurred
in the last iteration of a loop.

Clang 17 with -fsanitize=address,undefined:

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

Fixes: 88ccf47205d7f3aa314d358c72ef214f10f68b43
Co-authored-by: Sam James <sam@gentoo.org>
(cherry picked from commit 77c8f60547decefca8f2d0c905d9c708c38ee8ff)
2024-05-22 00:12:07 +03:00
Lasse Collin
2d14bf53b9 Tests: test_index: Fix failures when features are disabled
Fixes: cd88423e76d54eb72aea037364f3ebb21f122503
(cherry picked from commit 710a4573ef2cbd19c66318c3b2d1388e418e26c7)
2024-05-22 00:12:07 +03:00
Lasse Collin
8ace8b9c97 Tests: test_index: Edit a misleading test
(cherry picked from commit d879686469c9c4bf2a7c0bb6420ebe4530fc8f07)
2024-05-22 00:12:07 +03:00
Lasse Collin
7e8142ff56 Tests: test_index: Use minimal values to test integer overflow
(cherry picked from commit 612005bbdb0dea9dc09e9e2e9cc16a15c1480acd)
2024-05-22 00:12:07 +03:00
Lasse Collin
4ae9e708bc Tests: test_index: Test lzma_index_buffer_decode() more
(cherry picked from commit 4ad88b2544c2aaf8de8f38af54587098cbe66c1d)
2024-05-22 00:12:07 +03:00
Lasse Collin
61be041f84 Tests: test_index: Test that *i = NULL is done on LZMA_PROG_ERROR
On LZMA_DATA_ERROR from lzma_index_buffer_decode(), *i = NULL was
already done but this adds a test for that case too.

(cherry picked from commit 575b11b0d291e66c5fce31ce7a72f11436d57c83)
2024-05-22 00:12:07 +03:00
Lasse Collin
f39a7ba7f9 Tests: test_index: Test lzma_index_buffer_encode() with empty output buf
(cherry picked from commit 2c970debdb285823f01f75e875561d893345ac2b)
2024-05-22 00:12:07 +03:00
Lasse Collin
780ddb8173 Tests: test_index: Replace if-statements with tuktest assertions
(cherry picked from commit cd88423e76d54eb72aea037364f3ebb21f122503)
2024-05-22 00:12:07 +03:00
Lasse Collin
24dd20ca1d Tests: test_index: Make it clear that my_alloc() has no integer overflows
liblzma guarantees that the product of the allocation size arguments
will fit in size_t.

Putting the pre-increment in the if-statement was clearly wrong
although in practice it didn't matter here as the function is
called only a couple of times.

(cherry picked from commit 7f865577a6224fbbb5f5ca52574b62ea8ac9bf51)
2024-05-22 00:12:07 +03:00
Lasse Collin
189251f5d2 Tests: test_index: Verify also iter.block.number_in_stream
(cherry picked from commit 12313a3b6596cdcf012e180597f84d231f8730d3)
2024-05-22 00:12:07 +03:00
Lasse Collin
e82a20c5c1 Tests: test_index: Check cases that aren't a multiple of 4 bytes
(cherry picked from commit ad2654010d9d641ce1601beeff00630027e6bcd4)
2024-05-22 00:12:07 +03:00
Lasse Collin
214569ace8 liblzma: index_decoder: Fix missing initializations on LZMA_PROG_ERROR
If the arguments to lzma_index_decoder() or lzma_index_buffer_decode()
were such that LZMA_PROG_ERROR was returned, the lzma_index **i
argument wasn't touched even though the API docs say that *i = NULL
is done if an error occurs. This obviously won't be done even now
if i == NULL but otherwise it is best to do it due to the wording
in the API docs.

In practice this matters very little: The problem can occur only
if the functions are called with invalid arguments, that is,
the calling application must already have a bug.

(cherry picked from commit 71eed2520e2eecae89bade9dceea16e56cfa2ea0)
2024-05-22 00:12:07 +03:00
Lasse Collin
80f72396ea CMake: Bump maximum policy version to 3.29 2024-05-22 00:12:07 +03:00
Lasse Collin
cf3780e309 liblzma: API doc cleanups
(cherry picked from commit 08ab0966a75b501aa7c717622223f0c13a113c75)
2024-05-22 00:12:07 +03:00
Lasse Collin
d15eb46891 Tests: test_filter_str: Add a few assertions
(cherry picked from commit 3ac8a9bb4cccbee88350696dc9c645c48d77c989)
2024-05-22 00:12:07 +03:00
Lasse Collin
1c0dfaee63 Tests: test_filter_str: Move one assertion and add a comment
(cherry picked from commit 26c69be80523b05c84dea86c47c4ddd9a10945d7)
2024-05-22 00:12:07 +03:00
Lasse Collin
ef35365984 Tests: test_filter_str: Tweak comments and white space
(cherry picked from commit 4f6af853bc99904efb8b6c28a0af7b81a8476c1b)
2024-05-22 00:12:07 +03:00
Lasse Collin
c35e10fb37 Tests: test_filter_str: Test *error_pos more thoroughly
(cherry picked from commit b0366df1d7ed26268101f9303a001c91c0806dfc)
2024-05-22 00:12:07 +03:00
Lasse Collin
6364cbc63e 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 00:12:07 +03:00
Lasse Collin
6edc2b554f xz man page: Use .ft CR instead of CW to silence warnings from groff.
(cherry picked from commit 31ef676567c9d6fcc4ec9fc833c312f7a7c21c48)
2024-05-22 00:12:07 +03:00
Lasse Collin
077b673a8d 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 00:12:07 +03:00
Lasse Collin
c5c091332c 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 00:12:07 +03:00
Lasse Collin
995afe4646 Update THANKS.
(cherry picked from commit db4dd74a344580e0b81436598d9741a3454245b0)
2024-05-22 00:12:07 +03:00
Lasse Collin
44a5c1374e INSTALL: Document arguments of --enable-symbol-versions.
(cherry picked from commit 8a25ba024d55610c448c6e4f1400a00bae51b493)
2024-05-22 00:12:07 +03:00
Lasse Collin
b03139b1d2 Build: Use only the generic symbol versioning with NVIDIA HPC Compiler.
This does the previous commit with CMake.

AC_EGREP_CPP uses AC_REQUIRE so the outermost if-commands must
be changed to AS_IF to ensure that things wont break some day.
See 5a5bd7f871818029d5ccbe189f087f591258c294.

(cherry picked from commit 49324b711f9d42b3543bf2f3ae598eaa03360bd5)
2024-05-22 00:12:07 +03:00
Lasse Collin
08754772e8 CMake: Use only the generic symbol versioning with NVIDIA HPC Compiler.
It doesn't support the __symver__ attribute or __asm__(".symver ...").
The generic symbol versioning can still be used since it only needs
linker support.

(cherry picked from commit c273123ed0ebaebf49994057a7fe98aae7f42c40)
2024-05-22 00:12:07 +03:00
Lasse Collin
9579efdbfd Update THANKS.
(cherry picked from commit df7f487648d18a3992386a59b8a061edca862d17)
2024-05-22 00:12:07 +03:00
Lasse Collin
32e256c12a liblzma: Minor comment edits.
(cherry picked from commit 3217b82b3ec023bf8338249134a076bea0ea30ec)
2024-05-22 00:12:07 +03:00
Sergey Kosukhin
65ac20807c liblzma: Fix building with NVHPC (NVIDIA HPC SDK).
NVHPC compiler has several issues that make it impossible to
build liblzma:
  - the compiler cannot handle unions that contain pointers that
    are not the first members;
  - the compiler fails to produce valid code for delta_decode if the
    vectorization is enabled, which results in failed tests.

This introduces NVHPC-specific workarounds that address the issues.

(This commit was contributed under 0BSD but the author confirmed
that it is fine to backport it to the public domain branches. See
https://github.com/tukaani-project/xz/pull/90#issuecomment-2100185936
and the next two messages.)

(cherry picked from commit 096bc0e3f8fb4bfc4d2f3f64a7f219401ffb4c31)
2024-05-22 00:11:58 +03:00
Lasse Collin
78a015e753 CMake: Disable symbol versioning on non-glibc Linux.
This better matches what configure.ac does. For example, musl has
only basic symbol versioning support:

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

configure.ac tries to enable symbol versioning only with glibc
so now CMake does the same.

(cherry picked from commit 2ad7fad67080e88fa7fc191f9d613d8b7add9c62)
2024-05-22 00:11:58 +03:00