Tim Kientzle [Sun, 18 Jan 2009 19:22:22 +0000 (14:22 -0500)]
Rely on the compiler's include search path to find config.h files.
This works much better when building with a variety of build systems;
all of them can edit the include path but not all of them put the
built configure files in the same place.
Tim Kientzle [Sun, 18 Jan 2009 08:10:52 +0000 (03:10 -0500)]
Many improvements to cmake builds on FreeBSD, though there are still some rough edges:
Better:
* "make && make test" works and tests pass
* -Denable_tar=no -Denable_cpio=no -Denable_test=no are all supported
* Some progress towards out-of-source builds:
"mkdir build && cd build && cmake .." now doesn't pollute the dist dir
Still broken:
* out-of-source build attempt doesn't create a Makefile?
* out-of-source build needs to add compile option for locating config.h
* "make clean" doesn't work
* "make install" doesn't work
Tim Kientzle [Thu, 15 Jan 2009 05:17:08 +0000 (00:17 -0500)]
In archive_write_disk: If archive_write_header() fails to create
the file, that's a failure and should return ARCHIVE_FAILED.
Metadata restore failures still return ARCHIVE_WARN, because
that's non-critical. Fix test_write_disk_secure test to
verify the correct return code in one case; add test_write_disk_failures
to do another very simple test of restore failure.
In particular, this fixes the problem found with xattr restores
that a failure in setting an xattr would prevent the file and other
metadata from being written. Now, an xattr restore failure generates
a warning but does not prevent the rest of that file's data and metadata
from being properly written.
Tim Kientzle [Tue, 13 Jan 2009 04:58:16 +0000 (23:58 -0500)]
Merge r187126 from FreeBSD-CURRENT:
"The first part is just to give more info, the latter part fixes
an error to read files past the 32bit byte offset, for instance
on DVDs."
This occurs with Zip archives that have entries that are
compressed with deflate even though they are zero bytes
long. Libarchive's zip handler returns a zero-byte block
from the decompression before returning end-of-entry.
Writing that zero-byte block back to the filesystem
triggered some code intended to catch misuse of the API.
The fix suppresses the warning in the case of a zero-byte
write request.
This is all very silly: compressing a zero-byte file is
a silly thing to do, libarchive's zip format handler is
returning a silly sequence of responses, and the warning
is silly. Oh, well. At least I fixed the warning. ;-)
Tim Kientzle [Thu, 8 Jan 2009 06:52:41 +0000 (01:52 -0500)]
archive_read_disk_entry_from_file() knows how to pull
all metadata about a file from the filesystem to populate
an entry object. This takes advantage of the user/group
name lookup capabilities of the archive_read_disk object.
This should simplify bsdtar and bsdcpio by removing the
comparable code from those utilities.
Replace a path separator to '/' in archive_write_disk.c,
if the path separator of the running system is not '/'.
Because of libarchive expect the path separator
is '/' where program check the one.
On Windows, now archive_read_disk_set_standard_lookup.c is linked.
We call archive_read_disk_set_standard_lookup() function on
libarchive_test again, and check a value which that function
returns to what the feature is available.
This aims that programs which use libarchive shouldn't have to
to know what features are available on a particular platform.
Tim Kientzle [Wed, 7 Jan 2009 06:38:55 +0000 (01:38 -0500)]
Start of archive_read_disk API.
Right now, this is just a handle for username/group name lookups
and the associated caches. Soon, this will hold machinery to
populate archive_entry objects from files on disk (which relies
on efficient uname/gname lookups).
Tim Kientzle [Wed, 7 Jan 2009 05:15:09 +0000 (00:15 -0500)]
Correct a very minor memory leak in test/main.c.
Exiting on an illegal argument failed to free the
allocated buffer holding the path of the reference directory.
Tim Kientzle [Wed, 7 Jan 2009 05:12:07 +0000 (00:12 -0500)]
Fix the filter close handling. Since the archive_read core
creates the filter object, it should also free it. This
also corrects a small memory leak in
archive_read_support_compression_program.
On Windows, remove fstat64()/get_dev_ino()/
get_dev_ino_fd()/get_dev_ino_filename().
Those functions are no longer needed. now we can
use la_stat() instead of fstat64() when defined
__USE_LARGEFILE and __USE_FILE_OFFSET64.
On Windows, support long path name which is longer
than MAX_PATH(260). And add relationally new
features.
- Many file io functions such as open/mkdir/rmdir..etc
are replaced. Some new functions are using Win32 API
directly, some ones are wrapped orignal function.
- Add new feature to new stat() family.
1. set st_ino data by nFileIndexHigh and
nFileIndexLow of BY_HANDLE_FILE_INFORMATION.
2. set st_nlink data by nNumberOfLinks of
BY_HANDLE_FILE_INFORMATION.
3. set st_dev data by dwVolumeSerialNumber by
BY_HANDLE_FILE_INFORMATION.
- Rewrite link() function and add suuport hard-link.
- The new open() function has been changed error
handling to sumulate other POSIX systems.
Tim Kientzle [Sun, 4 Jan 2009 02:02:36 +0000 (21:02 -0500)]
Big decompression refactor, Phase 2.
First, I've changed terminology: the objects that were called
"sources" and "readers" in libarchive 2.6 are now called "filters" and
"filter bidders." I think this reads a lot better. It also more
cleanly conveys that filters can be stacked and are not limited
to decompression.
Filter objects are now created and owned by the archive_read core,
which attaches reblocking logic to the output of each one. This
allows filters to use the read_ahead/consume protocol to pull data
from upstream filters (the client itself is also handled as a filter,
one with no upstream). Peek/consume read semantics greatly simplify
bidding and should make it easier to handle other lookahead scenarios
such as concatenated gzip streams.
Bid protocol:
* Filters install bidders into the core.
* Bidder has a "bid" function which is handled an upstream filter to taste.
* Core creates a filter object for the winner and allows the filter
to initialize that object.
* Core repeats the bid with the new filter to build out filter streams.
Filter protocol:
* read() can use peek/consume to pull from upstream filter, returns
arbitrary blocks
* close() releases private data
* Optional skip() seeks forward in the stream.
The core obviously provides a lot more support in the way of reblocking
logic so that downstream filters can use simple peek/consume semantics
while upstream filters can provide arbitrary blocks without regard
for downstream needs. The lazy reblocking makes this pretty efficient
in practice.
Upcoming: I think the core should provide a "prepare" stage that's called
before the first read. Concatenated gzip streams would go back to prepare
after close. It will require a little thought to properly separate the
init() and prepare() operations.
Tim Kientzle [Thu, 1 Jan 2009 02:07:29 +0000 (21:07 -0500)]
Create test_option_s to exercise basic -s handling.
In particular, add some checks for multiple -s options in order
to verify a bug reported where multiple -s options have no effect.
A bad typo was causing the substitution-matching loop to always exit
after checking the first match.
Fixed.
Thanks to Wayne Marshall for reporting this problem.
Tim Kientzle [Thu, 1 Jan 2009 00:57:15 +0000 (19:57 -0500)]
The code to support concatenated gzip streams is broken and
it breaks some non-concatenated streams. So just disable this
by always marking EOF immediately when we hit the end of a
gzip stream.
Tim Kientzle [Wed, 31 Dec 2008 07:20:56 +0000 (02:20 -0500)]
Skip testing character conversion failures on platforms
where the "C" locale never generates such failures.
(Cygwin apparently has an overly-permissive "C" locale;
wctomb() never fails.)
Tim Kientzle [Wed, 31 Dec 2008 06:56:54 +0000 (01:56 -0500)]
If zlib/bzlib don't exist, use stub implementations of
archive_write_set_compression_gzip/archive_write_set_compression_bzip2
that always return errors.