Commit Graph

47 Commits

Author SHA1 Message Date
Glen Barber
58175a74fc Fix typo in bsdcpio manual:
s/libarchive_formats/libarchive-formats

PR:		150300
Submitted by:	Kurt Jaeger <fbsd-pr at opsec dot eu>
Patch by:	Kurt Jaeger
Approved by:	keramida (mentor)
MFC after:	1 week
2010-09-06 20:40:38 +00:00
Joel Dahl
c2025a7660 Fix typos, spelling, formatting and mdoc mistakes found by Nobuyuki while
translating these manual pages.  Minor corrections by me.

Submitted by:	Nobuyuki Koganemaru <n-kogane@syd.odn.ne.jp>
2010-08-16 15:18:30 +00:00
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
Martin Matuska
7fbeb03eb7 Enable liblzma support in libarchive
Adjust dependencies for programs using libarchive
Add xz and linkage against liblzma to rescue system

Approved by:	kientzle, delphij (mentor)
MFC after:	2 weeks
2010-05-10 15:28:44 +00:00
Tim Kientzle
b6cb607644 bsdcpio 2.8.3 2010-05-08 16:47:33 +00:00
Xin LI
36e60cda45 Remove GNU cpio after fix of CVE-2010-0624.
Note that this is actually a no-op for most users, as this GNU
cpio was broken on -HEAD and 8-STABLE since last March until
the recent fix.

FreeBSD 8.0+ uses BSD cpio by default and the code is being
actively maintained.

Blessed by:	kientzle
With hat:	secteam
MFC after:	3 days
2010-03-26 17:02:32 +00:00
Ruslan Ermilov
bee10047c0 Fixed dependencies (make checkdpadd). 2010-02-25 20:24:19 +00:00
Ulrich Spörlein
8fa03d08ca Fix common misspelling of hierarchy
Pointed out by:		bf1783 at gmail
Approved by:		np (cxgb), kientzle (tar, etc.), philip (mentor)
2010-02-20 10:19:19 +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
Ed Schouten
b7946da96b Build usr.bin/ with WARNS=6 by default.
Also add some missing $FreeBSD$ to keep svn happy.
2010-01-02 10:27:05 +00:00
Tim Kientzle
3e0fc6d3f3 This addresses some issues with my earlier -R fix that
were pointed out by Brooks Davis and Alexey Dokuchaev:
* It now tries to lookup arguments as names first, then tries
   to parse them as numbers.  In particular, this makes the
   behavior consistent with POSIX conventions when usernames
   consist entirely of digits.
* It now uses strtoul() for the numeric parsing.

Finally, I've included an update to the test harness
to exercise the new numeric cases for -R.

Approved by:	re (kib)
2009-07-06 02:02:45 +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
79cf3de423 Make -lcrypto usage dependent on whether or not we're building with OpenSSL. 2009-04-18 06:03:09 +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
5eca8160b5 Make the GCC-specific __dead2 markers conditional on whether
we're compiling under GCC.
2008-12-06 07:15:42 +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
0f5e12d1d9 MfP4: Verify correct interaction with umask: Add another
file with different permissions and set a non-zero umask
during the actual copy tests.  The extra entry increases
the size of the test archives of course, so adjust the
expected sizes.
2008-08-25 06:39:29 +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
21353e7f83 straighten out the "clean" target 2008-08-24 05:49:36 +00:00
Tim Kientzle
47317d6e6d cpio -v emits a line for every item copied. 2008-08-24 05:40:42 +00:00
Tim Kientzle
631631e45b Update the passthrough_dotdot test to reproduce a
problem reported by Kris Kennaway.

PR:		bin/124924
2008-08-24 05:24:52 +00:00
Tim Kientzle
ea66e24484 Test for proper handling of "cpio -p .."
PR:		bin/124924
2008-08-24 05:14:03 +00:00
Tim Kientzle
c9c5c49045 Test for a bug reported by Bernd Walter: In passthrough mode,
copying "dir/file" and then copying "dir" results in
"File on disk is not older; skipping" for the "dir" because
it was implicitly created by "dir/file."  Among other sins,
this means that "dir" ends up with the wrong permissions
and ownership.

This is actually a libarchive bug; fix is forthcoming.
2008-08-24 04:58:22 +00:00
Tim Kientzle
5d5624c080 Comment a couple of places where bsdcpio and gcpio 2.9 disagree.
The number of blocks read from ustar archives is just an implementation
difference.  The failure of bsdcpio to emit a block count to stderr
in -p mode is a real bug in bsdcpio.
2008-08-22 02:27:06 +00:00
Tim Kientzle
643cd4ffe7 The newc-format verification is now a little smarter about
following the archive structure.  In particular, it no longer
crashes if you run it against GNU cpio 2.9 (although it does
still complain a lot more than it should).
2008-08-22 02:09:10 +00:00
Tim Kientzle
630d7662c3 cpio should restore file flags and ACLs when they're available 2008-08-20 16:39:18 +00:00
Colin Percival
f9bcf9cabf Mark functions as __dead2 in order to help the LLVM static checker
understand which code paths aren't possible.

This commit eliminates 117 false positive bug reports of the form
"allocate memory; error out if pointer is NULL; use pointer".
2008-08-04 01:25:48 +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
ba779d5afd bsdcpio is now at version 1.0.0. 2008-07-05 05:17:33 +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
2ebfcda850 Remove an unused define. 2008-07-05 05:15:07 +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
00e3ab6e67 Various long options for GNU cpio compat. 2008-06-21 02:18:52 +00:00
Tim Kientzle
152e214a9a MfP4: test improvements, mostly for portability. 2008-06-21 02:17:18 +00:00
Doug Barton
482ff78560 Include bsd.own.mk to pick up the definition of MK_GNU_CPIO 2008-06-16 07:24:05 +00:00
Doug Barton
6973701a00 1. Make the BSD version of cpio the default [1]
a. The BSD version will be built and installed unless
WITHOUT_BSD_CPIO is defined.
b. The GNU version will not be built or installed unless
WITH_GNU_CPIO is defined. If this is defined, the symlink
in /usr/bin will be to the GNU version whether the BSD
version is present or not.

When these changes are MFCed the defaults should be flipped.

2. Add a knob to disable the building of GNU grep. This will
make it easier for those that want to test the BSD version in
the ports.

Approved by:	kientzle [1]
2008-06-16 05:48:15 +00:00
Tim Kientzle
4d6b2b93cb bsdcpio is always installed as 'bsdcpio', symlink it to 'cpio'
only if WITH_BSDCPIO is defined.
2008-05-26 17:17:43 +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