1
0
Fork 0
mirror of https://git.tukaani.org/xz.git synced 2024-04-04 12:36:23 +02:00
Commit graph

1412 commits

Author SHA1 Message Date
Lasse Collin
053e624fe3 Update NEWS for 5.2.3. 2016-12-30 13:25:10 +02:00
Lasse Collin
cae412b2b7 xz: Fix the Capsicum rights on user_abort_pipe. 2016-12-30 13:13:57 +02:00
Lasse Collin
9ccbae4100 Mention potential sandboxing bugs in INSTALL. 2016-12-28 21:05:22 +02:00
Lasse Collin
e013a337d3 liblzma: Avoid multiple definitions of lzma_coder structures.
Only one definition was visible in a translation unit.
It avoided a few casts and temp variables but seems that
this hack doesn't work with link-time optimizations in compilers
as it's not C99/C11 compliant.

Fixes:
http://www.mail-archive.com/xz-devel@tukaani.org/msg00279.html
2016-12-28 19:59:32 +02:00
Lasse Collin
8e0f1af3dc Document --enable-sandbox configure option in INSTALL. 2016-12-26 20:50:25 +02:00
Lasse Collin
ce2542d220 xz: Add support for sandboxing with Capsicum (disabled by default).
In the v5.2 branch this feature is considered experimental
and thus disabled by default.

The sandboxing is used conditionally as described in main.c.
This isn't optimal but it was much easier to implement than
a full sandboxing solution and it still covers the most common
use cases where xz is writing to standard output. This should
have practically no effect on performance even with small files
as fork() isn't needed.

C and locale libraries can open files as needed. This has been
fine in the past, but it's a problem with things like Capsicum.
io_sandbox_enter() tries to ensure that various locale-related
files have been loaded before cap_enter() is called, but it's
possible that there are other similar problems which haven't
been seen yet.

Currently Capsicum is available on FreeBSD 10 and later
and there is a port to Linux too.

Thanks to Loganaden Velvindron for help.
2016-12-26 20:40:27 +02:00
Lasse Collin
3ca1d5e632 Fix bugs and otherwise improve ax_check_capsicum.m4.
AU_ALIAS was removed because the new version is incompatible
with the old version.

It no longer checks for <sys/capability.h> separately.
It's enough to test for it as part of AC_CHECK_DECL.
The defines HAVE_CAPSICUM_SYS_CAPSICUM_H and
HAVE_CAPSICUM_SYS_CAPABILITY_H were removed as unneeded.
HAVE_SYS_CAPSICUM_H from AC_CHECK_HEADERS is enough.

It no longer does a useless search for the Capsicum library
if the header wasn't found.

Fixed a bug in ACTION-IF-FOUND (the first argument). Specifying
the argument omitted the default action but the given action
wasn't used instead.

AC_DEFINE([HAVE_CAPSICUM]) is now always called when Capsicum
support is found. Previously it was part of the default
ACTION-IF-FOUND which a custom action would override. Now
the default action only prepends ${CAPSICUM_LIB} to LIBS.

The documentation was updated.

Since there as no serial number, "#serial 2" was added.
2016-12-26 20:37:40 +02:00
Lasse Collin
5f3a742b64 Add m4/ax_check_capsicum.m4 for detecting Capsicum support.
The file was loaded from this web page:
https://github.com/google/capsicum-test/blob/dev/autoconf/m4/ax_check_capsicum.m4

Thanks to Loganaden Velvindron for pointing it out for me.
2016-12-26 20:37:40 +02:00
Lasse Collin
d74377e62b liblzma: Fix a memory leak in error path of lzma_index_dup().
lzma_index_dup() calls index_dup_stream() which, in case of
an error, calls index_stream_end() to free memory allocated
by index_stream_init(). However, it illogically didn't
actually free the memory. To make it logical, the tree
handling code was modified a bit in addition to changing
index_stream_end().

Thanks to Evan Nemerson for the bug report.
2016-12-26 17:57:51 +02:00
Lasse Collin
f580732216 Update THANKS. 2016-12-26 17:24:15 +02:00
Lasse Collin
88d7a7fd15 tuklib_cpucores: Add support for sched_getaffinity().
It's available in glibc (GNU/Linux, GNU/kFreeBSD). It's better
than sysconf(_SC_NPROCESSORS_ONLN) because sched_getaffinity()
gives the number of cores available to the process instead of
the total number of cores online.

As a side effect, this commit fixes a bug on GNU/kFreeBSD where
configure would detect the FreeBSD-specific cpuset_getaffinity()
but it wouldn't actually work because on GNU/kFreeBSD it requires
using -lfreebsd-glue when linking. Now the glibc-specific function
will be used instead.

Thanks to Sebastian Andrzej Siewior for the original patch
and testing.
2016-12-26 17:24:09 +02:00
Lasse Collin
51baf68437 xz: Fix copying of timestamps on Windows.
xz used to call utime() on Windows, but its result gets lost
on close(). Using _futime() seems to work.

Thanks to Martok for reporting the bug:
http://www.mail-archive.com/xz-devel@tukaani.org/msg00261.html
2016-06-30 21:00:49 +03:00
Lasse Collin
1ddc479851 xz: Silence warnings from -Wlogical-op.
Thanks to Evan Nemerson.
2016-06-28 21:11:02 +03:00
Lasse Collin
be647ff5ed Build: Fix = to += for xz_SOURCES in src/xz/Makefile.am.
Thanks to Christian Kujau.
2016-06-28 21:09:46 +03:00
Lasse Collin
fb6d50c153 Build: Bump GNU Gettext version requirement to 0.19.
It silences a few warnings and most people probably have
0.19 even on stable distributions.

Thanks to Christian Kujau.
2016-06-28 21:09:46 +03:00
Lasse Collin
74f8dad9f9 liblzma: Disable external SHA-256 by default.
This is the sane thing to do. The conflict with OpenSSL
on some OSes and especially that the OS-provided versions
can be significantly slower makes it clear that it was
a mistake to have the external SHA-256 support enabled by
default.

Those who want it can now pass --enable-external-sha256 to
configure. INSTALL was updated with notes about OSes where
this can be a bad idea.

The SHA-256 detection code in configure.ac had some bugs that
could lead to a build failure in some situations. These were
fixed, although it doesn't matter that much now that the
external SHA-256 is disabled by default.

MINIX >= 3.2.0 uses NetBSD's libc and thus has SHA256_Init
in libc instead of libutil. Support for the libutil version
was removed.
2016-06-28 21:09:46 +03:00
Lasse Collin
ea7f6ff04c Update THANKS. 2016-06-28 21:09:46 +03:00
Lasse Collin
d0e018016b Build: Avoid SHA256_Init on FreeBSD and MINIX 3.
On FreeBSD 10 and older, SHA256_Init from libmd conflicts
with libcrypto from OpenSSL. The OpenSSL version has
different sizeof(SHA256_CTX) and it can cause weird
problems if wrong SHA256_Init gets used.

Looking at the source, MINIX 3 seems to have a similar issue but
I'm not sure. To be safe, I disabled SHA256_Init on MINIX 3 too.

NetBSD has SHA256_Init in libc and they had a similar problem,
but they already fixed it in 2009.

Thanks to Jim Wilcoxson for the bug report that helped
in finding the problem.
2016-06-28 21:09:46 +03:00
Lasse Collin
5daae12391 tuklib_physmem: Hopefully silence a warning on Windows. 2016-06-28 21:09:46 +03:00
Lasse Collin
491acc406e Update THANKS. 2016-06-28 21:09:46 +03:00
Lasse Collin
8173ff8790 liblzma: Make Valgrind happier with optimized (gcc -O2) liblzma.
When optimizing, GCC can reorder code so that an uninitialized
value gets used in a comparison, which makes Valgrind unhappy.
It doesn't happen when compiled with -O0, which I tend to use
when running Valgrind.

Thanks to Rich Prohaska. I remember this being mentioned long
ago by someone else but nothing was done back then.
2016-06-28 21:09:46 +03:00
Lasse Collin
013de2b5ab liblzma: Rename lzma_presets.c back to lzma_encoder_presets.c.
It would be too annoying to update other build systems
just because of this.
2016-06-28 21:09:46 +03:00
Lasse Collin
a322f70ad9 Build: Disable xzdec, lzmadec, and lzmainfo when they cannot be built.
They all need decoder support and if that isn't available,
there's no point trying to build them.
2016-06-28 21:09:46 +03:00
Lasse Collin
8ea49606cf Build: Simplify $enable_{encoders,decoders} usage a bit. 2016-06-28 21:09:46 +03:00
Lasse Collin
42131a25e5 Windows/MSVC: Update config.h. 2016-06-28 21:09:46 +03:00
Lasse Collin
e9184e87cc DOS: Update config.h. 2016-06-28 21:09:46 +03:00
Lasse Collin
2296778f3c xz: Make xz buildable even when encoders or decoders are disabled.
The patch is quite long but it's mostly about adding new #ifdefs
to omit code when encoders or decoders have been disabled.

This adds two new #defines to config.h: HAVE_ENCODERS and
HAVE_DECODERS.
2016-06-28 21:09:46 +03:00
Lasse Collin
97a3109281 Build: Build LZMA1/2 presets also when only decoder is wanted.
People shouldn't rely on the presets when decoding raw streams,
but xz uses the presets as the starting point for raw decoder
options anyway.

lzma_encocder_presets.c was renamed to lzma_presets.c to
make it clear it's not used solely by the encoder code.
2016-06-28 21:09:46 +03:00
Lasse Collin
dc6b78d7f0 Build: Fix configure to handle LZMA1 dependency with LZMA2.
Now it gives an error if LZMA1 encoder/decoder is missing
when LZMA2 encoder/decoder was requested. Even better would
be LZMA2 implicitly enabling LZMA1 but it would need more code.
2016-06-28 21:09:46 +03:00
Lasse Collin
46d76c9cd3 Build: Don't omit lzma_cputhreads() unless using --disable-threads.
Previously it was omitted if encoders were disabled
with --disable-encoders. It didn't make sense and
it also broke the build.
2016-06-28 21:09:46 +03:00
Lasse Collin
16d68f874d liblzma: Fix a build failure related to external SHA-256 support.
If an appropriate header and structure were found by configure,
but a library with a usable SHA-256 functions wasn't, the build
failed.
2016-06-28 21:09:46 +03:00
Lasse Collin
d9311647fc xz: Always close the file before trying to delete it.
unlink() can return EBUSY in errno for open files on some
operating systems and file systems.
2016-06-28 21:09:46 +03:00
Lasse Collin
f59c4183f3 Update THANKS. 2016-06-28 21:09:46 +03:00
Lasse Collin
35f189673e Tests: Add tests for the two bugs fixed in index.c. 2016-06-28 21:09:46 +03:00
Lasse Collin
e10bfdb0fc liblzma: Fix lzma_index_dup() for empty Streams.
Stream Flags and Stream Padding weren't copied from
empty Streams.
2016-06-28 21:09:46 +03:00
Lasse Collin
06f434bd89 liblzma: Add a note to index.c for those using static analyzers. 2016-06-28 21:09:46 +03:00
Lasse Collin
9815cdf698 Bump version and soname for 5.2.2. 2015-09-29 13:59:35 +03:00
Lasse Collin
cbe0cec847 Update NEWS for 5.2.2. 2015-09-29 13:57:46 +03:00
Andre Noll
49427ce7ee Fix typo in German translation.
As pointed out by Robert Pollak, there's a typo in the German
translation of the compression preset option (-0 ... -9) help text.
"The compressor" translates to "der Komprimierer", and the genitive
form is "des Komprimierers". The old word makes no sense at all.
2015-09-28 19:05:13 +03:00
Hauke Henningsen
608d6f06c9 Update German translation, mostly wrt orthography
Provide an update of the German translation.
* A lot of compound words were previously written with spaces, while
  German orthography is relatively clear in that the components
  should not be separated.
* When referring to the actual process of (de)compression rather than the
  concept, replace “(De-)Kompression” with “(De-)Komprimierung”.
  Previously, both forms were used in this context and are now used in a
  manner consistent with “Komprimierung” being more likely to refer to
  a process.
* Consistently translate “standard input”/“output”
* Use “Zeichen” instead of false friend “Charakter” for “character”
* Insert commas around relative clauses (as required in German)
* Some other minor corrections
* Capitalize “ß” as “ẞ”
* Consistently start option descriptions in --help with capital letters

Acked-By: Andre Noll <maan@tuebingen.mpg.de>

* Update after msgmerge
2015-09-25 14:03:24 +03:00
Lasse Collin
c8988414e5 Build: Minor Cygwin cleanup.
Some tests used "cygwin*" and some used "cygwin". I changed
them all to use "cygwin". Shouldn't affect anything in practice.
2015-09-25 14:03:24 +03:00
Lasse Collin
85a6dfed53 Build: Support building of MSYS2 binaries. 2015-09-25 14:03:24 +03:00
Lasse Collin
77f270be84 Windows: Define DLL_EXPORT when building liblzma.dll with MSVC.
src/liblzma/common/common.h uses it to set __declspec(dllexport)
for the API symbols.

Thanks to Adam Walling.
2015-09-25 14:03:24 +03:00
Lasse Collin
8c975446c5 Windows: Omit unneeded header files from MSVC project files. 2015-09-25 14:03:24 +03:00
Lasse Collin
119a004349 liblzma: A MSVC-specific hack isn't needed with MSVC 2013 and newer. 2015-09-25 14:03:24 +03:00
Lasse Collin
d4e7c557fc Update THANKS. 2015-09-25 14:03:24 +03:00
Lasse Collin
98001740ca Windows: Update the docs. 2015-09-25 14:03:24 +03:00
Lasse Collin
28195e4c87 Windows: Add MSVC project files for building liblzma.
Thanks to Adam Walling for creating these files.
2015-09-25 14:03:24 +03:00
Lasse Collin
960440f323 Tests: Fix a memory leak in test_bcj_exact_size.
Thanks to Cristian Rodríguez.
2015-05-13 21:36:19 +03:00
Lasse Collin
68cd35acaf Fix NEWS about threading in 5.2.0.
Thanks to Andy Hochhaus.
2015-05-12 18:08:38 +03:00