58 Commits

Author SHA1 Message Date
Lasse Collin
495aaf3a5b Bump version and soname for 5.0.7. 2014-09-20 20:44:32 +03:00
Lasse Collin
ac6c8921d1 Update NEWS for 5.0.7. 2014-09-20 20:43:29 +03:00
Lasse Collin
d1b0276aaf liblzma: Fix invalid Libs.private value in liblzma.pc. 2014-09-20 20:21:18 +03:00
Lasse Collin
cac72956b1 liblzma: Fix a portability problem in Makefile.am.
POSIX supports $< only in inference rules (suffix rules).
Using it elsewhere is a GNU make extension and doesn't
work e.g. with OpenBSD make.

Thanks to Christian Weisgerber for the patch.
2014-09-20 19:48:16 +03:00
Lasse Collin
2cdf0875de Bump version and soname for 5.0.6. 2014-09-14 19:35:45 +03:00
Lasse Collin
0168b6c8fb Update NEWS for 5.0.6. 2014-09-14 19:33:46 +03:00
Lasse Collin
13337714e8 xzgrep: List xzgrep_expected_output in tests/Makefile.am. 2014-09-09 19:18:23 +03:00
Lasse Collin
ccc728d829 xzgrep: Improve the test script.
Now it should be close to the functionality of the original
version by Pavel Raiskup.
2014-09-09 19:18:23 +03:00
Lasse Collin
948f5865fe xzgrep: Add a test for the previous fix.
This is a simplified version of Pavel Raiskup's
original patch.
2014-09-09 19:18:23 +03:00
Lasse Collin
64228d0d5c xzgrep: exit 0 when at least one file matches.
Mimic the original grep behavior and return exit_success when
at least one xz compressed file matches given pattern.

Original bugreport:
https://bugzilla.redhat.com/show_bug.cgi?id=1108085

Thanks to Pavel Raiskup for the patch.
2014-09-09 19:18:23 +03:00
Lasse Collin
98d3368ef4 Build: Fix the combination of --disable-xzdec --enable-lzmadec.
In this case "make install" could fail if the man page directory
didn't already exist at the destination. If it did exist, a
dangling symlink was created there. Now the link is omitted
instead. This isn't the best fix but it's better than the old
behavior.
2014-04-26 08:47:36 +03:00
Lasse Collin
ba3b5dd082 Build: Add --disable-doc to configure. 2014-04-26 08:47:36 +03:00
Lasse Collin
3d4575f236 Update INSTALL.
Add a note about failing "make check". The source of
the problem should be fixed in libtool (if it really is
a libtool bug and not mine) but I'm unable to spend time
on that for now. Thanks to Nelson H. F. Beebe for reporting
the issue.

Add a note about a possible need to run "ldconfig" after
"make install".
2014-04-26 08:47:24 +03:00
Lasse Collin
b9f0584e3e xz: Rename a variable to avoid a namespace collision on Solaris.
I don't know the details but I have an impression that there's
no problem in practice if using GCC since people have built xz
with GCC (without patching xz), but renaming the variable cannot
hurt either.

Thanks to Mark Ashley.
2014-04-26 08:47:24 +03:00
Lasse Collin
cc41bcaf77 xz: Fix a comment. 2014-04-26 08:45:49 +03:00
Lasse Collin
e34025d666 liblzma: Avoid C99 compound literal arrays.
MSVC 2013 doesn't like them. Maybe they aren't so good
for readability either since many aren't used to them.
2014-04-26 08:38:12 +03:00
Lasse Collin
0b6168974f liblzma: Remove a useless C99ism from sha256.c.
Unsurprisingly it makes no difference in compiled output.
2014-04-26 08:38:12 +03:00
Lasse Collin
41e436076c xz: Fix use of wrong variable.
Since the only call to suffix_set() uses optarg
as the argument, fixing this bug doesn't change
the behavior of the program.
2014-04-26 08:37:15 +03:00
Lasse Collin
c33efefd4e Fix typos in comments. 2014-04-26 08:37:00 +03:00
Lasse Collin
e560c82f1f Update THANKS. 2014-04-26 08:31:53 +03:00
Lasse Collin
05192b32e5 liblzma: Document the need for block->check for lzma_block_header_decode().
Thanks to Tomer Chachamu.
2014-04-26 08:31:43 +03:00
Lasse Collin
0f35eafe51 Update TODO. 2014-04-26 08:31:21 +03:00
Lasse Collin
fc9eaf81d7 Build: Remove a comment about Automake 1.10 from configure.ac.
The previous commit supports silent rules and that requires
Automake 1.11.
2014-04-26 08:30:00 +03:00
Lasse Collin
090c69dda5 Build: Create liblzma.pc in a src/liblzma/Makefile.am.
Previously it was done in configure, but doing that goes
against the Autoconf manual. Autoconf requires that it is
possible to override e.g. prefix after running configure
and that doesn't work correctly if liblzma.pc is created
by configure.

A potential downside of this change is that now e.g.
libdir in liblzma.pc is a standalone string instead of
being defined via ${prefix}, so if one overrides prefix
when running pkg-config the libdir won't get the new value.
I don't know if this matters in practice.

Thanks to Vincent Torri.
2014-04-26 08:29:17 +03:00
Anders F Bjorklund
1f35331332 macosx: separate liblzma package 2013-08-03 13:24:47 +03:00
Anders F Bjorklund
1415f1d946 macosx: set minimum to leopard 2013-08-03 13:24:47 +03:00
Anders F Bjorklund
41913949b9 move configurables into variables 2013-08-03 13:24:47 +03:00
Lasse Collin
3dffda33f4 Build: Fix the detection of missing CRC32.
Thanks to Vincent Torri.
2013-08-03 13:24:36 +03:00
Lasse Collin
b69900ed0b Man pages: Use similar syntax for synopsis as in xz.
The man pages of lzmainfo, xzmore, and xzdec had similar
constructs as the man page of xz had before the commit
eb6ca9854b. Eric S. Raymond
didn't mention these man pages in his bug report, but
it's nice to be consistent.
2013-06-30 18:03:54 +03:00
Lasse Collin
cf4a1e1879 Update NEWS for 5.0.5. 2013-06-30 15:55:09 +03:00
Lasse Collin
cb94bb6d1f Bump version and soname for 5.0.5. 2013-06-30 15:54:38 +03:00
Lasse Collin
b7dee202d5 xz: Fix return value type in io_write_buf().
It didn't affect the behavior of the code since -1
becomes true anyway.
2013-06-28 23:56:34 +03:00
Lasse Collin
265e7b44d8 xz: Remove an outdated NetBSD-specific comment.
Nowadays errno == EFTYPE is documented in open(2).
2013-06-28 22:04:40 +03:00
Lasse Collin
78c2f8db90 xz: Fix error detection of fcntl(fd, F_SETFL, flags) calls.
POSIX says that fcntl(fd, F_SETFL, flags) returns -1 on
error and "other than -1" on success. This is how it is
documented e.g. on OpenBSD too. On Linux, success with
F_SETFL is always 0 (at least accorinding to fcntl(2)
from man-pages 3.51).
2013-06-28 22:04:36 +03:00
Lasse Collin
91750dff8f xz: Fix use of wrong variable in a fcntl() call.
Due to a wrong variable name, when writing a sparse file
to standard output, *all* file status flags were cleared
(to the extent the operating system allowed it) instead of
only clearing the O_APPEND flag. In practice this worked
fine in the common situations on GNU/Linux, but I didn't
check how it behaved elsewhere.

The original flags were still restored correctly. I still
changed the code to use a separate boolean variable to
indicate when the flags should be restored instead of
relying on a special value in stdout_flags.
2013-06-28 22:04:32 +03:00
Lasse Collin
e11888a79a xz: Check the value of lzma_stream_flags.version in --list.
It is a no-op for now, but if an old xz version is used
together with a newer liblzma that supports something new,
then this check becomes important and will stop the old xz
from trying to parse files that it won't understand.
2013-06-26 13:31:19 +03:00
Lasse Collin
f39ddd88f3 Build: Require Automake 1.12 and use serial-tests option.
It should actually still work with Automake 1.10 if
the serial-tests option is removed. Automake 1.13 started
using parallel tests by default and the option to get
the old behavior isn't supported before 1.12.

At least for now, parallel tests don't improve anything
in XZ Utils but they hide the progress output from
test_compress.sh.
2013-06-26 12:17:13 +03:00
Lasse Collin
cb84e27802 xz: Validate Uncompressed Size from Block Header in list.c.
This affects only "xz -lvv". Normal decompression with xz
already detected if Block Header and Index had mismatched
Uncompressed Size fields. So this just makes "xz -lvv"
show such files as corrupt instead of showing the
Uncompressed Size from Index.
2013-06-26 10:59:19 +03:00
Lasse Collin
f01780fce4 Update THANKS. 2013-06-26 10:58:58 +03:00
Lasse Collin
d98ede7d70 xz: Make the man page more friendly to doclifter.
Thanks to Eric S. Raymond.
2013-06-26 10:58:07 +03:00
Lasse Collin
19b447b64b xz: A couple of man page fixes.
Now the interaction of presets and custom filter chains
is described correctly. Earlier it contradicted itself.

Thanks to DevHC who reported these issues on IRC to me
on 2012-12-14.
2013-06-26 10:54:24 +03:00
Lasse Collin
45edf2966f xz: Fix interaction between preset and custom filter chains.
There was somewhat illogical behavior when --extreme was
specified and mixed with custom filter chains.

Before this commit, "xz -9 --lzma2 -e" was equivalent
to "xz --lzma2". After it is equivalent to "xz -6e"
(all earlier preset options get forgotten when a custom
filter chain is specified and the default preset is 6
to which -e is applied). I find this less illogical.

This also affects the meaning of "xz -9e --lzma2 -7".
Earlier it was equivalent to "xz -7e" (the -e specified
before a custom filter chain wasn't forgotten). Now it
is "xz -7". Note that "xz -7e" still is the same as "xz -e7".

Hopefully very few cared about this in the first place,
so pretty much no one should even notice this change.

Thanks to Conley Moorhous.
2013-06-26 10:54:18 +03:00
Lasse Collin
b065984e5a xz: Change size_t to uint32_t in a few places. 2013-06-26 10:54:09 +03:00
Lasse Collin
32be621f52 Build: Use -Wvla with GCC if supported.
Variable-length arrays are mandatory in C99 but optional in C11.
The code doesn't currently use any VLAs and it shouldn't in the
future either to stay compatible with C11 without requiring any
optional C11 features.
2013-06-26 10:53:57 +03:00
Lasse Collin
efb07cfba6 xzdec: Improve the --help message.
The options are now ordered in the same order as in xz's help
message.

Descriptions were added to the options that are ignored.
I left them in parenthesis even if it looks a bit weird
because I find it easier to spot the ignored vs. non-ignored
options from the list that way.
2013-06-26 10:53:57 +03:00
Lasse Collin
e3c8be1369 Update THANKS. 2013-04-05 19:34:42 +03:00
Jeff Bastian
ad8282efe4 xzgrep: make the '-h' option to be --no-filename equivalent
* src/scripts/xzgrep.in: Accept the '-h' option in argument parsing.
2013-04-05 19:34:42 +03:00
Lasse Collin
9271a3eb0e liblzma: Be less picky in lzma_alone_decoder().
To avoid false positives when detecting .lzma files,
rare values in dictionary size and uncompressed size fields
were rejected. They will still be rejected if .lzma files
are decoded with lzma_auto_decoder(), but when using
lzma_alone_decoder() directly, such files will now be accepted.
Hopefully this is an OK compromise.

This doesn't affect xz because xz still has its own file
format detection code. This does affect lzmadec though.
So after this commit lzmadec will accept files that xz or
xz-emulating-lzma doesn't.

NOTE: lzma_alone_decoder() still won't decode all .lzma files
because liblzma's LZMA decoder doesn't support lc + lp > 4.

Reported here:
http://sourceforge.net/projects/lzmautils/forums/forum/708858/topic/7068827

Conflicts:
	src/liblzma/common/alone_decoder.c
	src/liblzma/common/alone_decoder.h
2013-04-05 19:34:09 +03:00
Lasse Collin
211b931cee Avoid unneeded use of awk in xzless.
Use "read" instead of "awk" in xzless to get the version
number of "less". The need for awk was introduced in
the commit db5c1817fa.

Thanks to Ariel P for the patch.
2013-04-05 19:28:08 +03:00
Jonathan Nieder
9f62fd9605 xzless: Make "less -V" parsing more robust
In v4.999.9beta~30 (xzless: Support compressed standard input,
2009-08-09), xzless learned to parse ‘less -V’ output to figure out
whether less is new enough to handle $LESSOPEN settings starting
with “|-”.  That worked well for a while, but the version string from
‘less’ versions 448 (June, 2012) is misparsed, producing a warning:

	$ xzless /tmp/test.xz; echo $?
	/usr/bin/xzless: line 49: test: 456 (GNU regular expressions): \
	integer expression expected
	0

More precisely, modern ‘less’ lists the regexp implementation along
with its version number, and xzless passes the entire version number
with attached parenthetical phrase as a number to "test $a -gt $b",
producing the above confusing message.

	$ less-444 -V | head -1
	less 444
	$ less -V | head -1
	less 456 (no regular expressions)

So relax the pattern matched --- instead of expecting "less <number>",
look for a line of the form "less <number>[ (extra parenthetical)]".
While at it, improve the behavior when no matching line is found ---
instead of producing a cryptic message, we can fall back on a LESSPIPE
setting that is supported by all versions of ‘less’.

The implementation uses "awk" for simplicity.  Hopefully that’s
portable enough.

Reported-by: Jörg-Volker Peetz <jvpeetz@web.de>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2012-12-15 20:01:45 +02:00
Lasse Collin
1d05980f5b xz: Fix the note about --rsyncable on the man page. 2012-12-15 20:01:45 +02:00
Lasse Collin
fb68497333 xz: Improve handling of failed realloc in xrealloc.
Thanks to Jim Meyering.
2012-12-15 20:01:45 +02:00
Lasse Collin
75013db6d4 A few typo fixes to comments and the xz man page.
Thanks to Jim Meyering.
2012-12-15 20:01:02 +02:00
Lasse Collin
e44b21839b Build: Bump gettext version requirement to 0.18.
Otherwise too old version of m4/lib-link.m4 gets included
when autoreconf -fi is run.
2012-08-02 17:14:06 +03:00
Lasse Collin
fd3dbb23ca Tests: Remove tests/test_block.c that had gotten committed accidentally. 2012-07-05 07:49:40 +03:00
Lasse Collin
05a735d279 Build: Include macosx/build.sh in the distribution.
It has been in the Git repository since 2010 but probably
few people have seen it since it hasn't been included in
the release tarballs. :-(
2012-07-05 07:49:31 +03:00
Lasse Collin
4e6d62793b Docs: Fix the name LZMA Utils -> XZ Utils in debug/README. 2012-07-05 07:49:21 +03:00
Lasse Collin
dd95b5e761 Include debug/translation.bash in the distribution.
Also fix the script name mentioned in README.
2012-07-05 07:49:10 +03:00
38 changed files with 446 additions and 194 deletions

31
INSTALL
View File

@@ -26,6 +26,8 @@ XZ Utils Installation
4.2. "No POSIX conforming shell (sh) was found."
4.3. configure works but build fails at crc32_x86.S
4.4. Lots of warnings about symbol visibility
4.5. "make check" fails
4.6. liblzma.so (or similar) not found when running xz
0. Preface
@@ -251,6 +253,12 @@ XZ Utils Installation
Don't install the scripts xzdiff, xzgrep, xzmore, xzless,
and their symlinks.
--disable-doc
Don't install the documentation files to $docdir
(often /usr/doc/xz or /usr/local/doc/xz). Man pages
will still be installed. The $docdir can be changed
with --docdir=DIR.
--disable-assembler
liblzma includes some assembler optimizations. Currently
there is only assembler code for CRC32 and CRC64 for
@@ -463,3 +471,26 @@ XZ Utils Installation
resulting binaries, but fewer warnings looks nicer and may allow
using --enable-werror.
4.5. "make check" fails
A likely reason is that libtool links the test programs against
an installed version of liblzma instead of the version that was
just built. This is obviously a bug which seems to happen on
some platforms. A workaround is to uninstall the old liblzma
versions first.
If the problem isn't the one described above, then it's likely
a bug in XZ Utils or in the compiler. See the platform-specific
notes in this file for possible known problems. Please report
a bug if you cannot solve the problem. See README for contact
information.
4.6. liblzma.so (or similar) not found when running xz
If you installed the package with "make install" and get an error
about liblzma.so (or a similarly named file) being missing, try
running "ldconfig" to update the run-time linker cache (if your
operating system has such a command).

View File

@@ -17,6 +17,7 @@ endif
SUBDIRS += src po tests
if COND_DOC
dist_doc_DATA = \
AUTHORS \
COPYING \
@@ -42,11 +43,13 @@ examplesolddir = $(docdir)/examples_old
dist_examplesold_DATA = \
doc/examples_old/xz_pipe_comp.c \
doc/examples_old/xz_pipe_decomp.c
endif
EXTRA_DIST = \
extra \
dos \
windows \
macosx \
autogen.sh \
Doxyfile.in \
COPYING.GPLv2 \

70
NEWS
View File

@@ -2,6 +2,76 @@
XZ Utils Release Notes
======================
5.0.7 (2014-09-20)
* Fix regressions introduced in 5.0.6:
- Fix building with non-GNU make.
- Fix invalid Libs.private value in liblzma.pc which broke
static linking against liblzma if the linker flags were
taken from pkg-config.
5.0.6 (2014-09-14)
* xzgrep now exits with status 0 if at least one file matched.
* A few minor portability and build system fixes
5.0.5 (2013-06-30)
* lzmadec and liblzma's lzma_alone_decoder(): Support decompressing
.lzma files that have less common settings in the headers
(dictionary size other than 2^n or 2^n + 2^(n-1), or uncompressed
size greater than 256 GiB). The limitations existed to avoid false
positives when detecting .lzma files. The lc + lp <= 4 limitation
still remains since liblzma's LZMA decoder has that limitation.
NOTE: xz's .lzma support or liblzma's lzma_auto_decoder() are NOT
affected by this change. They still consider uncommon .lzma headers
as not being in the .lzma format. Changing this would give way too
many false positives.
* xz:
- Interaction of preset and custom filter chain options was
made less illogical. This affects only certain less typical
uses cases so few people are expected to notice this change.
Now when a custom filter chain option (e.g. --lzma2) is
specified, all preset options (-0 ... -9, -e) earlier are on
the command line are completely forgotten. Similarly, when
a preset option is specified, all custom filter chain options
earlier on the command line are completely forgotten.
Example 1: "xz -9 --lzma2=preset=5 -e" is equivalent to "xz -e"
which is equivalent to "xz -6e". Earlier -e didn't put xz back
into preset mode and thus the example command was equivalent
to "xz --lzma2=preset=5".
Example 2: "xz -9e --lzma2=preset=5 -7" is equivalent to
"xz -7". Earlier a custom filter chain option didn't make
xz forget the -e option so the example was equivalent to
"xz -7e".
- Fixes and improvements to error handling.
- Various fixes to the man page.
* xzless: Fixed to work with "less" versions 448 and later.
* xzgrep: Made -h an alias for --no-filename.
* Include the previously missing debug/translation.bash which can
be useful for translators.
* Include a build script for Mac OS X. This has been in the Git
repository since 2010 but due to a mistake in Makefile.am the
script hasn't been included in a release tarball before.
5.0.4 (2012-06-22)
* liblzma:

4
README
View File

@@ -210,8 +210,8 @@ XZ Utils
# <Edit the .po file in the po directory.>
make -C po update-po
make install
bash debug/translations.bash | less
bash debug/translations.bash | less -S # For --list outputs
bash debug/translation.bash | less
bash debug/translation.bash | less -S # For --list outputs
Repeat the above as needed (no need to re-run configure though).

5
THANKS
View File

@@ -6,6 +6,7 @@ Some people have helped more, some less, but nevertheless everyone's help
has been important. :-) In alphabetical order:
- Mark Adler
- H. Peter Anvin
- Jeff Bastian
- Nelson H. F. Beebe
- Karl Berry
- Anders F. Björklund
@@ -19,6 +20,7 @@ has been important. :-) In alphabetical order:
- Daniel Mealha Cabrita
- Milo Casagrande
- Marek Černocký
- Tomer Chachamu
- Chris Donawa
- Andrew Dudman
- Markus Duft
@@ -47,6 +49,7 @@ has been important. :-) In alphabetical order:
- Bela Lubkin
- Gregory Margo
- Jim Meyering
- Conley Moorhous
- Rafał Mużyło
- Adrien Nader
- Hongbo Ni
@@ -58,8 +61,10 @@ has been important. :-) In alphabetical order:
- Diego Elio Pettenò
- Elbert Pol
- Mikko Pouru
- Pavel Raiskup
- Robert Readman
- Bernhard Reutner-Fischer
- Eric S. Raymond
- Cristian Rodríguez
- Christian von Roques
- Jukka Salmi

4
TODO
View File

@@ -12,10 +12,6 @@ Known bugs
it would be possible by switching from BT2/BT3/BT4 match finder to
HC3/HC4.
The code to detect number of CPU cores doesn't count hyperthreading
as multiple cores. In context of xz, it probably should.
Hyperthreading is good at least with p7zip.
XZ Utils compress some files significantly worse than LZMA Utils.
This is due to faster compression presets used by XZ Utils, and
can often be worked around by using "xz --extreme". With some files

View File

@@ -260,7 +260,7 @@ else
done
AC_MSG_RESULT([$enable_checks])
fi
if test "x$enable_checks_crc32" = xno ; then
if test "x$enable_check_crc32" = xno ; then
AC_MSG_ERROR([For now, the CRC32 check must always be enabled.])
fi
@@ -402,6 +402,12 @@ AC_ARG_ENABLE([scripts], [AC_HELP_STRING([--disable-scripts],
[], [enable_scripts=yes])
AM_CONDITIONAL([COND_SCRIPTS], [test x$enable_scripts != xno])
AC_ARG_ENABLE([doc], [AC_HELP_STRING([--disable-doc],
[do not install documentation files to docdir
(man pages will still be installed)])],
[], [enable_doc=yes])
AM_CONDITIONAL([COND_DOC], [test x$enable_doc != xno])
###############################################################################
# Checks for programs.
@@ -416,7 +422,7 @@ fi
echo
echo "Initializing Automake:"
AM_INIT_AUTOMAKE([1.10 foreign tar-v7 filename-length-max=99])
AM_INIT_AUTOMAKE([1.12 foreign tar-v7 filename-length-max=99 serial-tests])
AC_PROG_LN_S
AC_PROG_CC_C99
@@ -460,7 +466,7 @@ AM_CONDITIONAL([COND_SHARED], [test "x$enable_shared" != xno])
echo
echo "Initializing gettext:"
AM_GNU_GETTEXT_VERSION([0.16.1])
AM_GNU_GETTEXT_VERSION([0.18])
AM_GNU_GETTEXT([external])
###############################################################################
@@ -498,7 +504,7 @@ AC_TYPE_UINTPTR_T
AC_CHECK_SIZEOF([size_t])
# The command line tool can copy high resolution timestamps if such
# information is availabe in struct stat. Otherwise one second accuracy
# information is available in struct stat. Otherwise one second accuracy
# is used.
AC_CHECK_MEMBERS([
struct stat.st_atim.tv_nsec,
@@ -560,6 +566,7 @@ if test "$GCC" = yes ; then
for NEW_FLAG in \
-Wall \
-Wextra \
-Wvla \
-Wformat=2 \
-Winit-self \
-Wmissing-include-dirs \
@@ -624,7 +631,6 @@ AC_CONFIG_FILES([
po/Makefile.in
lib/Makefile
src/Makefile
src/liblzma/liblzma.pc
src/liblzma/Makefile
src/liblzma/api/Makefile
src/xz/Makefile

View File

@@ -5,6 +5,9 @@
## You can do whatever you want with this file.
##
EXTRA_DIST = \
translation.bash
noinst_PROGRAMS = \
repeat \
sync_flush \

View File

@@ -3,7 +3,7 @@ Debug tools
-----------
This directory contains a few tiny programs that may be helpful when
debugging LZMA Utils.
debugging XZ Utils.
These tools are not meant to be installed. Often one needs to edit
the source code a little to make the programs do the wanted things.

View File

@@ -13,14 +13,26 @@ mkdir -p Resources
# Abort immediately if something goes wrong.
set -e
GCC="gcc-4.2"
SDK="/Developer/SDKs/MacOSX10.5.sdk"
MDT="10.5"
GTT=i686-apple-darwin9
ARCHES1="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
ARCHES2="-arch ppc -arch i386"
PKGFORMAT="10.5" # xar
# avoid "unknown required load command: 0x80000022" from linking on Snow Leopard
uname -r | grep ^1 >/dev/null && LDFLAGS="$LDFLAGS -Wl,-no_compact_linkedit"
# Clean up if it was already configured.
[ -f Makefile ] && make distclean
# Build the regular fat program
CC="gcc-4.0" \
CFLAGS="-O2 -g -arch ppc -arch ppc64 -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4" \
../configure --disable-dependency-tracking --disable-xzdec --disable-lzmadec i686-apple-darwin8
CC="$GCC" \
CFLAGS="-O2 -g $ARCHES1 -isysroot $SDK -mmacosx-version-min=$MDT" \
../configure --disable-dependency-tracking --disable-xzdec --disable-lzmadec $GTT
make
@@ -32,9 +44,9 @@ make distclean
# Build the size-optimized program
CC="gcc-4.0" \
CFLAGS="-Os -g -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4" \
../configure --disable-dependency-tracking --disable-shared --disable-nls --disable-encoders --enable-small --disable-threads i686-apple-darwin8
CC="$GCC" \
CFLAGS="-Os -g $ARCHES2 -isysroot $SDK -mmacosx-version-min=$MDT" \
../configure --disable-dependency-tracking --disable-shared --disable-nls --disable-encoders --enable-small --disable-threads $GTT
make -C src/liblzma
make -C src/xzdec
@@ -44,6 +56,19 @@ cp -a ../extra Root/usr/local/share/doc/xz
make distclean
# Move development files to different package
test -d liblzma && rm -r liblzma
mkdir -p liblzma/usr/local
mv Root/usr/local/include liblzma/usr/local
mv Root/usr/local/lib liblzma/usr/local
mkdir -p Root/usr/local/lib
cp -p liblzma/usr/local/lib/liblzma.5.dylib Root/usr/local/lib
mkdir -p liblzma/usr/local/share/doc/xz
mv Root/usr/local/share/doc/xz/examples* liblzma/usr/local/share/doc/xz
# Strip debugging symbols and make relocatable
for bin in xz lzmainfo xzdec lzmadec; do
@@ -56,19 +81,12 @@ for lib in liblzma.5.dylib; do
install_name_tool -id @executable_path/../lib/liblzma.5.dylib Root/usr/local/lib/$lib
done
strip -S Root/usr/local/lib/liblzma.a
rm -f Root/usr/local/lib/liblzma.la
# Include pkg-config while making relocatable
sed -e 's|prefix=/usr/local|prefix=${pcfiledir}/../..|' < Root/usr/local/lib/pkgconfig/liblzma.pc > Root/liblzma.pc
mv Root/liblzma.pc Root/usr/local/lib/pkgconfig/liblzma.pc
# Create tarball, but without the HFS+ attrib
rmdir debug lib po src/liblzma/api src/liblzma src/lzmainfo src/scripts src/xz src/xzdec src tests
( cd Root/usr/local; COPY_EXTENDED_ATTRIBUTES_DISABLE=true COPYFILE_DISABLE=true tar cvjf ../../../XZ.tbz * )
( cd liblzma; COPY_EXTENDED_ATTRIBUTES_DISABLE=true COPYFILE_DISABLE=true tar cvjf ../liblzma.tbz ./usr/local )
# Include documentation files for package
@@ -80,12 +98,15 @@ cp -p ../COPYING Resources/License.txt
ID="org.tukaani.xz"
VERSION=`cd ..; sh build-aux/version.sh`
PACKAGEMAKER=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
$PACKAGEMAKER -r Root/usr/local -l /usr/local -e Resources -i $ID -n $VERSION -t XZ -o XZ.pkg -g 10.4 --verbose
$PACKAGEMAKER -r Root/usr/local -l /usr/local -e Resources -i $ID -n $VERSION -t XZ -o XZ.pkg -g $PKGFORMAT --verbose
$PACKAGEMAKER -r liblzma -w -k -i $ID.liblzma -n $VERSION -o liblzma.pkg -g $PKGFORMAT --verbose
# Put the package in a disk image
if [ "$PKGFORMAT" != "10.5" ]; then
hdiutil create -fs HFS+ -format UDZO -quiet -srcfolder XZ.pkg -ov XZ.dmg
hdiutil internet-enable -yes -quiet XZ.dmg
fi
echo
echo "Build completed successfully."

View File

@@ -24,7 +24,7 @@ liblzma_la_CPPFLAGS = \
-I$(top_srcdir)/src/liblzma/simple \
-I$(top_srcdir)/src/common \
-DTUKLIB_SYMBOL_PREFIX=lzma_
liblzma_la_LDFLAGS = -no-undefined -version-info 5:4:0
liblzma_la_LDFLAGS = -no-undefined -version-info 5:7:0
include $(srcdir)/common/Makefile.inc
include $(srcdir)/check/Makefile.inc
@@ -88,3 +88,23 @@ endif
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = liblzma.pc
EXTRA_DIST += liblzma.pc.in
pc_verbose = $(pc_verbose_@AM_V@)
pc_verbose_ = $(pc_verbose_@AM_DEFAULT_V@)
pc_verbose_0 = @echo " PC " $@;
liblzma.pc: $(srcdir)/liblzma.pc.in
$(AM_V_at)rm -f $@
$(pc_verbose)sed \
-e 's,@prefix[@],$(prefix),g' \
-e 's,@exec_prefix[@],$(exec_prefix),g' \
-e 's,@libdir[@],$(libdir),g' \
-e 's,@includedir[@],$(includedir),g' \
-e 's,@PACKAGE_URL[@],$(PACKAGE_URL),g' \
-e 's,@PACKAGE_VERSION[@],$(PACKAGE_VERSION),g' \
-e 's,@PTHREAD_CFLAGS[@],$(PTHREAD_CFLAGS),g' \
-e 's,@PTHREAD_LIBS[@],$(PTHREAD_LIBS),g' \
< $(srcdir)/liblzma.pc.in > $@ || { rm -f $@; exit 1; }
clean-local:
rm -f liblzma.pc

View File

@@ -318,6 +318,9 @@ extern LZMA_API(lzma_ret) lzma_block_header_encode(
* The size of the Block Header must have already been decoded with
* lzma_block_header_size_decode() macro and stored to block->header_size.
*
* The integrity check type from Stream Header must have been stored
* to block->check.
*
* block->filters must have been allocated, but they don't need to be
* initialized (possible existing filter options are not freed).
*

View File

@@ -22,7 +22,7 @@
*/
#define LZMA_VERSION_MAJOR 5
#define LZMA_VERSION_MINOR 0
#define LZMA_VERSION_PATCH 4
#define LZMA_VERSION_PATCH 7
#define LZMA_VERSION_STABILITY LZMA_VERSION_STABILITY_STABLE
#ifndef LZMA_VERSION_COMMIT

View File

@@ -20,7 +20,7 @@
#include "crc_macros.h"
// If you make any changes, do some bench marking! Seemingly unrelated
// If you make any changes, do some benchmarking! Seemingly unrelated
// changes can very easily ruin the performance (and very probably is
// very compiler dependent).
extern LZMA_API(uint32_t)

View File

@@ -6,7 +6,6 @@
/// \todo Crypto++ has x86 ASM optimizations. They use SSE so if they
/// are imported to liblzma, SSE instructions need to be used
/// conditionally to keep the code working on older boxes.
/// We could also support using some external libary for SHA-256.
//
// This code is based on the code found from 7-Zip, which has a modified
// version of the SHA-256 found from Crypto++ <http://www.cryptopp.com/>.
@@ -81,7 +80,7 @@ static const uint32_t SHA256_K[64] = {
static void
transform(uint32_t state[static 8], const uint32_t data[static 16])
transform(uint32_t state[8], const uint32_t data[16])
{
uint32_t W[16];
uint32_t T[8];

View File

@@ -26,6 +26,11 @@ struct lzma_coder_s {
SEQ_CODE,
} sequence;
/// If true, reject files that are unlikely to be .lzma files.
/// If false, more non-.lzma files get accepted and will give
/// LZMA_DATA_ERROR either immediately or after a few output bytes.
bool picky;
/// Position in the header fields
size_t pos;
@@ -68,13 +73,13 @@ alone_decode(lzma_coder *coder,
|= (size_t)(in[*in_pos]) << (coder->pos * 8);
if (++coder->pos == 4) {
if (coder->options.dict_size != UINT32_MAX) {
if (coder->picky && coder->options.dict_size
!= UINT32_MAX) {
// A hack to ditch tons of false positives:
// We allow only dictionary sizes that are
// 2^n or 2^n + 2^(n-1). LZMA_Alone created
// only files with 2^n, but accepts any
// dictionary size. If someone complains, this
// will be reconsidered.
// dictionary size.
uint32_t d = coder->options.dict_size - 1;
d |= d >> 2;
d |= d >> 3;
@@ -103,9 +108,9 @@ alone_decode(lzma_coder *coder,
// Another hack to ditch false positives: Assume that
// if the uncompressed size is known, it must be less
// than 256 GiB. Again, if someone complains, this
// will be reconsidered.
if (coder->uncompressed_size != LZMA_VLI_UNKNOWN
// than 256 GiB.
if (coder->picky
&& coder->uncompressed_size != LZMA_VLI_UNKNOWN
&& coder->uncompressed_size
>= (LZMA_VLI_C(1) << 38))
return LZMA_FORMAT_ERROR;
@@ -189,7 +194,7 @@ alone_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
extern lzma_ret
lzma_alone_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
uint64_t memlimit)
uint64_t memlimit, bool picky)
{
lzma_next_coder_init(&lzma_alone_decoder_init, next, allocator);
@@ -208,6 +213,7 @@ lzma_alone_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
}
next->coder->sequence = SEQ_PROPERTIES;
next->coder->picky = picky;
next->coder->pos = 0;
next->coder->options.dict_size = 0;
next->coder->options.preset_dict = NULL;
@@ -223,7 +229,7 @@ lzma_alone_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
extern LZMA_API(lzma_ret)
lzma_alone_decoder(lzma_stream *strm, uint64_t memlimit)
{
lzma_next_strm_init(lzma_alone_decoder_init, strm, memlimit);
lzma_next_strm_init(lzma_alone_decoder_init, strm, memlimit, false);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;

View File

@@ -16,7 +16,8 @@
#include "common.h"
extern lzma_ret lzma_alone_decoder_init(lzma_next_coder *next,
lzma_allocator *allocator, uint64_t memlimit);
extern lzma_ret lzma_alone_decoder_init(
lzma_next_coder *next, lzma_allocator *allocator,
uint64_t memlimit, bool picky);
#endif

View File

@@ -54,7 +54,7 @@ auto_decode(lzma_coder *coder, lzma_allocator *allocator,
coder->memlimit, coder->flags));
} else {
return_if_error(lzma_alone_decoder_init(&coder->next,
allocator, coder->memlimit));
allocator, coder->memlimit, true));
// If the application wants to know about missing
// integrity check or about the check in general, we

View File

@@ -30,14 +30,16 @@ lzma_lzma_preset(lzma_options_lzma *options, uint32_t preset)
options->lp = LZMA_LP_DEFAULT;
options->pb = LZMA_PB_DEFAULT;
options->dict_size = UINT32_C(1) << (uint8_t []){
18, 20, 21, 22, 22, 23, 23, 24, 25, 26 }[level];
static const uint8_t dict_pow2[]
= { 18, 20, 21, 22, 22, 23, 23, 24, 25, 26 };
options->dict_size = UINT32_C(1) << dict_pow2[level];
if (level <= 3) {
options->mode = LZMA_MODE_FAST;
options->mf = level == 0 ? LZMA_MF_HC3 : LZMA_MF_HC4;
options->nice_len = level <= 1 ? 128 : 273;
options->depth = (uint8_t []){ 4, 8, 24, 48 }[level];
static const uint8_t depths[] = { 4, 8, 24, 48 };
options->depth = depths[level];
} else {
options->mode = LZMA_MODE_NORMAL;
options->mf = LZMA_MF_BT4;

View File

@@ -4,14 +4,14 @@
.\" This file has been put into the public domain.
.\" You can do whatever you want with this file.
.\"
.TH LZMAINFO 1 "2010-09-27" "Tukaani" "XZ Utils"
.TH LZMAINFO 1 "2013-06-30" "Tukaani" "XZ Utils"
.SH NAME
lzmainfo \- show information stored in the .lzma file header
.SH SYNOPSIS
.B lzmainfo
.RB [ \-\-help ]
.RB [ \-\-version ]
.RI [ file ]...
.RI [ file... ]
.SH DESCRIPTION
.B lzmainfo
shows information stored in the

View File

@@ -109,7 +109,7 @@ while test $# -ne 0; do
files_with_matches=1;;
(-L | --files-witho*)
files_without_matches=1;;
(--no-f*)
(-h | --no-f*)
no_filename=1;;
(-V | --v | --ve | --ver | --vers | --versi | --versio | --version)
echo "$version" || exit 2
@@ -147,7 +147,9 @@ if test $# -eq 0; then
fi
exec 3>&1
res=0
# res=1 means that no file matched yet
res=1
for i; do
case $i in
@@ -194,8 +196,17 @@ for i; do
fi >&3 5>&-
)
r=$?
# fail occured previously, nothing worse can happen
test $res -gt 1 && continue
test "$xz_status" -eq 0 || test "$xz_status" -eq 2 \
|| test "$(kill -l "$xz_status" 2> /dev/null)" = "PIPE" || r=2
test $res -lt $r && res=$r
# still no match
test $r -eq 1 && continue
# 0 == match, >=2 == fail
res=$r
done
exit $res

View File

@@ -46,7 +46,7 @@ if test "${LESSMETACHARS+set}" != set; then
LESSMETACHARS="$space$tab$nl'"';*?"()<>[|&^`#\$%=~'
fi
if test "$(less -V | { read ver && echo ${ver#less }; })" -ge 429; then
if test "$(less -V | { read less ver re && echo ${ver}; })" -ge 429; then
# less 429 or later: LESSOPEN pipe will be used on
# standard input if $LESSOPEN begins with |-.
LESSOPEN="|-$xz -cdfq -- %s"

View File

@@ -4,15 +4,15 @@
.\"
.\" License: GNU GPLv2+
.\"
.TH XZMORE 1 "2010-09-27" "Tukaani" "XZ Utils"
.TH XZMORE 1 "2013-06-30" "Tukaani" "XZ Utils"
.SH NAME
xzmore, lzmore \- view xz or lzma compressed (text) files
.SH SYNOPSIS
.B xzmore
.RI [ "filename ..." ]
.RI [ file... ]
.br
.B lzmore
.RI [ "filename ..." ]
.RI [ file... ]
.SH DESCRIPTION
.B xzmore
is a filter which allows examination of

View File

@@ -37,15 +37,10 @@ static io_buf in_buf;
static io_buf out_buf;
/// Number of filters. Zero indicates that we are using a preset.
static size_t filters_count = 0;
static uint32_t filters_count = 0;
/// Number of the preset (0-9)
static size_t preset_number = 6;
/// If a preset is used (no custom filter chain) and preset_extreme is true,
/// a significantly slower compression is used to achieve slightly better
/// compression ratio.
static bool preset_extreme = false;
static uint32_t preset_number = LZMA_PRESET_DEFAULT;
/// Integrity check type
static lzma_check check;
@@ -63,11 +58,9 @@ coder_set_check(lzma_check new_check)
}
extern void
coder_set_preset(size_t new_preset)
static void
forget_filter_chain(void)
{
preset_number = new_preset;
// Setting a preset makes us forget a possibly defined custom
// filter chain.
while (filters_count > 0) {
@@ -80,10 +73,21 @@ coder_set_preset(size_t new_preset)
}
extern void
coder_set_preset(uint32_t new_preset)
{
preset_number &= ~LZMA_PRESET_LEVEL_MASK;
preset_number |= new_preset;
forget_filter_chain();
return;
}
extern void
coder_set_extreme(void)
{
preset_extreme = true;
preset_number |= LZMA_PRESET_EXTREME;
forget_filter_chain();
return;
}
@@ -98,6 +102,12 @@ coder_add_filter(lzma_vli id, void *options)
filters[filters_count].options = options;
++filters_count;
// Setting a custom filter chain makes us forget the preset options.
// This makes a difference if one specifies e.g. "xz -9 --lzma2 -e"
// where the custom filter chain resets the preset level back to
// the default 6, making the example equivalent to "xz -6e".
preset_number = LZMA_PRESET_DEFAULT;
return;
}
@@ -134,9 +144,6 @@ coder_set_compression_settings(void)
}
// Get the preset for LZMA1 or LZMA2.
if (preset_extreme)
preset_number |= LZMA_PRESET_EXTREME;
if (lzma_lzma_preset(&opt_lzma, preset_number))
message_bug();
@@ -193,9 +200,9 @@ coder_set_compression_settings(void)
}
if (memory_usage > memory_limit) {
// If --no-auto-adjust was used or we didn't find LZMA1 or
// If --no-adjust was used or we didn't find LZMA1 or
// LZMA2 as the last filter, give an error immediately.
// --format=raw implies --no-auto-adjust.
// --format=raw implies --no-adjust.
if (!opt_auto_adjust || opt_format == FORMAT_RAW)
memlimit_too_small(memory_usage);

View File

@@ -46,7 +46,7 @@ extern bool opt_auto_adjust;
extern void coder_set_check(lzma_check check);
/// Set preset number
extern void coder_set_preset(size_t new_preset);
extern void coder_set_preset(uint32_t new_preset);
/// Enable extreme mode
extern void coder_set_extreme(void);

View File

@@ -41,9 +41,10 @@ static bool warn_fchown;
static bool try_sparse = true;
#ifndef TUKLIB_DOSLIKE
/// File status flags of standard output. This is used by io_open_dest()
/// and io_close_dest().
static int stdout_flags = 0;
/// Original file status flags of standard output. This is used by
/// io_open_dest() and io_close_dest() to save and restore the flags.
static int stdout_flags;
static bool restore_stdout_flags = false;
#endif
@@ -397,10 +398,6 @@ io_open_src_real(file_pair *pair)
was_symlink = true;
# elif defined(__NetBSD__)
// As of 2010-09-05, NetBSD doesn't document what errno is
// used with O_NOFOLLOW. It is EFTYPE though, and I
// understood that is very unlikely to change even though
// it is undocumented.
if (errno == EFTYPE)
was_symlink = true;
@@ -441,7 +438,7 @@ io_open_src_real(file_pair *pair)
flags &= ~O_NONBLOCK;
if (fcntl(pair->src_fd, F_SETFL, flags))
if (fcntl(pair->src_fd, F_SETFL, flags) == -1)
goto error_msg;
}
#endif
@@ -634,11 +631,11 @@ io_open_dest_real(file_pair *pair)
if (!S_ISREG(pair->dest_st.st_mode))
return false;
const int flags = fcntl(STDOUT_FILENO, F_GETFL);
if (flags == -1)
stdout_flags = fcntl(STDOUT_FILENO, F_GETFL);
if (stdout_flags == -1)
return false;
if (flags & O_APPEND) {
if (stdout_flags & O_APPEND) {
// Creating a sparse file is not possible
// when O_APPEND is active (it's used by
// shell's >> redirection). As I understand
@@ -657,12 +654,14 @@ io_open_dest_real(file_pair *pair)
return false;
if (fcntl(STDOUT_FILENO, F_SETFL,
stdout_flags & ~O_APPEND))
stdout_flags & ~O_APPEND)
== -1)
return false;
// Remember the flags so that io_close_dest()
// can restore them.
stdout_flags = flags;
// Disabling O_APPEND succeeded. Mark
// that the flags should be restored
// in io_close_dest().
restore_stdout_flags = true;
} else if (lseek(STDOUT_FILENO, 0, SEEK_CUR)
!= pair->dest_st.st_size) {
@@ -703,13 +702,12 @@ io_close_dest(file_pair *pair, bool success)
{
#ifndef TUKLIB_DOSLIKE
// If io_open_dest() has disabled O_APPEND, restore it here.
if (stdout_flags != 0) {
if (restore_stdout_flags) {
assert(pair->dest_fd == STDOUT_FILENO);
const int fail = fcntl(STDOUT_FILENO, F_SETFL, stdout_flags);
stdout_flags = 0;
restore_stdout_flags = false;
if (fail) {
if (fcntl(STDOUT_FILENO, F_SETFL, stdout_flags) == -1) {
message_error(_("Error restoring the O_APPEND flag "
"to standard output: %s"),
strerror(errno));
@@ -882,7 +880,7 @@ io_write_buf(file_pair *pair, const uint8_t *buf, size_t size)
if (amount == -1) {
if (errno == EINTR) {
if (user_abort)
return -1;
return true;
continue;
}

View File

@@ -203,6 +203,20 @@ parse_indexes(xz_file_info *xfi, file_pair *pair)
goto error;
}
// Check that the Stream Footer doesn't specify something
// that we don't support. This can only happen if the xz
// version is older than liblzma and liblzma supports
// something new.
//
// It is enough to check Stream Footer. Stream Header must
// match when it is compared against Stream Footer with
// lzma_stream_flags_compare().
if (footer_flags.version != 0) {
message_error("%s: %s", pair->src_name,
message_strm(LZMA_OPTIONS_ERROR));
goto error;
}
// Check that the size of the Index field looks sane.
lzma_vli index_size = footer_flags.backward_size;
if ((lzma_vli)(pos) < index_size + LZMA_STREAM_HEADER_SIZE) {
@@ -429,7 +443,19 @@ parse_block_header(file_pair *pair, const lzma_index_iter *iter,
switch (lzma_block_compressed_size(&block,
iter->block.unpadded_size)) {
case LZMA_OK:
break;
// Validate also block.uncompressed_size if it is present.
// If it isn't present, there's no need to set it since
// we aren't going to actually decompress the Block; if
// we were decompressing, then we should set it so that
// the Block decoder could validate the Uncompressed Size
// that was stored in the Index.
if (block.uncompressed_size == LZMA_VLI_UNKNOWN
|| block.uncompressed_size
== iter->block.uncompressed_size)
break;
// If the above fails, the file is corrupt so
// LZMA_DATA_ERROR is a good error code.
case LZMA_DATA_ERROR:
// Free the memory allocated by lzma_block_header_decode().

View File

@@ -77,17 +77,19 @@ signals_init(void)
sigaddset(&hooked_signals, message_progress_sigs[i]);
#endif
struct sigaction sa;
// Using "my_sa" because "sa" may conflict with a sockaddr variable
// from system headers on Solaris.
struct sigaction my_sa;
// All the signals that we handle we also blocked while the signal
// handler runs.
sa.sa_mask = hooked_signals;
my_sa.sa_mask = hooked_signals;
// Don't set SA_RESTART, because we want EINTR so that we can check
// for user_abort and cleanup before exiting. We block the signals
// for which we have established a handler when we don't want EINTR.
sa.sa_flags = 0;
sa.sa_handler = &signal_handler;
my_sa.sa_flags = 0;
my_sa.sa_handler = &signal_handler;
for (size_t i = 0; i < ARRAY_SIZE(sigs); ++i) {
// If the parent process has left some signals ignored,
@@ -98,7 +100,7 @@ signals_init(void)
continue;
// Establish the signal handler.
if (sigaction(sigs[i], &sa, NULL))
if (sigaction(sigs[i], &my_sa, NULL))
message_signal_handler();
}

View File

@@ -232,7 +232,7 @@ suffix_set(const char *suffix)
// Empty suffix and suffixes having a directory separator are
// rejected. Such suffixes would break things later.
if (suffix[0] == '\0' || has_dir_sep(suffix))
message_fatal(_("%s: Invalid filename suffix"), optarg);
message_fatal(_("%s: Invalid filename suffix"), suffix);
// Replace the old custom_suffix (if any) with the new suffix.
free(custom_suffix);

View File

@@ -26,9 +26,19 @@ xrealloc(void *ptr, size_t size)
{
assert(size > 0);
// Save ptr so that we can free it if realloc fails.
// The point is that message_fatal ends up calling stdio functions
// which in some libc implementations might allocate memory from
// the heap. Freeing ptr improves the chances that there's free
// memory for stdio functions if they need it.
void *p = ptr;
ptr = realloc(ptr, size);
if (ptr == NULL)
message_fatal("%s", strerror(errno));
if (ptr == NULL) {
const int saved_errno = errno;
free(p);
message_fatal("%s", strerror(saved_errno));
}
return ptr;
}

View File

@@ -5,16 +5,17 @@
.\" This file has been put into the public domain.
.\" You can do whatever you want with this file.
.\"
.TH XZ 1 "2012-05-27" "Tukaani" "XZ Utils"
.TH XZ 1 "2013-06-21" "Tukaani" "XZ Utils"
.
.SH NAME
xz, unxz, xzcat, lzma, unlzma, lzcat \- Compress or decompress .xz and .lzma files
.
.SH SYNOPSIS
.B xz
.RI [ option ]...
.RI [ file ]...
.PP
.RI [ option... ]
.RI [ file... ]
.
.SH COMMAND ALIASES
.B unxz
is equivalent to
.BR "xz \-\-decompress" .
@@ -708,7 +709,7 @@ be dramatically higher than that of the single-threaded mode.
DecMem contains the decompressor memory requirements.
That is, the compression settings determine
the memory requirements of the decompressor.
The exact decompressor memory usage is slighly more than
The exact decompressor memory usage is slightly more than
the LZMA2 dictionary size, but the values in the table
have been rounded up to the next full MiB.
.RE
@@ -897,11 +898,14 @@ if threading will be enabled by default.
.SS "Custom compressor filter chains"
A custom filter chain allows specifying
the compression settings in detail instead of relying on
the settings associated to the preset levels.
the settings associated to the presets.
When a custom filter chain is specified,
the compression preset level options
(\fB\-0\fR ... \fB\-9\fR and \fB\-\-extreme\fR) are
silently ignored.
preset options (\fB\-0\fR ... \fB\-9\fR and \fB\-\-extreme\fR)
earlier on the command line are forgotten.
If a preset option is specified
after one or more custom filter chain options,
the new preset takes effect and
the custom filter chain options specified earlier are forgotten.
.PP
A filter chain is comparable to piping on the command line.
When compressing, the uncompressed input goes to the first filter,
@@ -934,6 +938,15 @@ Extra commas in
are ignored.
Every option has a default value, so you need to
specify only those you want to change.
.PP
To see the whole filter chain and
.IR options ,
use
.B "xz \-vv"
(that is, use
.B \-\-verbose
twice).
This works also for viewing the filter chain options used by presets.
.TP
\fB\-\-lzma1\fR[\fB=\fIoptions\fR]
.PD 0
@@ -976,13 +989,12 @@ The only supported modifier is currently
.BR e ,
which matches
.BR \-\-extreme .
The default
.I preset
is
.BR 6 ,
from which the default values for the rest of the LZMA1 or LZMA2
If no
.B preset
is specified, the default values of LZMA1 or LZMA2
.I options
are taken.
are taken from the preset
.BR 6 .
.TP
.BI dict= size
Dictionary (history buffer)
@@ -1578,7 +1590,7 @@ is supported only together with
.BR \-\-info\-memory ,
and
.BR \-\-list .
It will be supported for normal compression and
It will be supported for compression and
decompression in the future.
.
.SS Version
@@ -2179,14 +2191,15 @@ The output can vary even between different
builds of the same XZ Utils version,
if different build options are used.
.PP
The above means that implementing
The above means that once
.B \-\-rsyncable
to create rsyncable
.B .xz
files is not going to happen without
freezing a part of the encoder
implementation, which can then be used with
.BR \-\-rsyncable .
has been implemented,
the resulting files won't necessarily be rsyncable
unless both old and new files have been compressed
with the same xz version.
This problem can be fixed if a part of the encoder
implementation is frozen to keep rsyncable output
stable across xz versions.
.
.SS "Embedded .xz decompressors"
Embedded

View File

@@ -59,7 +59,14 @@ endif
if COND_LZMADEC
bin_PROGRAMS += lzmadec
# FIXME: If xzdec is disabled, this will create a dangling symlink.
# Create the symlink lzmadec.1->xzdec.1 only if xzdec.1 was installed.
# This is better than creating a dangling symlink, especially
# because creating the link may fail due to the directory being missing.
#
# FIXME: The correct solution would be to install xzdec.1 as lzmadec.1
# but I don't know what is the sane way to do it and since this is a bit
# unusual situation anyway, it's not that important.
if COND_XZDEC
install-data-hook:
cd $(DESTDIR)$(mandir)/man1 && \
target=`echo xzdec | sed '$(transform)'` && \
@@ -72,3 +79,4 @@ uninstall-hook:
link=`echo lzmadec | sed '$(transform)'` && \
rm -f $$link.1
endif
endif

View File

@@ -4,17 +4,17 @@
.\" This file has been put into the public domain.
.\" You can do whatever you want with this file.
.\"
.TH XZDEC 1 "2010-09-27" "Tukaani" "XZ Utils"
.TH XZDEC 1 "2013-06-30" "Tukaani" "XZ Utils"
.SH NAME
xzdec, lzmadec \- Small .xz and .lzma decompressors
.SH SYNOPSIS
.B xzdec
.RI [ option ]...
.RI [ file ]...
.RI [ option... ]
.RI [ file... ]
.br
.B lzmadec
.RI [ option ]...
.RI [ file ]...
.RI [ option... ]
.RI [ file... ]
.SH DESCRIPTION
.B xzdec
is a liblzma-based decompression-only tool for

View File

@@ -62,13 +62,13 @@ help(void)
{
printf(
"Usage: %s [OPTION]... [FILE]...\n"
"Uncompress files in the ." TOOL_FORMAT " format to the standard output.\n"
"Decompress files in the ." TOOL_FORMAT " format to standard output.\n"
"\n"
" -c, --stdout (ignored)\n"
" -d, --decompress (ignored)\n"
" -k, --keep (ignored)\n"
" -d, --decompress (ignored, only decompression is supported)\n"
" -k, --keep (ignored, files are never deleted)\n"
" -c, --stdout (ignored, output is always written to standard output)\n"
" -q, --quiet specify *twice* to suppress errors\n"
" -Q, --no-warn (ignored)\n"
" -Q, --no-warn (ignored, the exit status 2 is never used)\n"
" -h, --help display this help and exit\n"
" -V, --version display the version number and exit\n"
"\n"

View File

@@ -13,7 +13,8 @@ EXTRA_DIST = \
test_scripts.sh \
bcj_test.c \
compress_prepared_bcj_sparc \
compress_prepared_bcj_x86
compress_prepared_bcj_x86 \
xzgrep_expected_output
AM_CPPFLAGS = \
-I$(top_srcdir)/src/common \
@@ -52,4 +53,5 @@ TESTS += test_scripts.sh
endif
clean-local:
-rm -f compress_generated_*
-rm -f compress_generated_* \
xzgrep_test_output xzgrep_test_1.xz xzgrep_test_2.xz

View File

@@ -1,52 +0,0 @@
///////////////////////////////////////////////////////////////////////////////
//
/// \file test_block.c
/// \brief Tests Block coders
//
// Author: Lasse Collin
//
// This file has been put into the public domain.
// You can do whatever you want with this file.
//
///////////////////////////////////////////////////////////////////////////////
#include "tests.h"
static uint8_t text[] = "Hello world!";
static uint8_t buffer[4096];
static lzma_options_block block_options;
static lzma_stream strm = LZMA_STREAM_INIT;
static void
test1(void)
{
}
int
main()
{
lzma_init();
block_options = (lzma_options_block){
.check_type = LZMA_CHECK_NONE,
.has_eopm = true,
.has_uncompressed_size_in_footer = false,
.has_backward_size = false,
.handle_padding = false,
.total_size = LZMA_VLI_UNKNOWN,
.compressed_size = LZMA_VLI_UNKNOWN,
.uncompressed_size = LZMA_VLI_UNKNOWN,
.header_size = 5,
};
block_options.filters[0].id = LZMA_VLI_UNKNOWN;
block_options.filters[0].options = NULL;
lzma_end(&strm);
return 0;
}

View File

@@ -12,16 +12,18 @@
# If scripts weren't built, this test is skipped.
XZ=../src/xz/xz
XZDIFF=../src/scripts/xzdiff
test -x "$XZ" || XZ=
test -x "$XZDIFF" || XZDIFF=
if test -z "$XZ" || test -z "$XZDIFF"; then
XZGREP=../src/scripts/xzgrep
for i in XZ XZDIFF XZGREP; do
eval test -x "\$$i" && continue
(exit 77)
exit 77
fi
done
PATH=`pwd`/../src/xz:$PATH
export PATH
test -z "$srcdir" && srcdir=.
preimage=$srcdir/files/good-1-check-crc32.xz
samepostimage=$srcdir/files/good-1-check-crc64.xz
otherpostimage=$srcdir/files/good-1-lzma2-1.xz
@@ -50,5 +52,25 @@ if test "$status" != 2 ; then
exit 1
fi
# The exit status must be 0 when a match was found at least from one file,
# and 1 when no match was found in any file.
cp "$srcdir/files/good-1-lzma2-1.xz" xzgrep_test_1.xz
cp "$srcdir/files/good-2-lzma2.xz" xzgrep_test_2.xz
for pattern in el Hello NOMATCH; do
for opts in "" "-l" "-h" "-H"; do
echo "=> xzgrep $opts $pattern <="
"$XZGREP" $opts $pattern xzgrep_test_1.xz xzgrep_test_2.xz
echo retval $?
done
done > xzgrep_test_output 2>&1
if cmp -s "$srcdir/xzgrep_expected_output" xzgrep_test_output ; then
:
else
echo "unexpected output from xzgrep"
(exit 1)
exit 1
fi
(exit 0)
exit 0

View File

@@ -0,0 +1,39 @@
=> xzgrep el <=
xzgrep_test_1.xz:elit, sed do eiusmod tempor incididunt ut
xzgrep_test_1.xz:in voluptate velit esse cillum dolore eu
xzgrep_test_2.xz:Hello
retval 0
=> xzgrep -l el <=
xzgrep_test_1.xz
xzgrep_test_2.xz
retval 0
=> xzgrep -h el <=
elit, sed do eiusmod tempor incididunt ut
in voluptate velit esse cillum dolore eu
Hello
retval 0
=> xzgrep -H el <=
xzgrep_test_1.xz:elit, sed do eiusmod tempor incididunt ut
xzgrep_test_1.xz:in voluptate velit esse cillum dolore eu
xzgrep_test_2.xz:Hello
retval 0
=> xzgrep Hello <=
xzgrep_test_2.xz:Hello
retval 0
=> xzgrep -l Hello <=
xzgrep_test_2.xz
retval 0
=> xzgrep -h Hello <=
Hello
retval 0
=> xzgrep -H Hello <=
xzgrep_test_2.xz:Hello
retval 0
=> xzgrep NOMATCH <=
retval 1
=> xzgrep -l NOMATCH <=
retval 1
=> xzgrep -h NOMATCH <=
retval 1
=> xzgrep -H NOMATCH <=
retval 1