home *** CD-ROM | disk | FTP | other *** search
/ BURKS 2 / BURKS_AUG97.ISO / SLAKWARE / A8 / TAR.TGZ / TAR.tar / usr / info / tar.info-7.gz / tar.info-7 (.txt)
GNU Info File  |  1995-06-17  |  37KB  |  679 lines

  1. This is Info file tar.info, produced by Makeinfo-1.61 from the input
  2. file tar.texinfo.
  3. START-INFO-DIR-ENTRY
  4. * tar: (tar).            Making tape (or disk) archives.
  5. END-INFO-DIR-ENTRY
  6.    This file documents GNU `tar', a utility used to store, backup, and
  7. transport files.
  8.    Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
  9.    Permission is granted to make and distribute verbatim copies of this
  10. manual provided the copyright notice and this permission notice are
  11. preserved on all copies.
  12.    Permission is granted to copy and distribute modified versions of
  13. this manual under the conditions for verbatim copying, provided that
  14. the entire resulting derived work is distributed under the terms of a
  15. permission notice identical to this one.
  16.    Permission is granted to copy and distribute translations of this
  17. manual into another language, under the above conditions for modified
  18. versions, except that this permission notice may be stated in a
  19. translation approved by the Foundation.
  20. File: tar.info,  Node: Standard,  Next: Extensions,  Prev: Archive Format,  Up: Archive Format
  21. The Standard Format
  22. ===================
  23.      *(This message will disappear, once this node revised.)*
  24.    A `tar' archive file contains a series of records.  Each record
  25. contains `RECORDSIZE' bytes.  Although this format may be thought of as
  26. being on magnetic tape, other media are often used.
  27.    Each file archived is represented by a header record which describes
  28. the file, followed by zero or more records which give the contents of
  29. the file.  At the end of the archive file there may be a record filled
  30. with binary zeros as an end-of-file marker.  A reasonable system should
  31. write a record of zeros at the end, but must not assume that such a
  32. record exists when reading an archive.
  33.    The records may be "blocked" for physical I/O operations.  Each
  34. block of N records (where N is set by the `--block-size=512-SIZE' (`-b
  35. 512-SIZE') option to `tar') is written with a single `write ()'
  36. operation.  On magnetic tapes, the result of such a write is a single
  37. tape record.  When writing an archive, the last block of records should
  38. be written at the full size, with records after the zero record
  39. containing all zeroes.  When reading an archive, a reasonable system
  40. should properly handle an archive whose last block is shorter than the
  41. rest, or which contains garbage records after a zero record.
  42.    The header record is defined in C as follows.  In the GNU `tar'
  43. distribution, this is part of file `src/tar.h':
  44.      /* Standard Archive Format - Standard TAR - USTAR.  */
  45.      
  46.      /* Header block on tape.
  47.      
  48.         We use traditional DP naming conventions here.  A "block" is a big chunk
  49.         of stuff that we do I/O on.  A "record" is a piece of info that we care
  50.         about.  Typically many "record"s fit into a "block".  */
  51.      
  52.      #define RECORDSIZE      512
  53.      #define NAMSIZ          100
  54.      #define TUNMLEN         32
  55.      #define TGNMLEN         32
  56.      #define SPARSE_EXT_HDR  21
  57.      #define SPARSE_IN_HDR   4
  58.      
  59.      struct sparse
  60.        {
  61.          char offset[12];
  62.          char numbytes[12];
  63.        };
  64.      
  65.      union record
  66.        {
  67.          char charptr[RECORDSIZE];
  68.      
  69.          struct header
  70.            {
  71.              char arch_name[NAMSIZ];
  72.              char mode[8];
  73.              char uid[8];
  74.              char gid[8];
  75.              char size[12];
  76.              char mtime[12];
  77.              char chksum[8];
  78.              char linkflag;
  79.              char arch_linkname[NAMSIZ];
  80.              char magic[8];
  81.              char uname[TUNMLEN];
  82.              char gname[TGNMLEN];
  83.              char devmajor[8];
  84.              char devminor[8];
  85.      
  86.              /* The following fields were added for GNU and are not standard.  */
  87.      
  88.              char atime[12];
  89.              char ctime[12];
  90.              char offset[12];
  91.              char longnames[4];
  92.              /* Some compilers would insert the pad themselves, so pad was
  93.                 once autoconfigured.  It is simpler to always insert it!  */
  94.              char pad;
  95.              struct sparse sp[SPARSE_IN_HDR];
  96.              char isextended;
  97.              char realsize[12];      /* true size of the sparse file */
  98.      #if 0
  99.              char ending_blanks[12]; /* number of nulls at the end of the file,
  100.                                         if any */
  101.      #endif
  102.            }
  103.          header;
  104.      
  105.          struct extended_header
  106.            {
  107.              struct sparse sp[21];
  108.              char isextended;
  109.            }
  110.          ext_hdr;
  111.        };
  112.      
  113.      /* The checksum field is filled with this while the checksum is computed.  */
  114.      #define CHKBLANKS       "        "      /* 8 blanks, no null */
  115.      
  116.      /* The magic field is filled with this value if uname and gname are valid,
  117.         marking the archive as being in standard POSIX format (though GNU tar
  118.         itself is not POSIX conforming).  */
  119.      #define TMAGIC "ustar  "        /* 7 chars and a null */
  120.      
  121.      /* The magic field is filled with this if this is a GNU format dump entry.
  122.         But I suspect this is not true anymore.  */
  123.      #define GNUMAGIC "GNUtar "      /* 7 chars and a null */
  124.      
  125.      /* The linkflag defines the type of file.  */
  126.      #define LF_OLDNORMAL    '\0'    /* normal disk file, Unix compat */
  127.      #define LF_NORMAL       '0'     /* normal disk file */
  128.      #define LF_LINK         '1'     /* link to previously dumped file */
  129.      #define LF_SYMLINK      '2'     /* symbolic link */
  130.      #define LF_CHR          '3'     /* character special file */
  131.      #define LF_BLK          '4'     /* block special file */
  132.      #define LF_DIR          '5'     /* directory */
  133.      #define LF_FIFO         '6'     /* FIFO special file */
  134.      #define LF_CONTIG       '7'     /* contiguous file */
  135.      /* Further link types may be defined later.  */
  136.      
  137.      /* Note that the standards committee allows only capital A through
  138.         capital Z for user-defined expansion.  This means that defining
  139.         something as, say '8' is a *bad* idea.  */
  140.      
  141.      /* This is a dir entry that contains the names of files that were in the
  142.         dir at the time the dump was made.  */
  143.      #define LF_DUMPDIR      'D'
  144.      
  145.      /* Identifies the NEXT file on the tape as having a long linkname.  */
  146.      #define LF_LONGLINK     'K'
  147.      
  148.      /* Identifies the NEXT file on the tape as having a long name.  */
  149.      #define LF_LONGNAME     'L'
  150.      
  151.      /* This is the continuation of a file that began on another volume.  */
  152.      #define LF_MULTIVOL     'M'
  153.      
  154.      /* For storing filenames that didn't fit in 100 characters.  */
  155.      #define LF_NAMES        'N'
  156.      
  157.      /* This is for sparse files.  */
  158.      #define LF_SPARSE       'S'
  159.      
  160.      /* This file is a tape/volume header.  Ignore it on extraction.  */
  161.      #define LF_VOLHDR       'V'
  162.      
  163.      #if 0
  164.      /* The following two blocks of #define's are unused in GNU tar.  */
  165.      
  166.      /* Bits used in the mode field - values in octal */
  167.      #define  TSUID    04000         /* set UID on execution */
  168.      #define  TSGID    02000         /* set GID on execution */
  169.      #define  TSVTX    01000         /* save text (sticky bit) */
  170.      
  171.      /* File permissions */
  172.      #define  TUREAD   00400         /* read by owner */
  173.      #define  TUWRITE  00200         /* write by owner */
  174.      #define  TUEXEC   00100         /* execute/search by owner */
  175.      #define  TGREAD   00040         /* read by group */
  176.      #define  TGWRITE  00020         /* write by group */
  177.      #define  TGEXEC   00010         /* execute/search by group */
  178.      #define  TOREAD   00004         /* read by other */
  179.      #define  TOWRITE  00002         /* write by other */
  180.      #define  TOEXEC   00001         /* execute/search by other */
  181.      
  182.      #endif
  183.      
  184.      /* End of Standard Archive Format description.  */
  185.    All characters in header records are represented by using 8-bit
  186. characters in the local variant of ASCII.  Each field within the
  187. structure is contiguous; that is, there is no padding used within the
  188. structure.  Each character on the archive medium is stored contiguously.
  189.    Bytes representing the contents of files (after the header record of
  190.