Simplify the line reader:
- Do not allocate a buffer in advance, it will be reallocated on the
first round anyway.
- Allocate one more byte to allow always terminating the buffer.
- Use strcpsn to compute the end of line. This slightly changes the
behavior for NUL in text lines as they are no longer truncated.
Provide a sane default strategy for the various formats.
zip and ar don't do hardlinks, so work like old-cpio.
shar is like tar.
Default to old-cpio as fallback as it is the least problematic of the
three options.
Tim Kientzle [Sat, 20 Feb 2010 05:53:11 +0000 (00:53 -0500)]
Stackable write filter support. This ended up touching an awful lot
of files. But, the old API is supported almost entirely unchanged, which
I wasn't certain would be possible.
Big changes:
* You can add more than one write filter by using
archive_write_add_filter_{bzip2,compress,gzip,lzma,xz}.
This will be more interesting when we have uuencode, RPM, encryption.
* The old archive_write_set_compression_XXXX are shorthands for
"remove all the current filters and add this one." They're
deprecated and scheduled to be removed in libarchive 4.0.
* The internal API and life cycle for write filters has been
rationalized: create, set options, open, write, close, free.
* New utility functions provide information about each filter
when there's more than one: code, name, and number of bytes processed
* Old archive_bytes_compressed(), etc, are implemented in terms of
the more generic new functions.
* The read side was generalized to also support the new utility
functions.
In particular, the write filters are much simpler since each
one doesn't have to deal with blocking. In this version, there's
still a "write_add_filter_none" that handles blocking, but I
think I'll soon fold that down into the client wrapper and
add_filter_none will become a no-op. I think this also gets
us a big step closer to multi-volume support on the write side.
Tim Kientzle [Sat, 20 Feb 2010 05:32:24 +0000 (00:32 -0500)]
Returning ARCHIVE_WARN when someone tries to write past the declared
file size seems entirely reasonable. I had thought about changing
this in 3.0 but have decided against it.
Tim Kientzle [Wed, 17 Feb 2010 05:54:50 +0000 (00:54 -0500)]
Modernize this test. Add additional assertions to verify that
archive_position_compressed()
== archive_position_uncompressed()
== number of bytes actually written
when we didn't overflow the buffer. These may not match when
the buffer does overflow because some writes down the pipeline
will fail.
Make a Windows version of __archive_mktemp() in archive_windows.c
and merge __la_mkstemp() and __archive_mktemp() because
__la_mkstemp() was only used by __archive_mktemp().
Tim Kientzle [Mon, 8 Feb 2010 07:18:22 +0000 (02:18 -0500)]
Rename archive_read_finish to archive_read_free and
archive_write_finish to archive_write_free. Update all clients,
tests, and documentation to use the new names exclusively. (Though
I've not yet run a global search-and-replace against the Wiki. I'll
do that shortly.)
I've preserved the old names as aliases, scheduled to be removed with
libarchive 4.x, so there is no immediate impact to existing code from
this change.
Tim Kientzle [Sat, 6 Feb 2010 05:10:13 +0000 (00:10 -0500)]
Guard against out-of-range nanosecond time values and make it easy for
people to make small time adjustments using code such as:
archive_entry_set_ctime(entry,
archive_entry_ctime(entry),
archive_entry_ctime_nsec(entry) + 123456);
Fix test_read_format_cpio_afio failure on the some platform,
on which the size of uid_t is too small to set a over 65535 value.
But this fix will be removed when we use int64_t for uid.
Get a sprase info in GNU PAX formart "1.0" before the process of
reading file data so that we reliably get the sparse info with
archive_entry_sparse_*() functions.
Tim Kientzle [Mon, 1 Feb 2010 05:51:37 +0000 (00:51 -0500)]
First step towards integrating Mac OS "copyfile" extension from Apple.
This part adds probes for the copyfile.h header, and adds a new command-line
option --disable-copyfile, which does nothing on non-MacOS systems.
Tim Kientzle [Mon, 1 Feb 2010 03:52:55 +0000 (22:52 -0500)]
Minor adjustments to the bsdtar.1 man page.
In particular:
* Downplay the "tape" aspect; few people use tar with tape drives any more.
* Document default device a bit more carefully.
* Update supported formats.
* Clarify the history of this implementation.
Tim Kientzle [Mon, 18 Jan 2010 17:55:30 +0000 (12:55 -0500)]
Return proper errors from archive_read_disk_entry_from_file() if
you're asked for information about a non-existent file.
Update cpio to actually use this properly to report errors for
nonexistent files and exit with a delayed error if there were
files that could not be read.
Fix memory leak in ISO reader.
Do not use a reference counter to decide to release a memory
used for struct file_info.
Release all memories of struct file_info at the end instead.
Tim Kientzle [Tue, 5 Jan 2010 16:44:20 +0000 (11:44 -0500)]
Fix a failing tar test: On some systems (certain Linux systems
with security features enabled), the default tar format chooses
to include pax extensions, which confuses the validation logic in
this test.
Tim Kientzle [Sun, 3 Jan 2010 21:25:38 +0000 (16:25 -0500)]
Issue 48: Instead of setting RUNTIME_OUTPUT_DIRECTORY separately for
each component, set CMAKE_RUNTIME_OUTPUT_DIRECTORY once at the
top and let each component inherit that implicitly. This allows
other projects that want to include libarchive to do so a little
more simply.