As specified for nbpax, when the optional keyword is present and
the on-disk item doesn't exist or has a different type, skip it.
Fix the error message for the mismatch to not include errno.
Claim copyright for parts of this file.
Skip over entries where mtree and on-disk type disagree.
For directories and files, fstat the on-disk item, otherwise
lstat it. Copy device, gid/uid, mtime, nlink, permissions and
size if they have not been explicitly specified.
Skip entries that don't specify the type -- mtree requires this.
Input archive and target archive might disagree about the entry
size. E.g. the entry to write is a hardlink and the tar writer
reset the entry size to 0, skip the data on the input side.
Tim Kientzle [Thu, 15 May 2008 22:14:57 +0000 (18:14 -0400)]
Overhaul this test a bit so that the right entries get stored
as hardlinks, regardless of what order the underlying filesystem
returns the files in. This basically just involves segregating
the different groups of entries into separate dirs and specifying
those dirs -- in the correct order -- on the command line,
instead of relying entirely on the tree traversal.
This should fix a persistent test failure that's been reported
on Linux when using newer filesystems.
Tim Kientzle [Thu, 15 May 2008 22:11:25 +0000 (18:11 -0400)]
Failing to write a header is not just a "WARN" problem,
it's a "FAILED" operation. In particular, this fixes a
relatively obscure problem writing ustar archives with bsdtar.
Prior to this, bsdtar would report additional bogus errors
because it kept trying to write the body even after the
header failed.
Actually recognize the '-s' option by adding it to the getopt
string. Refactor substitution code by integrating it in
edit_pathname. This also makes the subst code apply to -c.
Add a very basic test case.
Add support to sparsify files on write. This scans output blocks
for NUL bytes and seeks if a block is full of NULs. This is
optional, but the penalty is very small.
optional and ignore are pure keywords without arguments.
Currently ignore them both, for optional it might be better to
mask errors later though.
Add device keyword support, this doesn't do any mapping though.
Fix link keyword, it always specifies a symlink independent of
whether the type keyword was processed already.
Fix BSD ar writer to not increase the size of the archive_entry
for long filenames. This breaks applications that use
archive_entry_size to decide how much to write.
Ignore the various checksums supported by NetBSD's mtree.
Add support for flags keyword.
Add support for nlink keyword.
Sort time keyword correctly.
Ignore tags keyword. This should deal with include/exclude
later.
Add commented out entries for device, ignore and optional.
Refactor stat cache handling into a function. Consistenly use
lstat(2) as no symlink sohuld ever be referenced at this point.
After unlink(2)/rmdir(2) operations ensure that the stat cache
is reset.
Fix the extraction of archives where hardlinks and the main file
disagree on permissions. This can be observed with base.tgz of
an unprivileged NetBSD build.
After the change permissions are restored only for files that
have content attached. This works for almost ustar. For pax
archives with optional data in the second entry and cpio this
will fail for unprivileged user if the first entry doesn't allow
writing for the current user.
Tim Kientzle [Thu, 8 May 2008 20:48:01 +0000 (16:48 -0400)]
Just skip entries where --strip-components removes everything.
Previously, this was failing for dir entries that had exactly
the right number of components, e.g. "a/" with --strip-components=1,
leading to odd warnings about "Invalid empty pathname"
PR: bin/121158
Tim Kientzle [Thu, 8 May 2008 20:28:36 +0000 (16:28 -0400)]
If there are leftover inclusions (command-line patterns) after
extraction, warn about them:
$ bsdtar xfv tar.tgz foo bar
-rw-r--r-- 0 tim tim 0 May 8 19:50 foo
bsdtar: bar: Not found in archive
bsdtar: Error exit delayed from previous errors.
Tim Kientzle [Wed, 7 May 2008 08:54:46 +0000 (04:54 -0400)]
More Windows cleanup: Add a copyright notice (as discussed with
the author, Kees Zeelenberg) to archive_windows.c, include a comment
explaining the history and intent for this file. Remove a couple
of unnecessary functions.
Tim Kientzle [Tue, 6 May 2008 22:55:46 +0000 (18:55 -0400)]
Add some additional examples and clarification about using
mtree descriptions to generate tar archives using
tar -cf output.tar @input.mtree
Obtained from: Vincent Zweije
Tim Kientzle [Sat, 3 May 2008 16:21:41 +0000 (12:21 -0400)]
archive_read_extract2() provides much of the convenience of
archive_read_extract() while allowing you to configure the
archive_write_disk restore object.
Tim Kientzle [Sat, 3 May 2008 15:11:31 +0000 (11:11 -0400)]
Clean up some memory-management issues in the link resolver.
Now, the 'canonical' entry is the one actually used for matching
and lookups, the 'entry' is used for transient needs, and
the bookkeeping now correctly tracks when the 'entry' is no
longer valid because it was handed back to the client.
Tim Kientzle [Fri, 2 May 2008 23:19:43 +0000 (19:19 -0400)]
Eliminate archive.h.in; instead of editing a new version into
the Makefile and having the Makefile edit it into archive.h,
just edit it directly into archive.h in the first place.
This means that archive.h is no longer a constructed file,
which simplifies quite a number of things.
Tim Kientzle [Thu, 1 May 2008 22:37:23 +0000 (18:37 -0400)]
Documentation updates:
Document -o option (old format) for -c, -r, -u modes,
correct --format to indicate that it can be used with -r and -u
Correct option checks to not suppress --format with -r or -u
PR: bin/122600