Tim Kientzle [Wed, 15 Apr 2009 19:29:44 +0000 (15:29 -0400)]
Manpage touchups:
* Fix tar.1 to properly format the substitution arguments
* Fix mdoc2wiki.awk to render .It Pa and .It Ev in bold
* Update the translated docs on the wiki.
Tim Kientzle [Tue, 14 Apr 2009 02:05:39 +0000 (22:05 -0400)]
Document the new "raw" format reader and fill in some
other missing documentation for mtree, lzma, and xz
readers. Also, document the new convention that
setup functions return ARCHIVE_WARN if that compression
or format is supported only through an external program.
The test suite really needs this; other people might
find it amusing.
Tim Kientzle [Tue, 14 Apr 2009 02:05:39 +0000 (22:05 -0400)]
Document the new "raw" format reader and fill in some
other missing documentation for mtree, lzma, and xz
readers. Also, document the new convention that
setup functions return ARCHIVE_WARN if that compression
or format is supported only through an external program.
The test suite really needs this; other people might
find it amusing.
Tim Kientzle [Tue, 14 Apr 2009 01:29:55 +0000 (21:29 -0400)]
ARCHIVE_EOF is positive. I'm going to change this in libarchive 3.0.
Until then, use an explicit -1 here to flag EOF, to distinguish it
from a valid code return.
Tim Kientzle [Tue, 14 Apr 2009 01:22:43 +0000 (21:22 -0400)]
Rework the read_ahead interface slightly to provide a "best-effort"
read_ahead_lenient() function.
While I'm here, fix two rather bizarre bugs:
1) Increment the position in the "uncompressed" stream only
when skipping in the top filter, not within read_filter_skip.
2) When we simulate a skip by reading ahead, read against the
current filter, not the top filter.
Fortunately, neither of these bugs are visible in the current library,
because no filter currently passes skip requests through to upstream
filters, so skip processing always happens only at the top filter.
Tim Kientzle [Mon, 13 Apr 2009 21:08:53 +0000 (17:08 -0400)]
First real attempt to convert all mdoc manpages to Wiki syntax.
Including the awk script I'm using and updates to the doc generator
to produce the Wiki versions as part of the regular deployment.
Tim Kientzle [Fri, 10 Apr 2009 05:36:25 +0000 (01:36 -0400)]
Fix a number of memory leaks:
* write_set_compression_{gzip,bzip2,lzma,xz} need to call finish
even if nothing is ever written so that the config data
can be cleaned up. Set the finish entry in the initial
setup function (instead of the init function), have the
finish function only close out the compression if there
is a state, update the tests to exercise set up and
tear down without any intermediate open and/or writing.
* read_open_{fd,filename} would leak data if the fd or file
didn't exist. Do all of the fd/file checks before trying
to allocate data.
* archive_entry leaked the sourcepath field
* support_format_mtree leaked the list of active default fields
* several tests leaked archive_entry objects
* test/read_open_memory has a special mode to exercise
providing a minimal set of callbacks; unfortunately it
omitted the close callback, which caused a leak.
* Add a chokepoint to test/main.c where we can do something
for every assertion. I temporarily added a line # printf here
to help identify the location of certain crashes.
All of this needs to be merged to libarchive/2.7 branch.
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).