home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.11 / text0066.txt < prev    next >
Encoding:
Text File  |  1987-07-18  |  16.1 KB  |  363 lines

  1. Yesterday was 16 June, which was the day I said I would collect
  2. tar and cpio comments until.  Included below is the revised note
  3. for P1003.1, incorporating those comments.  I will deliver it
  4. to P1003.1 in Seattle Monday.
  5.  
  6.  
  7.  
  8.                                   tar vs. cpio      IEEE P1003.1 N.___
  9.                                                           17 June 1987
  10.  
  11.                                John S. Quarterman
  12.  
  13.                     Institutional Representative from USENIX
  14.                                    usenix!jsq
  15.  
  16.  
  17.  
  18.           Secretary, IEEE Standards Board
  19.           Attention: P1003 Working Group
  20.           345 East 47th St.
  21.           New York, NY 10017
  22.  
  23.           In both the Trial Use Standard and the current Draft 10,
  24.           POSIX sS10.1 describes a data interchange format based on the
  25.           tar program.  That section has appeared in every draft of
  26.           IEEE 1003.1 in some form and has always been based on tar
  27.           format.  The P1003.1 Working Group has recently received two
  28.           related proposals regarding that section: one to add cpio
  29.           format (including old-style, non-ASCII (non c option)
  30.           format); <N.048 Lorraine C. Kevra> <V11N14> <V11N25 Eric S.
  31.           Raymond> the other to replace the existing tar-based format
  32.           with cpio format.  <N.043 X/OPEN> <V11N13> Some
  33.           clarifications were received to the former.  <N.064 Dominic
  34.           Dunlop> <V11N15> It was also proposed verbally in the latest
  35.           Working Group meeting to drop sS10.1 altogether and let
  36.           P1003.2 handle the issue.  <V11N08> <V11N11> <V11N09 Guy
  37.           Harris> <V11N12 Doug Gwyn>
  38.  
  39.           The present note is a response to those proposals.  Much of
  40.           the detail in it is derived from articles posted in the
  41.           USENET newsgroup comp.std.unix.  Those articles are
  42.           referenced with this format: <V11N09 Guy Harris> which gives
  43.           the volume (always 11) and number of the article, and the
  44.           name of the submittor.  If no submittor name is given, the
  45.           posting was by the moderator, John S. Quarterman.  Thanks to
  46.           those who submitted articles.  However, the content of this
  47.           note is solely the responsibility of the author.
  48.  
  49.           This note is addressed to P1003.1, and is concerned with
  50.           data interchange formats.  Although user interface issues
  51.           may be of interest to P1003.2, they are not addressed here.
  52.  
  53.           There are a number of problems with both cpio formats.
  54.           First, those related to the non-ASCII format:
  55.  
  56.             1.  Numerous parameters, including inode numbers, mode
  57.                 bits, and user and group IDs, are kept in two-byte
  58.                 binary integers.  This has historically produced
  59.                 serious byte-order problems when data is moved among
  60.                 systems with different byte orders.  <V11N09 Guy
  61.                 Harris>
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.           Page 2                  tar vs. cpio      IEEE P1003.1 N.___
  71.  
  72.  
  73.  
  74.             2.  The byte-swapping and word-swapping options to the
  75.                 cpio program are inadequate patches; with an ASCII
  76.                 format the problem would not be present.  The options
  77.                 are not consistent across versions of the program: in
  78.                 System III, data blocks and file names are byte
  79.                 swapped; in System V, only data blocks are byte
  80.                 swapped.  <V11N09 Guy Harris> <V11N47 Andrew
  81.                 Tannenbaum>
  82.  
  83.             3.  The two-byte integer format limits the range of inode
  84.                 numbers to 0..65535.  Many current file systems are
  85.                 bigger than that.  <V11N37 Paul Eggert> <V11N39 Henry
  86.                 Spencer>
  87.  
  88.           Non-ASCII cpio format is clearly not portable and should not
  89.           even be considered for standardization.  <V11N12 Doug Gwyn>
  90.  
  91.           There are several problems that occur even with the ASCII
  92.           cpio format:
  93.  
  94.             1.  Many implementations of cpio only look at the lower 16
  95.                 (or even 15) bits of the inode number, even in ASCII
  96.                 format.  <V11N39 Henry Spencer> This is because the
  97.                 variable that is used to contain the value is declared
  98.                 to be unsigned short, just as in binary format.  Thus,
  99.                 even though ASCII cpio format only constrains this
  100.                 number to the range 0..262143, the format is still
  101.                 less than portable.  <V11N37 Paul Eggert>
  102.  
  103.             2.  The proposed cpio ASCII format as specified, <N.048
  104.                 Lorraine C. Kevra> <V11N14> is not portable because
  105.                 the proposal assumes that sizeof(int) == sizeof(long).
  106.                 <N.064 Dominic Dunlop> <V11N15>
  107.  
  108.             3.  The file type is written in a numerical format, making
  109.                 it UNIX specific rather than POSIX specific, since
  110.                 POSIX (and tar) specifies symbolic, rather than
  111.                 numerical, values for file types.  <V11N09 Guy Harris>
  112.  
  113.             4.  Hard links are not handled well, since cpio format
  114.                 does not directly record that two files are linked.
  115.                 If two files that are linked are written in cpio
  116.                 format, two copies will be written.  The cpio program
  117.                 detects duplicate files by matching pairs of (h_dev,
  118.                 h_ino) and producing links, but that is done after the
  119.                 fact.  <V11N09 Guy Harris> <V11N45 Guy Harris> <V11N54
  120.                 Ian Donaldson> (There is a program, afio, that handles
  121.                 cpio format more efficiently in this and other cases
  122.                 than the licensed versions of the program.) <V11N21
  123.                 Chuck Forsberg>
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.           Page 3                  tar vs. cpio      IEEE P1003.1 N.___
  133.  
  134.  
  135.  
  136.             5.  Symbolic links are not handled at all, and no type
  137.                 value is reserved for them.  This makes cpio useless
  138.                 on a large class of historical implementations (those
  139.                 based on 4.2BSD or its file system) for one of the
  140.                 main purposes of POSIX sS10.1: archiving files for
  141.                 later retrieval and use on the same system.  Although
  142.                 it is possible to extend cpio to handle symbolic
  143.                 links, and at least one vendor has done this, <V11N45
  144.                 Guy Harris> the format proposed to P1003.1 is the
  145.                 format in the SVID, and does not handle symbolic
  146.                 links.
  147.  
  148.             6.  The cpio format is less common than tar format: there
  149.                 are few historical implementations from Version 7 on
  150.                 that do not have tar; there are many that do not have
  151.                 cpio.  <V11N09 Guy Harris> <V11N10 Charles Hedrick>
  152.                 <V11N24 Jim Cottrell> It is true that cpio (non-ASCII
  153.                 format) was invented before tar, <V11N22 Joseph S. D.
  154.                 Yao> apparently in PWB System 1.0.  <V11N26 Joseph S.
  155.                 D. Yao> The cpio program was first available outside
  156.                 AT&T with PWB/UNIX 1.0, <V11N45 Guy Harris> <V11N63
  157.                 Joseph S. D. Yao> and later with System III.  However,
  158.                 in the interim, Version 7, which did not include cpio
  159.                 <V11N53 Bill Jones> <V11N62 Guy Harris> but did
  160.                 include tar, became the most influential system.
  161.                 There was a V7 addendum tape, but it also did not
  162.                 include cpio (according to its README file); <V11N65
  163.                 Rick Adams> the addendum tape was in tar format.
  164.                 Also, it appears that the cpio format of PWB was not
  165.                 the same as that of System III.  <V11N39 Henry
  166.                 Spencer> And System III and all releases of System V
  167.                 include tar.  <V11N26 Joseph S. D. Yao> <V11N63 Joseph
  168.                 S. D. Yao> <V11N45 Guy Harris> <V11N47 Andrew
  169.                 Tannenbaum>
  170.  
  171.             7.  It is very late in the process to propose that P1003.1
  172.                 adopt cpio format now, especially considering that it
  173.                 was originally proposed to and rejected by the
  174.                 /usr/group committee before P1003.1 was even formed.
  175.                 <V11N39 Henry Spencer>
  176.  
  177.           Advantages of cpio format include:
  178.  
  179.             1.  Both X/OPEN <N.043 X/OPEN> <V11N13> and the SVID
  180.                 <N.048 Lorraine C. Kevra> <V11N14> use it, although
  181.                 evidently defined somewhat differently.  <N.064
  182.                 Dominic Dunlop> <V11N15>
  183.  
  184.             2.  Archives made in cpio format are often smaller than
  185.                 ones in tar format.  <V11N44 Mark Horton> But this is
  186.                 only because of the headers, and thus the effect
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.           Page 4                  tar vs. cpio      IEEE P1003.1 N.___
  195.  
  196.  
  197.  
  198.                 diminishes with larger files.
  199.  
  200.             3.  On a local (non-networked) system, cpio is more
  201.                 efficient at copying directory trees than tar.
  202.                 <V11N46 Steve Blasingame> However, this is really an
  203.                 implementation issue.
  204.  
  205.           There are several advantages to the current tar-based format
  206.           as specified in sS10.1:
  207.  
  208.             1.  There are no byte- or word-swapping issues caused by
  209.                 the format, since all the header values are ASCII byte
  210.                 streams.  <V11N17 John Gilmore>
  211.  
  212.             2.  There are no inode numbers recorded, and file types
  213.                 are kept in symbolic form, so the format is less
  214.                 implementation-specific than cpio format.  <V11N17
  215.                 John Gilmore>
  216.  
  217.             3.  Historical tar format is the most widely used, as
  218.                 discussed in 6. above, despite apparent assertions to
  219.                 the contrary.  <N.043 X/OPEN> <V11N13>
  220.  
  221.             4.  The format specified in sS10.1 is upward-compatible
  222.                 with tar format.  Old tar archives can be extracted by
  223.                 a program that implements sS10.1.  Archives using some
  224.                 of the extensions of sS10.1 can be extracted with old
  225.                 (Version 7) tar programs, although symbolic links will
  226.                 not be extracted and contiguous files will not be
  227.                 handled properly (cpio does not handle these
  228.                 capabilities at all).  Files with very long names will
  229.                 not be handled properly (cpio does no better at this).
  230.                 All tar implementations are compatible to this extent.
  231.                 <V11N17 John Gilmore>
  232.  
  233.             5.  The /usr/group working group and P1003.1 have already
  234.                 done the work <P.061> <M.019 5.1.121 Pg.13> <RFC.003
  235.                 #121> <P.038> <P.006> required to add optional
  236.                 extensions (such as symbolic links, long file names,
  237.                 <V11N49 Jerry Schwarz> <V11N50 Michael MacDonald> and
  238.                 contiguous files) that are needed on many historical
  239.                 implementations and that cpio format lacks.
  240.  
  241.             6.  The format is extensible for future facilities.
  242.                 <V11N39 Henry Spencer>
  243.  
  244.             7.  There is a public domain implementation of the format
  245.                 of sS10.1.  That implementation provided feedback which
  246.                 led to improvements in the current specification, and
  247.                 has been in use for years in transferring data with
  248.                 licensed tar implementations.  <V11N17 John Gilmore>
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.           Page 5                  tar vs. cpio      IEEE P1003.1 N.___
  257.  
  258.  
  259.  
  260.             8.  Many people prefer the user interface of the cpio
  261.                 program to that of the tar program, because the former
  262.                 can accept a list of pathnames to archive on standard
  263.                 input while the latter takes them as arguments,
  264.                 limiting the length of the list.  <V11N34 Andrew
  265.                 Tannenbaum> However, the above-mentioned public domain
  266.                 implementation of tar accepts pathnames on standard
  267.                 input, <V11N17 John Gilmore> <V11N19 Jim Cottrell> and
  268.                 at least one vendor sells a version of tar that can do
  269.                 this.  <V11N48 Michael Gersten> Diffs to standard tar
  270.                 to add an option to accept pathnames on standard input
  271.                 when creating an archive have also been posted to
  272.                 USENET.  <V11N36 John Gilmore> The user interface is,
  273.                 in any case, irrelevant to P1003.1.  <V11N39 Henry
  274.                 Spencer> <V11N40 Rahul Dhesi>
  275.  
  276.           Disadvantages of tar format:
  277.  
  278.             1.  If an attempt is made to extract only the second of a
  279.                 pair of hard linked files the tar program will attempt
  280.                 to link the second file to the nonexistent first file,
  281.                 and nothing will be extracted.  Although a
  282.                 sufficiently clever implementation could avoid this,
  283.                 the problem can be considered to be in the archive
  284.                 format.  <V11N66 Kenneth Almquist>
  285.  
  286.           There are some problems that neither tar nor cpio handles
  287.           well.
  288.  
  289.             1.  File names still longer than the length of PATH_MAX
  290.                 (at least 255) <V11N50 Michael MacDonald> that the
  291.                 POSIX format allows (and than the 128 that cpio
  292.                 permits or than the 100 that historical tar allows)
  293.                 would be preferable, although the POSIX limit is
  294.                 useful for most cases.  <V11N54 Ian Donaldson>
  295.  
  296.             2.  An option to prevent crossing mount points would be
  297.                 useful for backups.  <V11N19 Jim Cottrell> <V11N22
  298.                 Joseph S. D. Yao> However, this appears to be more of
  299.                 an implementation issue than a format issue, <V11N28
  300.                 Dave Brower> <V11N32 Joseph S. D. Yao> especially
  301.                 considering that there are options to find in 4.2BSD,
  302.                 <V11N24 Jim Cottrell> SunOS 3.2, <V11N36 John Gilmore>
  303.                 and System V Release 3.0 <V11N35 Mike Akre> that take
  304.                 care of this.
  305.  
  306.             3.  The default block size in many tar implementations is
  307.                 too large for some tape controllers to read <V11N27
  308.                 Rob Lake> (the 3B20 has this problem).  This is not a
  309.                 problem with the interchange format, however.
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.           Page 6                  tar vs. cpio      IEEE P1003.1 N.___
  319.  
  320.  
  321.  
  322.           There is nothing that the proposed cpio can handle that the
  323.           tar-based format already in POSIX sS10.1 cannot handle; in
  324.           fact, the former is less capable.  If cpio format were
  325.           augmented to handle missing capabilities, it would be
  326.           subject to the same objections now aimed at the format given
  327.           in sS10.1: that it was not identical with an existing format.
  328.  
  329.           There is no advantage in replacing the current tar-based
  330.           format of sS10.1 with cpio format.  There is also no
  331.           advantage in adding cpio format, because two standards are
  332.           not as good as a single standard.
  333.  
  334.           Some have recommended removing sS10.1 from POSIX altogether,
  335.           <V11N12 Doug Gwyn> perhaps with a recommendation for P1003.2
  336.           to pick up the idea.  <V11N09 Guy Harris> While I believe
  337.           that that would be preferable to adding cpio format, whether
  338.           or not tar format remains, I recommend leaving sS10.1 as it
  339.           is, because
  340.  
  341.              o+ The inclusion of an archive/interchange file format is
  342.                in agreement with the purpose of POSIX to promote
  343.                portability of application programs across interface
  344.                implementations.  Some format will be used.  It is to
  345.                the advantage of the users of the standard for there to
  346.                be a standard format.
  347.  
  348.              o+ The de facto standard is tar format.  The current sS10.1
  349.                standardizes that, and provides upward-compatible
  350.                extensions in areas that were previously lacking.
  351.  
  352.           The Archive/Interchange File Format should be left as it is.
  353.  
  354.                                                   Thank you,
  355.  
  356.  
  357.  
  358.                                                   John S. Quarterman
  359.  
  360.  
  361. Volume-Number: Volume 11, Number 67
  362.  
  363.