Commit Graph

564 Commits

Author SHA1 Message Date
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
Tim Kientzle
92ab0af8a3 Correct the documented declaration of the archive_write_callback to
match the code.

PR:		docs/128089
Submitted by:	Mel
MFC after:	3 days
2008-11-01 19:11:21 +00:00
Dag-Erling Smørgrav
c1f91a825f Move va_end() up 2008-10-21 12:10:30 +00:00
Tim Kientzle
ee8a341ef4 If we don't know the file size, leave the file size unset.
If it's not a regular file, don't return any data, even if the size is unknown.

Update the Zip test with a hand-tweaked Zip archive that has a
directory (with length-at-end set), a regular file without
length-at-end set, and a regular file with length-at-end set and a bad
CRC.  Update the test code to verify that the file size is unset
for the regular file with length-at-end.

MFC after:	7 days
2008-10-21 05:08:35 +00:00
Tim Kientzle
758dfd70db Add test to verify ACL restores on FreeBSD, verify kern/128203 (mtime
restore fails if ACL provided), apply patch from kern/128203, and verify fix.

PR:		kern/128203
Submitted by:	Udo Schweigert
MFC after:	3 days
2008-10-19 00:18:44 +00:00
Tim Kientzle
d34dca65fa Style: Mark private data 'static', correct an old comment.
MFC after:	3 days
2008-10-19 00:13:57 +00:00
Tim Kientzle
b2d4ddad82 Verify high-res birthtime support on FreeBSD.
MFC after:	30 days
2008-09-30 04:13:21 +00:00
Tim Kientzle
f70105fb18 MfP4: restore birth time data to disk + more thorough tests for
time restore to disk.

MFC after:	30 days
2008-09-30 04:02:36 +00:00
Tim Kientzle
155524db13 MfP4: Store/read birthtime data in pax format.
Submitted by:	Pedro Giffuni
MFC after:	30 days
2008-09-30 03:57:07 +00:00
Tim Kientzle
8b18fa965d MfP4: Support for storing birthtime in archive_entry objects.
Submitted by:	Pedro Giffuni
MFC after:	30 days
2008-09-30 03:53:03 +00:00
Tim Kientzle
c42f5c226a MfP4: Generalize int64_t in the public headers to support compilers
which have a 64-bit integer type but don't provide standard C99 definitions.
2008-09-18 04:19:06 +00:00
Tim Kientzle
a370f3ca73 Trying to distinguish different "versions" of mtree files was a silly idea.
Submitted by:	Joerg Sonnenberger
2008-09-18 04:13:36 +00:00
Tim Kientzle
29a23c776a Choose a flag-handling strategy based on platform capabilities
rather than on platform.
2008-09-14 05:51:25 +00:00
Tim Kientzle
1074aa240c Portability: Don't use symbolic constants when the values are more
standard than the names are.  Remove some trailing whitespace.
2008-09-12 05:33:00 +00:00
Tim Kientzle
a2854491c4 Portability: Not everyone is lucky enough to have ftruncate() 2008-09-12 04:08:11 +00:00
Tim Kientzle
220265229d Portability: Support platforms that lack (struct stat).st_blksize or SSIZE_MAX
Of course, FreeBSD has both.
2008-09-12 04:03:34 +00:00
Tim Kientzle
6d35d9a6e9 Windows compatibility: The stub replacement for compression_program
(which always returns an error when invoked) needs its prototype.
2008-09-12 03:53:54 +00:00
Tim Kientzle
a2a72fd640 Fix a type-aliasing problem in the libarchive test suite,
restore WARNS=6.
2008-09-08 00:58:12 +00:00
Tim Kientzle
fb7ec956eb Correct a leaking archive_entry in the test suite. 2008-09-07 23:59:27 +00:00
Tim Kientzle
7480311f87 Correct the comments here.
PR:		bin/126849
MFC after:	3 days
2008-09-07 06:15:45 +00:00
Tim Kientzle
11663004bd When restoring a directory, allow symlinks to be followed. The full
logic here gets a little complex, but the net effect is that the
SECURE_SYMLINKS flag will prevent us from ever following a symlink.
Without it, we'll only follow symlinks to dirs.  bsdtar specifies
SECURE_SYMLINKS by default, suppresses it for -P.

I've also beefed up the write_disk_secure test to verify this
behavior.

PR:		bin/126849
2008-09-07 05:22:33 +00:00
Tim Kientzle
11b4b8458c The link resolver now unsets the size to mark a hardlink
with no body instead of setting it to zero.
2008-09-05 06:15:25 +00:00
Tim Kientzle
a0bfb8ae3e MfP4: Handle entries with unset size properly: Regular files with
unspecified size are "unlimited" (required by Zip reader, which
sometimes does not know the uncompressed size of an entry until it
gets to the end).  Also, hardlinks with unspecified (or zero) size do
not overwrite the data on disk nor do they set metadata.  This is
compatible with GNU tar and NetBSD pax behavior.
2008-09-05 06:13:11 +00:00
Tim Kientzle
e20d272f0a MfP4: Use the set/unset tracking to determine when mtime or atime
is unavailable.  Use start_time as a substitute when one is missing;
if both are missing, skip the call to {f,l,}utime{s,}() entirely.
2008-09-05 05:55:49 +00:00
Tim Kientzle
1b42ff4cd6 Markup fix.
MFC after:	3 days
2008-09-04 05:22:00 +00:00
Tim Kientzle
0c35edadaa Style: Use ARCHIVE_VERSION_NUMBER to conditionalize tests on
the particular libarchive version being tested instead of the
deprecated ARCHIVE_API_VERSION and ARCHIVE_VERSION_STAMP macros.
2008-09-01 05:38:33 +00:00
Tim Kientzle
32364a7ddb MfP4: set/unset tracking for atime, ctime, mtime, and size fields.
This generalizes the existing set/unset tracking for hardlink/symlink
fields and extends it to cover non-string fields.  Eventually, this
will be further extended to cover most fields.

In particular, this is needed to correctly detect when time fields
are missing (for example, reading ustar archives doesn't set atime or
ctime) for proper time restore and is helpful when trying to determine
whether to overwrite data when restoring hardlinks.

This commit updates the tests but not the docs.
2008-09-01 04:54:29 +00:00