Commit Graph

690 Commits

Author SHA1 Message Date
Tim Kientzle
8952729381 Merge from libarchive.googlecode.com: Numerous fixes to the
write options handling, including documentation.
2009-04-17 00:42:45 +00:00
Tim Kientzle
625683944d Merge from libarchive.googlecode.com: If we're
given an empty filename, just invoke write_open_fd()
instead of re-implementing the code to use stdout.
2009-04-17 00:39:35 +00:00
Tim Kientzle
73beb0d530 Re-enable backing up extended attributes, as the ZFS bug this
triggered seems to have been fixed by John Baldwin's commit
r189967.
2009-04-13 18:56:53 +00:00
Tim Kientzle
cc2a51aaf7 Merge from libarchive.googlecode.com r791, r879, r884, r948: Various
fixes to read_support_compression_program.  In particular, failure of
the external program is detected a lot earlier, which gives much more
reasonable error handling.
2009-04-12 05:47:23 +00:00
Tim Kientzle
056e26b45e Thanks to Christoph Mallon for pointing out the dead variable here.
Also, rework this a little to make the logic excruciatingly clear.
2009-04-12 05:38:35 +00:00
Tim Kientzle
e2421f7667 Merge from libarchive.googlecode.com: Mostly a bunch of
corrections to the Windows support to reconcile differences
between Visual Studio and Cygwin.  Includes parts of
revisions 757, 774, 787, 815, 817, 819, 820, 844, and 886.

Of particular note, r886 overhauled the UTF-8/Unicode conversions to
work correctly regardless of whether the local system uses 16-bit
or 32-bit wchar_t.  (I assume that systems with 16-bit wchar_t
use UTF-16 and those with 32-bit wchar_t use UCS-4.)  This revision
also added a preference for wcrtomb() (which is thread-safe) on
platforms that support it.
2009-04-12 05:33:34 +00:00
Tim Kientzle
e1089c1e0c Merge from libarchive.googlecode.com r756,r761:
Document the new archive_read_disk API.
2009-04-12 05:04:02 +00:00
Tim Kientzle
f8c35626c4 Merge from libarchive.googlecode.com:
r751: Change __archive_strncat() to use a void * source, which reduces
the amount of casting needed to use this with "char", "signed char"
and "unsigned char".
r752: Use additions instead of multiplications when growing buffer;
faster and less chance of overflow.
2009-04-12 04:59:11 +00:00
Tim Kientzle
0da7a22640 Merge r881 from libarchive.googlecode.com: The "empty" format
should not be recognized if there is a read error.
2009-04-12 04:45:40 +00:00
Tim Kientzle
4ef9925138 Temporary hack to unbreak user/group lookups;
use a larger buffer for getpwuid_r/getgrgid_r.
This needs to be dynamically sized.
2009-04-04 20:08:08 +00:00
Tim Kientzle
351ae75265 Hack: *Temporarily* disable reading extended attributes from disk, as
it seems to be badly broken on ZFS.
2009-03-11 05:11:57 +00:00
Tim Kientzle
3882931590 Set version to 2.6.901a to indicate this now matches
libarchive.googlecode.com r745.  (Except for the lzma/xz support,
which needs a little more attention before it can be merged.)
2009-03-08 04:32:38 +00:00
Tim Kientzle
9e4f5968dc Merge a bunch of changes through r722 from libarchive.googlecode.com:
mtree writer now supports a variety of checksum keys; it also provides
option hooks to set what keys get written.
2009-03-08 04:20:19 +00:00
Tim Kientzle
9d875e6973 Merge r718 from libarchive.googlecode.com: Some additional
tests of restoring files to disk with unusual characters, specifically
to exercise Windows issues.
2009-03-07 07:23:04 +00:00
Tim Kientzle
6d8acef62f Fix spelling. 2009-03-07 07:19:25 +00:00
Tim Kientzle
0d9e6eaf1a Merge r348 from libarchive.googlecode.com: Suppress testing invalid
conversions if there aren't any.  In particular, Cygwin's "C" locale
has no invalid inputs for wctomb().
2009-03-07 03:41:29 +00:00
Tim Kientzle
419eb469bc Merge r596,r690 from libarchive.googlecode.com: Minor style and compile
warning fixes for test_read_pax_truncated.c.
2009-03-07 03:34:34 +00:00
Tim Kientzle
71938b80a7 Merge r335,653,676 from libarchive.googlecode.com: Instead of
conditioning tests on HAVE_ZLIB, etc, just ask libarchive for the
service and handle the failure coming back from libarchive.  This
gives us better test coverage of common client usage where clients
simply try to use libarchive services and handle the errors coming
back instead of trying to second-guess which libarchive services are
compiled in.
2009-03-07 03:30:35 +00:00
Tim Kientzle
144552f37d Merge r280,281,496,595,675,712 from libarchive.googlecode.com: Various
test improvements, including some work on Windows compatibility and an
extra check to verify that no test leaves open file descriptors
around.
2009-03-07 03:16:16 +00:00
Tim Kientzle
fe8c58805a Merge r540 from libarchive.googlecode.com: Interix doesn't have inttypes.h
either.  <sigh>
2009-03-07 03:04:06 +00:00
Tim Kientzle
c2a577bb0d Merge r723 from libarchive.googlecode.com: Don't try to restore
owner or SUID bits on Windows; just ignore them.
2009-03-07 03:00:44 +00:00
Tim Kientzle
21bbe086cb Merge r511,r513,r607 from libarchive.googlecode.com: Mtree reader
tweaks:  Support nanosecond timestamps, handle attributes broken
across multiple lines.
2009-03-07 02:58:15 +00:00
Tim Kientzle
cd22d2cc9e Merge r585,r669 from libarchive.googlecode.com: If zlib is unavailable,
use external "gunzip" instead.  With this in place, we can unconditionally
enable gzip read support.
2009-03-07 02:51:18 +00:00
Tim Kientzle
de01c3b1eb Merge r550,584,587,609,647,674 from libarchive.googlecode.com:
Refactor the read_compression_program to add two new abilities:
 * Public API:  You can now include a signature string when you
   register a program; the program will run only on input that
   matches the signature string.
 * Internal API: You can use the init() function to instantiate
   an external program as part of a filter pipeline.  This
   can be used for graceful fallback (if zlib is unavailable, use
   external gzip instead) and to use external programs with
   bidders that are more sophisticated than a static signature check.
2009-03-07 02:47:04 +00:00
Tim Kientzle
4f7d8a29e1 Merge r591 from libarchive.googlecode.com: signed/unsigned fixes. 2009-03-07 02:29:43 +00:00
Tim Kientzle
cdad0e17a1 Merge r558,567,569,571,581,582,583,598 from libarchive.googlecode.com:
Support Joliet extensions.  This currently ignores Rockridge extensions
if both exist on the same disk unless the '!joliet' option is provided.
e.g.: tar -xvf example.iso --options '!joliet'
Thanks to: Andreas Henriksson
2009-03-07 02:24:32 +00:00
Tim Kientzle
5e9641ba0a Merge r658 from libarchive.googlecode.com: Only flush and close the
file if it was actually opened.  Test for this case.
2009-03-07 02:09:21 +00:00
Tim Kientzle
3381df89e8 Merge r714,r715 from libarchive.googlecode.com: Fix Debian bug #516577.
Don't crash if client does not provide a skip function.  Extend one
of the test cases to use archive_read_open2() with only a read callback.
2009-03-07 01:21:46 +00:00
Tim Kientzle
83829cd8ea Merge r608 from libarchive.googlecode.com: Clear a newly-allocated
bidder object.
2009-03-07 01:18:30 +00:00
Tim Kientzle
98768f0df8 Merge r564,r566 from libarchive.googlecode.com: Fix segfault when
specifying an option and the current format doesn't have an
options handler.
2009-03-07 01:17:13 +00:00
Tim Kientzle
071b9e6dc9 Merge the rest of r453 from libarchive.googlecode.com: Test using
libarchive APIs to read extended attributes from disk on FreeBSD.
2009-03-07 01:12:01 +00:00
Tim Kientzle
e54dbd0167 Minor whitespace adjustment to reduce diffs with libarchive.googlecode.com. 2009-03-07 01:08:16 +00:00
Tim Kientzle
eee9002fb2 Merge r552,r559 from libarchive.googlecode.com: Support high-resolution
timestamps on Tru64, AIX, and GNU Hurd.  Thanks to Björn Jacke.
2009-03-07 00:52:02 +00:00
Tim Kientzle
4797bb9435 Merge r283,r529 from libarchive.googlecode.com: Fix ext2_fs.h includes
for Linux.
2009-03-07 00:36:50 +00:00
Tim Kientzle
14289cd993 Merge r659 from libarchive.googlecode.com: Correctly report "none"
as the compression name when no other read filter bid.  Add some
assertions to various tests to verify that read filters are properly
setting the textual name as well as the compression code.
2009-03-07 00:25:33 +00:00
Tim Kientzle
b7baebb91a Merge r668 from libarchive.googlecode.com: Style correction to the
'ar' reader:  Don't redefine 'isdigit' and don't create a macro that's
only used once.
2009-03-06 06:14:44 +00:00
Tim Kientzle
f7c755c1db Merge r541,r542 from libarchive.googlecode.com: Two sign mismatches
in the Zip reader.
2009-03-06 06:13:25 +00:00
Tim Kientzle
634fb9dd48 Merge r491,493,500,507,510,530,543 from libarchive.googlecode.com:
This implements the new generic options framework that provides a way
to override format- and compression-specific parameters.
2009-03-06 05:58:56 +00:00
Tim Kientzle
ce54c7c56a Merge r448 from libarchive.googlecode.com: Suppress testing write_disk
failures on Windows for now.  Someday this will be revisited.
2009-03-06 05:40:09 +00:00
Tim Kientzle
4bf1b0bdfa Merge r403,702,721 from libarchive.googlecode.com: Handle odd
pathnames on Windows by mapping '\\' to '/' and converting
illegal characters to '_'.
2009-03-06 05:38:53 +00:00
Tim Kientzle
af176e930c Merge r505 from libarchive.googlecode.com: Fix %ju support. Simplify
the code here a bit by making the int formatting functions static to
archive_string_sprintf.c, which is the only place this has ever been
used.
2009-03-06 05:14:55 +00:00
Tim Kientzle
c07eec6459 Merge r457 from libarchive.googlecode.com: Stop appending strerror()
information to error strings.  This caused a lot of unnecessary
duplication in error messages; in particular, there are a few cases
where error messages get copied from one archive object to another
and this would cause the strerror() info to get appended each time.
2009-03-06 05:13:12 +00:00
Tim Kientzle
a86d4001dd Merge r420,r494 from libarchive.googlecode.com: Prettify the test
harness a bit:  remove a dead comment, tweak the wording of the
summary report.
2009-03-06 05:07:03 +00:00
Tim Kientzle
6a7c3e70e3 Merge r435,r443 from libarchive.googlecode.com: Read config files from
include path; this makes it easier to support multiple build frameworks.
2009-03-06 05:04:15 +00:00
Tim Kientzle
ce077a6fd8 Merge r416 from libarchive.googlecode.com:
Restoring POSIX.1e Extended Attributes on FreeBSD, part 1

This implements the basic ability to restore extended attributes
on FreeBSD, including a test suite.
2009-03-06 04:55:51 +00:00
Tim Kientzle
17fcda1a0b Merge r407,r508 from libarchive.googlecode.com: Correctly handle
Zip entries that are zero length but stored with deflate.  This
is arguably a silly thing to do (deflating a zero-length file actually
makes it bigger) but apparently quite a few Zip writers do this.
This was broken in two places:  archive_write_disk disliked being asked
to write data to zero-length files (even if the write was zero-length)
and zip_read_file_header tripped over itself when non-regular files
had compressed bodies.
2009-03-06 04:50:39 +00:00
Tim Kientzle
43a8e5f098 Merge r399,401,402,405,415,430,440,452,453,458,506,533,536,538,544,590
from libarchive.googlecode.com:  Add a new "archive_read_disk" API
that provides the important service of reading metadata from the
disk.  In particular, this will make it possible to remove all
knowledge of extended attributes, ACLs, etc, from clients such
as bsdtar and bsdcpio.

Closely related, this API also provides pluggable uid->uname
and gid->gname lookup and caching services similar to
the uname->uid and gname->gid services provided by archive_write_disk.
Remember this is also required for correct ACL management.

Documentation is still pending...
2009-03-06 04:35:31 +00:00
Tim Kientzle
74aced1051 Merge r398 from libarchive.googlecode.com: Check that bidder
object was allocated before we try to use it.
2009-03-06 04:22:34 +00:00
Tim Kientzle
c6b235629a Merge r394,r396 from libarchive.googlecode.com: Plug some memory
leaks in the ACL test, correctly mark that FreeBSD has acl_get_perm_np().
2009-03-06 04:21:23 +00:00
Tim Kientzle
341f2011d8 Merge r390,r391,r392,r397 from libarchive.googlecode.com: Virtualize
"close" and "finish" across both read and write interfaces.
(Someday, "finish" should be renamed to "free" to better reflect
what it actually does...)
2009-03-05 21:18:10 +00:00
Tim Kientzle
90e7486664 Merge r389 from libarchive.googlecode.com: Fix a memory
leak in ISO9660 handler structure whenever a file entry
has a nonsensical CE offset.
2009-03-05 18:38:36 +00:00
Tim Kientzle
e80e6f7018 Merge r386,r395,r451 from libarchive.googlecode.com: On Windows, break
into the debugger on test setup failures (otherwise, the console window
just goes away and you can't see what went wrong).  On all platforms,
clean up a stray buffer before exiting.
2009-03-05 18:30:50 +00:00
Tim Kientzle
ffd201719e Argh. r189389 was supposed to include r539 from libarchive.googlecode.com
but those compile fixes somehow got lost.  This should fix the build.
2009-03-05 06:26:08 +00:00
Tim Kientzle
241028d43a Merge r551,r561 from libarchive.googlecode.com: Update gzip read filter
to fully take advantage of the new peek/consume I/O support.
In particular, this now properly handles concatenated gzip streams.
2009-03-05 02:37:05 +00:00
Tim Kientzle
facbbae9f9 Merge r364, r378, r379, r393, and r539 from libarchive.googlecode.com:
This is the last phase of the "big decompression refactor" that
puts a lazy reblocking layer between each pair of read filters.
I've also changed the terminology for this area---the two kinds
of objects are now called "read filters" and "read filter bidders"---and
moved ownership of these objects to the archive_read core.

This greatly simplifies implementing new read filters, which
can now use peek/consume I/O semantics both for bidding (arbitrary
look-ahead!) and for reading streams (look-ahead simplifies handling
concatenated streams, for instance).

The first merge here is the overhaul proper; the remainder are small
fixes to correct errors in the initial implementation.
2009-03-05 02:19:42 +00:00
Tim Kientzle
a48ae5111e Correct r189383, which mis-merged a change from libarchive.googlecode.com. 2009-03-05 01:59:49 +00:00
Tim Kientzle
30b7287aff Merge r356 and r358 from libarchive.googlecode.com: Remove a Windows
special case from archive_entry.c, add one to archive_check_magic.c.
2009-03-05 00:44:12 +00:00
Tim Kientzle
a60167b66c Merge r357 from libarchive.googlecode.com: bzip2 compression
support can always be enabled even if bzlib doesn't exist on
this platform; don't give up until we fail to open the file.
2009-03-05 00:42:50 +00:00
Tim Kientzle
24b4dd3387 Merge r362 from libarchive.googlecode.com: Minor fix to
custom argument parser.
2009-03-05 00:41:02 +00:00
Tim Kientzle
32baf20434 Merge r342 from libarchive.googlecode.com: Remove some
Windows special casing.
2009-03-05 00:36:13 +00:00
Tim Kientzle
faeada5e26 Merge r344 from libarchive.googlecode.com: __LA_INT64_T and __LA_SSIZE_T
are part of the public API and therefore need to be exposed.  This is
ugly; I'd like to find a better solution for this.
2009-03-05 00:35:21 +00:00
Tim Kientzle
ba2a6a7201 Merge r341,r345,r346,347 from libarchive.googlecode.com: Style
fixes to test harness and a few extra guards to detect tests
that can't succeed on certain platforms.
2009-03-05 00:31:48 +00:00
Tim Kientzle
9c886c4181 Merge r340 from libarchive.googlecode.com: If zlib/bzlib aren't available,
we can still detect gzip/bzip2 compressed streams, we just can't
decompress them.
2009-03-03 17:07:27 +00:00
Tim Kientzle
690f818afd Merge r294:337,r348:350 from libarchive.googlecode.com: A lot
of work to make libarchive work on Windows.
2009-03-03 17:02:51 +00:00
Tim Kientzle
ed466ea1cf Merge r294 from libarchive.googlecode.com: Skip testing for
locale-based failures on systems where the "C" locale is so permissive
that it cannot possibly fail.  In particular, this fixes a test
problem on Cygwin.
2009-03-03 07:01:57 +00:00
Tim Kientzle
bc14277c79 Merge r282 from libarchive.googlecode.com: Close multiple filters
by walking the filter list in archive_read_close().
2009-03-03 03:33:25 +00:00
Tim Kientzle
80bb6bf259 Merge r272 from libarchive.googlecode.com: Fix building on MSVC6. 2009-03-03 03:28:09 +00:00
Tim Kientzle
56b5addbbd Permit ` as a pad character in the filename table.
This seems to fix the devel/zziplib port, which distributes
its man pages in an ar archive.
2009-02-01 02:33:02 +00:00
Tim Kientzle
7376ba1329 Fix ARCHIVE_EXTRACT_SPARSE handling in libarchive.
Add a test to exercise this feature.
This should fix --sparse/-S support in tar.

Thanks to:      Daichi GOTO
MFC after:	1 week
2009-01-26 05:44:40 +00:00
Tim Kientzle
53272655f6 Merge-from-Googlecode r419
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.

This should fix cpio coredumping when it tries to restore to
a write-protected directory.

Thanks to: Giorgos Keramidas
MFC after: 30 days
2009-01-21 06:55:27 +00:00
Tim Kientzle
3342e45402 "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."

Submitted by:	phk@
MFC after:	10 days
2009-01-13 04:56:41 +00:00
Tim Kientzle
a612d4d7ae Don't try to read the next Gzip header after we reach the
end of the compressed stream.  This is desirable behavior,
but the implementation here is very broken and causes strange
problems, so disable it for now.

Thanks to Simon L. Nielsen for reporting this problem.
2009-01-01 02:29:57 +00:00
Tim Kientzle
929b60ba42 If conversion from UTF8 fails, don't mark Unicode text as available.
Submitted by:	Michihiro NAKAJIMA
MFC after:	30 days
2008-12-23 05:01:43 +00:00
Tim Kientzle
fec90b6c9b Teach get_refdir() about FreeBSD's /usr/obj convention.
In development, I run libarchive_test frequently by hand
and it gets tedious having to specify a suitable -r path
all of the time.
2008-12-21 00:13:50 +00:00
Tim Kientzle
514c68e92c Fill in a missing const 2008-12-17 19:05:58 +00:00
Tim Kientzle
eef2284331 Exit earlier on failure in this test. 2008-12-17 19:05:25 +00:00
Tim Kientzle
9515da8712 Once the test has failed, exit before the segfault. 2008-12-17 19:05:00 +00:00
Tim Kientzle
da9157722d Update the ar write test to give more detailed information about failures. 2008-12-17 19:03:44 +00:00
Tim Kientzle
6ebec34c8d Clarify an 'ar' error message. 2008-12-17 19:02:42 +00:00
Tim Kientzle
18f815b95c Obey the TMPDIR, TMP, TEMP, or TEMPDIR environment variables
when choosing a scratch directory for the tests.  Fallback
to "/tmp", of course.
2008-12-08 17:22:44 +00:00
Tim Kientzle
dff5b8bc1f New tests:
* support for bzip2 file with multiple concatenated bzip2 streams
 * support for bzip2 file with junk after bzip2 stream
 * support for gzip file with junk after gzip stream
 * "fuzz" tester randomly modifies a bunch of input files in order to try
   to crash libarchive (this found an amusing hang in the ISO9660 code
   when trying to read images that advertised a zero blocksize).

This test is implemented, but commented out for now:
 * support for gzip file with multiple concatenated gzip streams
2008-12-06 07:08:08 +00:00
Tim Kientzle
dc8cb157dd Strip ";1" and trailing "." from ISO9660 entries.
This seems a better match for people's expectations.
2008-12-06 06:57:45 +00:00
Tim Kientzle
08da6f539c General improvements to Rockridge parsing and ISO9660 format detection. 2008-12-06 06:55:07 +00:00
Tim Kientzle
ebcb29a003 Conditionalize a bunch of debugging messages; this also
eliminates what should be the only remaining stdio dependency.
2008-12-06 06:50:09 +00:00
Tim Kientzle
b1ff9c25b8 MfP4: Big read filter refactoring.
This is an attempt to eliminate a lot of redundant
code from the read ("decompression") filters by
changing them to juggle arbitrary-sized blocks
and consolidate reblocking code at a single point
in archive_read.c.

Along the way, I've changed the internal read/consume
API used by the format handlers to a slightly
different style originally suggested by des@.  It
does seem to simplify a lot of common cases.

The most dramatic change is, of course, to
archive_read_support_compression_none(), which
has just evaporated into a no-op as the blocking
code this used to hold has all been moved up
a level.

There's at least one more big round of refactoring
yet to come before the individual filters are as
straightforward as I think they should be...
2008-12-06 06:45:15 +00:00
Tim Kientzle
72a4c788ff Style: tabs after #define 2008-12-06 06:23:37 +00:00
Tim Kientzle
da28fde4f9 Use GCC-specific dead function markers only when using GCC. 2008-12-06 06:20:21 +00:00
Tim Kientzle
9d822fe4b1 Structure declarations can't be dllexported. 2008-12-06 06:18:46 +00:00
Tim Kientzle
485698c170 Style fixes:
* Wrap long declarations to fit 80 chars
 * #undef macros that shouldn't be exported
 * Organize the version-dependent conditionals a
   bit more consistently

Speculative:
 * libarchive 3.0 will (eventually) use int64_t
   instead of off_t.  This is an attempt to avoid
   some the headaches caused by Linux LFS.  (I'll
   still have to do ugly things for the struct stat
   references in archive_entry.h, of course.)
2008-12-06 06:17:18 +00:00
Tim Kientzle
0373bf6531 A couple of portability fixes from Joerg Sonnenberger 2008-12-06 06:12:24 +00:00
Tim Kientzle
605fc11462 Recover after test failure. 2008-12-06 06:02:26 +00:00
Tim Kientzle
796b668980 Style: skipping() function correctly counts this as a skipped test. 2008-12-06 06:01:50 +00:00
Tim Kientzle
f1bcf83200 Style improvements. 2008-12-06 06:00:52 +00:00
Tim Kientzle
39bb5e0dd0 Better reporting of test failures. 2008-12-06 05:59:46 +00:00
Tim Kientzle
23fb0d7a7c Recover from a test failure here. 2008-12-06 05:58:24 +00:00
Tim Kientzle
0a68927a88 New internal archive_string_concat utility function. 2008-12-06 05:56:43 +00:00
Tim Kientzle
fe7350cb22 Minor portability: Declare 'r' only within the conditional
block where it's used; S_ISLNK is more portable than S_ISLINK.
2008-12-06 05:55:46 +00:00
Tim Kientzle
b55ef4a75a Windows build now uses PLATFORM_CONFIG_H macro, so we can eliminate the
special case for it.
2008-12-06 05:53:05 +00:00
Tim Kientzle
a8d0992f23 2 is more portable than STDERR_FILENO 2008-12-06 05:52:01 +00:00
Tim Kientzle
9fe9800cb5 When running on a filesystem that lacks ACL support,
just SKIP the test, don't report a test failure.
2008-11-17 21:06:17 +00:00