Tim Kientzle [Tue, 29 Jul 2008 20:48:57 +0000 (16:48 -0400)]
Modify test_basic to verify that cpio is ignoring umask
when copying files. In particular, this verifies the
recent fix to cpio.c to set ARCHIVE_EXTRACT_PERM.
Tim Kientzle [Tue, 29 Jul 2008 20:27:19 +0000 (16:27 -0400)]
Preserve all permissions by default.
In particular, this fixes the curiosity that cpio -dumpl would
apply umask to the new dirs (which got created) but not
to the new files (which are just links to the existing files).
Thanks to Kris Kennaway for reminding me about this one.
Tim Kientzle [Sat, 26 Jul 2008 21:20:32 +0000 (17:20 -0400)]
If the size is unknown, don't limit data writes.
This seems to straighten out some of the disk-write semantics
and should solve a problem with Zip extraction when the
size of the file is not known in advance.
Tim Kientzle [Sat, 26 Jul 2008 21:17:48 +0000 (17:17 -0400)]
Provide a hook for unsetting the size field.
Use it in the link resolver for correctly marking hard links
where the size of the linked-to file is actually unknown.
Tim Kientzle [Sat, 26 Jul 2008 10:32:39 +0000 (06:32 -0400)]
Add a bitmap in the entry to track which values have been
set. Change the ad hoc symlink and hardlink tracking to use
the new bitmap, add tracking for atime and size fields.
This is motivated by some errors restoring Zip entries where
the file size is not known and by errors restoring file
times (utimes(2) sets both atime and mtime, old tar archives
only store mtime).
PR: bin/124915
- don't push data line wise to the compressor, accumulate it
in local buffer
- reduce required error checking as fewer writes to the
compressor need attention
- explicitly initialise the work string, don't depend on memset
for that
- optimise inner loop of sed backend to take ~25% less time
- simplify and optimise uuencoding to always work on full lines,
padding them explicitly with NUL (harmless changes in output).
Overall uuencoding requires more than 50% less time.
Tim Kientzle [Fri, 27 Jun 2008 00:08:58 +0000 (20:08 -0400)]
On systems that use SysV-style SGID handling for directories,
the SGID bit can be set intrinsically by the system.
When handling EXTRACT_PERM (tar -p) on such systems, we need
to do an additional chmod() on directories, even if the
dir creation used the correct full mode.
Tim Kientzle [Thu, 26 Jun 2008 08:51:21 +0000 (04:51 -0400)]
When hardlinking files for -l by using archive_write_header(),
ensure that we're just doing a bare hardlink without any accompanying
data. (Remember that cpio allows hardlinks to have data.)
Otherwise, -l creates a link and then opens the linked files
for overwrite, resulting in the files being erased.
Tim Kientzle [Wed, 18 Jun 2008 21:15:25 +0000 (17:15 -0400)]
Use times at least a full 24 hours after the Epoch for testing.
In particular, this should fix tests on systems that lack timegm(),
whose mktime() cannot handle times prior to the Epoch, when run
in timezones with negative offsets from GMT.
Extend mtree quoting support to the full c-style quoting from
the strvis(3) man page and to allow line continuation.
As with the other changes, this aims to be correct first, so it
can certainly be optimised.
Tim Kientzle [Sun, 15 Jun 2008 19:49:20 +0000 (15:49 -0400)]
Separate out the BZip2-compressed ISO image into a separate
file, to make it easier to update the image. While I'm here,
fix the instructions in the C source for this test about how
to regenerate the reference file from scratch.
Tim Kientzle [Sun, 15 Jun 2008 03:20:28 +0000 (23:20 -0400)]
Back out change 143007; go back to using platform getopt_long
if it exists.
(I intend to re-add this getopt_long implementation at a later
date, but I'm trying to stabilize the libarchive 2.5 release
and this is a bit disruptive.)
Tim Kientzle [Sat, 14 Jun 2008 21:27:26 +0000 (17:27 -0400)]
Fix the link resolver to never match dirs as hardlinks.
In particular, this seems to fix some recent port build failures
(the use of tar in these ports is rather bizarre, but it did work
with tar's old link-matching code).
Thanks to: Kris Kennaway
Tim Kientzle [Sat, 14 Jun 2008 15:11:37 +0000 (11:11 -0400)]
On some platforms, the GID bit is inherited by subdirectories.
This caused a lot of false failures in the libarchive test
harness. Be a little more careful: the GID bit on created
directories should only be checked if ARCHIVE_EXTRACT_PERM
was used when the dir was created.
Submitted by: Carey Evans
Tim Kientzle [Sat, 14 Jun 2008 14:45:42 +0000 (10:45 -0400)]
Flush stdout after printing the name of the test;
this ensures that any errors from that test appear after the
name of the test. <sigh>
Submitted by: Carey Evans
Tim Kientzle [Sat, 14 Jun 2008 14:36:30 +0000 (10:36 -0400)]
Use wctomb(), which is present in C90, instead of wcrtomb(),
which wasn't introduced until C99. In particular, this allows
the new locale support to work on FreeBSD 4, which doesn't
implement C99 wide character functions.
Include an autoconf check for wctomb(); if it's not present at
all, use the built-in UTF-8 functions instead so that pax
extended headers (which are stored in UTF-8) can still be minimally
supported.
Tim Kientzle [Sat, 7 Jun 2008 18:23:50 +0000 (14:23 -0400)]
Somewhere I got the idea that wcrtomb(NULL, ...) cleared the
provided shift state. This is wrong; memset() seems to be
the correct portable way to clear the shift state.
Submitted by: NAKAJIMA Michihiro
MFP4 after: 3 days
Tim Kientzle [Thu, 5 Jun 2008 22:41:21 +0000 (18:41 -0400)]
Use Gregory Pietsch's public domain getopt_long() implementation
instead of relying on the platform one.
Having the tar program use getopt() on platforms that didn't
support getopt_long() was a nice idea, but it's turning out to
be a real headache. This way, I can just assume long option
support and simplify chunks of the test harness.
Tim Kientzle [Wed, 28 May 2008 22:33:11 +0000 (18:33 -0400)]
Mis-integrate; the p4 version doesn't need this, since archive.h isn't
a built file.
Code in CVS needs this until archive.h.in gets renamed to archive.h.
Between all the false cases found by Coverity, one is actual
relevant: after closing child_stdin, set it to -1, keeping
child_stdout alone and not the other way around.
Some systems don't have vfork, only fork. It is good enough for
our purposes, so use either.
Include archive.h if the program support is not present to fix
compilation.
Be more persistent when trying to get blocking behavior back for
the pipes. If the child switched the descriptor back to
non-blocking, set it back to blocking and call poll/select.
Make the poll/select code filter out -1 as descriptor for this
purpose.
Move the opening of the file to write down into
write_entry_backend, if it isn't already open.
Use archive_entry_sourcepath for this purpose and allow
writing deferred entries for newc format that way.
Tim Kientzle [Wed, 21 May 2008 20:53:40 +0000 (16:53 -0400)]
Follow-on to change 141950: Enforce the non-zero minimum BEFORE
checking to ensure that the buffer really is larger. Otherwise,
doubling zero gives us zero.
Pointy hat: /me
Store mtree option as individual strings in a single linked
list. Scan when adding options for an entry for duplicate
keywords and override them. Implement /set and /unset support.
Change the behaviour for multiple full pathes to match the
NetBSD mtree behaviour: only the last line is used.
Match NetBSD mtree behaviour and always parse the permissions
as octal. Actually return a warning when the mode is symbolic.
Handle the current directory as full path, this seems to match
the behaviour of NetBSD mtree, but is not documented.
Tim Kientzle [Tue, 20 May 2008 21:45:46 +0000 (17:45 -0400)]
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).