8131 Commits
Author SHA1 Message Date
Joerg Sonnenberger 9c93872f35 siginfo exists already as union on NetBSD, rename struct to
bsdtar_siginfo.

SVN-Revision: 81
2008-05-20 19:12:37 -04:00
Tim Kientzle bc665d69a1 Fix the broken mtree test. Joerg recently made the mtree parser
a bit stricter; 'type' is now a required keyword, in keeping
with the expectations of mtree(8).

SVN-Revision: 80
2008-05-20 17:45:46 -04:00
Tim Kientzle 4c8e027b1d tar/siginfo.c is a new file; include it in the portable build.
SVN-Revision: 79
2008-05-20 17:44:55 -04:00
Tim Kientzle e28797731c Fix a typecast.
SVN-Revision: 78
2008-05-20 17:44:35 -04:00
Tim Kientzle 28bffcb0cf Guard against a number of theoretical buffer and integer
overflows.  As far as I can tell, none of these are
actually exploitable.

Thanks to David Remahl at Apple for pointing these out.
MFP4 after:	1 day

SVN-Revision: 77
2008-05-20 15:57:10 -04:00
Tim Kientzle d9363627f0 Another file created by autoconf & friends.
SVN-Revision: 76
2008-05-20 14:51:58 -04:00
Tim Kientzle 58337c84f2 IFC
SVN-Revision: 75
2008-05-20 14:47:23 -04:00
Joerg Sonnenberger d0ba3be08a Just as archive_entry_free, recognize NULL strings as noops.
SVN-Revision: 74
2008-05-20 12:36:18 -04:00
Joerg Sonnenberger 230a49780d 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.

SVN-Revision: 73
2008-05-20 04:34:16 -04:00
Joerg Sonnenberger c642cacb83 Merge rev 1.5 from FreeBSD CVS: Return ARCHIVE_FATAL after
failing malloc.

SVN-Revision: 72
2008-05-20 00:09:43 -04:00
Joerg Sonnenberger c55d170734 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.

SVN-Revision: 71
2008-05-19 23:28:32 -04:00
Joerg Sonnenberger d0a9a9ff77 Consistently use copy_hardlink.
Fix a double-free/use-after-free.

SVN-Revision: 70
2008-05-19 23:24:19 -04:00
Joerg Sonnenberger aaf2e7138a wcrtomb is not declared in wchar.h on IRIX. From NetBSD
pkg/38674 by Tobias Nygren.

SVN-Revision: 69
2008-05-18 23:18:54 -04:00
Joerg Sonnenberger c8b251d06c Use the link resolver to detect hardlinks when writing archives
using mtree files.

SVN-Revision: 68
2008-05-18 22:19:29 -04:00
Joerg Sonnenberger 4bef229cdd Use copy_pathname/copy_hardlink/copy_symlink instead of the set
version after modifying them.

SVN-Revision: 67
2008-05-18 22:18:05 -04:00
Joerg Sonnenberger 0b13971a8b 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.

SVN-Revision: 66
2008-05-18 22:17:20 -04:00
Joerg Sonnenberger a8588bf6d3 Add a mtree mode for the link resolver. This does hardlink
resolving, but doesn't change the size of the entry.

SVN-Revision: 65
2008-05-18 22:12:05 -04:00
Tim Kientzle 4ead2345d5 More cleanup of unused variables.
SVN-Revision: 64
2008-05-17 03:45:39 -04:00
Tim Kientzle f73c14223a Clean up after Joerg. ;-)
SVN-Revision: 63
2008-05-16 18:46:44 -04:00
Tim Kientzle b406d5c8b5 Remove aclocal.m4 since it's build by the auto* tools.
SVN-Revision: 62
2008-05-16 18:44:18 -04:00
Joerg Sonnenberger 7bb5cb5274 Switch bsdtar to use archive_entry_linkresolver.
SVN-Revision: 61
2008-05-16 01:02:56 -04:00
Tim Kientzle 249f6038f8 On second thought, Makefile.in doesn't belong here at all, since
it's constructed by automake.

SVN-Revision: 60
2008-05-15 18:19:56 -04:00
Tim Kientzle 70837d444b Updated Makefile.in.
SVN-Revision: 59
2008-05-15 18:18:37 -04:00
Tim Kientzle b822d3bb5d 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.

SVN-Revision: 58
2008-05-15 18:14:57 -04:00
Tim Kientzle ec50ba5e1f 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.

SVN-Revision: 57
2008-05-15 18:11:25 -04:00
Tim Kientzle a31efee11a Extend the fflags test just a tad.
This could be significantly improved.

SVN-Revision: 56
2008-05-15 17:19:20 -04:00
Joerg Sonnenberger bf9f5fbc17 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.

SVN-Revision: 55
2008-05-15 09:58:03 -04:00
Joerg Sonnenberger d3dcf900f7 Document that the return value of archive_write_data needs to be
reinvestigated.

SVN-Revision: 54
2008-05-14 23:11:22 -04:00
Joerg Sonnenberger 326a25bc94 Add support for pax-like tar substitutions as found in NetBSD's
pax-as-tar.  This code is not compiled in on platforms lacking
regex.h.

SVN-Revision: 53
2008-05-13 22:12:21 -04:00
Tim Kientzle a1a72a7969 Simpler alternative to timegm(), thanks to Garrett Wollman.
SVN-Revision: 52
2008-05-13 17:43:58 -04:00
Joerg Sonnenberger 51300afefa 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.

SVN-Revision: 51
2008-05-13 01:41:46 -04:00
Joerg Sonnenberger adb4f3a60f Writing data beyond the end of the file is not valid, change the
incorrect test into an actual assertion for the expected
behaviour.

SVN-Revision: 50
2008-05-13 01:31:31 -04:00
Joerg Sonnenberger 88d72401a4 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.

SVN-Revision: 49
2008-05-13 01:21:05 -04:00
Joerg Sonnenberger d9a5d12bb6 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.

SVN-Revision: 48
2008-05-13 01:18:15 -04:00
Joerg Sonnenberger 8dacaef769 Compress/LZW can be written as well.
SVN-Revision: 47
2008-05-13 01:15:12 -04:00
Joerg Sonnenberger 629947e3ba 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.

SVN-Revision: 46
2008-05-12 08:23:26 -04:00
Joerg Sonnenberger 5954fe3bce Fix ae_strtofflags. It was using the wchar constants.
SVN-Revision: 45
2008-05-12 08:14:05 -04:00
Joerg Sonnenberger 098bceb11e Document archive_entry_copy_fflags_text.
SVN-Revision: 44
2008-05-12 07:39:56 -04:00
Joerg Sonnenberger 054049a3be Make ARCHIVE_EXTRACT_* use hex.
SVN-Revision: 43
2008-05-12 04:02:11 -04:00
Joerg Sonnenberger 2f8873c204 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.

SVN-Revision: 42
2008-05-12 03:47:34 -04:00
Tim Kientzle c950be814b Include tar/test/test_patterns.c, the initial skeleton of
a test for command-line pattern matching.

SVN-Revision: 41
2008-05-11 10:47:57 -04:00
Tim Kientzle ef87488636 Fix a small race in the format check for cpio; the four entries
might get slightly different timestamps.

SVN-Revision: 40
2008-05-11 10:47:11 -04:00
Joerg Sonnenberger 76970580f8 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.

SVN-Revision: 39
2008-05-11 05:32:51 -04:00
Joerg Sonnenberger 5583ed0bef Document archive_write_set_compression_compress.
SVN-Revision: 38
2008-05-11 03:39:16 -04:00
Tim Kientzle b907305f3d 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

SVN-Revision: 37
2008-05-08 16:48:01 -04:00
Tim Kientzle cf8faa82d4 Missed a file from change 141352
SVN-Revision: 36
2008-05-08 16:33:48 -04:00
Tim Kientzle 31f358cf9b 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.

PR:		bin/121598

SVN-Revision: 35
2008-05-08 16:28:36 -04:00
Tim Kientzle 3f3749c43b Include contributed Windows build files in portable release.
Obtained from:	Scott

SVN-Revision: 34
2008-05-08 15:42:51 -04:00
Tim Kientzle ddf63e1e01 Improve the bzip2 detection by looking for the data or end-of-data
marker that must follow the initial file signature.
Obtained from:	Scott

SVN-Revision: 33
2008-05-08 15:30:43 -04:00
Tim Kientzle 56c6190462 Include the Windows helper files in the portable distribution.
Prune out a few more unnecessary definitions from archive_windows.h.

SVN-Revision: 32
2008-05-08 15:12:12 -04:00