Charles Wilson [Sun, 19 Jul 2009 23:10:39 +0000 (19:10 -0400)]
Merge r1084 from trunk:
Add custom _dosmaperr() implementation (copied from
PostgreSQL) and use it instead of the undocumented
Windows CRT function (which isn't available in all versions
of Windows CRT). Rename it to la_dosmaperr() to avoid
any name conflicts with the "standard" one.
Tim Kientzle [Fri, 12 Jun 2009 03:24:41 +0000 (23:24 -0400)]
It appears that liblzma truly does use the 'memlimit' argument
to lzma_stream_decoder() and lzma_alone_decoder() as an upper
limit on the amount of memory they will allocate, allocating
less if the stream uses less. So I don't see any reason to
not make this value very large.
Tim Kientzle [Mon, 25 May 2009 05:02:50 +0000 (01:02 -0400)]
Merge r1093 from trunk: Correctly account for
"extra data" field when reading gzip headers.
In particular, this fixes reading gzip files that
have been signed with the OpenBSD "gzsig" program.
Tim Kientzle [Thu, 7 May 2009 22:55:24 +0000 (18:55 -0400)]
Merge r1068 from trunk: This partially reverts r868, which
broke tar handling of end-of-file when reading from a pipe.
With this change, tar once again flushes input from a pipe
which avoids SIGPIPE getting sent upstream.
Tim Kientzle [Sun, 5 Apr 2009 05:24:45 +0000 (01:24 -0400)]
Rename the tests to a consistent style:
Test for -L = test_option_L_upper
Test for -B = test_option_B_upper
Test for -l = test_option_l
This should be reasonably legible and be sane
on case-insensitive systems.
Tim Kientzle [Sun, 5 Apr 2009 04:40:12 +0000 (00:40 -0400)]
Two new tests:
test_cmdline exercises some boundary cases in the cmdline parsing,
including ambiguous long options, missing arguments, etc.
test_option_C_upper exercises the -C option (the _upper is
to prevent filename conflicts with test_option_c on case-insensitive
systems).
Tim Kientzle [Sat, 4 Apr 2009 22:44:43 +0000 (18:44 -0400)]
Dynamically size the buffer used for getpwuid_r and
getgrgid_r. We allocate an initial buffer early
and then double it whenever we learn it is too small.
By keeping the buffer in the persistent cache state,
the cost should be very small.
Tim Kientzle [Thu, 2 Apr 2009 01:38:45 +0000 (21:38 -0400)]
The distribution contains a pre-built list.h that includes
test_windows.c. By default, cmake seems to pick up the
existing list.h instead of remaking it, so we'd better
always compile test_windows.c. It includes enough compile
guards that this is safe on all platforms.
Tim Kientzle [Wed, 1 Apr 2009 22:55:09 +0000 (18:55 -0400)]
Issue 18: Limit compression-level to 6 within the
write options processing. Restore the test to
exercise compression-level=9, which should work now
(even though the results should not be any different
than compression-level=6). In particular, all compression
writers should now accept a compression-level option
with values from 0 through 9.
Tim Kientzle [Wed, 1 Apr 2009 19:54:33 +0000 (15:54 -0400)]
Some cleanup and testing of the XZ and LZMA writer:
* Fix the options parser to use a separate config object.
* Set the compression code and name at setup time.
* Copy the gzip/bzip2 write tests to create new XZ and LZMA write tests
Tim Kientzle [Wed, 1 Apr 2009 07:36:15 +0000 (03:36 -0400)]
Have xz/lzma support fall back to the unxz/unlzma command-line utilities
if the libraries were unavailable at build time. Have the public setup
functions return ARCHIVE_WARN in this case. Update the tests to
detect this situation and simply skip the appropriate tests.
TODO: Update one of these tests to use systemf() to try
running the command-line tool; if we can find it, run the
test anyway. That will give us some coverage of the fallback
handling.
Tim Kientzle [Wed, 1 Apr 2009 07:32:55 +0000 (03:32 -0400)]
If the necessary libraries are missing for gzip/bzip2 writing,
have the public setup function return ARCHIVE_FATAL and a suitable
error message. Alter the write tests to simply skip if the
initial compression setup returns ARCHIVE_FATAL. This should
fix these tests on platforms without zlib/bzlib.
Tim Kientzle [Wed, 1 Apr 2009 05:48:09 +0000 (01:48 -0400)]
archive_read_support_compression_bzip2() now supports fallback to
bunzip2 command-line program if it is compiled without bzlib support.
It returns ARCHIVE_WARN in this case, so that the test harness
(or other clients) can detect this degraded state.
Tim Kientzle [Wed, 1 Apr 2009 04:52:48 +0000 (00:52 -0400)]
archive_read_support_compression_gzip() now returns ARCHIVE_WARN
if decompression is being handled via an external program.
This simplifies the many tests that need to check whether we have
full gzip support or not. While reworking these tests, I've also
updated the style of many of them to use assertEqualFoo() instead
of plain assert() and fixed an oversight in main.c that caused it
to print an alarm if a single skip was processed multiple times.
Tim Kientzle [Wed, 1 Apr 2009 01:49:08 +0000 (21:49 -0400)]
1. Make the UTF-8 <-> Unicode conversions more robust by
handling surrogate pairs correctly. This should be general
enough (and portable enough) to be used on all platforms,
even Windows, so I've removed the Windows-specific versions
of this.
2. On POSIX systems, prefer the thread-safe wcrtomb()
for Unicode <-> current locale conversions when it's
available; fall back to wctomb() where necessary.
Tim Kientzle [Wed, 1 Apr 2009 01:42:20 +0000 (21:42 -0400)]
Improve the error handling here just a bit by harvesting
the child (and collecting its exit status) whenever the
child closes stdout. By not waiting until archive_close,
we catch most cases of a failed child at the first
real I/O (usually archive_read_next_header).
I'm still investigating whether it makes sense to try
pushing this even earlier... It may be possible to
detect some child failures as early as read_open() time.
Tim Kientzle [Sun, 29 Mar 2009 07:16:15 +0000 (03:16 -0400)]
Only return ARCHIVE_WARN from set_options if no format AND no compressor
can use these options.
Clear errors on entry to compressor_options and format_options in an
attempt to reduce the redundancy a bit. This needs to be refactored
somewhat to improve the error messages.
Tim Kientzle [Sun, 29 Mar 2009 06:34:42 +0000 (02:34 -0400)]
More work on extending test coverage...
Test the gzip compressor more carefully, including exercising
the compress-level option. Fix the option setter to use
a separate config data structure so that configuration options
such as compression level can be set before the compressor
is actually initialized.
Tim Kientzle [Sun, 29 Mar 2009 04:31:57 +0000 (00:31 -0400)]
Improve test coverage:
* Add new tests of archive_{read,write}_open_{fd,FILE,filename}
* Refactor the corresponding code to reduce the number of unreachable
cases and eliminate a lot of duplicated code. In particular,
{read,write}_open_filename now simply invoke {read,write}_open_fd to
handle handle the fallback case of reading stdin when called with an
empty filename.
* Eliminate the unnecessary "open" callbacks; "open" callbacks are
never needed (I plan to eliminate them from the API someday).
Tim Kientzle [Thu, 26 Mar 2009 06:23:14 +0000 (02:23 -0400)]
Rename --format-options to simply --options, since these are options
for filter/compressors as well as format handlers.
On write, set options before we open the file.