Tim Kientzle [Wed, 10 Nov 2010 05:59:05 +0000 (00:59 -0500)]
Issue 113: When writing headers, return ARCHIVE_FAILED
on various problems:
* Missing name
* Missing size (except for hardlinks)
* Missing filetype
* Size too large for format
Tim Kientzle [Sun, 7 Nov 2010 02:14:21 +0000 (22:14 -0400)]
If we see junk when we're expecting a 'PK' signature
block, scan forward to see if we can find a suitable
signature.
This is necessary to read archives that have been modified
by some Zip utilities that update entries in-place without
compacting the entire archive.
Of course, this would be very natural if libarchive
used the Central directory. But even when libarchive
does support the Central directory, this kind of logic
will still be useful for reading Zip archives in streaming
mode.
Tim Kientzle [Sun, 31 Oct 2010 06:35:10 +0000 (02:35 -0400)]
Return NULL if there is no error message.
In particular, we should start filling in assertions in lots
of tests to verify that textual error messages are getting
generated on errors.
Tim Kientzle [Sun, 31 Oct 2010 04:44:03 +0000 (00:44 -0400)]
Reconcile the test harnesses across libarchive, tar, and cpio.
Remove almost all of the varargs capabilities from the various
assertion helpers, since they complicate the code and are
hardly ever used.
Tim Kientzle [Sat, 30 Oct 2010 07:38:53 +0000 (03:38 -0400)]
Handle umask a little more carefully: Instead of setting umask to
zero, then restoring a file, then restoring umask, just query
the umask and adjust the file restore operations to account for it.
Go ahead and query the umask at new() time as well.
This opens the possibility of removing the umask query from
write_disk_header if you want to make libarchive behave more
nicely with threads.
Brian Harring [Mon, 27 Sep 2010 15:42:07 +0000 (11:42 -0400)]
fix a bug introduced in the last set of cleanups to this file; if setting the unconsumed, don't invoke consume ourselves (this fixes the readahead/consume in this case)
Brian Harring [Sat, 25 Sep 2010 05:43:07 +0000 (01:43 -0400)]
finish conversion over to tar_flush_unconsumed, and converting adhoc readahead/consume pairing. Haven't been able to pinpoint why test_read_large, test_read_truncated, and test_read_data_large fail when poisoning is enabled- either the readahead/consume pairing is still off slightly, or (what I suspect) there is a dangling ptr that just happens to work currently. Will root this one out under libtransform where I can more easily make the actual space no longer valid (literal free'ing), hopefully smoking it out via a segfault.
Brian Harring [Sat, 25 Sep 2010 04:36:27 +0000 (00:36 -0400)]
more work to pair tar's readahead/consume; this still isn't perfect (the disabled poison code w/in tar_flush_unconsumed confirms this), although pretty close.
Brian Harring [Thu, 23 Sep 2010 11:40:18 +0000 (07:40 -0400)]
replace an adhoc consume/skip invocation with a proper skip/consume invocation (primarily relevant since the underlaying transforms/source may be able to shift to an lseek; unlikely, but it simplifies the code a bit). As for updating padding when the seek is less than what was requested, this is being done purely to keep existing behaviour- the ARCHIVE_FATAL return should make this a noop, but being safe.
Brian Harring [Thu, 23 Sep 2010 11:26:11 +0000 (07:26 -0400)]
not hugely happy with the implementation (specifically unconsumed passing), but rework the header reading to properly pair it's read_ahead/consume usage
Brian Harring [Thu, 23 Sep 2010 10:21:09 +0000 (06:21 -0400)]
correct a mismatch- you tell libarchive something is consumed only after you've actually consumed it. Once you've consumed a read_ahead block, the data it points to is volatile. Mainline trunk currently currently wouldn't cause issues with this usage, but the usage violates the api contract (and will have issues under libtransform) so fixing it.
Brian Harring [Wed, 1 Sep 2010 12:25:23 +0000 (08:25 -0400)]
fix tcp.sh to work (looks like upon importation it picked up some address scrubbing crap from gmail/websites). tweak the logic slightly also to just process available tar implementaitons for testing
Tim Kientzle [Sun, 15 Aug 2010 04:11:25 +0000 (00:11 -0400)]
When -R is specified, make sure to clear the uname/gname
fields. Add a TODO here for the -R parser to return
usable uname/gname text (only useful for tar output,
so not a huge priority right now).
Tim Kientzle [Sun, 25 Jul 2010 01:16:30 +0000 (21:16 -0400)]
Instead of trying a read-ahead after each filter stage,
just do it once after the full pipeline is built.
In particular, this catches errors on uncompressed
input at open time. Also, if any filter stage fails
to initialize, clean up the entire pipeline
immediately.
Tim Kientzle [Sun, 25 Jul 2010 01:11:34 +0000 (21:11 -0400)]
If opening the filter pipeline fails, immediately
close the pipeline and return with an error without
initializing the format writer. Ensure that close requests
propagate up the pipeline even if a particular
stage hasn't registered a closer.
In particular, this fixes a crash that occurs when
write openers would fail but the format would get
initialized anyway. At close time, formats such
as tar perform a write that would crash because the
pipeline wasn't fully initialized. With this
change, the format never gets initialized in
this case so it doesn't need to be cleaned up.
Tim Kientzle [Mon, 19 Jul 2010 05:24:09 +0000 (01:24 -0400)]
As reported by Aaron W Hsu, some ISO writers put a
Path Table starting at sector 18; the taster was rejecting
such archives (requiring that the path table start after
sector 18).
Tim Kientzle [Sat, 17 Jul 2010 23:23:16 +0000 (19:23 -0400)]
Virtualize archive_read_next_header(). In particular, attempts to
call this on a read_disk handle will fail immediately with a Null
pointer dereference instead of trying to run the archive_read
implementation, which fails with a much more inscrutable error.
Tim Kientzle [Tue, 13 Jul 2010 03:36:29 +0000 (23:36 -0400)]
As discussed on the libarchive-discuss mailing list,
don't use any special declaration marker for GNU C on Windows.
The explicit dllimport marker hasn't been needed for many years
and removing it allows the same headers to be used for either a
static or dynamic library.
On Windows, use BY_HANDLE_FILE_INFORMAION directly to set up a archive_entry
object instead of struct stat with archive_entry_copy_stat in
directory traversals.
Tim Kientzle [Sat, 3 Jul 2010 03:56:02 +0000 (23:56 -0400)]
Finish fixing the breakage from r2522: In particular, fcopyfile() seems
broken so we can't use the more straightforward (and more secure)
fd-oriented approach here.
Tim Kientzle [Sat, 3 Jul 2010 02:32:12 +0000 (22:32 -0400)]
Fix a counting error in the Mac pathname editing.
Using memmove() here is efficient, but a bit touchy.
This fixes bsdtar_test_copy, which was broken in r2522.
iso9660: fix joliet version/dot stripping code to handle wide characters.
Kientzle noticed that test_write_format_iso9660_filename failure
was introduced by rev 2514. See comments at:
http://code.google.com/p/libarchive/source/detail?r=2514
This fixes the problem by not comparing wchar_t against 'x' but L'x'.
Tim Kientzle [Wed, 30 Jun 2010 05:12:57 +0000 (01:12 -0400)]
Basic test for tar --newer-than option. So far, this
exercises very basic creation-time filtering and
extraction-time filtering but doesn't yet test the
directory-descent problem documented in Issue 97.
It did uncover a problem with extraction-time filtering
that is fixed here.
Tim Kientzle [Sat, 26 Jun 2010 18:41:38 +0000 (14:41 -0400)]
Choose the copy buffer size used for reading files
to be archived dynamically:
* At least 64k
* At least as large as the -b setting
In particular, this should speed up things noticably when large -b
values are in use. This is also the first cut at aligning the copy
buffer so we can take advantage of O_DIRECT someday.
Tim Kientzle [Sat, 26 Jun 2010 17:18:30 +0000 (13:18 -0400)]
Use -b setting when interpolating archives.
Simplify the handling of -b values by setting
a default early and then just using the value
instead of duplicating the logic.
Tim Kientzle [Sat, 26 Jun 2010 06:17:32 +0000 (02:17 -0400)]
Use intmax_t for %jd printf arguments.
We should probably be using archive_string_sprintf
here instead of printf to avoid the portability problem
(not all platforms have intmax_t, not all have %jd).
Tim Kientzle [Fri, 25 Jun 2010 23:26:45 +0000 (19:26 -0400)]
Various tar format improvements:
* Improve description of Apple extensions
* AIX ACL extensions
* Solaris ACL extensions
* Move numeric extensions section next to ustar section
* Add summary of tar header types
* Add LIBARCHIVE.* pax extensions
Tim Kientzle [Sat, 19 Jun 2010 02:48:53 +0000 (22:48 -0400)]
Add ARCHIVE_EXTRACT_MAC_METADATA flag to archive_write_disk. This
feeds the mac_metadata blob from the archive_entry to the Mac
copyfile() function to restore ACLs and xattrs. Restoring these attrs
on dirs is correctly deferred until end-of-archive.
Enable this for tar -p
This is the rest of the support for reading and restoring
Apple extensions to tar archives.