freebsd-dev/gnu/usr.bin/cpio
Bruce Evans d1e00e9390 Improve the handling of large minor numbers:
cpio/copyout.c:
Don't output a file if the major, minor or totality of its rdev would be
truncated.  Print a message about the skipped files to stderr but don't
report the error in the exit status.  cpio's abysmal error handling doesn't
allow continuing after an error, and the rdev checks had to be misplaced
to avoid the problem of returning an error code from routines that return
void.

pax/pax.h:
Use the system macros for major(), minor() and makedev().

pax already checks _all_ output conversions for overflow.  This has the
undesirable effect that failure to convert relatively useless fields
such as st_dev for regular files causes files not to be output.  pax
doesn't report exactly which fields couldn't be converted.

tar/create.c:
Don't output a file if the major or minor its rdev would be truncated.
Print a message about the skipped files to stderr and report the error
in the exit status.

tar/tar.c:
For not immediately fatal errors, exit with status 1, not the error count
(mod 256).

All:
Minor numbers are limited to 21 bits in pax's ustar format and to 18
bits in archives created by gnu tar (gnu tar wastes 3 bits for padding).
pax's and cpio's ustar format is incompatible with gnu tar's ustar
format for other reasons (see cpio/README).
1995-06-26 06:24:48 +00:00
..
alloca.c This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
ChangeLog This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
copyin.c Remove trailing whitespace. 1995-05-30 05:05:38 +00:00
COPYING This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
COPYING.LIB This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
copyout.c Improve the handling of large minor numbers: 1995-06-26 06:24:48 +00:00
copypass.c Remove trailing whitespace. 1995-05-30 05:05:38 +00:00
cpio.1 Fix gross spelling and typographical errors pointed out by Keith Bostic. 1994-04-24 01:22:07 +00:00
cpio.h This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
cpiohdr.h This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
defer.c This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
defer.h This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
dirname.c This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
dstring.c This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
dstring.h This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
error.c This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
extern.h Add dummy lchown function so that cpio understands 4.4 symbolic links. 1995-03-17 07:52:23 +00:00
filemode.c This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
filetypes.h This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
fnmatch.c This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
fnmatch.h Use __GNU_P not __P. 1994-08-04 20:57:07 +00:00
getopt1.c This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
getopt.c This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
getopt.h This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
global.c This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
idcache.c Remove trailing whitespace. 1995-05-30 05:05:38 +00:00
lchown.c Add dummy lchown function so that cpio understands 4.4 symbolic links. 1995-03-17 07:52:23 +00:00
main.c This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
Makefile Add dummy lchown function so that cpio understands 4.4 symbolic links. 1995-03-17 07:52:23 +00:00
makepath.c Remove trailing whitespace. 1995-05-30 05:05:38 +00:00
mt.1 This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
NEWS This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
README This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
rmt.c This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
rmt.h This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
rtapelib.c This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
stripslash.c This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
system.h This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
tar.c Remove trailing whitespace. 1995-05-30 05:05:38 +00:00
tar.h This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
tarhdr.h This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
tcexparg.c This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
userspec.c This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
util.c Remove trailing whitespace. 1995-05-30 05:05:38 +00:00
version.c This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
xmalloc.c This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00
xstrdup.c This is GNU cpio 2.3. It handles tar files and is fully compatible 1993-08-07 22:33:48 +00:00

This is GNU cpio, a program to manage archives of files.
As of version 2.0, it supports the features of the System V release 4
cpio, including support for tar archives.

The main advantages of GNU cpio over Unix versions are:

* It can access tape drives on other hosts using TCP/IP.

* `-o' and `-p' can copy symbolic links either as symbolic links or,
with `-L', as the files they point to.

* `-i' automatically recognizes the archive format and tries to
recover from corrupted archives.

* The output of '-itv' looks like 'ls -l'.

* It accepts long-named options as well as traditional
single-character options.

A few features of other versions of cpio are missing from GNU cpio, including:

* The `-6' option to support Sixth Edition Unix cpio archives with `-i'.

* An option to limit volume size, like afio -s.


GNU cpio supports the POSIX.1 "ustar" tar format.  GNU tar supports a
somewhat different, early draft of that format.  That draft format has
a slightly different magic number in the tar header and doesn't
include the path prefix part of the header, which allows storing file
names that are longer than 100 characters.  GNU cpio knows to
recognize the nonstandard GNU tar "ustar" archives.

The following patch to GNU tar 1.11.1 makes GNU tar recognize standard
"ustar" archives, such as GNU cpio produces, except that it won't use
the path prefix.  Without this patch, GNU tar thinks that standard
"ustar" archives are old-format tar archives and can not use the extra
information that "ustar" format contains.  If you use this patch,
remember that you will lose the beginnings of paths that are longer
than 100 characters.  That's why it's not an official part of GNU tar.
(Adding support for the path prefix to GNU tar is not trivial.)

--- list.c.orig Mon Sep 14 17:04:03 1992
+++ list.c      Wed Oct 14 14:02:28 1992
@@ -439,7 +439,7 @@
                st->st_ctime = from_oct(1+12, header->header.ctime);
        }
 
-       if (0==strcmp(header->header.magic, TMAGIC)) {
+       if (0==strncmp(header->header.magic, TMAGIC, 5)) {
                /* Unix Standard tar archive */
                *stdp = 1;
                if (wantug) {

Mail suggestions and bug reports for GNU cpio to
bug-gnu-utils@prep.ai.mit.edu.