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.
Tim Kientzle [Thu, 26 Mar 2009 06:16:47 +0000 (02:16 -0400)]
Succeed if we're handed an empty or NULL option argument.
In particular, this simplifies clients such as bsdtar, which can
now simply call archive_read_set_options() with a fixed string
that may be NULL.
Tim Kientzle [Thu, 26 Mar 2009 06:14:29 +0000 (02:14 -0400)]
Return ARCHIVE_OK for "indent" and "use-set" options, which
are consumed but don't use the 'keybit' mechanism. Without
this, mtree options returned ARCHIVE_WARN ("not used") for
these options.
When generating list.h file, Do not check CMAKE_CURRENT_LIST_FILE
at GENERATE_LIST_H macro. It will have a wrong path
if GENERATE_LIST_H macro is called from other CMakeList.txt.
Tim Kientzle [Tue, 24 Mar 2009 20:01:00 +0000 (16:01 -0400)]
Add archive_read_next_header2(), which populates the archive_entry
object passed into it. Make archive_read_next_header() be the obvious
wrapper that just reuses a single entry object. This has been shown
to provide a big speedup for cases where people want to generate a list
of every entry in an archive; creating a new entry is faster than cloning
an existing entry.
Remove a lot of duplicate functions which simulates POSIX
function for Windows platform. And move the remaining
simulate functions to archive_windows.[ch]. It will be
easy maintenance and avoid the same named functions having
different codes. This change does *not* mean libarchive
library has those ones or exports it. All libarchive's
executable programs include archive_windows.c for one of
its program files.
Tim Kientzle [Sun, 22 Mar 2009 17:17:27 +0000 (13:17 -0400)]
Issue 16: Change the text files to all end in '.txt' for the
convenience of file browsers (including Windows shell, KDE, Mac OS
Finder, etc) that use file extensions as a type hint.
Tim Kientzle [Sun, 22 Mar 2009 05:58:07 +0000 (01:58 -0400)]
Files that are used by the autoconf build system belong in
the build/autoconf dir. We may need to further split that
out to separate the files that get generated by autoconf/automake/etc
from the files that are provided by libarchive.
Charles Wilson [Sat, 21 Mar 2009 14:25:50 +0000 (10:25 -0400)]
Issue 15, part 14. Build system
build/m4/la_syslibsearchpath.m4: New. Allows to automatically
determine where binmode.o is located, even on cross builds (hopefully).
configure.ac: specify AC_CONFIG_MACRO_DIR, AC_CANONICAL_HOST, and
AC_LIBTOOL_WIN32_DLL. Add new AM_CONDITIONALs INC_WINDOWS_FILES and
INC_CYGWIN_FILES. Use new macro LA_SYS_LIB_SEARCH_PATH to set
new AC_SUBST, PROG_LDADD_EXTRA, to <some path>/binmode.o on cygwin.
Makefile.am: Specify ACLOCAL_AMFLAGS. Use INC_WINDOWS_FILES and
INC_CYGWIN_FILES where appropriate. Update all *_EXTRA_DIST variables
with new files. Add -DLIBARCHIVE_STATIC to all *_test_CPPFLAGS. Add
or update existing ${APP}_LDADD to specify @PROG_LDADD_EXTRA@ (this
enables to link apps with binmode.o on cygwin).
Works on cygwin (ac-2.63, am-1.10.1, libtool-2.2.7a). Passes all tests.
Works on linux (ac-2.61, am-1.10, libtool-1.5.22). Passes all tests.
Tim Kientzle [Fri, 20 Mar 2009 19:21:45 +0000 (15:21 -0400)]
Testing: test_pathmatch.c now has 100% test coverage of pathmatch.c
Allow '$' to force anchor at end iff PATHMATCH_NO_ANCHOR_END is in flags.
Fix backslash escaping so that patterns such as "\\/./" or "/\\./" match
an explicit "/./" but do not match plain "/", even though "/./" does
ordinarily match "/".
I think this is finally sufficient to match my long-standing desire
to be able to extract "./foo/" by just asking for "foo".
There's still an open question whether this can be extended to handle
Windows-style \ path separators without causing conflicts with
the use of \ as a quote character. I don't think it can.
Split a CMakeLists.txt into each subdirectory, and remove
useless '#include LIST_H'. It was used for out-of-source build
with the previous CMakeLists.txt.
Charles Wilson [Fri, 20 Mar 2009 07:52:34 +0000 (03:52 -0400)]
Issue 15, part 13. cygwin test failures
cpio/test/test_owner_parse.c: Attempt to work around lack
of 'root' account. May need to revisit.
libarchive/archive_write_disk.c: For cygwin, go ahead and try
to chown if requested; don't assume failure based on uid/gid.
libarchive/test/test_read_disk.c: For cygwin, don't attempt
to verify "standare" uname/gname lookup.