Commit Graph

817 Commits

Author SHA1 Message Date
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
Lasse Collin 20778053a0 xz: Update man page date to match the latest update. 2012-06-22 14:36:16 +03:00
Lasse Collin 2cefa84af6 Bump version and soname for 5.0.4. 2012-06-22 10:25:43 +03:00
Lasse Collin 433fec191a Update NEWS for 5.0.4. 2012-06-22 10:25:09 +03:00
Lasse Collin 711fa680f5 Docs: Language fix to 01_compress_easy.c.
Thanks to Jonathan Nieder.
2012-06-22 09:31:42 +03:00
Lasse Collin 3d7ab1dc61 Fix the top-level Makefile.am for the new example programs. 2012-06-22 09:31:42 +03:00
Lasse Collin ef8b8e5f11 Docs: Add new example programs.
These have more comments than the old examples and
human-readable error messages. More tutorial-like examples
are needed but these are a start.
2012-06-22 09:31:42 +03:00
Lasse Collin 75c149bc80 Docs: Move xz_pipe_comp.c and xz_pipe_decomp.c to doc/examples_old.
It is good to keep these around to so that if someone has
copied the decompressor bug from xz_pipe_decomp.c he has
an example how to easily fix it.
2012-06-22 09:31:42 +03:00
Lasse Collin 456307ebf9 Docs: Fix a bug in xz_pipe_decomp.c example program. 2012-06-22 09:31:42 +03:00
Lasse Collin 4c310b8a29 Translations: Update the Italian translation.
Thanks to Milo Casagrande.
2012-05-31 15:53:25 +03:00
Lasse Collin ec32b79366 Translations: Update the French translation.
Thanks to Adrien Nader.
2012-05-30 23:15:07 +03:00
Lasse Collin dd06f40e4d Translations: Update the German translation. 2012-05-29 22:27:00 +03:00
Lasse Collin c66808d1f5 Translations: Update Polish translation. 2012-05-29 22:12:57 +03:00
Lasse Collin 556c22dfed Preliminary NEWS for 5.0.4. 2012-05-29 13:10:36 +03:00
Lasse Collin dd13b66bf5 liblzma: Fix possibility of incorrect LZMA_BUF_ERROR.
lzma_code() could incorrectly return LZMA_BUF_ERROR if
all of the following was true:

  - The caller knows how many bytes of output to expect
    and only provides that much output space.

  - When the last output bytes are decoded, the
    caller-provided input buffer ends right before
    the LZMA2 end of payload marker. So LZMA2 won't
    provide more output anymore, but it won't know it
    yet and thus won't return LZMA_STREAM_END yet.

  - A BCJ filter is in use and it hasn't left any
    unfiltered bytes in the temp buffer. This can happen
    with any BCJ filter, but in practice it's more likely
    with filters other than the x86 BCJ.

Another situation where the bug can be triggered happens
if the uncompressed size is zero bytes and no output space
is provided. In this case the decompression can fail even
if the whole input file is given to lzma_code().

A similar bug was fixed in XZ Embedded on 2011-09-19.
2012-05-29 12:54:47 +03:00
Lasse Collin a0223bf796 Update THANKS. 2012-05-29 12:54:47 +03:00
Lasse Collin 86e57e4bfe xz: Don't show a huge number in -vv when memory limit is disabled. 2012-05-29 12:54:47 +03:00
Lasse Collin 13e44a94da xz: Document the "summary" lines of --robot -lvv.
This documents only the columns that are in v5.0.
The new columns added in the master branch aren't
necessarily stable yet.
2012-05-29 12:54:22 +03:00
Lasse Collin 2f90345e13 xz: Fix output of verbose --robot --list modes.
It printed the filename in "filename (x/y)" format
which it obviously shouldn't do in robot mode.
2012-05-29 12:54:22 +03:00
Lasse Collin 8d4864f53f Update THANKS. 2012-05-24 19:16:37 +03:00
Lasse Collin 35e9c58abb Docs: Cleanup line wrapping a bit. 2012-05-24 19:16:37 +03:00
Benno Schulenberg 532b3e4c56 Fix a few typos and add some missing articles in some documents.
Also hyphenate several compound adjectives.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2012-05-24 19:16:37 +03:00
Lasse Collin afb6ce8c82 Windows: Update notes about static linking with MSVC. 2012-05-24 19:16:14 +03:00
Lasse Collin 7c3ba2ed5c liblzma: Remove outdated comments. 2012-05-24 19:16:14 +03:00
Lasse Collin f55db9c187 DOS: Link against DJGPP's libemu to support FPU emulation.
This way xz should work on 386SX and 486SX. Floating point
only is needed for verbose output in xz.
2012-05-24 19:16:14 +03:00