Commit Graph

546 Commits

Author SHA1 Message Date
kientzle
c9d6a73af2 Recover from a test failure here. 2008-12-06 05:58:24 +00:00
kientzle
9bd8cf4e76 New internal archive_string_concat utility function. 2008-12-06 05:56:43 +00:00
kientzle
fa92961e89 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
kientzle
f7c489d836 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
kientzle
cb9f366909 2 is more portable than STDERR_FILENO 2008-12-06 05:52:01 +00:00
kientzle
9aed2614cc 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
kientzle
b93042ab7d 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
des
d9ae813ea1 Move va_end() up 2008-10-21 12:10:30 +00:00
kientzle
24084253f7 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
kientzle
88da8906fe 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
kientzle
e2204b1f39 Style: Mark private data 'static', correct an old comment.
MFC after:	3 days
2008-10-19 00:13:57 +00:00
kientzle
18256ca193 Verify high-res birthtime support on FreeBSD.
MFC after:	30 days
2008-09-30 04:13:21 +00:00
kientzle
1f6b640a75 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
kientzle
c7ce068f95 MfP4: Store/read birthtime data in pax format.
Submitted by:	Pedro Giffuni
MFC after:	30 days
2008-09-30 03:57:07 +00:00
kientzle
6902e811f6 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
kientzle
46af6c4ecf 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
kientzle
97219c55ce Trying to distinguish different "versions" of mtree files was a silly idea.
Submitted by:	Joerg Sonnenberger
2008-09-18 04:13:36 +00:00
kientzle
c575680569 Choose a flag-handling strategy based on platform capabilities
rather than on platform.
2008-09-14 05:51:25 +00:00
kientzle
f86ac1c574 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
kientzle
ccdf5b420c Portability: Not everyone is lucky enough to have ftruncate() 2008-09-12 04:08:11 +00:00
kientzle
96223dee11 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
kientzle
93721eec26 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
kientzle
97fcc0ce31 Fix a type-aliasing problem in the libarchive test suite,
restore WARNS=6.
2008-09-08 00:58:12 +00:00
kientzle
76f6bbac93 Correct a leaking archive_entry in the test suite. 2008-09-07 23:59:27 +00:00
kientzle
f900007096 Correct the comments here.
PR:		bin/126849
MFC after:	3 days
2008-09-07 06:15:45 +00:00
kientzle
02ce672bbc 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
kientzle
ae483162bf 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
kientzle
5290cd20ad 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
kientzle
88514167fd 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
kientzle
5cd175eaac Markup fix.
MFC after:	3 days
2008-09-04 05:22:00 +00:00
kientzle
da7b4a0824 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
kientzle
3b54160eff 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
kientzle
12d7b9e21b Sort the list of format names. 2008-09-01 02:50:53 +00:00
kientzle
7711ed1cf5 Use the "start_time" (time at which the restore process began)
to fill in a missing atime instead of substituting mtime.

PR:		bin/124915
2008-09-01 02:50:24 +00:00
kientzle
fe3cf0e14f New mtree writer, thanks to Joerg Sonnenberger.
Obtained from:	Joerg Sonnenberger
2008-08-31 07:21:46 +00:00
kientzle
ede0c9fe5c Joerg Sonnenberger's improvements to the shar writer.
Significant performance improvements, better quoting of file names, etc.
2008-08-31 07:10:40 +00:00
kientzle
a3fa470b0f Make libarchive_test a little smarter about trying to find
its reference files when you don't specify -r.  It now checks
a couple of likely nearby directories to see if any of them
have a particular known file.
2008-08-31 07:06:02 +00:00
kientzle
558a49e6d8 When atime wasn't specified, it should get set == mtime.
This is much stronger than just asserting that it's not zero.
2008-08-30 05:31:23 +00:00
kientzle
76addb3012 If no atime was specified (for example, when extracting from ustar
archives), set atime == mtime.  Before this, atime would get restored
to 0.
2008-08-28 06:40:22 +00:00
kientzle
f8ec8301f6 Alphabetize the list of tests. 2008-08-25 06:08:22 +00:00
kientzle
0563028aef Update the total archive byte counters when writing entries to disk using
archive_write_disk.
Update cpio to use this to emit block counts in -p mode.
Update cpio tests to verify these block counts.
2008-08-24 06:21:00 +00:00
kientzle
5f09367fca Remove the stillborn attempt to cleanup tests as well as the build dir. 2008-08-24 05:54:28 +00:00
kientzle
1f8b9faf14 Fail copying path/.. only if SECURE_NODOTDOT was specified.
Since we already warn for any '..' elements in that case,
the extra "lastdotdot" tracking turns out to be unnecessary.

PR:		bin/124924
2008-08-24 05:42:22 +00:00
kientzle
ad89b2721b Fix the cpio bug tested for by r182092 of usr.bin/cpio/test.
Since various 'find' incantations can emit container directories
in various orders, we cannot refuse to update a dir because it's
apparently the same age.

MFC after:	3 days
2008-08-24 05:01:01 +00:00
kientzle
0e0fb66ac7 Fix up test suite so it works again with the libarchive 1.x API.
In particular, FreeBSD 6 still uses the libarchive 1.x API and
this correction will permit MFCing new libarchive features back
to FreeBSD 6.
2008-08-11 01:19:36 +00:00
kientzle
aa6984275e Correct test_tar_large so it works correctly with the libarchive 1.x API. 2008-08-10 21:14:26 +00:00
kientzle
55e9379b97 Explain why two apparently-identical archive_read_data() calls
really should have different return values.
2008-08-10 03:13:42 +00:00
kientzle
58af11b815 MfP4: Joerg Sonnenberger's fixes to make 'ar' and 'pax' writers
robust against multiple calls to their destroy() functions.
2008-08-10 02:06:28 +00:00
cperciva
45f0d08992 Mark functions as __dead2 in order to help the LLVM static checker
understand which code paths aren't possible.

This commit eliminates 117 false positive bug reports of the form
"allocate memory; error out if pointer is NULL; use pointer".
2008-08-04 01:25:48 +00:00
cperciva
e539172ce0 Garbage collect a variable which is assigned a value once but otherwise
is never used.

Found by:	LLVM/Clang Static Analyzer
2008-07-10 09:50:55 +00:00