Commit Graph

21 Commits

Author SHA1 Message Date
Tim Kientzle
c459cbeb2b Fix -R when used with -p. Previously, the
uname and gname weren't overwritten, so the
disk restore would use those to lookup the
original uid/gid again.  Clearing the uname
and gname prevents this.

Reported by: swell.k
MFC after: 7 days
2010-08-08 01:25:33 +00:00
Tim Kientzle
b6cb607644 bsdcpio 2.8.3 2010-05-08 16:47:33 +00:00
Tim Kientzle
378b2ffde5 Support -V option to print a dot for each file processed.
Also, change the existing -vi behavior to send the filenames to
stderr rather than stdout, as GNU cpio does.

PR:             bin/141175
Submitted by:	Philip Kizer
MFC after:	14 days
2010-01-30 06:49:18 +00:00
Tim Kientzle
99b13cfb97 This fixes bsdcpio's -R option to accept numeric
user or group Ids as well as user or group names.
In particular, this fixes freesbie2, which uses
-R 0:0 to copy a bunch of files so that the result
will be owned by root.

Also fixes a related bug that mixed-up the uid
and gid specified by -R when in passthrough mode.

Thanks to Dominique Goncalves for reporting this
regression.

Approved by:	re (kib)
2009-07-03 17:54:33 +00:00
Tim Kientzle
4f6b15547b When compiled for the release crunches, be a bit
more selective about what libarchive features we pull in:
 * No compression support
 * Only cpio and ustar writing
 * Only cpio and tar/pax readers
This reduces a statically linked, stripped binary from 900k to 680k
and completely eliminates the dependency on libcrypto.
2009-04-19 06:59:12 +00:00
Tim Kientzle
d46c56dcba Merge from libarchive.googlecode.com:
* Lots of new tests.
 * New -n / --numeric-uid-gid option
 * More sanity-checking of arguments
 * Various Windows portability improvements
 * Sync up version number to 2.7.0
2009-04-17 04:04:57 +00:00
Tim Kientzle
4b058a88d8 Custom command line parser for cpio; this is a little more
code but should be a lot fewer cross-platform compatibility
headaches.
2008-12-06 07:30:40 +00:00
Tim Kientzle
5157f46024 Format the output of -itv for real. In particular:
* Lookup uname/gname if not provided by the archive (I copied the
   uname/gname lookup cache from bsdtar)
 * Format device number instead of size for device nodes
 * Format date.

There's still a few improvements that I could copy from
bsdtar, especially the locale-aware safe_fprintf() code
and the locale-aware setup for day_first date formatting.
(And, of course, I need to think through a clean way to
push this stuff down into libarchive.)

Thanks to Peter Wemm for reminding me of this overlooked TODO item.
2008-11-29 20:22:02 +00:00
Tim Kientzle
33cbc37d91 Don't destroy the archive until after you finish pulling useful
information out of it.  As reported by Giorgos Keramidas.
2008-09-04 05:20:46 +00:00
Tim Kientzle
3269dc16fd 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
Tim Kientzle
630d7662c3 cpio should restore file flags and ACLs when they're available 2008-08-20 16:39:18 +00:00
Tim Kientzle
979b646f30 MfP4: Preserve permissions by default.
In particular, this fixes the oddity that -dumpl would apply
umask to copied dirs (which are created in the target tree)
but not to "copied" files (which are only linked).  After
this change:

$ ls -ld a a/b a/b/c
d--x-w-r--  3 tim  tim  512 Jul 29 20:08 a
drwxr----x  3 tim  tim  512 Jul 29 20:09 a/b
dr----x-w-  2 tim  tim  512 Jul 29 20:09 a/b/c
$ (echo a; echo a/b; echo a/b/c) | cpio -dumpl o
$ cd o
$ ls -ld a a/b a/b/c
d--x-w-r--  3 tim  tim  512 Jul 29 20:08 a
drwxr----x  3 tim  tim  512 Jul 29 20:09 a/b
dr----x-w-  2 tim  tim  512 Jul 29 20:09 a/b/c
2008-07-30 03:35:45 +00:00
Tim Kientzle
b423c28f74 Add --no-preserve-owner, which seems to be required by some ports.
Thanks to: Erwin Lansing
2008-07-29 15:23:31 +00:00
Tim Kientzle
af03c60c06 Preserve ownership if cpio is run as root. 2008-07-06 16:39:18 +00:00
Tim Kientzle
0d35b0da0c In -pl mode, only hardlink regular files. I need to test
other implementations, but it's clear that dirs and symlinks,
at least, shouldn't be hardlinked.
2008-07-05 05:16:23 +00:00
Tim Kientzle
77f719e605 Don't try to hardlink directories. While I'm here, expand some
comments to make this section of code a little clearer.
2008-07-01 05:45:03 +00:00
Tim Kientzle
6986afe53e As reported by Alexey Shuvaev, -dumpl overwrote files after
linking them, with predictably bad results.
2008-06-26 15:46:01 +00:00
Tim Kientzle
e6c78aec4f In -p mode, don't gaurd against '..' in paths. We continue to
check in -i mode unless --insecure is specified.

PR: bin/124924
2008-06-24 15:18:40 +00:00
Tim Kientzle
1aaade6e93 If we're using -l and can't hardlink the file because of a cross-device
link, just ignore the -l option and copy the file instead.
In particular, this should fix the COPYTREE_* macros used in the
ports infrastructure which use -l to preserve space but often get
used for cross-device copies.
2008-06-21 17:47:56 +00:00
Tim Kientzle
9b48cdcc39 Rework line-processing framework to add support for --null and
to eliminate a callback.
2008-06-21 02:20:20 +00:00
Tim Kientzle
1e38350b0a Initial commit of bsdcpio 0.9.11b.
A new implementation of cpio that uses libarchive as it's back-end
archiving/dearchiving infrastructure.  Includes test harness;
"make check" in the bsdcpio directory to build and run the test
harness.
2008-05-26 17:15:35 +00:00