Tim Kientzle [Thu, 24 Sep 2009 15:11:32 +0000 (11:11 -0400)]
Fix tar archiving of hardlinks on Windows: tree.c uses
Windows stat() call which doesn't actually provide
link count or inode values. Passing this data down into
libarchive (to avoid redundant stat() calls) meant that
hardlink detection simply failed on Windows. Until
I can work up something better, this simply avoids passing
stat() data from tree down into libarchive on Windows.
This allows libarchive to do the GetFileInfoByHandle
which provides useful information.
Tim Kientzle [Thu, 24 Sep 2009 15:06:56 +0000 (11:06 -0400)]
Use int64_t for storing inode values internally.
This fixes some hardlink-detection issues on Windows: NTFS uses 64-bit inode values, but Windows ino_t is only 16 bits.
Tim Kientzle [Mon, 14 Sep 2009 04:38:40 +0000 (00:38 -0400)]
Various fixes to symlink-related tests:
* canSymlink() is no longer hardwired to always return false
* cpio/test/test_gcpio_compat now has symlink-free test archives
for use on platforms that lack symlink support
* several other tests have slightly finer-grained avoidance of
checks that rely on symlink support
Tim Kientzle [Sat, 12 Sep 2009 18:08:48 +0000 (14:08 -0400)]
Merge cpio test refactorings into tar and libarchive test harnesses,
apply a few minor reorgs to further reduce diffs among the test
harnesses, update a bunch of tests to match the harness changes,
update some comments, rewrite the gzip/gunzip platform probes to the
new "canFoo()" style, sprinkle a few new symlink support checks. This
hasn't been tested on Windows yet, but should chip away a few more
test failures there.
Tim Kientzle [Sat, 12 Sep 2009 05:24:28 +0000 (01:24 -0400)]
Refactor hardlink/symlink support in test harness: we now have
assertIsHardlink() and assertIsNotHardlink(). On the symlink side,
I've added a run-time platform probe canSymlink() that tests the
local platform the first time it is called and remembers the result.
As an experiment, refactor test_basic.c to omit symlinks from the
tests if the current platform lacks symlink support.
Tim Kientzle [Fri, 11 Sep 2009 05:28:37 +0000 (01:28 -0400)]
Real hardlink detection on Windows (yes, Windows stat() really does seem to be that broken!). Also, expose the core hardlink test as a non-assertion so we can assert it false.
In particular, this fixes test_option_l on Windows.
Tim Kientzle [Fri, 11 Sep 2009 02:24:42 +0000 (22:24 -0400)]
Check whether platform permits filenames with control characters
before we try to actually test with one. In particular, this should
fix this test on Windows. (On platforms that permit control
characters in filenames, this test verifies that the -null option
really does treat LF characters as part of a filename instead of as a
line terminator.)
Even on platforms that don't support control characters, we can
test most of the line-parsing capabilities.
Charles Wilson [Thu, 10 Sep 2009 18:17:34 +0000 (14:17 -0400)]
Fix compiler warnings on MinGW with gcc-4.4.0
* tar/test/main.c (assertion_file_time): Silence 'var may
be used uninitialized' warning.
* cpio/test/main.c (assertion_file_time): Silence 'var may
be used uninitialized' warning.
* libarchive/test/main.c: Don't re-#define chdir.
(assertion_file_time): Silence 'var may be used uninitialized' warning.
Tim Kientzle [Thu, 10 Sep 2009 04:36:02 +0000 (00:36 -0400)]
Propagate the recent overhaul of libarchive/test/main.c to the tar and
cpio test suites, update run_all_tests to take advantage of the new
default test output.
Tim Kientzle [Tue, 8 Sep 2009 03:47:47 +0000 (23:47 -0400)]
Reading zip archives failed if you only gave
archive_read_support_format_zip() because of a bug in how the
read-ahead logic handled read(0) requests. Change the compat_zip test
to exercise this case and fix the underlying bug.
Tim Kientzle [Sun, 6 Sep 2009 06:44:40 +0000 (02:44 -0400)]
Add new assertions to verify atime, birthtime, and mtime, both
for exact values and "recent". Sketch in support for FreeBSD
(including high-res), Windows (including high-res and birthtime),
and generic POSIX.
Inspired in part by the discovery that stat() on Windows shifts mtime
values depending on DST settings, so the old code that used stat()
breaks in weird ways on Windows. GetFileTime() seems to not have this
problem, but using that requires that we not use stat().
Tim Kientzle [Sat, 5 Sep 2009 02:41:09 +0000 (22:41 -0400)]
Probe for CreateHardLinkW and use it only if it's found.
(Needed for MinGW, which doesn't have new enough Windows
headers to compile calls to CreateHardLinkW.)
Tim Kientzle [Thu, 3 Sep 2009 04:37:38 +0000 (00:37 -0400)]
Rename all externally visible shim functions to start with __la_ so
they don't conflict with "stat", etc, simulations that might be used
by various applications.
Tim Kientzle [Tue, 1 Sep 2009 01:34:07 +0000 (21:34 -0400)]
CreateHardLinkA is supported on Win2k and later, which is good
enough for now. (Plus, I was having inexplicable problems getting
the dynamic probe to work for this function.)
Tim Kientzle [Mon, 31 Aug 2009 04:43:36 +0000 (00:43 -0400)]
If the starting path isn't a pattern, then we don't feed it to FindFirstFile(), so we can't rely on FIND_FILE_DATA to determine whether it's a dir or not. So, add support for GetFileInformationByHandle(). This needs to be extended so that we use this info to fill the archive_entry instead of Windows' anemic stat() data.
Tim Kientzle [Mon, 31 Aug 2009 03:45:49 +0000 (23:45 -0400)]
We should only use FindFirstFile for the path provided on the command line if it actually has wildcard characters in it. Otherwise, we can use the same code used on Posix.
Tim Kientzle [Sat, 29 Aug 2009 17:37:21 +0000 (13:37 -0400)]
This test requires a certain umask() setting but doesn't actually
set it. Since the immediately preceding test does set umask(), this
only shows up if you run this test by itself. (Or at least first.)
Tim Kientzle [Sat, 29 Aug 2009 04:33:18 +0000 (00:33 -0400)]
Minor updates to minitar: Support compress on write, add full
user/group lookups by default and an option to suppress them. With
all of the suppression macros, this compiles to about the same size as
does examples/untar.c.
Tim Kientzle [Sat, 29 Aug 2009 04:08:13 +0000 (00:08 -0400)]
Merge r1396 from libarchive/trunk: significant rework of examples/untar.c,
the minimal libarchive-based untar.c program. (Not to be confused with
contrib/untar.c which is an even more minimal untar program that doesn't
use libarchive. I have got to rename one of them someday....)
Tim Kientzle [Sat, 29 Aug 2009 03:42:55 +0000 (23:42 -0400)]
Fix a handful of bugs in untar.c and significantly extend the opening
commentary, which hasn't really been updated since 2006 or so. In
particular, I went back and rechecked the sizes on modern FreeBSD and
found that things have bloated quite a bit: statically compiled,
untar.c is now about 25% larger than hello.c, where it used to be
almost 25% smaller.
Tim Kientzle [Thu, 27 Aug 2009 04:24:19 +0000 (00:24 -0400)]
If ftruncate() isn't available, we fall back to use
lseek()/write() to extend a file. Unfortunately, that
code was broken, as would be readily apparent to anyone who
ran the test suite on a platform that lacked ftruncate().
Tim Kientzle [Sun, 23 Aug 2009 04:16:58 +0000 (00:16 -0400)]
Test -T with varying end-of-line conventions, including --null -T with
a filename that includes a NL character. Fix the line parser in
util.c to correctly handle these cases.
Tim Kientzle [Sun, 23 Aug 2009 03:18:13 +0000 (23:18 -0400)]
Rewrite a lot of the test assertion framework.
Mostly, this was done just to simplify the code, but it also brings
the file/line reporting into one place where it can be adjusted to
suit different environments (e.g., Visual Studio expects "file.c(89):
message" instead of "file.c:89: message").
Tim Kientzle [Sun, 16 Aug 2009 00:21:30 +0000 (20:21 -0400)]
Issue 36: Fix acl probing on Linux.
I used the additional library checks directly from the patch provided.
Probing the functions properly proved a bit more challenging because
the indicated headers aren't the same on all systems. Instead, I
generalized the existing header tests to build up a list ${INCLUDE}
of all headers present on the local system and used that.
Tim Kientzle [Tue, 11 Aug 2009 15:55:52 +0000 (11:55 -0400)]
Probe acl_get_link and acl_get_link_np so that ACLs are properly
read from symlinks. Without this, link-related tests fail for cpio
on FreeBSD. (Same as r1357, but for autoconf-generated builds.)
Tim Kientzle [Tue, 11 Aug 2009 15:14:32 +0000 (11:14 -0400)]
Fix cpio symlink tests on FreeBSD; the link-sensitive ACL routines
weren't being properly configured, which was causing the regular
Posix mode bits to get overwritten.