home *** CD-ROM | disk | FTP | other *** search
- Submitted-by: karish@pangea.Stanford.EDU (Chuck Karish)
-
- In article <1lrvj6INNi5p@ftp.UU.NET> conklin@kaleida.com writes:
- >I like cpio's ability to take a list of files on standard input, but
- >was suprised when I converted a tar archive of pbmplus executables
- >(about 1MB) to a cpio archive (about 20MB). It turns out that cpio,
- >unlike tar, stores the contents of each hard linked file in the
- >archive.
- >
- >I found a cpio "clone", afio, which does not do that. The first file
- >is output as normal, but subsequent instances are output with a zero
- >length.
-
- This seems to be an extension that's not spelled out in POSIX.1:
- If a file header has the same values for c_dev and c_ino as
- another file in the archive, and a size of zero, and an
- appropriate link count (greater than the nuymber of links
- links that have been made to that file so far), treat it as
- another link to the other file.
-
- Note that this can break down if inode numbers are big enough
- to overflow the c_ino field. That's one reason why USL started
- using a new cpio format (magic number == 070701) so soon after the
- POSIX.1 cpio format was standardized.
-
- >Archives produced by afio are successfully extracted by every version
- >of cpio I've been able to test it with. Is this behavior acceptable?
- >
- >I'm asking this because I'd like to add a similar feature to the cpio
- >furnished with 386BSD (but only if the archives it would produce are
- >still standards complient).
-
- POSIX.1 says "c_dev and c_ino shall contain values that
- uniquely identify the file within the archive (i.e., no
- files shall contain the same pair of c_dev and c_ino values
- unless they are links to the same file)". This clearly
- allows the cpio utility to make multiple links to the file.
-
- There's no specific requirement that subsequent files in
- the archive that are links to a previous file be treated
- specially with regard to file size. This says to me that
- the specification would expect the data in a file with
- multiple links to be repeated in the archive, but not on
- disk after the files are extracted from the archive.
-
- I've checked the behavior of cpio on a SVR2 system and a
- SVR4 system. On SVR2 and on SVR4 with the '-H odc'
- option selected, cpio saves the data three times in
- the archive and extracts three links to the same file.
- On SVR4 with the default (070701) format, cpio saves
- the data only once.
-
- Thus the POSIX.1 specification is faithful to historical
- implementations of cpio, and the implementors of cpio have
- recognized the limitations of the historical version.
-
- You might like to take a look at GNU cpio, which provides
- both cpio formats. This program also allows you to
- make tar archives using a list of file names on stdin.
-
- --
- Chuck Karish karish@mindcraft.com
- (415) 323-9000 x117 karish@pangea.stanford.edu
-
-
- Volume-Number: Volume 30, Number 65
-
-