head	1.9;
access;
symbols
	libarchive-3-8-7:1.1.1.11
	libarchive-3-8-6:1.1.1.11
	pkgsrc-2026Q1:1.9.0.12
	pkgsrc-2026Q1-base:1.9
	libarchive-3-8-5:1.1.1.11
	libarchive-3-8-4:1.1.1.11
	pkgsrc-2025Q4:1.9.0.10
	pkgsrc-2025Q4-base:1.9
	libarchive-3-8-3:1.1.1.11
	libarchive-3-8-2:1.1.1.11
	pkgsrc-2025Q3:1.9.0.8
	pkgsrc-2025Q3-base:1.9
	libarchive-3-8-1:1.1.1.11
	pkgsrc-2025Q2:1.9.0.6
	pkgsrc-2025Q2-base:1.9
	libarchive-3-8-0:1.1.1.11
	libarchive-3-7-9:1.1.1.11
	pkgsrc-2025Q1:1.9.0.4
	pkgsrc-2025Q1-base:1.9
	pkgsrc-2024Q4:1.9.0.2
	pkgsrc-2024Q4-base:1.9
	libarchive-3-7-7:1.1.1.11
	pkgsrc-2024Q3:1.8.0.6
	pkgsrc-2024Q3-base:1.8
	libarchive-3-7-5:1.1.1.10
	pkgsrc-2024Q2:1.8.0.4
	pkgsrc-2024Q2-base:1.8
	libarchive-3-7-4:1.1.1.10
	libarchive-3-7-3:1.1.1.10
	pkgsrc-2024Q1:1.8.0.2
	pkgsrc-2024Q1-base:1.8
	libarchive-3-7-2:1.1.1.10
	pkgsrc-2023Q4:1.7.0.30
	pkgsrc-2023Q4-base:1.7
	pkgsrc-2023Q3:1.7.0.28
	pkgsrc-2023Q3-base:1.7
	pkgsrc-2023Q2:1.7.0.26
	pkgsrc-2023Q2-base:1.7
	pkgsrc-2023Q1:1.7.0.24
	pkgsrc-2023Q1-base:1.7
	pkgsrc-2022Q4:1.7.0.22
	pkgsrc-2022Q4-base:1.7
	pkgsrc-2022Q3:1.7.0.20
	pkgsrc-2022Q3-base:1.7
	pkgsrc-2022Q2:1.7.0.18
	pkgsrc-2022Q2-base:1.7
	pkgsrc-2022Q1:1.7.0.16
	pkgsrc-2022Q1-base:1.7
	pkgsrc-2021Q4:1.7.0.14
	pkgsrc-2021Q4-base:1.7
	pkgsrc-2021Q3:1.7.0.12
	pkgsrc-2021Q3-base:1.7
	pkgsrc-2021Q2:1.7.0.10
	pkgsrc-2021Q2-base:1.7
	pkgsrc-2021Q1:1.7.0.8
	pkgsrc-2021Q1-base:1.7
	pkgsrc-2020Q4:1.7.0.6
	pkgsrc-2020Q4-base:1.7
	pkgsrc-2020Q3:1.7.0.4
	pkgsrc-2020Q3-base:1.7
	pkgsrc-2020Q2:1.7.0.2
	pkgsrc-2020Q2-base:1.7
	pkgsrc-2020Q1:1.6.0.4
	pkgsrc-2020Q1-base:1.6
	pkgsrc-2019Q4:1.6.0.6
	pkgsrc-2019Q4-base:1.6
	pkgsrc-2019Q3:1.6.0.2
	pkgsrc-2019Q3-base:1.6
	libarchive-3-4-0:1.1.1.9
	libarchive-3-3-3:1.1.1.8
	pkgsrc-2019Q2:1.5.0.18
	pkgsrc-2019Q2-base:1.5
	pkgsrc-2019Q1:1.5.0.16
	pkgsrc-2019Q1-base:1.5
	pkgsrc-2018Q4:1.5.0.14
	pkgsrc-2018Q4-base:1.5
	pkgsrc-2018Q3:1.5.0.12
	pkgsrc-2018Q3-base:1.5
	pkgsrc-2018Q2:1.5.0.10
	pkgsrc-2018Q2-base:1.5
	pkgsrc-2018Q1:1.5.0.8
	pkgsrc-2018Q1-base:1.5
	pkgsrc-2017Q4:1.5.0.6
	pkgsrc-2017Q4-base:1.5
	pkgsrc-2017Q3:1.5.0.4
	pkgsrc-2017Q3-base:1.5
	libarchive-3-3-2:1.1.1.8
	pkgsrc-2017Q2:1.4.0.4
	pkgsrc-2017Q2-base:1.4
	pkgsrc-2017Q1:1.4.0.2
	pkgsrc-2017Q1-base:1.4
	libarchive-3-3-1:1.1.1.7
	pkgsrc-2016Q4:1.3.0.6
	pkgsrc-2016Q4-base:1.3
	pkgsrc-2016Q3:1.3.0.4
	pkgsrc-2016Q3-base:1.3
	pkgsrc-2016Q2:1.3.0.2
	pkgsrc-2016Q2-base:1.3
	libarchive-3-2-1:1.1.1.6
	pkgsrc-2016Q1:1.2.0.10
	pkgsrc-2016Q1-base:1.2
	pkgsrc-2015Q4:1.2.0.8
	pkgsrc-2015Q4-base:1.2
	pkgsrc-2015Q3:1.2.0.6
	pkgsrc-2015Q3-base:1.2
	pkgsrc-2015Q2:1.2.0.4
	pkgsrc-2015Q2-base:1.2
	pkgsrc-2015Q1:1.2.0.2
	pkgsrc-2015Q1-base:1.2
	pkgsrc-2014Q4:1.1.1.5.0.36
	pkgsrc-2014Q4-base:1.1.1.5
	pkgsrc-2014Q3:1.1.1.5.0.34
	pkgsrc-2014Q3-base:1.1.1.5
	pkgsrc-2014Q2:1.1.1.5.0.32
	pkgsrc-2014Q2-base:1.1.1.5
	pkgsrc-2014Q1:1.1.1.5.0.30
	pkgsrc-2014Q1-base:1.1.1.5
	pkgsrc-2013Q4:1.1.1.5.0.28
	pkgsrc-2013Q4-base:1.1.1.5
	pkgsrc-2013Q3:1.1.1.5.0.26
	pkgsrc-2013Q3-base:1.1.1.5
	pkgsrc-2013Q2:1.1.1.5.0.24
	pkgsrc-2013Q2-base:1.1.1.5
	pkgsrc-2013Q1:1.1.1.5.0.22
	pkgsrc-2013Q1-base:1.1.1.5
	pkgsrc-2012Q4:1.1.1.5.0.20
	pkgsrc-2012Q4-base:1.1.1.5
	pkgsrc-2012Q3:1.1.1.5.0.18
	pkgsrc-2012Q3-base:1.1.1.5
	pkgsrc-2012Q2:1.1.1.5.0.16
	pkgsrc-2012Q2-base:1.1.1.5
	pkgsrc-2012Q1:1.1.1.5.0.14
	pkgsrc-2012Q1-base:1.1.1.5
	pkgsrc-2011Q4:1.1.1.5.0.12
	pkgsrc-2011Q4-base:1.1.1.5
	pkgsrc-2011Q3:1.1.1.5.0.10
	pkgsrc-2011Q3-base:1.1.1.5
	pkgsrc-2011Q2:1.1.1.5.0.8
	pkgsrc-2011Q2-base:1.1.1.5
	pkgsrc-2011Q1:1.1.1.5.0.6
	pkgsrc-2011Q1-base:1.1.1.5
	pkgsrc-2010Q4:1.1.1.5.0.4
	pkgsrc-2010Q4-base:1.1.1.5
	pkgsrc-2010Q3:1.1.1.5.0.2
	pkgsrc-2010Q3-base:1.1.1.5
	libarchive-2-8-4:1.1.1.5
	pkgsrc-2010Q2:1.1.1.4.0.4
	pkgsrc-2010Q2-base:1.1.1.4
	pkgsrc-2010Q1:1.1.1.4.0.2
	pkgsrc-2010Q1-base:1.1.1.4
	libarchive-2-8-3:1.1.1.4
	libarchive-2-8-2:1.1.1.3
	libarchive-2-8-0:1.1.1.2
	pkgsrc-2009Q4:1.1.1.1.0.22
	pkgsrc-2009Q4-base:1.1.1.1
	pkgsrc-2009Q3:1.1.1.1.0.20
	pkgsrc-2009Q3-base:1.1.1.1
	pkgsrc-2009Q2:1.1.1.1.0.18
	pkgsrc-2009Q2-base:1.1.1.1
	pkgsrc-2009Q1:1.1.1.1.0.16
	pkgsrc-2009Q1-base:1.1.1.1
	pkgsrc-2008Q4:1.1.1.1.0.14
	pkgsrc-2008Q4-base:1.1.1.1
	pkgsrc-2008Q3:1.1.1.1.0.12
	pkgsrc-2008Q3-base:1.1.1.1
	cube-native-xorg:1.1.1.1.0.10
	cube-native-xorg-base:1.1.1.1
	pkgsrc-2008Q2:1.1.1.1.0.8
	pkgsrc-2008Q2-base:1.1.1.1
	cwrapper:1.1.1.1.0.6
	pkgsrc-2008Q1:1.1.1.1.0.4
	pkgsrc-2008Q1-base:1.1.1.1
	pkgsrc-2007Q4:1.1.1.1.0.2
	pkgsrc-2007Q4-base:1.1.1.1
	libarchive-2-4-0:1.1.1.1
	KIENTZLE:1.1.1;
locks; strict;
comment	@# @;


1.9
date	2024.10.19.05.39.58;	author adam;	state Exp;
branches;
next	1.8;
commitid	fYRSlpIWMYluweuF;

1.8
date	2024.01.18.18.00.16;	author adam;	state Exp;
branches;
next	1.7;
commitid	hNXpsHx3SuHqsXUE;

1.7
date	2020.05.26.09.16.41;	author nia;	state Exp;
branches;
next	1.6;
commitid	nNhsdZACz3PjmJ9C;

1.6
date	2019.09.22.09.55.08;	author joerg;	state Exp;
branches;
next	1.5;
commitid	FdPvRjF4OzwBwZDB;

1.5
date	2017.08.01.22.26.23;	author joerg;	state Exp;
branches;
next	1.4;
commitid	32clTfkmVE8bPy1A;

1.4
date	2017.02.25.21.11.19;	author joerg;	state Exp;
branches;
next	1.3;
commitid	rW8QfCWrsCO1snHz;

1.3
date	2016.06.20.17.24.57;	author joerg;	state Exp;
branches;
next	1.2;
commitid	ArUvympBjfBseebz;

1.2
date	2015.01.17.12.44.49;	author adam;	state Exp;
branches;
next	1.1;
commitid	yy7e1hLrfmA2pn6y;

1.1
date	2007.11.30.21.25.33;	author joerg;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2007.11.30.21.25.33;	author joerg;	state Exp;
branches;
next	1.1.1.2;

1.1.1.2
date	2010.02.20.03.50.04;	author joerg;	state Exp;
branches;
next	1.1.1.3;

1.1.1.3
date	2010.03.14.17.57.22;	author joerg;	state Exp;
branches;
next	1.1.1.4;

1.1.1.4
date	2010.03.16.17.07.36;	author joerg;	state Exp;
branches;
next	1.1.1.5;

1.1.1.5
date	2010.07.09.11.53.32;	author joerg;	state Exp;
branches;
next	1.1.1.6;

1.1.1.6
date	2016.06.20.17.12.03;	author joerg;	state Exp;
branches;
next	1.1.1.7;
commitid	rRgm3BqbmbI8aebz;

1.1.1.7
date	2017.02.25.20.54.12;	author joerg;	state Exp;
branches;
next	1.1.1.8;
commitid	ReqPI0ibLYjdmnHz;

1.1.1.8
date	2017.08.01.22.21.12;	author joerg;	state Exp;
branches;
next	1.1.1.9;
commitid	XQwPAFJku336Ny1A;

1.1.1.9
date	2019.09.22.09.51.33;	author joerg;	state Exp;
branches;
next	1.1.1.10;
commitid	5kDbfPbiV3INvZDB;

1.1.1.10
date	2024.01.18.17.37.45;	author adam;	state Exp;
branches;
next	1.1.1.11;
commitid	zDULEPUODGjTkXUE;

1.1.1.11
date	2024.10.19.05.27.34;	author adam;	state Exp;
branches;
next	;
commitid	v1iXM4j1Na52seuF;


desc
@@


1.9
log
@libarchive: updated to 3.7.7

Libarchive 3.7.7 is a bugfix and security release

Security fixes:

gzip: prevent a hang when processing a malformed gzip inside a gzip
tar: don't crash on truncated tar archives
tar: fix two leaks in tar header parsing

Important bugfixes:

7-zip: read/write symlink paths as UTF-8
cpio: exit with an error code if an entry could not be extracted
rar5: report encrypted entries
tar: fix truncation of entry pathnames in specific archives
windows: fix ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS


Libarchive 3.7.6 is a bugfix and security release.
This release fixes a tar regression introduced in libarchive 3.7.5

Important bugfixes.

tar: clean up linkpath between entries
tar: fix memory leaks when processing symlinks or parsing pax headers
iso: be more cautious about parsing ISO-9660 timestamps
@
text
@4mTAR24m(5)			   File Formats Manual			     4mTAR24m(5)

1mNAME0m
       tar — format of tape archive files

1mDESCRIPTION0m
       The  1mtar  22marchive format collects any number of files, directories, and
       other file system objects (symbolic links, device nodes, etc.)  into  a
       single  stream of bytes.	 The format was originally designed to be used
       with tape drives that operate with fixed-size  blocks,  but  is	widely
       used as a general packaging mechanism.

   1mGeneral Format0m
       A 1mtar 22marchive consists of a series of 512-byte records.  Each file sys‐
       tem  object requires a header record which stores basic metadata (path‐
       name, owner, permissions, etc.) and zero or more records containing any
       file data.  The end of the archive is indicated by two records consist‐
       ing entirely of zero bytes.

       For compatibility with tape drives that use fixed block sizes, programs
       that read or write tar files always read or write  a  fixed  number  of
       records	with each I/O operation.  These “blocks” are always a multiple
       of the record size.  The maximum block size supported by	 early	imple‐
       mentations  was	10240  bytes or 20 records.  This is still the default
       for most implementations although block sizes of 1MiB (2048 records) or
       larger are commonly used with modern high-speed	tape  drives.	(Note:
       the  terms  “block”  and	 “record” here are not entirely standard; this
       document follows the convention established by John  Gilmore  in	 docu‐
       menting 1mpdtar22m.)

   1mOld-Style Archive Format0m
       The original tar archive format has been extended many times to include
       additional information that various implementors found necessary.  This
       section	describes  the variant implemented by the tar command included
       in Version 7 AT&T UNIX, which seems to be the earliest widely-used ver‐
       sion of the tar program.

       The header record for an old-style 1mtar 22marchive consists of the  follow‐
       ing:

	     struct header_old_tar {
		     char name[100];
		     char mode[8];
		     char uid[8];
		     char gid[8];
		     char size[12];
		     char mtime[12];
		     char checksum[8];
		     char linkflag[1];
		     char linkname[100];
		     char pad[255];
	     };
       All unused bytes in the header record are filled with nulls.

       4mname24m    Pathname, stored as a null-terminated string.  Early tar imple‐
	       mentations  only	 stored	 regular files (including hardlinks to
	       those files).  One common early convention used a trailing  "/"
	       character to indicate a directory name, allowing directory per‐
	       missions and owner information to be archived and restored.

       4mmode24m    File mode, stored as an octal number in ASCII.

       4muid24m, 4mgid0m
	       User id and group id of owner, as octal numbers in ASCII.

       4msize24m    Size  of  file,  as	 octal	number in ASCII.  For regular files
	       only, this indicates  the  amount  of  data  that  follows  the
	       header.	In particular, this field was ignored by early tar im‐
	       plementations when extracting hardlinks.	 Modern writers should
	       always store a zero length for hardlink entries.

       4mmtime24m   Modification  time	of file, as an octal number in ASCII.  This
	       indicates the number of seconds since the start of  the	epoch,
	       00:00:00 UTC January 1, 1970.  Note that negative values should
	       be avoided here, as they are handled inconsistently.

       4mchecksum0m
	       Header  checksum,  stored as an octal number in ASCII.  To com‐
	       pute the checksum, set the checksum field to all	 spaces,  then
	       sum  all	 bytes	in the header using unsigned arithmetic.  This
	       field should be stored as six octal digits followed by  a  null
	       and a space character.  Note that many early implementations of
	       tar  used  signed  arithmetic for the checksum field, which can
	       cause interoperability problems when transferring archives  be‐
	       tween systems.  Modern robust readers compute the checksum both
	       ways and accept the header if either computation matches.

       4mlinkflag24m, 4mlinkname0m
	       In  order  to preserve hardlinks and conserve tape, a file with
	       multiple links is only written to the archive the first time it
	       is encountered.	The next time it is encountered, the  4mlinkflag0m
	       is  set	to an ASCII ‘1’ and the 4mlinkname24m field holds the first
	       name under which this file appears.  (Note that	regular	 files
	       have a null value in the 4mlinkflag24m field.)

       Early  tar  implementations varied in how they terminated these fields.
       The tar command in Version 7 AT&T UNIX used the	following  conventions
       (this  is  also documented in early BSD manpages): the pathname must be
       null-terminated; the mode, uid, and gid fields must end in a space  and
       a  null byte; the size and mtime fields must end in a space; the check‐
       sum is terminated by a null and a space.	 Early implementations	filled
       the numeric fields with leading spaces.	This seems to have been common
       practice	 until	the  IEEE Std 1003.1-1988 (“POSIX.1”) standard was re‐
       leased.	For best portability, modern implementations should  fill  the
       numeric fields with leading zeros.

   1mPre-POSIX Archives0m
       An  early draft of IEEE Std 1003.1-1988 (“POSIX.1”) served as the basis
       for John Gilmore's 1mpdtar 22mprogram and many system  implementations  from
       the  late  1980s	 and early 1990s.  These archives generally follow the
       POSIX ustar format described below with the following variations:
       1m•	 22mThe magic value consists of the five  characters  “ustar”  fol‐
	       lowed by a space.  The version field contains a space character
	       followed by a null.
       1m•	 22mThe	 numeric  fields  are  generally filled with leading spaces
	       (not leading zeros as recommended in the final standard).
       1m•	 22mThe prefix field is often not used, limiting pathnames  to	the
	       100 characters of old-style archives.

   1mPOSIX ustar Archives0m
       IEEE  Std 1003.1-1988 (“POSIX.1”) defined a standard tar file format to
       be read and written by compliant implementations of 4mtar24m(1).	 This  for‐
       mat  is	often called the “ustar” format, after the magic value used in
       the header.  (The name is an acronym for “Unix Standard TAR”.)  It  ex‐
       tends the historic format with new fields:

	     struct header_posix_ustar {
		     char name[100];
		     char mode[8];
		     char uid[8];
		     char gid[8];
		     char size[12];
		     char mtime[12];
		     char checksum[8];
		     char typeflag[1];
		     char linkname[100];
		     char magic[6];
		     char version[2];
		     char uname[32];
		     char gname[32];
		     char devmajor[8];
		     char devminor[8];
		     char prefix[155];
		     char pad[12];
	     };

       4mtypeflag0m
	       Type  of entry.	POSIX extended the earlier 4mlinkflag24m field with
	       several new type values:
	       “0”     Regular file.  NUL should be treated as a synonym,  for
		       compatibility purposes.
	       “1”     Hard link.
	       “2”     Symbolic link.
	       “3”     Character device node.
	       “4”     Block device node.
	       “5”     Directory.
	       “6”     FIFO node.
	       “7”     Reserved.
	       Other   A  POSIX-compliant implementation must treat any unrec‐
		       ognized typeflag value as a regular file.  In  particu‐
		       lar,  writers  should  ensure  that  all entries have a
		       valid filename so that they can be restored by  readers
		       that  do	 not support the corresponding extension.  Up‐
		       percase letters "A" through "Z" are reserved for custom
		       extensions.  Note that sockets and whiteout entries are
		       not archivable.
	       It is worth noting that the 4msize24m field, in particular, has dif‐
	       ferent meanings depending on the type.  For regular  files,  of
	       course,	it  indicates the amount of data following the header.
	       For directories, it may be used to indicate the total  size  of
	       all  files  in the directory, for use by operating systems that
	       pre-allocate directory space.  For all other types,  it	should
	       be set to zero by writers and ignored by readers.

       4mmagic24m   Contains  the magic value “ustar” followed by a NUL byte to in‐
	       dicate that this is a POSIX standard archive.  Full  compliance
	       requires the uname and gname fields be properly set.

       4mversion0m
	       Version.	  This	should	be “00” (two copies of the ASCII digit
	       zero) for POSIX standard archives.

       4muname24m, 4mgname0m
	       User and group names, as null-terminated ASCII strings.	 These
	       should  be  used	 in preference to the uid/gid values when they
	       are set and the corresponding names exist on the system.

       4mdevmajor24m, 4mdevminor0m
	       Major and minor numbers for character device  or	 block	device
	       entry.

       4mname24m, 4mprefix0m
	       If the pathname is too long to fit in the 100 bytes provided by
	       the  standard  format,  it can be split at any 4m/24m character with
	       the first portion going into the prefix field.  If  the	prefix
	       field  is  not  empty, the reader will prepend the prefix value
	       and a 4m/24m character to the regular name field to obtain the  full
	       pathname.  The standard does not require a trailing 4m/24m character
	       on  directory  names, though most implementations still include
	       this for compatibility reasons.

       Note that all unused bytes must be set to NUL.

       Field termination is specified slightly differently by  POSIX  than  by
       previous implementations.  The 4mmagic24m, 4muname24m, and 4mgname24m fields must have
       a  trailing NUL.	 The 4mpathname24m, 4mlinkname24m, and 4mprefix24m fields must have a
       trailing NUL unless they fill the entire field.	(In particular, it  is
       possible to store a 256-character pathname if it happens to have a 4m/24m as
       the  156th character.)  POSIX requires numeric fields to be zero-padded
       in the front, and requires them to be terminated with either  space  or
       NUL characters.

       Currently, most tar implementations comply with the ustar format, occa‐
       sionally extending it by adding new fields to the blank area at the end
       of the header record.

   1mNumeric Extensions0m
       There  have been several attempts to extend the range of sizes or times
       supported by modifying how numbers are stored in the header.

       One obvious extension to increase the size of files is to eliminate the
       terminating characters from the various numeric fields.	 For  example,
       the standard only allows the size field to contain 11 octal digits, re‐
       serving the twelfth byte for a trailing NUL character.  Allowing 12 oc‐
       tal digits allows file sizes up to 64 GB.

       Another	extension,  utilized by GNU tar, star, and other newer 1mtar 22mim‐
       plementations, permits binary numbers in the standard  numeric  fields.
       This is flagged by setting the high bit of the first byte.  The remain‐
       der  of	the  field is treated as a signed twos-complement value.  This
       permits 95-bit values for the length and time fields and 63-bit	values
       for  the	 uid, gid, and device numbers.	In particular, this provides a
       consistent way to handle negative time values.  GNU tar	supports  this
       extension  for  the  length,  mtime,  ctime,  and  atime fields.	 Joerg
       Schilling's star program and the libarchive library support this exten‐
       sion for all numeric fields.  Note that this extension is largely obso‐
       leted by the extended attribute record provided by the pax  interchange
       format.

       Another	early  GNU extension allowed base-64 values rather than octal.
       This extension was short-lived and is no longer supported by any imple‐
       mentation.

   1mPax Interchange Format0m
       There are many attributes that cannot be portably stored in a POSIX us‐
       tar  archive.   IEEE  Std  1003.1-2001  (“POSIX.1”)  defined   a	  “pax
       interchange  format”  that  uses two new types of entries to hold text-
       formatted metadata that applies to following entries.  Note that a  pax
       interchange  format  archive  is a ustar archive in every respect.  The
       new data is stored in ustar-compatible archive entries that use the “x”
       or “g” typeflag.	 In particular,	 older	implementations	 that  do  not
       fully  support  these extensions will extract the metadata into regular
       files, where the metadata can be examined as necessary.

       An entry in a pax interchange format archive consists  of  one  or  two
       standard	 ustar	entries, each with its own header and data.  The first
       optional entry stores the extended attributes for the following	entry.
       This optional first entry has an "x" typeflag and a size field that in‐
       dicates	the  total  size of the extended attributes.  The extended at‐
       tributes themselves are stored as a series of text-format lines encoded
       in the portable UTF-8 encoding.	Each line consists of a	 decimal  num‐
       ber,  a	space, a key string, an equals sign, a value string, and a new
       line.  The decimal number indicates the length of the entire line,  in‐
       cluding	the initial length field and the trailing newline.  An example
       of such a field is:
	     1m25 ctime=1084839148.1212\n0m
       Keys in all lowercase are standard keys.	 Vendors  can  add  their  own
       keys  by prefixing them with an all uppercase vendor name and a period.
       Note that, unlike the historic header, numeric values are stored	 using
       decimal, not octal.  A description of some common keys follows:

       1matime22m, 1mctime22m, 1mmtime0m
	       File  access,  inode  change,  and  modification	 times.	 These
	       fields can be negative or include a decimal point and  a	 frac‐
	       tional value.

       1mhdrcharset0m
	       The  character  set  used  by the pax extension values.	By de‐
	       fault, all textual values in the pax  extended  attributes  are
	       assumed	to  be	in UTF-8, including pathnames, user names, and
	       group names.  In some cases, it is not  possible	 to  translate
	       local  conventions  into UTF-8.	If this key is present and the
	       value is the six-character ASCII string “BINARY”, then all tex‐
	       tual values are assumed to be in	 a  platform-dependent	multi-
	       byte  encoding.	 Note that there are only two valid values for
	       this key: “BINARY” or “ISO-IR 10646 2000 UTF-8”.	 No other val‐
	       ues are permitted by the standard, and the latter value	should
	       generally not be used as it is the default when this key is not
	       specified.   In	particular,  this flag should not be used as a
	       general mechanism to allow filenames to be stored in  arbitrary
	       encodings.

       1muname22m, 1muid22m, 1mgname22m, 1mgid0m
	       User  name,  group  name,  and numeric UID and GID values.  The
	       user name and group name stored here are encoded	 in  UTF8  and
	       can  thus include non-ASCII characters.	The UID and GID fields
	       can be of arbitrary length.

       1mlinkpath0m
	       The full path of the linked-to file.  Note that this is encoded
	       in UTF8 and can thus include non-ASCII characters.

       1mpath	 22mThe full pathname of the entry.  Note that this is	encoded	 in
	       UTF8 and can thus include non-ASCII characters.

       1mrealtime.*22m, 1msecurity.*0m
	       These keys are reserved and may be used for future standardiza‐
	       tion.

       1msize	 22mThe	 size  of  the file.  Note that there is no length limit on
	       this field, allowing conforming archives to  store  files  much
	       larger than the historic 8GB limit.

       1mSCHILY.*0m
	       Vendor-specific	attributes  used by Joerg Schilling's 1mstar 22mim‐
	       plementation.

       1mSCHILY.acl.access22m, 1mSCHILY.acl.default22m, 1mSCHILY.acl.ace0m
	       Stores the access, default and NFSv4 ACLs as textual strings in
	       a format that is	 an  extension	of  the	 format	 specified  by
	       POSIX.1e	 draft	17.   In particular, each user or group access
	       specification can include an additional	colon-separated	 field
	       with  the  numeric UID or GID.  This allows ACLs to be restored
	       on systems that may not have complete user or group information
	       available (such as when NIS/YP or LDAP services are temporarily
	       unavailable).

       1mSCHILY.devminor22m, 1mSCHILY.devmajor0m
	       The full minor and major numbers for device nodes.

       1mSCHILY.fflags0m
	       The file flags.

       1mSCHILY.realsize0m
	       The full size of the file on disk.  XXX explain? XXX

       1mSCHILY.dev22m, 1mSCHILY.ino22m, 1mSCHILY.nlinks0m
	       The device number, inode number, and link count for the	entry.
	       In particular, note that a pax interchange format archive using
	       Joerg Schilling's 1mSCHILY.* 22mextensions can store all of the data
	       from 4mstruct24m 4mstat24m.

       1mLIBARCHIVE.*0m
	       Vendor-specific	attributes  used by the 1mlibarchive 22mlibrary and
	       programs that use it.

       1mLIBARCHIVE.creationtime0m
	       The time when the file was created.  (This should not  be  con‐
	       fused  with  the	 POSIX	“ctime” attribute, which refers to the
	       time when the file metadata was last changed.)

       1mLIBARCHIVE.xattr22m.4mnamespace24m.4mkey0m
	       Libarchive stores POSIX.1e-style extended attributes using keys
	       of this form.  The 4mkey24m  value  is  URL-encoded:  All  non-ASCII
	       characters  and	the two special characters “=” and “%” are en‐
	       coded as “%” followed by two uppercase hexadecimal digits.  The
	       value of this key is the extended attribute  value  encoded  in
	       base 64.	 XXX Detail the base-64 format here XXX

       1mVENDOR.*0m
	       XXX document other vendor-specific extensions XXX

       Any  values  stored in an extended attribute override the corresponding
       values in the regular tar header.  Note that compliant  readers	should
       ignore the regular fields when they are overridden.  This is important,
       as  existing  archivers	are known to store non-compliant values in the
       standard header fields in this  situation.   There  are	no  limits  on
       length  for  any of these fields.  In particular, numeric fields can be
       arbitrarily large.  All text fields are	encoded	 in  UTF8.   Compliant
       writers	should store only portable 7-bit ASCII characters in the stan‐
       dard ustar header and use extended attributes  whenever	a  text	 value
       contains non-ASCII characters.

       In  addition to the 1mx 22mentry described above, the pax interchange format
       also supports a 1mg 22mentry.  The 1mg 22mentry is identical in format, but spec‐
       ifies attributes that serve as defaults for all subsequent archive  en‐
       tries.  The 1mg 22mentry is not widely used.

       Besides	the  new 1mx 22mand 1mg 22mentries, the pax interchange format has a few
       other minor variations from the earlier ustar format.  The  most	 trou‐
       bling  one is that hardlinks are permitted to have data following them.
       This allows readers to restore any hardlink to a file without having to
       rewind the archive to find an earlier entry.  However, it creates  com‐
       plications  for robust readers, as it is no longer clear whether or not
       they should ignore the size field for hardlink entries.

   1mGNU Tar Archives0m
       The GNU tar program started with a pre-POSIX format similar to that de‐
       scribed earlier and has extended it using several different mechanisms:
       It added new fields to the empty space in the header (some of which was
       later used by POSIX for conflicting purposes); it allowed the header to
       be continued over multiple records; and it  defined  new	 entries  that
       modify following entries (similar in principle to the 1mx 22mentry described
       above,  but  each  GNU special entry is single-purpose, unlike the gen‐
       eral-purpose 1mx 22mentry).  As a result, GNU tar  archives  are	 not  POSIX
       compatible,  although more lenient POSIX-compliant readers can success‐
       fully extract most GNU tar archives.

	     struct header_gnu_tar {
		     char name[100];
		     char mode[8];
		     char uid[8];
		     char gid[8];
		     char size[12];
		     char mtime[12];
		     char checksum[8];
		     char typeflag[1];
		     char linkname[100];
		     char magic[6];
		     char version[2];
		     char uname[32];
		     char gname[32];
		     char devmajor[8];
		     char devminor[8];
		     char atime[12];
		     char ctime[12];
		     char offset[12];
		     char longnames[4];
		     char unused[1];
		     struct {
			     char offset[12];
			     char numbytes[12];
		     } sparse[4];
		     char isextended[1];
		     char realsize[12];
		     char pad[17];
	     };

       4mtypeflag0m
	       GNU tar uses the following special entry types, in addition  to
	       those defined by POSIX:

	       7       GNU tar treats type "7" records identically to type "0"
		       records, except on one obscure RTOS where they are used
		       to  indicate the pre-allocation of a contiguous file on
		       disk.

	       D       This indicates a directory entry.   Unlike  the	POSIX-
		       standard	 "5"  typeflag, the header is followed by data
		       records listing the names of files in  this  directory.
		       Each  name  is  preceded by an ASCII "Y" if the file is
		       stored in this archive or "N" if the file is not stored
		       in this archive.	 Each name is terminated with a	 null,
		       and  an extra null marks the end of the name list.  The
		       purpose of this entry is to support  incremental	 back‐
		       ups;  a program restoring from such an archive may wish
		       to delete files on disk that did not exist in  the  di‐
		       rectory when the archive was made.

		       Note that the "D" typeflag specifically violates POSIX,
		       which  requires that unrecognized typeflags be restored
		       as normal files.	 In this case, restoring the "D" entry
		       as a file could interfere with subsequent  creation  of
		       the like-named directory.

	       K       The data for this entry is a long linkname for the fol‐
		       lowing regular entry.

	       L       The data for this entry is a long pathname for the fol‐
		       lowing regular entry.

	       M       This is a continuation of the last file on the previous
		       volume.	 GNU multi-volume archives guarantee that each
		       volume begins with a valid  entry  header.   To	ensure
		       this,  a file may be split, with part stored at the end
		       of one volume, and part stored at the beginning of  the
		       next  volume.  The "M" typeflag indicates that this en‐
		       try continues an existing file.	Such entries can  only
		       occur  as  the first or second entry in an archive (the
		       latter only if the first entry is a volume label).  The
		       4msize24m field specifies  the  size  of	 this  entry.	The
		       4moffset24m  field  at  bytes  369-380  specifies the offset
		       where this file fragment begins.	  The  4mrealsize24m  field
		       specifies  the total size of the file (which must equal
		       4msize24m plus 4moffset24m).  When  extracting,	GNU  tar  checks
		       that  the  header file name is the one it is expecting,
		       that the header offset is in the correct sequence,  and
		       that the sum of offset and size is equal to realsize.

	       N       Type  "N"  records  are no longer generated by GNU tar.
		       They contained a list of files to be  renamed  or  sym‐
		       linked  after  extraction;  this was originally used to
		       support long names.  The contents of this record are  a
		       text  description  of the operations to be done, in the
		       form “Rename %s to %s\n” or “Symlink %s	to  %s\n”;  in
		       either  case,  both  filenames  are escaped using K&R C
		       syntax.	Due to security concerns, "N" records are  now
		       generally ignored when reading archives.

	       S       This  is	 a  “sparse”  regular  file.  Sparse files are
		       stored as a series of fragments.	 The header contains a
		       list of fragment offset/length  pairs.	If  more  than
		       four  such entries are required, the header is extended
		       as necessary with “extra” header extensions  (an	 older
		       format that is no longer used), or “sparse” extensions.

	       V       The  4mname24m  field should be interpreted as a tape/volume
		       header name.  This entry should generally be ignored on
		       extraction.

       4mmagic24m   The magic field holds the five characters “ustar” followed by a
	       space.  Note that POSIX ustar archives have a trailing null.

       4mversion0m
	       The version field holds a space character followed by  a	 null.
	       Note  that  POSIX  ustar	 archives  use two copies of the ASCII
	       digit “0”.

       4matime24m, 4mctime0m
	       The time the file was last accessed and the time of last change
	       of file information, stored in octal as with 4mmtime24m.

       4mlongnames0m
	       This field is apparently no longer used.

       Sparse 4moffset24m 4m/24m 4mnumbytes0m
	       Each such structure specifies a single  fragment	 of  a	sparse
	       file.  The two fields store values as octal numbers.  The frag‐
	       ments  are  each	 padded	 to  a	multiple  of  512 bytes in the
	       archive.	 On extraction, the list  of  fragments	 is  collected
	       from the header (including any extension headers), and the data
	       is then read and written to the file at appropriate offsets.

       4misextended0m
	       If  this is set to non-zero, the header will be followed by ad‐
	       ditional “sparse header” records.  Each	such  record  contains
	       information  about  as  many  as 21 additional sparse blocks as
	       shown here:

		     struct gnu_sparse_header {
			     struct {
				     char offset[12];
				     char numbytes[12];
			     } sparse[21];
			     char    isextended[1];
			     char    padding[7];
		     };

       4mrealsize0m
	       A binary representation of the file's  complete	size,  with  a
	       much  larger  range  than  the POSIX file size.	In particular,
	       with 1mM 22mtype files, the current entry is only a portion  of	the
	       file.   In  that	 case,	the POSIX size field will indicate the
	       size of this entry; the 4mrealsize24m field will indicate the  total
	       size of the file.

   1mGNU tar pax archives0m
       GNU  tar 1.14 (XXX check this XXX) and later will write pax interchange
       format archives when you specify the 1m--posix 22mflag.	This format follows
       the pax interchange format closely, using some 1mSCHILY 22mtags	and  intro‐
       ducing  new keywords to store sparse file information.  There have been
       three iterations of the sparse file  support,  referred	to  as	“0.0”,
       “0.1”, and “1.0”.

       1mGNU.sparse.numblocks22m,      1mGNU.sparse.offset22m,	    1mGNU.sparse.numbytes22m,
	       1mGNU.sparse.size0m
	       The “0.0” format used an initial 1mGNU.sparse.numblocks 22mattribute
	       to indicate the number  of  blocks  in  the  file,  a  pair  of
	       1mGNU.sparse.offset  22mand 1mGNU.sparse.numbytes 22mto indicate the off‐
	       set and size of each block, and a single 1mGNU.sparse.size 22mto in‐
	       dicate the full size of the file.  This is not the same as  the
	       size  in	 the  tar header because the latter value does not in‐
	       clude the size of any holes.  This format required that the or‐
	       der of attributes be preserved and relied on readers  accepting
	       multiple	 appearances of the same attribute names, which is not
	       officially permitted by the standards.

       1mGNU.sparse.map0m
	       The “0.1” format used a single attribute that stored  a	comma-
	       separated  list of decimal numbers.  Each pair of numbers indi‐
	       cated the offset and size, respectively, of a  block  of	 data.
	       This  does  not	work  well  if	the archive is extracted by an
	       archiver that does not recognize this extension, since many pax
	       implementations simply discard unrecognized attributes.

       1mGNU.sparse.major22m,	       1mGNU.sparse.minor22m,		1mGNU.sparse.name22m,
	       1mGNU.sparse.realsize0m
	       The  “1.0”  format  stores  the sparse block map in one or more
	       512-byte blocks prepended to the file data in the  entry	 body.
	       The  pax attributes indicate the existence of this map (via the
	       1mGNU.sparse.major 22mand 1mGNU.sparse.minor 22mfields) and the full size
	       of the file.  The 1mGNU.sparse.name 22mholds the true  name  of	the
	       file.   To  avoid confusion, the name stored in the regular tar
	       header is a modified name so that extraction errors will be ap‐
	       parent to users.

   1mSolaris Tar0m
       XXX More Details Needed XXX

       Solaris	tar  (beginning	 with  SunOS  XXX  5.7	??  XXX)  supports  an
       “extended” format that is fundamentally similar to pax interchange for‐
       mat, with the following differences:
       1m•	 22mExtended attributes are stored in an entry whose type is 1mX22m, not
	       1mx22m,	as  used by pax interchange format.  The detailed format of
	       this entry appears to be the same as detailed above for	the  1mx0m
	       entry.
       1m•	 22mAn	additional 1mA 22mheader is used to store an ACL for the follow‐
	       ing regular entry.  The body of this entry  contains  a	seven-
	       digit  octal  number  followed  by a zero byte, followed by the
	       textual ACL description.	 The octal value is the number of  ACL
	       entries	plus  a constant that indicates the ACL type: 01000000
	       for POSIX.1e ACLs and 03000000 for NFSv4 ACLs.

   1mAIX Tar0m
       XXX More details needed XXX

       AIX Tar uses a ustar-formatted header with the type 1mA 22mfor storing coded
       ACL information.	 Unlike the Solaris format, AIX tar writes this header
       after the regular file body to which it applies.	 The pathname in  this
       header  is either 1mNFS4 22mor 1mAIXC 22mto indicate the type of ACL stored.  The
       actual ACL is stored in platform-specific binary format.

   1mMac OS X Tar0m
       The tar distributed with Apple's Mac OS X stores most regular files  as
       two  separate  files  in	 the tar archive.  The two files have the same
       name except that the first one has “._” prepended to the last path ele‐
       ment.  This special file stores an AppleDouble-encoded binary blob with
       additional metadata about the second file, including ACL, extended  at‐
       tributes,  and  resources.  To recreate the original file on disk, each
       separate file can be extracted and the Mac OS X 1mcopyfile22m() function can
       be used to unpack the separate metadata file and apply it to th regular
       file.  Conversely, the same function provides a “pack” option to encode
       the extended metadata from a file into a separate file  whose  contents
       can then be put into a tar archive.

       Note  that the Apple extended attributes interact badly with long file‐
       names.  Since each file is stored with the full name, a separate set of
       extensions needs to be included in the archive for each	one,  doubling
       the overhead required for files with long names.

   1mSummary of tar type codes0m
       The following list is a condensed summary of the type codes used in tar
       header  records	generated  by different tar implementations.  More de‐
       tails about specific implementations can be found above:
       NUL  Early tar programs stored a zero byte for regular files.
       1m0    22mPOSIX standard type code for a regular file.
       1m1    22mPOSIX standard type code for a hard link description.
       1m2    22mPOSIX standard type code for a symbolic link description.
       1m3    22mPOSIX standard type code for a character device node.
       1m4    22mPOSIX standard type code for a block device node.
       1m5    22mPOSIX standard type code for a directory.
       1m6    22mPOSIX standard type code for a FIFO.
       1m7    22mPOSIX reserved.
       1m7    22mGNU tar used for pre-allocated files on some systems.
       1mA    22mSolaris tar ACL description stored prior to a regular file header.
       1mA    22mAIX tar ACL description stored after the file body.
       1mD    22mGNU tar directory dump.
       1mK    22mGNU tar long linkname for the following header.
       1mL    22mGNU tar long pathname for the following header.
       1mM    22mGNU tar multivolume marker, indicating the file is a  continuation
	    of a file from the previous volume.
       1mN    22mGNU tar long filename support.	 Deprecated.
       1mS    22mGNU tar sparse regular file.
       1mV    22mGNU tar tape/volume header name.
       1mX    22mSolaris tar general-purpose extension header.
       1mg    22mPOSIX pax interchange format global extensions.
       1mx    22mPOSIX pax interchange format per-file extensions.

1mSEE ALSO0m
       4mar24m(1), 4mpax24m(1), 4mtar24m(1)

1mSTANDARDS0m
       The  1mtar  22mutility is no longer a part of POSIX or the Single Unix Stan‐
       dard.  It last appeared in Version 2 of the Single  UNIX	 Specification
       (“SUSv2”).   It	has been supplanted in subsequent standards by 4mpax24m(1).
       The ustar format is currently part of the specification for the	4mpax24m(1)
       utility.	  The  pax  interchange	 file  format  is  new	with  IEEE Std
       1003.1-2001 (“POSIX.1”).

1mHISTORY0m
       A 1mtar 22mcommand appeared in Seventh Edition Unix, which was  released	 in
       January,	 1979.	 It  replaced  the 1mtp 22mprogram from Fourth Edition Unix
       which in turn replaced the 1mtap 22mprogram from First Edition  Unix.   John
       Gilmore's  1mpdtar  22mpublic-domain  implementation (circa 1987) was highly
       influential and formed the  basis  of  1mGNU  tar  22m(circa  1988).   Joerg
       Shilling's 1mstar 22marchiver is another open-source (CDDL) archiver (origi‐
       nally developed circa 1985) which features complete support for pax in‐
       terchange format.

       This  documentation  was	 written  as part of the 1mlibarchive 22mand 1mbsdtar0m
       project by Tim Kientzle <kientzle@@FreeBSD.org>.

Debian			       December 27, 2016			4mTAR24m(5)
@


1.8
log
@libarchive: updated to 3.7.2

Libarchive 3.7.2 is a security, bugfix and feature release.

Security fixes:

Multiple vulnerabilities have been fixed in the PAX writer (1b4e0d0)
Important bugfixes:

bsdunzip(1) now correctly handles arguments following an -x after the zipfile
New features:

bsdunzip(1) now supports the "--version" flag
7-zip reader now translates Windows permissions into UNIX permissions
uudecode filter in raw mode now supports file name and file mode
zstd filter now supports the "long" write option


Libarchive 3.7.1 is a security, feature and bugfix release.

Security fixes:

SEGV and stack buffer overflow in verbose mode of cpio
Feature updates:

bsdunzip updated to match latest upstream code
Important bugfixes:

miscellaneous functional bugfixes
build fixes on multiple platforms


Libarchive 3.7.0 is a feature and bugfix release.

New features:

bsdunzip: new tool ported from FreeBSD
drop-in replacement for Info-ZIP unzip, not yet ported for Windows
7zip reader: support for Zstandard compression
7zip reader: support for ARM64 filter
zstd filter: support for multi-frame zstd archives
Other notable bugfixes and improvements:

pax: fix year 2038 problem on platforms with 64-bit time_t
Windows: Universal Windows Platform (UWP) fixes and improvements
Windows: bcrypt usage fixes and improvements
Windows: time function usage fixes and improvements
@
text
@d1 1
a1 1
TAR(5)			    BSD File Formats Manual			TAR(5)
d3 2
a4 2
NAME
     tar — format of tape archive files
d6 673
a678 664
DESCRIPTION
     The tar archive format collects any number of files, directories, and
     other file system objects (symbolic links, device nodes, etc.) into a
     single stream of bytes.  The format was originally designed to be used
     with tape drives that operate with fixed-size blocks, but is widely used
     as a general packaging mechanism.

   General Format
     A tar archive consists of a series of 512-byte records.  Each file system
     object requires a header record which stores basic metadata (pathname,
     owner, permissions, etc.) and zero or more records containing any file
     data.  The end of the archive is indicated by two records consisting en‐
     tirely of zero bytes.

     For compatibility with tape drives that use fixed block sizes, programs
     that read or write tar files always read or write a fixed number of
     records with each I/O operation.  These “blocks” are always a multiple of
     the record size.  The maximum block size supported by early implementa‐
     tions was 10240 bytes or 20 records.  This is still the default for most
     implementations although block sizes of 1MiB (2048 records) or larger are
     commonly used with modern high-speed tape drives.	(Note: the terms
     “block” and “record” here are not entirely standard; this document fol‐
     lows the convention established by John Gilmore in documenting pdtar.)

   Old-Style Archive Format
     The original tar archive format has been extended many times to include
     additional information that various implementors found necessary.	This
     section describes the variant implemented by the tar command included in
     Version 7 AT&T UNIX, which seems to be the earliest widely-used version
     of the tar program.

     The header record for an old-style tar archive consists of the following:

	   struct header_old_tar {
		   char name[100];
		   char mode[8];
		   char uid[8];
		   char gid[8];
		   char size[12];
		   char mtime[12];
		   char checksum[8];
		   char linkflag[1];
		   char linkname[100];
		   char pad[255];
	   };
     All unused bytes in the header record are filled with nulls.

     name    Pathname, stored as a null-terminated string.  Early tar imple‐
	     mentations only stored regular files (including hardlinks to
	     those files).  One common early convention used a trailing "/"
	     character to indicate a directory name, allowing directory per‐
	     missions and owner information to be archived and restored.

     mode    File mode, stored as an octal number in ASCII.

     uid, gid
	     User id and group id of owner, as octal numbers in ASCII.

     size    Size of file, as octal number in ASCII.  For regular files only,
	     this indicates the amount of data that follows the header.	 In
	     particular, this field was ignored by early tar implementations
	     when extracting hardlinks.	 Modern writers should always store a
	     zero length for hardlink entries.

     mtime   Modification time of file, as an octal number in ASCII.  This in‐
	     dicates the number of seconds since the start of the epoch,
	     00:00:00 UTC January 1, 1970.  Note that negative values should
	     be avoided here, as they are handled inconsistently.

     checksum
	     Header checksum, stored as an octal number in ASCII.  To compute
	     the checksum, set the checksum field to all spaces, then sum all
	     bytes in the header using unsigned arithmetic.  This field should
	     be stored as six octal digits followed by a null and a space
	     character.	 Note that many early implementations of tar used
	     signed arithmetic for the checksum field, which can cause inter‐
	     operability problems when transferring archives between systems.
	     Modern robust readers compute the checksum both ways and accept
	     the header if either computation matches.

     linkflag, linkname
	     In order to preserve hardlinks and conserve tape, a file with
	     multiple links is only written to the archive the first time it
	     is encountered.  The next time it is encountered, the linkflag is
	     set to an ASCII ‘1’ and the linkname field holds the first name
	     under which this file appears.  (Note that regular files have a
	     null value in the linkflag field.)

     Early tar implementations varied in how they terminated these fields.
     The tar command in Version 7 AT&T UNIX used the following conventions
     (this is also documented in early BSD manpages): the pathname must be
     null-terminated; the mode, uid, and gid fields must end in a space and a
     null byte; the size and mtime fields must end in a space; the checksum is
     terminated by a null and a space.	Early implementations filled the nu‐
     meric fields with leading spaces.	This seems to have been common prac‐
     tice until the IEEE Std 1003.1-1988 (“POSIX.1”) standard was released.
     For best portability, modern implementations should fill the numeric
     fields with leading zeros.

   Pre-POSIX Archives
     An early draft of IEEE Std 1003.1-1988 (“POSIX.1”) served as the basis
     for John Gilmore's pdtar program and many system implementations from the
     late 1980s and early 1990s.  These archives generally follow the POSIX
     ustar format described below with the following variations:
     •	     The magic value consists of the five characters “ustar” followed
	     by a space.  The version field contains a space character fol‐
	     lowed by a null.
     •	     The numeric fields are generally filled with leading spaces (not
	     leading zeros as recommended in the final standard).
     •	     The prefix field is often not used, limiting pathnames to the 100
	     characters of old-style archives.

   POSIX ustar Archives
     IEEE Std 1003.1-1988 (“POSIX.1”) defined a standard tar file format to be
     read and written by compliant implementations of tar(1).  This format is
     often called the “ustar” format, after the magic value used in the
     header.  (The name is an acronym for “Unix Standard TAR”.)	 It extends
     the historic format with new fields:

	   struct header_posix_ustar {
		   char name[100];
		   char mode[8];
		   char uid[8];
		   char gid[8];
		   char size[12];
		   char mtime[12];
		   char checksum[8];
		   char typeflag[1];
		   char linkname[100];
		   char magic[6];
		   char version[2];
		   char uname[32];
		   char gname[32];
		   char devmajor[8];
		   char devminor[8];
		   char prefix[155];
		   char pad[12];
	   };

     typeflag
	     Type of entry.  POSIX extended the earlier linkflag field with
	     several new type values:
	     “0”     Regular file.  NUL should be treated as a synonym, for
		     compatibility purposes.
	     “1”     Hard link.
	     “2”     Symbolic link.
	     “3”     Character device node.
	     “4”     Block device node.
	     “5”     Directory.
	     “6”     FIFO node.
	     “7”     Reserved.
	     Other   A POSIX-compliant implementation must treat any unrecog‐
		     nized typeflag value as a regular file.  In particular,
		     writers should ensure that all entries have a valid file‐
		     name so that they can be restored by readers that do not
		     support the corresponding extension.  Uppercase letters
		     "A" through "Z" are reserved for custom extensions.  Note
		     that sockets and whiteout entries are not archivable.
	     It is worth noting that the size field, in particular, has dif‐
	     ferent meanings depending on the type.  For regular files, of
	     course, it indicates the amount of data following the header.
	     For directories, it may be used to indicate the total size of all
	     files in the directory, for use by operating systems that pre-al‐
	     locate directory space.  For all other types, it should be set to
	     zero by writers and ignored by readers.

     magic   Contains the magic value “ustar” followed by a NUL byte to indi‐
	     cate that this is a POSIX standard archive.  Full compliance re‐
	     quires the uname and gname fields be properly set.

     version
	     Version.  This should be “00” (two copies of the ASCII digit
	     zero) for POSIX standard archives.

     uname, gname
	     User and group names, as null-terminated ASCII strings.  These
	     should be used in preference to the uid/gid values when they are
	     set and the corresponding names exist on the system.

     devmajor, devminor
	     Major and minor numbers for character device or block device en‐
	     try.

     name, prefix
	     If the pathname is too long to fit in the 100 bytes provided by
	     the standard format, it can be split at any / character with the
	     first portion going into the prefix field.	 If the prefix field
	     is not empty, the reader will prepend the prefix value and a /
	     character to the regular name field to obtain the full pathname.
	     The standard does not require a trailing / character on directory
	     names, though most implementations still include this for compat‐
	     ibility reasons.

     Note that all unused bytes must be set to NUL.

     Field termination is specified slightly differently by POSIX than by pre‐
     vious implementations.  The magic, uname, and gname fields must have a
     trailing NUL.  The pathname, linkname, and prefix fields must have a
     trailing NUL unless they fill the entire field.  (In particular, it is
     possible to store a 256-character pathname if it happens to have a / as
     the 156th character.)  POSIX requires numeric fields to be zero-padded in
     the front, and requires them to be terminated with either space or NUL
     characters.

     Currently, most tar implementations comply with the ustar format, occa‐
     sionally extending it by adding new fields to the blank area at the end
     of the header record.

   Numeric Extensions
     There have been several attempts to extend the range of sizes or times
     supported by modifying how numbers are stored in the header.

     One obvious extension to increase the size of files is to eliminate the
     terminating characters from the various numeric fields.  For example, the
     standard only allows the size field to contain 11 octal digits, reserving
     the twelfth byte for a trailing NUL character.  Allowing 12 octal digits
     allows file sizes up to 64 GB.

     Another extension, utilized by GNU tar, star, and other newer tar imple‐
     mentations, permits binary numbers in the standard numeric fields.	 This
     is flagged by setting the high bit of the first byte.  The remainder of
     the field is treated as a signed twos-complement value.  This permits
     95-bit values for the length and time fields and 63-bit values for the
     uid, gid, and device numbers.  In particular, this provides a consistent
     way to handle negative time values.  GNU tar supports this extension for
     the length, mtime, ctime, and atime fields.  Joerg Schilling's star pro‐
     gram and the libarchive library support this extension for all numeric
     fields.  Note that this extension is largely obsoleted by the extended
     attribute record provided by the pax interchange format.

     Another early GNU extension allowed base-64 values rather than octal.
     This extension was short-lived and is no longer supported by any imple‐
     mentation.

   Pax Interchange Format
     There are many attributes that cannot be portably stored in a POSIX ustar
     archive.  IEEE Std 1003.1-2001 (“POSIX.1”) defined a “pax interchange
     format” that uses two new types of entries to hold text-formatted meta‐
     data that applies to following entries.  Note that a pax interchange for‐
     mat archive is a ustar archive in every respect.  The new data is stored
     in ustar-compatible archive entries that use the “x” or “g” typeflag.  In
     particular, older implementations that do not fully support these exten‐
     sions will extract the metadata into regular files, where the metadata
     can be examined as necessary.

     An entry in a pax interchange format archive consists of one or two stan‐
     dard ustar entries, each with its own header and data.  The first op‐
     tional entry stores the extended attributes for the following entry.
     This optional first entry has an "x" typeflag and a size field that indi‐
     cates the total size of the extended attributes.  The extended attributes
     themselves are stored as a series of text-format lines encoded in the
     portable UTF-8 encoding.  Each line consists of a decimal number, a
     space, a key string, an equals sign, a value string, and a new line.  The
     decimal number indicates the length of the entire line, including the
     initial length field and the trailing newline.  An example of such a
     field is:
	   25 ctime=1084839148.1212\n
     Keys in all lowercase are standard keys.  Vendors can add their own keys
     by prefixing them with an all uppercase vendor name and a period.	Note
     that, unlike the historic header, numeric values are stored using deci‐
     mal, not octal.  A description of some common keys follows:

     atime, ctime, mtime
	     File access, inode change, and modification times.	 These fields
	     can be negative or include a decimal point and a fractional
	     value.

     hdrcharset
	     The character set used by the pax extension values.  By default,
	     all textual values in the pax extended attributes are assumed to
	     be in UTF-8, including pathnames, user names, and group names.
	     In some cases, it is not possible to translate local conventions
	     into UTF-8.  If this key is present and the value is the six-
	     character ASCII string “BINARY”, then all textual values are as‐
	     sumed to be in a platform-dependent multi-byte encoding.  Note
	     that there are only two valid values for this key: “BINARY” or
	     “ISO-IR 10646 2000 UTF-8”.	 No other values are permitted by the
	     standard, and the latter value should generally not be used as it
	     is the default when this key is not specified.  In particular,
	     this flag should not be used as a general mechanism to allow
	     filenames to be stored in arbitrary encodings.

     uname, uid, gname, gid
	     User name, group name, and numeric UID and GID values.  The user
	     name and group name stored here are encoded in UTF8 and can thus
	     include non-ASCII characters.  The UID and GID fields can be of
	     arbitrary length.

     linkpath
	     The full path of the linked-to file.  Note that this is encoded
	     in UTF8 and can thus include non-ASCII characters.

     path    The full pathname of the entry.  Note that this is encoded in
	     UTF8 and can thus include non-ASCII characters.

     realtime.*, security.*
	     These keys are reserved and may be used for future standardiza‐
	     tion.

     size    The size of the file.  Note that there is no length limit on this
	     field, allowing conforming archives to store files much larger
	     than the historic 8GB limit.

     SCHILY.*
	     Vendor-specific attributes used by Joerg Schilling's star imple‐
	     mentation.

     SCHILY.acl.access, SCHILY.acl.default, SCHILY.acl.ace
	     Stores the access, default and NFSv4 ACLs as textual strings in a
	     format that is an extension of the format specified by POSIX.1e
	     draft 17.	In particular, each user or group access specification
	     can include an additional colon-separated field with the numeric
	     UID or GID.  This allows ACLs to be restored on systems that may
	     not have complete user or group information available (such as
	     when NIS/YP or LDAP services are temporarily unavailable).

     SCHILY.devminor, SCHILY.devmajor
	     The full minor and major numbers for device nodes.

     SCHILY.fflags
	     The file flags.

     SCHILY.realsize
	     The full size of the file on disk.	 XXX explain? XXX

     SCHILY.dev, SCHILY.ino, SCHILY.nlinks
	     The device number, inode number, and link count for the entry.
	     In particular, note that a pax interchange format archive using
	     Joerg Schilling's SCHILY.* extensions can store all of the data
	     from struct stat.

     LIBARCHIVE.*
	     Vendor-specific attributes used by the libarchive library and
	     programs that use it.

     LIBARCHIVE.creationtime
	     The time when the file was created.  (This should not be confused
	     with the POSIX “ctime” attribute, which refers to the time when
	     the file metadata was last changed.)

     LIBARCHIVE.xattr.namespace.key
	     Libarchive stores POSIX.1e-style extended attributes using keys
	     of this form.  The key value is URL-encoded: All non-ASCII char‐
	     acters and the two special characters “=” and “%” are encoded as
	     “%” followed by two uppercase hexadecimal digits.	The value of
	     this key is the extended attribute value encoded in base 64.  XXX
	     Detail the base-64 format here XXX

     VENDOR.*
	     XXX document other vendor-specific extensions XXX

     Any values stored in an extended attribute override the corresponding
     values in the regular tar header.	Note that compliant readers should ig‐
     nore the regular fields when they are overridden.	This is important, as
     existing archivers are known to store non-compliant values in the stan‐
     dard header fields in this situation.  There are no limits on length for
     any of these fields.  In particular, numeric fields can be arbitrarily
     large.  All text fields are encoded in UTF8.  Compliant writers should
     store only portable 7-bit ASCII characters in the standard ustar header
     and use extended attributes whenever a text value contains non-ASCII
     characters.

     In addition to the x entry described above, the pax interchange format
     also supports a g entry.  The g entry is identical in format, but speci‐
     fies attributes that serve as defaults for all subsequent archive en‐
     tries.  The g entry is not widely used.

     Besides the new x and g entries, the pax interchange format has a few
     other minor variations from the earlier ustar format.  The most troubling
     one is that hardlinks are permitted to have data following them.  This
     allows readers to restore any hardlink to a file without having to rewind
     the archive to find an earlier entry.  However, it creates complications
     for robust readers, as it is no longer clear whether or not they should
     ignore the size field for hardlink entries.

   GNU Tar Archives
     The GNU tar program started with a pre-POSIX format similar to that de‐
     scribed earlier and has extended it using several different mechanisms:
     It added new fields to the empty space in the header (some of which was
     later used by POSIX for conflicting purposes); it allowed the header to
     be continued over multiple records; and it defined new entries that mod‐
     ify following entries (similar in principle to the x entry described
     above, but each GNU special entry is single-purpose, unlike the general-
     purpose x entry).	As a result, GNU tar archives are not POSIX compati‐
     ble, although more lenient POSIX-compliant readers can successfully ex‐
     tract most GNU tar archives.

	   struct header_gnu_tar {
		   char name[100];
		   char mode[8];
		   char uid[8];
		   char gid[8];
		   char size[12];
		   char mtime[12];
		   char checksum[8];
		   char typeflag[1];
		   char linkname[100];
		   char magic[6];
		   char version[2];
		   char uname[32];
		   char gname[32];
		   char devmajor[8];
		   char devminor[8];
		   char atime[12];
		   char ctime[12];
		   char offset[12];
		   char longnames[4];
		   char unused[1];
		   struct {
			   char offset[12];
			   char numbytes[12];
		   } sparse[4];
		   char isextended[1];
		   char realsize[12];
		   char pad[17];
	   };

     typeflag
	     GNU tar uses the following special entry types, in addition to
	     those defined by POSIX:

	     7	     GNU tar treats type "7" records identically to type "0"
		     records, except on one obscure RTOS where they are used
		     to indicate the pre-allocation of a contiguous file on
		     disk.

	     D	     This indicates a directory entry.	Unlike the POSIX-stan‐
		     dard "5" typeflag, the header is followed by data records
		     listing the names of files in this directory.  Each name
		     is preceded by an ASCII "Y" if the file is stored in this
		     archive or "N" if the file is not stored in this archive.
		     Each name is terminated with a null, and an extra null
		     marks the end of the name list.  The purpose of this en‐
		     try is to support incremental backups; a program restor‐
		     ing from such an archive may wish to delete files on disk
		     that did not exist in the directory when the archive was
		     made.

		     Note that the "D" typeflag specifically violates POSIX,
		     which requires that unrecognized typeflags be restored as
		     normal files.  In this case, restoring the "D" entry as a
		     file could interfere with subsequent creation of the
		     like-named directory.

	     K	     The data for this entry is a long linkname for the fol‐
		     lowing regular entry.

	     L	     The data for this entry is a long pathname for the fol‐
		     lowing regular entry.

	     M	     This is a continuation of the last file on the previous
		     volume.  GNU multi-volume archives guarantee that each
		     volume begins with a valid entry header.  To ensure this,
		     a file may be split, with part stored at the end of one
		     volume, and part stored at the beginning of the next vol‐
		     ume.  The "M" typeflag indicates that this entry contin‐
		     ues an existing file.  Such entries can only occur as the
		     first or second entry in an archive (the latter only if
		     the first entry is a volume label).  The size field spec‐
		     ifies the size of this entry.  The offset field at bytes
		     369-380 specifies the offset where this file fragment be‐
		     gins.  The realsize field specifies the total size of the
		     file (which must equal size plus offset).	When extract‐
		     ing, GNU tar checks that the header file name is the one
		     it is expecting, that the header offset is in the correct
		     sequence, and that the sum of offset and size is equal to
		     realsize.

	     N	     Type "N" records are no longer generated by GNU tar.
		     They contained a list of files to be renamed or symlinked
		     after extraction; this was originally used to support
		     long names.  The contents of this record are a text de‐
		     scription of the operations to be done, in the form
		     “Rename %s to %s\n” or “Symlink %s to %s\n”; in either
		     case, both filenames are escaped using K&R C syntax.  Due
		     to security concerns, "N" records are now generally ig‐
		     nored when reading archives.

	     S	     This is a “sparse” regular file.  Sparse files are stored
		     as a series of fragments.	The header contains a list of
		     fragment offset/length pairs.  If more than four such en‐
		     tries are required, the header is extended as necessary
		     with “extra” header extensions (an older format that is
		     no longer used), or “sparse” extensions.

	     V	     The name field should be interpreted as a tape/volume
		     header name.  This entry should generally be ignored on
		     extraction.

     magic   The magic field holds the five characters “ustar” followed by a
	     space.  Note that POSIX ustar archives have a trailing null.

     version
	     The version field holds a space character followed by a null.
	     Note that POSIX ustar archives use two copies of the ASCII digit
	     “0”.

     atime, ctime
	     The time the file was last accessed and the time of last change
	     of file information, stored in octal as with mtime.

     longnames
	     This field is apparently no longer used.

     Sparse offset / numbytes
	     Each such structure specifies a single fragment of a sparse file.
	     The two fields store values as octal numbers.  The fragments are
	     each padded to a multiple of 512 bytes in the archive.  On ex‐
	     traction, the list of fragments is collected from the header (in‐
	     cluding any extension headers), and the data is then read and
	     written to the file at appropriate offsets.

     isextended
	     If this is set to non-zero, the header will be followed by addi‐
	     tional “sparse header” records.  Each such record contains infor‐
	     mation about as many as 21 additional sparse blocks as shown
	     here:

		   struct gnu_sparse_header {
			   struct {
				   char offset[12];
				   char numbytes[12];
			   } sparse[21];
			   char	   isextended[1];
			   char	   padding[7];
		   };

     realsize
	     A binary representation of the file's complete size, with a much
	     larger range than the POSIX file size.  In particular, with M
	     type files, the current entry is only a portion of the file.  In
	     that case, the POSIX size field will indicate the size of this
	     entry; the realsize field will indicate the total size of the
	     file.

   GNU tar pax archives
     GNU tar 1.14 (XXX check this XXX) and later will write pax interchange
     format archives when you specify the --posix flag.	 This format follows
     the pax interchange format closely, using some SCHILY tags and introduc‐
     ing new keywords to store sparse file information.	 There have been three
     iterations of the sparse file support, referred to as “0.0”, “0.1”, and
     “1.0”.

     GNU.sparse.numblocks, GNU.sparse.offset, GNU.sparse.numbytes,
	     GNU.sparse.size
	     The “0.0” format used an initial GNU.sparse.numblocks attribute
	     to indicate the number of blocks in the file, a pair of
	     GNU.sparse.offset and GNU.sparse.numbytes to indicate the offset
	     and size of each block, and a single GNU.sparse.size to indicate
	     the full size of the file.	 This is not the same as the size in
	     the tar header because the latter value does not include the size
	     of any holes.  This format required that the order of attributes
	     be preserved and relied on readers accepting multiple appearances
	     of the same attribute names, which is not officially permitted by
	     the standards.

     GNU.sparse.map
	     The “0.1” format used a single attribute that stored a comma-sep‐
	     arated list of decimal numbers.  Each pair of numbers indicated
	     the offset and size, respectively, of a block of data.  This does
	     not work well if the archive is extracted by an archiver that
	     does not recognize this extension, since many pax implementations
	     simply discard unrecognized attributes.

     GNU.sparse.major, GNU.sparse.minor, GNU.sparse.name, GNU.sparse.realsize
	     The “1.0” format stores the sparse block map in one or more
	     512-byte blocks prepended to the file data in the entry body.
	     The pax attributes indicate the existence of this map (via the
	     GNU.sparse.major and GNU.sparse.minor fields) and the full size
	     of the file.  The GNU.sparse.name holds the true name of the
	     file.  To avoid confusion, the name stored in the regular tar
	     header is a modified name so that extraction errors will be ap‐
	     parent to users.

   Solaris Tar
     XXX More Details Needed XXX

     Solaris tar (beginning with SunOS XXX 5.7 ?? XXX) supports an “extended”
     format that is fundamentally similar to pax interchange format, with the
     following differences:
     •	     Extended attributes are stored in an entry whose type is X, not
	     x, as used by pax interchange format.  The detailed format of
	     this entry appears to be the same as detailed above for the x en‐
	     try.
     •	     An additional A header is used to store an ACL for the following
	     regular entry.  The body of this entry contains a seven-digit oc‐
	     tal number followed by a zero byte, followed by the textual ACL
	     description.  The octal value is the number of ACL entries plus a
	     constant that indicates the ACL type: 01000000 for POSIX.1e ACLs
	     and 03000000 for NFSv4 ACLs.

   AIX Tar
     XXX More details needed XXX

     AIX Tar uses a ustar-formatted header with the type A for storing coded
     ACL information.  Unlike the Solaris format, AIX tar writes this header
     after the regular file body to which it applies.  The pathname in this
     header is either NFS4 or AIXC to indicate the type of ACL stored.	The
     actual ACL is stored in platform-specific binary format.

   Mac OS X Tar
     The tar distributed with Apple's Mac OS X stores most regular files as
     two separate files in the tar archive.  The two files have the same name
     except that the first one has “._” prepended to the last path element.
     This special file stores an AppleDouble-encoded binary blob with addi‐
     tional metadata about the second file, including ACL, extended at‐
     tributes, and resources.  To recreate the original file on disk, each
     separate file can be extracted and the Mac OS X copyfile() function can
     be used to unpack the separate metadata file and apply it to th regular
     file.  Conversely, the same function provides a “pack” option to encode
     the extended metadata from a file into a separate file whose contents can
     then be put into a tar archive.

     Note that the Apple extended attributes interact badly with long file‐
     names.  Since each file is stored with the full name, a separate set of
     extensions needs to be included in the archive for each one, doubling the
     overhead required for files with long names.

   Summary of tar type codes
     The following list is a condensed summary of the type codes used in tar
     header records generated by different tar implementations.	 More details
     about specific implementations can be found above:
     NUL  Early tar programs stored a zero byte for regular files.
     0	  POSIX standard type code for a regular file.
     1	  POSIX standard type code for a hard link description.
     2	  POSIX standard type code for a symbolic link description.
     3	  POSIX standard type code for a character device node.
     4	  POSIX standard type code for a block device node.
     5	  POSIX standard type code for a directory.
     6	  POSIX standard type code for a FIFO.
     7	  POSIX reserved.
     7	  GNU tar used for pre-allocated files on some systems.
     A	  Solaris tar ACL description stored prior to a regular file header.
     A	  AIX tar ACL description stored after the file body.
     D	  GNU tar directory dump.
     K	  GNU tar long linkname for the following header.
     L	  GNU tar long pathname for the following header.
     M	  GNU tar multivolume marker, indicating the file is a continuation of
	  a file from the previous volume.
     N	  GNU tar long filename support.  Deprecated.
     S	  GNU tar sparse regular file.
     V	  GNU tar tape/volume header name.
     X	  Solaris tar general-purpose extension header.
     g	  POSIX pax interchange format global extensions.
     x	  POSIX pax interchange format per-file extensions.

SEE ALSO
     ar(1), pax(1), tar(1)

STANDARDS
     The tar utility is no longer a part of POSIX or the Single Unix Standard.
     It last appeared in Version 2 of the Single UNIX Specification (“SUSv2”).
     It has been supplanted in subsequent standards by pax(1).	The ustar for‐
     mat is currently part of the specification for the pax(1) utility.	 The
     pax interchange file format is new with IEEE Std 1003.1-2001 (“POSIX.1”).

HISTORY
     A tar command appeared in Seventh Edition Unix, which was released in
     January, 1979.  It replaced the tp program from Fourth Edition Unix which
     in turn replaced the tap program from First Edition Unix.	John Gilmore's
     pdtar public-domain implementation (circa 1987) was highly influential
     and formed the basis of GNU tar (circa 1988).  Joerg Shilling's star
     archiver is another open-source (CDDL) archiver (originally developed
     circa 1985) which features complete support for pax interchange format.
d680 2
a681 2
     This documentation was written as part of the libarchive and bsdtar
     project by Tim Kientzle <kientzle@@FreeBSD.org>.
d683 1
a683 1
BSD			       December 27, 2016			   BSD
@


1.7
log
@libarchive: Update to 3.4.3

Libarchive 3.4.3 is a feature and bugfix release.

New features:

    support for pzstd compressed files (#1357)
    support for RHT.security.selinux tar extended attribute (#1348)

Important bugfixes:

    various zstd fixes and improvements (#1342 #1352 #1359)
    child process handling fixes (#1372)

Libarchive 3.4.2 is a feature and security release.

New features:

    support for atomic file extraction (bsdtar -x --safe-writes) (#1289)
    support for mbed TLS (PolarSSL) (#1301)

Important bugfixes:

    security fixes in RAR5 reader (#1280 #1326)
    compression buffer fix in XAR writer (#1317)
    fix uname and gname longer than 32 characters in PAX writer (#1319)
    fix segfault when archiving hard links in ISO9660 and XAR writers (#1325)
    fix support for extracting 7z archive entries with Delta filter (#987)

Libarchive 3.4.1 is a feature and security release.

New features:

    Unicode filename support for reading lha/lzh archives
    New pax write option "xattrhdr"

Important bugfixes:

    security fixes in wide string processing (#1276 #1298)
    security fixes in RAR5 reader (#1212 #1217 #1296)
    security fixes and optimizations to write filter logic (#351)
    security fix related to use of readlink(2) (1dae5a5)
    sparse file handling fixes (#1218 #1260)

Thanks to all contributors and bug reporters.
Special thanks to Christos Zoulas (@@zoulasc) from NetBSD for the atomic file extraction feature.
@
text
@d4 1
a4 1
     tar -- format of tape archive files
d17 2
a18 2
     data.  The end of the archive is indicated by two records consisting
     entirely of zero bytes.
d22 7
a28 8
     records with each I/O operation.  These ``blocks'' are always a multiple
     of the record size.  The maximum block size supported by early implemen-
     tations was 10240 bytes or 20 records.  This is still the default for
     most implementations although block sizes of 1MiB (2048 records) or
     larger are commonly used with modern high-speed tape drives.  (Note: the
     terms ``block'' and ``record'' here are not entirely standard; this docu-
     ment follows the convention established by John Gilmore in documenting
     pdtar.)
d53 1
a53 1
     name    Pathname, stored as a null-terminated string.  Early tar imple-
d56 1
a56 1
	     character to indicate a directory name, allowing directory per-
d65 1
a65 1
	     this indicates the amount of data that follows the header.  In
d67 1
a67 1
	     when extracting hardlinks.  Modern writers should always store a
d70 2
a71 2
     mtime   Modification time of file, as an octal number in ASCII.  This
	     indicates the number of seconds since the start of the epoch,
d80 2
a81 2
	     character.  Note that many early implementations of tar used
	     signed arithmetic for the checksum field, which can cause inter-
d90 1
a90 1
	     set to an ASCII '1' and the linkname field holds the first name
d99 3
a101 3
     terminated by a null and a space.	Early implementations filled the
     numeric fields with leading spaces.  This seems to have been common prac-
     tice until the IEEE Std 1003.1-1988 (``POSIX.1'') standard was released.
d106 1
a106 1
     An early draft of IEEE Std 1003.1-1988 (``POSIX.1'') served as the basis
d110 4
a113 4
     o	     The magic value consists of the five characters ``ustar'' fol-
	     lowed by a space.	The version field contains a space character
	     followed by a null.
     o	     The numeric fields are generally filled with leading spaces (not
d115 1
a115 1
     o	     The prefix field is often not used, limiting pathnames to the 100
d119 4
a122 4
     IEEE Std 1003.1-1988 (``POSIX.1'') defined a standard tar file format to
     be read and written by compliant implementations of tar(1).  This format
     is often called the ``ustar'' format, after the magic value used in the
     header.  (The name is an acronym for ``Unix Standard TAR''.)  It extends
d148 1
a148 1
	     ``0''   Regular file.  NUL should be treated as a synonym, for
d150 8
a157 8
	     ``1''   Hard link.
	     ``2''   Symbolic link.
	     ``3''   Character device node.
	     ``4''   Block device node.
	     ``5''   Directory.
	     ``6''   FIFO node.
	     ``7''   Reserved.
	     Other   A POSIX-compliant implementation must treat any unrecog-
d159 1
a159 1
		     writers should ensure that all entries have a valid file-
d164 1
a164 1
	     It is worth noting that the size field, in particular, has dif-
d168 7
a174 7
	     files in the directory, for use by operating systems that pre-
	     allocate directory space.	For all other types, it should be set
	     to zero by writers and ignored by readers.

     magic   Contains the magic value ``ustar'' followed by a NUL byte to
	     indicate that this is a POSIX standard archive.  Full compliance
	     requires the uname and gname fields be properly set.
d177 1
a177 1
	     Version.  This should be ``00'' (two copies of the ASCII digit
d186 2
a187 2
	     Major and minor numbers for character device or block device
	     entry.
d192 1
a192 1
	     first portion going into the prefix field.  If the prefix field
d196 1
a196 1
	     names, though most implementations still include this for compat-
d201 1
a201 1
     Field termination is specified slightly differently by POSIX than by pre-
d210 1
a210 1
     Currently, most tar implementations comply with the ustar format, occa-
d224 2
a225 2
     Another extension, utilized by GNU tar, star, and other newer tar imple-
     mentations, permits binary numbers in the standard numeric fields.  This
d231 1
a231 1
     the length, mtime, ctime, and atime fields.  Joerg Schilling's star pro-
d237 1
a237 1
     This extension was short-lived and is no longer supported by any imple-
d242 3
a244 3
     archive.  IEEE Std 1003.1-2001 (``POSIX.1'') defined a ``pax interchange
     format'' that uses two new types of entries to hold text-formatted meta-
     data that applies to following entries.  Note that a pax interchange for-
d246 9
a254 9
     in ustar-compatible archive entries that use the ``x'' or ``g'' typeflag.
     In particular, older implementations that do not fully support these
     extensions will extract the metadata into regular files, where the meta-
     data can be examined as necessary.

     An entry in a pax interchange format archive consists of one or two stan-
     dard ustar entries, each with its own header and data.  The first
     optional entry stores the extended attributes for the following entry.
     This optional first entry has an "x" typeflag and a size field that indi-
d265 1
a265 1
     that, unlike the historic header, numeric values are stored using deci-
d269 1
a269 1
	     File access, inode change, and modification times.  These fields
d279 7
a285 7
	     character ASCII string ``BINARY'', then all textual values are
	     assumed to be in a platform-dependent multi-byte encoding.  Note
	     that there are only two valid values for this key: ``BINARY'' or
	     ``ISO-IR 10646 2000 UTF-8''.  No other values are permitted by
	     the standard, and the latter value should generally not be used
	     as it is the default when this key is not specified.  In particu-
	     lar, this flag should not be used as a general mechanism to allow
d302 1
a302 1
	     These keys are reserved and may be used for future standardiza-
d310 1
a310 1
	     Vendor-specific attributes used by Joerg Schilling's star imple-
d329 1
a329 1
	     The full size of the file on disk.  XXX explain? XXX
d343 1
a343 1
	     with the POSIX ``ctime'' attribute, which refers to the time when
d348 5
a352 5
	     of this form.  The key value is URL-encoded: All non-ASCII char-
	     acters and the two special characters ``='' and ``%'' are encoded
	     as ``%'' followed by two uppercase hexadecimal digits.  The value
	     of this key is the extended attribute value encoded in base 64.
	     XXX Detail the base-64 format here XXX
d358 9
a366 9
     values in the regular tar header.	Note that compliant readers should
     ignore the regular fields when they are overridden.  This is important,
     as existing archivers are known to store non-compliant values in the
     standard header fields in this situation.	There are no limits on length
     for any of these fields.  In particular, numeric fields can be arbitrar-
     ily large.  All text fields are encoded in UTF8.  Compliant writers
     should store only portable 7-bit ASCII characters in the standard ustar
     header and use extended attributes whenever a text value contains non-
     ASCII characters.
d369 3
a371 3
     also supports a g entry.  The g entry is identical in format, but speci-
     fies attributes that serve as defaults for all subsequent archive
     entries.  The g entry is not widely used.
d382 2
a383 2
     The GNU tar program started with a pre-POSIX format similar to that
     described earlier and has extended it using several different mechanisms:
d386 1
a386 1
     be continued over multiple records; and it defined new entries that mod-
d389 3
a391 3
     purpose x entry).	As a result, GNU tar archives are not POSIX compati-
     ble, although more lenient POSIX-compliant readers can successfully
     extract most GNU tar archives.
d432 1
a432 1
	     D	     This indicates a directory entry.	Unlike the POSIX-stan-
d438 5
a442 5
		     marks the end of the name list.  The purpose of this
		     entry is to support incremental backups; a program
		     restoring from such an archive may wish to delete files
		     on disk that did not exist in the directory when the ar-
		     chive was made.
d450 1
a450 1
	     K	     The data for this entry is a long linkname for the fol-
d453 1
a453 1
	     L	     The data for this entry is a long pathname for the fol-
d460 2
a461 2
		     volume, and part stored at the beginning of the next vol-
		     ume.  The "M" typeflag indicates that this entry contin-
d464 1
a464 1
		     the first entry is a volume label).  The size field spec-
d466 7
a472 7
		     369-380 specifies the offset where this file fragment
		     begins.  The realsize field specifies the total size of
		     the file (which must equal size plus offset).  When
		     extracting, GNU tar checks that the header file name is
		     the one it is expecting, that the header offset is in the
		     correct sequence, and that the sum of offset and size is
		     equal to realsize.
d477 13
a489 13
		     long names.  The contents of this record are a text
		     description of the operations to be done, in the form
		     ``Rename %s to %s\n'' or ``Symlink %s to %s\n''; in
		     either case, both filenames are escaped using K&R C syn-
		     tax.  Due to security concerns, "N" records are now gen-
		     erally ignored when reading archives.

	     S	     This is a ``sparse'' regular file.  Sparse files are
		     stored as a series of fragments.  The header contains a
		     list of fragment offset/length pairs.  If more than four
		     such entries are required, the header is extended as nec-
		     essary with ``extra'' header extensions (an older format
		     that is no longer used), or ``sparse'' extensions.
d495 1
a495 1
     magic   The magic field holds the five characters ``ustar'' followed by a
d501 1
a501 1
	     ``0''.
d513 3
a515 3
	     each padded to a multiple of 512 bytes in the archive.  On
	     extraction, the list of fragments is collected from the header
	     (including any extension headers), and the data is then read and
d519 3
a521 3
	     If this is set to non-zero, the header will be followed by addi-
	     tional ``sparse header'' records.	Each such record contains
	     information about as many as 21 additional sparse blocks as shown
d529 2
a530 2
			   char    isextended[1];
			   char    padding[7];
d543 5
a547 5
     format archives when you specify the --posix flag.  This format follows
     the pax interchange format closely, using some SCHILY tags and introduc-
     ing new keywords to store sparse file information.  There have been three
     iterations of the sparse file support, referred to as ``0.0'', ``0.1'',
     and ``1.0''.
d551 1
a551 1
	     The ``0.0'' format used an initial GNU.sparse.numblocks attribute
d555 1
a555 1
	     the full size of the file.  This is not the same as the size in
d563 6
a568 6
	     The ``0.1'' format used a single attribute that stored a comma-
	     separated list of decimal numbers.  Each pair of numbers indi-
	     cated the offset and size, respectively, of a block of data.
	     This does not work well if the archive is extracted by an
	     archiver that does not recognize this extension, since many pax
	     implementations simply discard unrecognized attributes.
d571 1
a571 1
	     The ``1.0'' format stores the sparse block map in one or more
d577 2
a578 2
	     header is a modified name so that extraction errors will be
	     apparent to users.
d583 4
a586 4
     Solaris tar (beginning with SunOS XXX 5.7 ?? XXX) supports an
     ``extended'' format that is fundamentally similar to pax interchange for-
     mat, with the following differences:
     o	     Extended attributes are stored in an entry whose type is X, not
d588 5
a592 5
	     this entry appears to be the same as detailed above for the x
	     entry.
     o	     An additional A header is used to store an ACL for the following
	     regular entry.  The body of this entry contains a seven-digit
	     octal number followed by a zero byte, followed by the textual ACL
d609 4
a612 4
     except that the first one has ``._'' prepended to the last path element.
     This special file stores an AppleDouble-encoded binary blob with addi-
     tional metadata about the second file, including ACL, extended
     attributes, and resources.  To recreate the original file on disk, each
d615 1
a615 1
     file.  Conversely, the same function provides a ``pack'' option to encode
d619 1
a619 1
     Note that the Apple extended attributes interact badly with long file-
d626 1
a626 1
     header records generated by different tar implementations.  More details
d657 4
a660 5
     It last appeared in Version 2 of the Single UNIX Specification
     (``SUSv2'').  It has been supplanted in subsequent standards by pax(1).
     The ustar format is currently part of the specification for the pax(1)
     utility.  The pax interchange file format is new with IEEE Std
     1003.1-2001 (``POSIX.1'').
@


1.6
log
@Update for libarchive-3.4.0:
- improvements for Android APK and JAR archives
- better support for non-recursive list and extract
- tar --exclude-vcs support
- fixes for file attributes and flags handling
- zipx support
- rar 5.0 reader
@
text
@d4 1
a4 1
     tar — format of tape archive files
d17 2
a18 2
     data.  The end of the archive is indicated by two records consisting en‐
     tirely of zero bytes.
d22 8
a29 7
     records with each I/O operation.  These “blocks” are always a multiple of
     the record size.  The maximum block size supported by early implementa‐
     tions was 10240 bytes or 20 records.  This is still the default for most
     implementations although block sizes of 1MiB (2048 records) or larger are
     commonly used with modern high-speed tape drives.	(Note: the terms
     “block” and “record” here are not entirely standard; this document fol‐
     lows the convention established by John Gilmore in documenting pdtar.)
d54 1
a54 1
     name    Pathname, stored as a null-terminated string.  Early tar imple‐
d57 1
a57 1
	     character to indicate a directory name, allowing directory per‐
d71 2
a72 2
     mtime   Modification time of file, as an octal number in ASCII.  This in‐
	     dicates the number of seconds since the start of the epoch,
d82 1
a82 1
	     signed arithmetic for the checksum field, which can cause inter‐
d91 1
a91 1
	     set to an ASCII ‘1’ and the linkname field holds the first name
d100 3
a102 3
     terminated by a null and a space.	Early implementations filled the nu‐
     meric fields with leading spaces.	This seems to have been common prac‐
     tice until the IEEE Std 1003.1-1988 (“POSIX.1”) standard was released.
d107 1
a107 1
     An early draft of IEEE Std 1003.1-1988 (“POSIX.1”) served as the basis
d111 4
a114 4
     •	     The magic value consists of the five characters “ustar” followed
	     by a space.  The version field contains a space character fol‐
	     lowed by a null.
     •	     The numeric fields are generally filled with leading spaces (not
d116 1
a116 1
     •	     The prefix field is often not used, limiting pathnames to the 100
d120 4
a123 4
     IEEE Std 1003.1-1988 (“POSIX.1”) defined a standard tar file format to be
     read and written by compliant implementations of tar(1).  This format is
     often called the “ustar” format, after the magic value used in the
     header.  (The name is an acronym for “Unix Standard TAR”.)  It extends
d149 1
a149 1
	     “0”     Regular file.  NUL should be treated as a synonym, for
d151 8
a158 8
	     “1”     Hard link.
	     “2”     Symbolic link.
	     “3”     Character device node.
	     “4”     Block device node.
	     “5”     Directory.
	     “6”     FIFO node.
	     “7”     Reserved.
	     Other   A POSIX-compliant implementation must treat any unrecog‐
d160 1
a160 1
		     writers should ensure that all entries have a valid file‐
d165 1
a165 1
	     It is worth noting that the size field, in particular, has dif‐
d169 7
a175 7
	     files in the directory, for use by operating systems that pre-al‐
	     locate directory space.  For all other types, it should be set to
	     zero by writers and ignored by readers.

     magic   Contains the magic value “ustar” followed by a NUL byte to indi‐
	     cate that this is a POSIX standard archive.  Full compliance re‐
	     quires the uname and gname fields be properly set.
d178 1
a178 1
	     Version.  This should be “00” (two copies of the ASCII digit
d187 2
a188 2
	     Major and minor numbers for character device or block device en‐
	     try.
d197 1
a197 1
	     names, though most implementations still include this for compat‐
d202 1
a202 1
     Field termination is specified slightly differently by POSIX than by pre‐
d211 1
a211 1
     Currently, most tar implementations comply with the ustar format, occa‐
d225 1
a225 1
     Another extension, utilized by GNU tar, star, and other newer tar imple‐
d232 1
a232 1
     the length, mtime, ctime, and atime fields.  Joerg Schilling's star pro‐
d238 1
a238 1
     This extension was short-lived and is no longer supported by any imple‐
d243 3
a245 3
     archive.  IEEE Std 1003.1-2001 (“POSIX.1”) defined a “pax interchange
     format” that uses two new types of entries to hold text-formatted meta‐
     data that applies to following entries.  Note that a pax interchange for‐
d247 9
a255 9
     in ustar-compatible archive entries that use the “x” or “g” typeflag.  In
     particular, older implementations that do not fully support these exten‐
     sions will extract the metadata into regular files, where the metadata
     can be examined as necessary.

     An entry in a pax interchange format archive consists of one or two stan‐
     dard ustar entries, each with its own header and data.  The first op‐
     tional entry stores the extended attributes for the following entry.
     This optional first entry has an "x" typeflag and a size field that indi‐
d266 1
a266 1
     that, unlike the historic header, numeric values are stored using deci‐
d280 7
a286 7
	     character ASCII string “BINARY”, then all textual values are as‐
	     sumed to be in a platform-dependent multi-byte encoding.  Note
	     that there are only two valid values for this key: “BINARY” or
	     “ISO-IR 10646 2000 UTF-8”.  No other values are permitted by the
	     standard, and the latter value should generally not be used as it
	     is the default when this key is not specified.  In particular,
	     this flag should not be used as a general mechanism to allow
d303 1
a303 1
	     These keys are reserved and may be used for future standardiza‐
d311 1
a311 1
	     Vendor-specific attributes used by Joerg Schilling's star imple‐
d344 1
a344 1
	     with the POSIX “ctime” attribute, which refers to the time when
d349 5
a353 5
	     of this form.  The key value is URL-encoded: All non-ASCII char‐
	     acters and the two special characters “=” and “%” are encoded as
	     “%” followed by two uppercase hexadecimal digits.	The value of
	     this key is the extended attribute value encoded in base 64.  XXX
	     Detail the base-64 format here XXX
d359 9
a367 9
     values in the regular tar header.	Note that compliant readers should ig‐
     nore the regular fields when they are overridden.	This is important, as
     existing archivers are known to store non-compliant values in the stan‐
     dard header fields in this situation.  There are no limits on length for
     any of these fields.  In particular, numeric fields can be arbitrarily
     large.  All text fields are encoded in UTF8.  Compliant writers should
     store only portable 7-bit ASCII characters in the standard ustar header
     and use extended attributes whenever a text value contains non-ASCII
     characters.
d370 3
a372 3
     also supports a g entry.  The g entry is identical in format, but speci‐
     fies attributes that serve as defaults for all subsequent archive en‐
     tries.  The g entry is not widely used.
d383 2
a384 2
     The GNU tar program started with a pre-POSIX format similar to that de‐
     scribed earlier and has extended it using several different mechanisms:
d387 1
a387 1
     be continued over multiple records; and it defined new entries that mod‐
d390 3
a392 3
     purpose x entry).	As a result, GNU tar archives are not POSIX compati‐
     ble, although more lenient POSIX-compliant readers can successfully ex‐
     tract most GNU tar archives.
d433 1
a433 1
	     D	     This indicates a directory entry.	Unlike the POSIX-stan‐
d439 5
a443 5
		     marks the end of the name list.  The purpose of this en‐
		     try is to support incremental backups; a program restor‐
		     ing from such an archive may wish to delete files on disk
		     that did not exist in the directory when the archive was
		     made.
d451 1
a451 1
	     K	     The data for this entry is a long linkname for the fol‐
d454 1
a454 1
	     L	     The data for this entry is a long pathname for the fol‐
d461 2
a462 2
		     volume, and part stored at the beginning of the next vol‐
		     ume.  The "M" typeflag indicates that this entry contin‐
d465 1
a465 1
		     the first entry is a volume label).  The size field spec‐
d467 7
a473 7
		     369-380 specifies the offset where this file fragment be‐
		     gins.  The realsize field specifies the total size of the
		     file (which must equal size plus offset).	When extract‐
		     ing, GNU tar checks that the header file name is the one
		     it is expecting, that the header offset is in the correct
		     sequence, and that the sum of offset and size is equal to
		     realsize.
d478 13
a490 13
		     long names.  The contents of this record are a text de‐
		     scription of the operations to be done, in the form
		     “Rename %s to %s\n” or “Symlink %s to %s\n”; in either
		     case, both filenames are escaped using K&R C syntax.  Due
		     to security concerns, "N" records are now generally ig‐
		     nored when reading archives.

	     S	     This is a “sparse” regular file.  Sparse files are stored
		     as a series of fragments.	The header contains a list of
		     fragment offset/length pairs.  If more than four such en‐
		     tries are required, the header is extended as necessary
		     with “extra” header extensions (an older format that is
		     no longer used), or “sparse” extensions.
d496 1
a496 1
     magic   The magic field holds the five characters “ustar” followed by a
d502 1
a502 1
	     “0”.
d514 3
a516 3
	     each padded to a multiple of 512 bytes in the archive.  On ex‐
	     traction, the list of fragments is collected from the header (in‐
	     cluding any extension headers), and the data is then read and
d520 3
a522 3
	     If this is set to non-zero, the header will be followed by addi‐
	     tional “sparse header” records.  Each such record contains infor‐
	     mation about as many as 21 additional sparse blocks as shown
d545 1
a545 1
     the pax interchange format closely, using some SCHILY tags and introduc‐
d547 2
a548 2
     iterations of the sparse file support, referred to as “0.0”, “0.1”, and
     “1.0”.
d552 1
a552 1
	     The “0.0” format used an initial GNU.sparse.numblocks attribute
d564 6
a569 6
	     The “0.1” format used a single attribute that stored a comma-sep‐
	     arated list of decimal numbers.  Each pair of numbers indicated
	     the offset and size, respectively, of a block of data.  This does
	     not work well if the archive is extracted by an archiver that
	     does not recognize this extension, since many pax implementations
	     simply discard unrecognized attributes.
d572 1
a572 1
	     The “1.0” format stores the sparse block map in one or more
d578 2
a579 2
	     header is a modified name so that extraction errors will be ap‐
	     parent to users.
d584 4
a587 4
     Solaris tar (beginning with SunOS XXX 5.7 ?? XXX) supports an “extended”
     format that is fundamentally similar to pax interchange format, with the
     following differences:
     •	     Extended attributes are stored in an entry whose type is X, not
d589 5
a593 5
	     this entry appears to be the same as detailed above for the x en‐
	     try.
     •	     An additional A header is used to store an ACL for the following
	     regular entry.  The body of this entry contains a seven-digit oc‐
	     tal number followed by a zero byte, followed by the textual ACL
d610 4
a613 4
     except that the first one has “._” prepended to the last path element.
     This special file stores an AppleDouble-encoded binary blob with addi‐
     tional metadata about the second file, including ACL, extended at‐
     tributes, and resources.  To recreate the original file on disk, each
d616 1
a616 1
     file.  Conversely, the same function provides a “pack” option to encode
d620 1
a620 1
     Note that the Apple extended attributes interact badly with long file‐
d658 5
a662 4
     It last appeared in Version 2 of the Single UNIX Specification (“SUSv2”).
     It has been supplanted in subsequent standards by pax(1).	The ustar for‐
     mat is currently part of the specification for the pax(1) utility.  The
     pax interchange file format is new with IEEE Std 1003.1-2001 (“POSIX.1”).
@


1.5
log
@Merge for libarchive-3.3.2.
@
text
@d17 2
a18 2
     data.  The end of the archive is indicated by two records consisting
     entirely of zero bytes.
d70 2
a71 2
     mtime   Modification time of file, as an octal number in ASCII.  This
	     indicates the number of seconds since the start of the epoch,
d99 2
a100 2
     terminated by a null and a space.	Early implementations filled the
     numeric fields with leading spaces.  This seems to have been common prac‐
d110 1
a110 1
     ·	     The magic value consists of the five characters “ustar” followed
d113 1
a113 1
     ·	     The numeric fields are generally filled with leading spaces (not
d115 1
a115 1
     ·	     The prefix field is often not used, limiting pathnames to the 100
d168 3
a170 3
	     files in the directory, for use by operating systems that pre-
	     allocate directory space.	For all other types, it should be set
	     to zero by writers and ignored by readers.
d173 2
a174 2
	     cate that this is a POSIX standard archive.  Full compliance
	     requires the uname and gname fields be properly set.
d186 2
a187 2
	     Major and minor numbers for character device or block device
	     entry.
d252 2
a253 2
     dard ustar entries, each with its own header and data.  The first
     optional entry stores the extended attributes for the following entry.
d279 2
a280 2
	     character ASCII string “BINARY”, then all textual values are
	     assumed to be in a platform-dependent multi-byte encoding.  Note
d358 9
a366 9
     values in the regular tar header.	Note that compliant readers should
     ignore the regular fields when they are overridden.  This is important,
     as existing archivers are known to store non-compliant values in the
     standard header fields in this situation.	There are no limits on length
     for any of these fields.  In particular, numeric fields can be arbitrar‐
     ily large.  All text fields are encoded in UTF8.  Compliant writers
     should store only portable 7-bit ASCII characters in the standard ustar
     header and use extended attributes whenever a text value contains non-
     ASCII characters.
d370 2
a371 2
     fies attributes that serve as defaults for all subsequent archive
     entries.  The g entry is not widely used.
d382 2
a383 2
     The GNU tar program started with a pre-POSIX format similar to that
     described earlier and has extended it using several different mechanisms:
d390 2
a391 2
     ble, although more lenient POSIX-compliant readers can successfully
     extract most GNU tar archives.
d438 5
a442 5
		     marks the end of the name list.  The purpose of this
		     entry is to support incremental backups; a program
		     restoring from such an archive may wish to delete files
		     on disk that did not exist in the directory when the ar‐
		     chive was made.
d466 7
a472 7
		     369-380 specifies the offset where this file fragment
		     begins.  The realsize field specifies the total size of
		     the file (which must equal size plus offset).  When
		     extracting, GNU tar checks that the header file name is
		     the one it is expecting, that the header offset is in the
		     correct sequence, and that the sum of offset and size is
		     equal to realsize.
d477 2
a478 2
		     long names.  The contents of this record are a text
		     description of the operations to be done, in the form
d481 2
a482 2
		     to security concerns, "N" records are now generally
		     ignored when reading archives.
d486 2
a487 2
		     fragment offset/length pairs.  If more than four such
		     entries are required, the header is extended as necessary
d513 3
a515 3
	     each padded to a multiple of 512 bytes in the archive.  On
	     extraction, the list of fragments is collected from the header
	     (including any extension headers), and the data is then read and
d577 2
a578 2
	     header is a modified name so that extraction errors will be
	     apparent to users.
d586 1
a586 1
     ·	     Extended attributes are stored in an entry whose type is X, not
d588 5
a592 5
	     this entry appears to be the same as detailed above for the x
	     entry.
     ·	     An additional A header is used to store an ACL for the following
	     regular entry.  The body of this entry contains a seven-digit
	     octal number followed by a zero byte, followed by the textual ACL
d611 2
a612 2
     tional metadata about the second file, including ACL, extended
     attributes, and resources.  To recreate the original file on disk, each
@


1.4
log
@Merge libarchive-3.3.1.
@
text
@d3 2
a4 2
1mNAME0m
     1mtar 22m— format of tape archive files
d6 2
a7 2
1mDESCRIPTION0m
     The 1mtar 22marchive format collects any number of files, directories, and
d13 2
a14 2
   1mGeneral Format0m
     A 1mtar 22marchive consists of a series of 512-byte records.  Each file system
d28 1
a28 1
     lows the convention established by John Gilmore in documenting 1mpdtar22m.)
d30 1
a30 1
   1mOld-Style Archive Format0m
d37 1
a37 1
     The header record for an old-style 1mtar 22marchive consists of the following:
d53 1
a53 1
     4mname24m	  Pathname, stored as a null-terminated string.  Early tar imple‐
d59 1
a59 1
     4mmode24m	  File mode, stored as an octal number in ASCII.
d61 1
a61 1
     4muid24m, 4mgid0m
d64 1
a64 1
     4msize24m	  Size of file, as octal number in ASCII.  For regular files only,
d70 1
a70 1
     4mmtime24m   Modification time of file, as an octal number in ASCII.  This
d75 1
a75 1
     4mchecksum0m
d86 1
a86 1
     4mlinkflag24m, 4mlinkname0m
d89 2
a90 2
	     is encountered.  The next time it is encountered, the 4mlinkflag24m is
	     set to an ASCII ‘1’ and the 4mlinkname24m field holds the first name
d92 1
a92 1
	     null value in the 4mlinkflag24m field.)
d105 1
a105 1
   1mPre-POSIX Archives0m
d107 1
a107 1
     for John Gilmore's 1mpdtar 22mprogram and many system implementations from the
d110 1
a110 1
     1m·       22mThe magic value consists of the five characters “ustar” followed
d113 1
a113 1
     1m·       22mThe numeric fields are generally filled with leading spaces (not
d115 1
a115 1
     1m·       22mThe prefix field is often not used, limiting pathnames to the 100
d118 1
a118 1
   1mPOSIX ustar Archives0m
d145 2
a146 2
     4mtypeflag0m
	     Type of entry.  POSIX extended the earlier 4mlinkflag24m field with
d164 1
a164 1
	     It is worth noting that the 4msize24m field, in particular, has dif‐
d172 1
a172 1
     4mmagic24m   Contains the magic value “ustar” followed by a NUL byte to indi‐
d176 1
a176 1
     4mversion0m
d180 1
a180 1
     4muname24m, 4mgname0m
d185 1
a185 1
     4mdevmajor24m, 4mdevminor0m
d189 1
a189 1
     4mname24m, 4mprefix0m
d191 1
a191 1
	     the standard format, it can be split at any 4m/24m character with the
d193 1
a193 1
	     is not empty, the reader will prepend the prefix value and a 4m/0m
d195 1
a195 1
	     The standard does not require a trailing 4m/24m character on directory
d202 2
a203 2
     vious implementations.  The 4mmagic24m, 4muname24m, and 4mgname24m fields must have a
     trailing NUL.  The 4mpathname24m, 4mlinkname24m, and 4mprefix24m fields must have a
d205 1
a205 1
     possible to store a 256-character pathname if it happens to have a 4m/24m as
d214 1
a214 1
   1mNumeric Extensions0m
d224 1
a224 1
     Another extension, utilized by GNU tar, star, and other newer 1mtar 22mimple‐
d240 1
a240 1
   1mPax Interchange Format0m
d268 1
a268 1
     1matime22m, 1mctime22m, 1mmtime0m
d273 1
a273 1
     1mhdrcharset0m
d288 1
a288 1
     1muname22m, 1muid22m, 1mgname22m, 1mgid0m
d294 1
a294 1
     1mlinkpath0m
d298 1
a298 1
     1mpath    22mThe full pathname of the entry.  Note that this is encoded in
d301 1
a301 1
     1mrealtime.*22m, 1msecurity.*0m
d305 1
a305 1
     1msize    22mThe size of the file.  Note that there is no length limit on this
d309 2
a310 2
     1mSCHILY.*0m
	     Vendor-specific attributes used by Joerg Schilling's 1mstar 22mimple‐
d313 1
a313 1
     1mSCHILY.acl.access22m, 1mSCHILY.acl.default, SCHILY.acl.ace0m
d322 1
a322 1
     1mSCHILY.devminor22m, 1mSCHILY.devmajor0m
d325 1
a325 1
     1mSCHILY.fflags0m
d328 1
a328 1
     1mSCHILY.realsize0m
d331 1
a331 1
     1mSCHILY.dev, SCHILY.ino22m, 1mSCHILY.nlinks0m
d334 2
a335 2
	     Joerg Schilling's 1mSCHILY.* 22mextensions can store all of the data
	     from 4mstruct24m 4mstat24m.
d337 2
a338 2
     1mLIBARCHIVE.*0m
	     Vendor-specific attributes used by the 1mlibarchive 22mlibrary and
d341 1
a341 1
     1mLIBARCHIVE.creationtime0m
d346 1
a346 1
     1mLIBARCHIVE.xattr.4m22mnamespace24m.4mkey0m
d348 1
a348 1
	     of this form.  The 4mkey24m value is URL-encoded: All non-ASCII char‐
d354 1
a354 1
     1mVENDOR.*0m
d368 2
a369 2
     In addition to the 1mx 22mentry described above, the pax interchange format
     also supports a 1mg 22mentry.  The 1mg 22mentry is identical in format, but speci‐
d371 1
a371 1
     entries.  The 1mg 22mentry is not widely used.
d373 1
a373 1
     Besides the new 1mx 22mand 1mg 22mentries, the pax interchange format has a few
d381 1
a381 1
   1mGNU Tar Archives0m
d387 1
a387 1
     ify following entries (similar in principle to the 1mx 22mentry described
d389 1
a389 1
     purpose 1mx 22mentry).  As a result, GNU tar archives are not POSIX compati‐
d423 1
a423 1
     4mtypeflag0m
d464 2
a465 2
		     the first entry is a volume label).  The 4msize24m field spec‐
		     ifies the size of this entry.  The 4moffset24m field at bytes
d467 2
a468 2
		     begins.  The 4mrealsize24m field specifies the total size of
		     the file (which must equal 4msize24m plus 4moffset24m).  When
d491 1
a491 1
	     V	     The 4mname24m field should be interpreted as a tape/volume
d495 1
a495 1
     4mmagic24m   The magic field holds the five characters “ustar” followed by a
d498 1
a498 1
     4mversion0m
d503 1
a503 1
     4matime24m, 4mctime0m
d505 1
a505 1
	     of file information, stored in octal as with 4mmtime24m.
d507 1
a507 1
     4mlongnames0m
d510 1
a510 1
     Sparse 4moffset24m 4m/24m 4mnumbytes0m
d518 1
a518 1
     4misextended0m
d533 1
a533 1
     4mrealsize0m
d535 1
a535 1
	     larger range than the POSIX file size.  In particular, with 1mM0m
d538 1
a538 1
	     entry; the 4mrealsize24m field will indicate the total size of the
d541 1
a541 1
   1mGNU tar pax archives0m
d543 2
a544 2
     format archives when you specify the 1m--posix 22mflag.  This format follows
     the pax interchange format closely, using some 1mSCHILY 22mtags and introduc‐
d549 3
a551 3
     1mGNU.sparse.numblocks22m, 1mGNU.sparse.offset22m, 1mGNU.sparse.numbytes22m,
	     1mGNU.sparse.size0m
	     The “0.0” format used an initial 1mGNU.sparse.numblocks 22mattribute
d553 2
a554 2
	     1mGNU.sparse.offset 22mand 1mGNU.sparse.numbytes 22mto indicate the offset
	     and size of each block, and a single 1mGNU.sparse.size 22mto indicate
d562 1
a562 1
     1mGNU.sparse.map0m
d570 1
a570 1
     1mGNU.sparse.major22m, 1mGNU.sparse.minor22m, 1mGNU.sparse.name22m, 1mGNU.sparse.realsize0m
d574 2
a575 2
	     1mGNU.sparse.major 22mand 1mGNU.sparse.minor 22mfields) and the full size
	     of the file.  The 1mGNU.sparse.name 22mholds the true name of the
d580 1
a580 1
   1mSolaris Tar0m
d586 3
a588 3
     1m·       22mExtended attributes are stored in an entry whose type is 1mX22m, not
	     1mx22m, as used by pax interchange format.  The detailed format of
	     this entry appears to be the same as detailed above for the 1mx0m
d590 1
a590 1
     1m·       22mAn additional 1mA 22mheader is used to store an ACL for the following
d597 1
a597 1
   1mAIX Tar0m
d600 1
a600 1
     AIX Tar uses a ustar-formatted header with the type 1mA 22mfor storing coded
d603 1
a603 1
     header is either 1mNFS4 22mor 1mAIXC 22mto indicate the type of ACL stored.  The
d606 1
a606 1
   1mMac OS X Tar0m
d613 1
a613 1
     separate file can be extracted and the Mac OS X 1mcopyfile22m() function can
d624 1
a624 1
   1mSummary of tar type codes0m
d629 15
a643 15
     1m0    22mPOSIX standard type code for a regular file.
     1m1    22mPOSIX standard type code for a hard link description.
     1m2    22mPOSIX standard type code for a symbolic link description.
     1m3    22mPOSIX standard type code for a character device node.
     1m4    22mPOSIX standard type code for a block device node.
     1m5    22mPOSIX standard type code for a directory.
     1m6    22mPOSIX standard type code for a FIFO.
     1m7    22mPOSIX reserved.
     1m7    22mGNU tar used for pre-allocated files on some systems.
     1mA    22mSolaris tar ACL description stored prior to a regular file header.
     1mA    22mAIX tar ACL description stored after the file body.
     1mD    22mGNU tar directory dump.
     1mK    22mGNU tar long linkname for the following header.
     1mL    22mGNU tar long pathname for the following header.
     1mM    22mGNU tar multivolume marker, indicating the file is a continuation of
d645 6
a650 6
     1mN    22mGNU tar long filename support.  Deprecated.
     1mS    22mGNU tar sparse regular file.
     1mV    22mGNU tar tape/volume header name.
     1mX    22mSolaris tar general-purpose extension header.
     1mg    22mPOSIX pax interchange format global extensions.
     1mx    22mPOSIX pax interchange format per-file extensions.
d652 1
a652 1
1mSEE ALSO0m
d655 2
a656 2
1mSTANDARDS0m
     The 1mtar 22mutility is no longer a part of POSIX or the Single Unix Standard.
d662 6
a667 6
1mHISTORY0m
     A 1mtar 22mcommand appeared in Seventh Edition Unix, which was released in
     January, 1979.  It replaced the 1mtp 22mprogram from Fourth Edition Unix which
     in turn replaced the 1mtap 22mprogram from First Edition Unix.  John Gilmore's
     1mpdtar 22mpublic-domain implementation (circa 1987) was highly influential
     and formed the basis of 1mGNU tar 22m(circa 1988).  Joerg Shilling's 1mstar0m
d671 1
a671 1
     This documentation was written as part of the 1mlibarchive 22mand 1mbsdtar0m
@


1.3
log
@Update for libarchive 3.2.1.
@
text
@d3 2
a4 2
NAME
     tar — format of tape archive files
d6 2
a7 2
DESCRIPTION
     The tar archive format collects any number of files, directories, and
d13 2
a14 2
   General Format
     A tar archive consists of a series of 512-byte records.  Each file system
d28 1
a28 1
     lows the convention established by John Gilmore in documenting pdtar.)
d30 1
a30 1
   Old-Style Archive Format
d37 1
a37 1
     The header record for an old-style tar archive consists of the following:
d53 1
a53 1
     name    Pathname, stored as a null-terminated string.  Early tar imple‐
d59 1
a59 1
     mode    File mode, stored as an octal number in ASCII.
d61 1
a61 1
     uid, gid
d64 1
a64 1
     size    Size of file, as octal number in ASCII.  For regular files only,
d70 1
a70 1
     mtime   Modification time of file, as an octal number in ASCII.  This
d75 1
a75 1
     checksum
d86 1
a86 1
     linkflag, linkname
d89 2
a90 2
	     is encountered.  The next time it is encountered, the linkflag is
	     set to an ASCII ‘1’ and the linkname field holds the first name
d92 1
a92 1
	     null value in the linkflag field.)
d105 1
a105 1
   Pre-POSIX Archives
d107 1
a107 1
     for John Gilmore's pdtar program and many system implementations from the
d110 1
a110 1
     ·	     The magic value consists of the five characters “ustar” followed
d113 1
a113 1
     ·	     The numeric fields are generally filled with leading spaces (not
d115 1
a115 1
     ·	     The prefix field is often not used, limiting pathnames to the 100
d118 1
a118 1
   POSIX ustar Archives
d145 2
a146 2
     typeflag
	     Type of entry.  POSIX extended the earlier linkflag field with
d164 1
a164 1
	     It is worth noting that the size field, in particular, has dif‐
d172 1
a172 1
     magic   Contains the magic value “ustar” followed by a NUL byte to indi‐
d176 1
a176 1
     version
d180 1
a180 1
     uname, gname
d185 1
a185 1
     devmajor, devminor
d189 1
a189 1
     name, prefix
d191 1
a191 1
	     the standard format, it can be split at any / character with the
d193 1
a193 1
	     is not empty, the reader will prepend the prefix value and a /
d195 1
a195 1
	     The standard does not require a trailing / character on directory
d202 2
a203 2
     vious implementations.  The magic, uname, and gname fields must have a
     trailing NUL.  The pathname, linkname, and prefix fields must have a
d205 1
a205 1
     possible to store a 256-character pathname if it happens to have a / as
d214 1
a214 1
   Numeric Extensions
d224 1
a224 1
     Another extension, utilized by GNU tar, star, and other newer tar imple‐
d240 1
a240 1
   Pax Interchange Format
d268 1
a268 1
     atime, ctime, mtime
d273 1
a273 1
     hdrcharset
d288 1
a288 1
     uname, uid, gname, gid
d294 1
a294 1
     linkpath
d298 1
a298 1
     path    The full pathname of the entry.  Note that this is encoded in
d301 1
a301 1
     realtime.*, security.*
d305 1
a305 1
     size    The size of the file.  Note that there is no length limit on this
d309 2
a310 2
     SCHILY.*
	     Vendor-specific attributes used by Joerg Schilling's star imple‐
d313 8
a320 8
     SCHILY.acl.access, SCHILY.acl.default
	     Stores the access and default ACLs as textual strings in a format
	     that is an extension of the format specified by POSIX.1e draft
	     17.  In particular, each user or group access specification can
	     include a fourth colon-separated field with the numeric UID or
	     GID.  This allows ACLs to be restored on systems that may not
	     have complete user or group information available (such as when
	     NIS/YP or LDAP services are temporarily unavailable).
d322 1
a322 1
     SCHILY.devminor, SCHILY.devmajor
d325 1
a325 1
     SCHILY.fflags
d328 1
a328 1
     SCHILY.realsize
d331 1
a331 1
     SCHILY.dev, SCHILY.ino, SCHILY.nlinks
d334 2
a335 2
	     Joerg Schilling's SCHILY.* extensions can store all of the data
	     from struct stat.
d337 2
a338 2
     LIBARCHIVE.*
	     Vendor-specific attributes used by the libarchive library and
d341 1
a341 1
     LIBARCHIVE.creationtime
d346 1
a346 1
     LIBARCHIVE.xattr.namespace.key
d348 1
a348 1
	     of this form.  The key value is URL-encoded: All non-ASCII char‐
d354 1
a354 1
     VENDOR.*
d368 2
a369 2
     In addition to the x entry described above, the pax interchange format
     also supports a g entry.  The g entry is identical in format, but speci‐
d371 1
a371 1
     entries.  The g entry is not widely used.
d373 1
a373 1
     Besides the new x and g entries, the pax interchange format has a few
d381 1
a381 1
   GNU Tar Archives
d387 1
a387 1
     ify following entries (similar in principle to the x entry described
d389 1
a389 1
     purpose x entry).	As a result, GNU tar archives are not POSIX compati‐
d423 1
a423 1
     typeflag
d464 2
a465 2
		     the first entry is a volume label).  The size field spec‐
		     ifies the size of this entry.  The offset field at bytes
d467 2
a468 2
		     begins.  The realsize field specifies the total size of
		     the file (which must equal size plus offset).  When
d491 1
a491 1
	     V	     The name field should be interpreted as a tape/volume
d495 1
a495 1
     magic   The magic field holds the five characters “ustar” followed by a
d498 1
a498 1
     version
d503 1
a503 1
     atime, ctime
d505 1
a505 1
	     of file information, stored in octal as with mtime.
d507 1
a507 1
     longnames
d510 1
a510 1
     Sparse offset / numbytes
d518 1
a518 1
     isextended
d533 1
a533 1
     realsize
d535 1
a535 1
	     larger range than the POSIX file size.  In particular, with M
d538 1
a538 1
	     entry; the realsize field will indicate the total size of the
d541 1
a541 1
   GNU tar pax archives
d543 2
a544 2
     format archives when you specify the --posix flag.  This format follows
     the pax interchange format closely, using some SCHILY tags and introduc‐
d549 3
a551 3
     GNU.sparse.numblocks, GNU.sparse.offset, GNU.sparse.numbytes,
	     GNU.sparse.size
	     The “0.0” format used an initial GNU.sparse.numblocks attribute
d553 2
a554 2
	     GNU.sparse.offset and GNU.sparse.numbytes to indicate the offset
	     and size of each block, and a single GNU.sparse.size to indicate
d562 1
a562 1
     GNU.sparse.map
d570 1
a570 1
     GNU.sparse.major, GNU.sparse.minor, GNU.sparse.name, GNU.sparse.realsize
d574 2
a575 2
	     GNU.sparse.major and GNU.sparse.minor fields) and the full size
	     of the file.  The GNU.sparse.name holds the true name of the
d580 1
a580 1
   Solaris Tar
d586 3
a588 3
     ·	     Extended attributes are stored in an entry whose type is X, not
	     x, as used by pax interchange format.  The detailed format of
	     this entry appears to be the same as detailed above for the x
d590 1
a590 1
     ·	     An additional A header is used to store an ACL for the following
d597 1
a597 1
   AIX Tar
d600 1
a600 1
     AIX Tar uses a ustar-formatted header with the type A for storing coded
d603 1
a603 1
     header is either NFS4 or AIXC to indicate the type of ACL stored.	The
d606 1
a606 1
   Mac OS X Tar
d613 1
a613 1
     separate file can be extracted and the Mac OS X copyfile() function can
d624 1
a624 1
   Summary of tar type codes
d629 15
a643 15
     0	  POSIX standard type code for a regular file.
     1	  POSIX standard type code for a hard link description.
     2	  POSIX standard type code for a symbolic link description.
     3	  POSIX standard type code for a character device node.
     4	  POSIX standard type code for a block device node.
     5	  POSIX standard type code for a directory.
     6	  POSIX standard type code for a FIFO.
     7	  POSIX reserved.
     7	  GNU tar used for pre-allocated files on some systems.
     A	  Solaris tar ACL description stored prior to a regular file header.
     A	  AIX tar ACL description stored after the file body.
     D	  GNU tar directory dump.
     K	  GNU tar long linkname for the following header.
     L	  GNU tar long pathname for the following header.
     M	  GNU tar multivolume marker, indicating the file is a continuation of
d645 6
a650 6
     N	  GNU tar long filename support.  Deprecated.
     S	  GNU tar sparse regular file.
     V	  GNU tar tape/volume header name.
     X	  Solaris tar general-purpose extension header.
     g	  POSIX pax interchange format global extensions.
     x	  POSIX pax interchange format per-file extensions.
d652 1
a652 1
SEE ALSO
d655 2
a656 2
STANDARDS
     The tar utility is no longer a part of POSIX or the Single Unix Standard.
d662 6
a667 6
HISTORY
     A tar command appeared in Seventh Edition Unix, which was released in
     January, 1979.  It replaced the tp program from Fourth Edition Unix which
     in turn replaced the tap program from First Edition Unix.	John Gilmore's
     pdtar public-domain implementation (circa 1987) was highly influential
     and formed the basis of GNU tar (circa 1988).  Joerg Shilling's star
d671 1
a671 1
     This documentation was written as part of the libarchive and bsdtar
d674 1
a674 1
BSD			       December 23, 2011			   BSD
@


1.2
log
@Changes 3.1.2:
This is a maintenance update to fix issues with the new RAR seeking
feature. This new release also contains fixes for build failures when
building libarchive using Visual Studio 2012 and MinGW.
@
text
@d668 1
a668 1
     archiver is another open-source (GPL) archiver (originally developed
d672 1
a672 1
     project by Tim Kientzle ⟨kientzle@@FreeBSD.org⟩.
@


1.1
log
@Initial revision
@
text
@d1 1
a1 1
TAR(5)			  FreeBSD File Formats Manual			TAR(5)
d4 1
a4 1
     tar -- format of tape archive files
d22 7
a28 6
     records with each I/O operation.  These ``blocks'' are always a multiple
     of the record size.  The most common block size--and the maximum sup-
     ported by historic implementations--is 10240 bytes or 20 records.	(Note:
     the terms ``block'' and ``record'' here are not entirely standard; this
     document follows the convention established by John Gilmore in document-
     ing pdtar.)
d34 2
a35 2
     Version 7 AT&T UNIX, which is one of the earliest widely-used versions of
     the tar program.
d53 1
a53 1
     name    Pathname, stored as a null-terminated string.  Early tar imple-
d56 1
a56 1
	     character to indicate a directory name, allowing directory per-
d81 1
a81 1
	     signed arithmetic for the checksum field, which can cause inter-
d90 1
a90 1
	     set to an ASCII `1' and the linkname field holds the first name
d100 2
a101 2
     numeric fields with leading spaces.  This seems to have been common prac-
     tice until the IEEE Std 1003.1-1988 (``POSIX.1'') standard was released.
d106 1
a106 1
     An early draft of IEEE Std 1003.1-1988 (``POSIX.1'') served as the basis
d110 4
a113 3
     o	     The magic value is ``ustar '' (note the following space).	The
	     version field contains a space character followed by a null.
     o	     The numeric fields are generally filled with leading spaces (not
d115 1
a115 1
     o	     The prefix field is often not used, limiting pathnames to the 100
d119 4
a122 4
     IEEE Std 1003.1-1988 (``POSIX.1'') defined a standard tar file format to
     be read and written by compliant implementations of tar(1).  This format
     is often called the ``ustar'' format, after the magic value used in the
     header.  (The name is an acronym for ``Unix Standard TAR''.)  It extends
d148 1
a148 1
	     ``0''   Regular file.  NULL should be treated as a synonym, for
d150 8
a157 8
	     ``1''   Hard link.
	     ``2''   Symbolic link.
	     ``3''   Character device node.
	     ``4''   Block device node.
	     ``5''   Directory.
	     ``6''   FIFO node.
	     ``7''   Reserved.
	     Other   A POSIX-compliant implementation must treat any unrecog-
d159 1
a159 1
		     writers should ensure that all entries have a valid file-
d164 1
a164 1
	     It is worth noting that the size field, in particular, has dif-
d172 2
a173 2
     magic   Contains the magic value ``ustar'' followed by a NULL byte to
	     indicate that this is a POSIX standard archive.  Full compliance
d177 1
a177 1
	     Version.  This should be ``00'' (two copies of the ASCII digit
d189 9
a197 6
     prefix  First part of pathname.  If the pathname is too long to fit in
	     the 100 bytes provided by the standard format, it can be split at
	     any / character with the first portion going here.  If the prefix
	     field is not empty, the reader will prepend the prefix value and
	     a / character to the regular name field to obtain the full path-
	     name.
d199 1
a199 1
     Note that all unused bytes must be set to NULL.
d201 1
a201 1
     Field termination is specified slightly differently by POSIX than by pre-
d203 2
a204 2
     trailing NULL.  The pathname, linkname, and prefix fields must have a
     trailing NULL unless they fill the entire field.  (In particular, it is
d207 1
a207 1
     the front, and allows them to be terminated with either space or NULL
d210 1
a210 1
     Currently, most tar implementations comply with the ustar format, occa-
d214 26
d242 3
a244 3
     archive.  IEEE Std 1003.1-2001 (``POSIX.1'') defined a ``pax interchange
     format'' that uses two new types of entries to hold text-formatted meta-
     data that applies to following entries.  Note that a pax interchange for-
d246 4
a249 4
     in ustar-compatible archive entries that use the ``x'' or ``g'' typeflag.
     In particular, older implementations that do not fully support these
     extensions will extract the metadata into regular files, where the meta-
     data can be examined as necessary.
d251 1
a251 1
     An entry in a pax interchange format archive consists of one or two stan-
d254 1
a254 1
     This optional first entry has an "x" typeflag and a size field that indi-
d265 1
a265 1
     that, unlike the historic header, numeric values are stored using deci-
d273 15
d302 1
a302 1
	     These keys are reserved and may be used for future standardiza-
d310 1
a310 1
	     Vendor-specific attributes used by Joerg Schilling's star imple-
d325 6
d337 9
d348 5
a352 5
	     of this form.  The key value is URL-encoded: All non-ASCII char-
	     acters and the two special characters ``='' and ``%'' are encoded
	     as ``%'' followed by two uppercase hexadecimal digits.  The value
	     of this key is the extended attribute value encoded in base 64.
	     XXX Detail the base-64 format here XXX
d362 1
a362 1
     for any of these fields.  In particular, numeric fields can be arbitrar-
d369 1
a369 1
     also supports a g entry.  The g entry is identical in format, but speci-
d386 1
a386 1
     be continued over multiple records; and it defined new entries that mod-
d389 1
a389 1
     purpose x entry).	As a result, GNU tar archives are not POSIX compati-
d432 1
a432 1
	     D	     This indicates a directory entry.	Unlike the POSIX-stan-
d441 1
a441 1
		     on disk that did not exist in the directory when the ar-
d450 1
a450 1
	     K	     The data for this entry is a long linkname for the fol-
d453 1
a453 1
	     L	     The data for this entry is a long pathname for the fol-
d460 2
a461 2
		     volume, and part stored at the beginning of the next vol-
		     ume.  The "M" typeflag indicates that this entry contin-
d464 1
a464 1
		     the first entry is a volume label).  The size field spec-
d472 1
a472 3
		     equal to realsize.  FreeBSD's version of GNU tar does not
		     handle the corner case of an archive's being continued in
		     the middle of a long name or other extension header.
d479 11
a489 10
		     ``Rename %s to %s\n'' or ``Symlink %s to %s\n''; in
		     either case, both filenames are escaped using K&R C syn-
		     tax.

	     S	     This is a ``sparse'' regular file.  Sparse files are
		     stored as a series of fragments.  The header contains a
		     list of fragment offset/length pairs.  If more than four
		     such entries are required, the header is extended as nec-
		     essary with ``extra'' header extensions (an older format
		     that is no longer used), or ``sparse'' extensions.
d495 1
a495 1
     magic   The magic field holds the five characters ``ustar'' followed by a
d501 1
a501 1
	     ``0''.
d519 3
a521 3
	     If this is set to non-zero, the header will be followed by addi-
	     tional ``sparse header'' records.	Each such record contains
	     information about as many as 21 additional sparse blocks as shown
d541 39
d583 4
a586 4
     Solaris tar (beginning with SunOS XXX 5.7 ?? XXX) supports an
     ``extended'' format that is fundamentally similar to pax interchange for-
     mat, with the following differences:
     o	     Extended attributes are stored in an entry whose type is X, not
d590 1
a590 1
     o	     An additional A entry is used to store an ACL for the following
d592 59
a650 20
	     octal number (whose value is 01000000 plus the number of ACL
	     entries) followed by a zero byte, followed by the textual ACL
	     description.

   Other Extensions
     One common extension, utilized by GNU tar, star, and other newer tar
     implementations, permits binary numbers in the standard numeric fields.
     This is flagged by setting the high bit of the first character.  This
     permits 95-bit values for the length and time fields and 63-bit values
     for the uid, gid, and device numbers.  GNU tar supports this extension
     for the length, mtime, ctime, and atime fields.  Joerg Schilling's star
     program supports this extension for all numeric fields.  Note that this
     extension is largely obsoleted by the extended attribute record provided
     by the pax interchange format.

     Another early GNU extension allowed base-64 values rather than octal.
     This extension was short-lived and such archives are almost never seen.
     However, there is still code in GNU tar to support them; this code is
     responsible for a very cryptic warning message that is sometimes seen
     when GNU tar encounters a damaged archive.
d657 4
a660 5
     It last appeared in Version 2 of the Single UNIX Specification
     (``SUSv2'').  It has been supplanted in subsequent standards by pax(1).
     The ustar format is currently part of the specification for the pax(1)
     utility.  The pax interchange file format is new with IEEE Std
     1003.1-2001 (``POSIX.1'').
d667 6
a672 3
     and formed the basis of GNU tar.  Joerg Shilling's star archiver is
     another open-source (GPL) archiver (originally developed circa 1985)
     which features complete support for pax interchange format.
d674 1
a674 1
FreeBSD 6.0			 May 20, 2004			   FreeBSD 6.0
@


1.1.1.1
log
@Import libarchive-2.4.0
@
text
@@


1.1.1.2
log
@Import libarchive 2.8.0:
- Infrastructure:
  - Allow command line tools as fallback for missing compression
    libraries. If compiled without gzip for example, gunzip will
    be used automatically.
  - Improved support for a number of platforms like high-resolution
    timestamps and Extended Attributes on various Unix systems
  - New convience interface for creating archives based on disk content,
    complement of the archive_write_disk interface.
- Frontends:
  - bsdcpio ready for public consumption
  - hand-written date parser replaces the yacc code
- Filter system:
  - Simplified read filter chains
  - Option support for filters
  - LZMA, XZ, uudecode handled
- Format support:
  - Write support for mtree files based on file system or archive
    content
  - Basic read support for Joliet
  - Write support for zip files
  - Write support for shar archives, both text-only and binary-safe
@
text
@d1 1
a1 1
tar(5)			  FreeBSD File Formats Manual			tar(5)
d23 5
a27 7
     of the record size.  The maximum block size supported by early implemen-
     tations was 10240 bytes or 20 records.  This is still the default for
     most implementations although block sizes of 1MiB (2048 records) or
     larger are commonly used with modern high-speed tape drives.  (Note: the
     terms ``block'' and ``record'' here are not entirely standard; this docu-
     ment follows the convention established by John Gilmore in documenting
     pdtar.)
d33 2
a34 2
     Version 7 AT&T UNIX, which seems to be the earliest widely-used version
     of the tar program.
d146 1
a146 1
	     ``0''   Regular file.  NUL should be treated as a synonym, for
d170 1
a170 1
     magic   Contains the magic value ``ustar'' followed by a NUL byte to
d187 6
a192 9
     name, prefix
	     If the pathname is too long to fit in the 100 bytes provided by
	     the standard format, it can be split at any / character with the
	     first portion going into the prefix field.  If the prefix field
	     is not empty, the reader will prepend the prefix value and a /
	     character to the regular name field to obtain the full pathname.
	     The standard does not require a trailing / character on directory
	     names, though most implementations still include this for compat-
	     ibility reasons.
d194 1
a194 1
     Note that all unused bytes must be set to NUL.
d198 2
a199 2
     trailing NUL.  The pathname, linkname, and prefix fields must have a
     trailing NUL unless they fill the entire field.  (In particular, it is
d202 1
a202 1
     the front, and requires them to be terminated with either space or NUL
a278 6
     SCHILY.fflags
	     The file flags.

     SCHILY.realsize
	     The full size of the file on disk.  XXX explain? XXX

d411 3
a413 1
		     equal to realsize.
d422 1
a422 2
		     tax.  Due to security concerns, "N" records are now gen-
		     erally ignored when reading archives.
a480 37
   GNU tar pax archives
     GNU tar 1.14 (XXX check this XXX) and later will write pax interchange
     format archives when you specify the --posix flag.  This format uses cus-
     tom keywords to store sparse file information.  There have been three
     iterations of this support, referred to as ``0.0'', ``0.1'', and ``1.0''.

     GNU.sparse.numblocks, GNU.sparse.offset, GNU.sparse.numbytes,
	     GNU.sparse.size
	     The ``0.0'' format used an initial GNU.sparse.numblocks attribute
	     to indicate the number of blocks in the file, a pair of
	     GNU.sparse.offset and GNU.sparse.numbytes to indicate the offset
	     and size of each block, and a single GNU.sparse.size to indicate
	     the full size of the file.  This is not the same as the size in
	     the tar header because the latter value does not include the size
	     of any holes.  This format required that the order of attributes
	     be preserved and relied on readers accepting multiple appearances
	     of the same attribute names, which is not officially permitted by
	     the standards.

     GNU.sparse.map
	     The ``0.1'' format used a single attribute that stored a comma-
	     separated list of decimal numbers.  Each pair of numbers indi-
	     cated the offset and size, respectively, of a block of data.
	     This does not work well if the archive is extracted by an
	     archiver that does not recognize this extension, since many pax
	     implementations simply discard unrecognized attributes.

     GNU.sparse.major, GNU.sparse.minor, GNU.sparse.name, GNU.sparse.realsize
	     The ``1.0'' format stores the sparse block map in one or more
	     512-byte blocks prepended to the file data in the entry body.
	     The pax attributes indicate the existence of this map (via the
	     GNU.sparse.major and GNU.sparse.minor fields) and the full size
	     of the file.  The GNU.sparse.name holds the true name of the
	     file.  To avoid confusion, the name stored in the regular tar
	     header is a modified name so that extraction errors will be
	     apparent to users.

d493 3
a495 16
	     octal number followed by a zero byte, followed by the textual ACL
	     description.  The octal value is the number of ACL entries plus a
	     constant that indicates the ACL type: 01000000 for POSIX.1e ACLs
	     and 03000000 for NFSv4 ACLs.

   AIX Tar
     XXX More details needed XXX

   Mac OS X Tar
     The tar distributed with Apple's Mac OS X stores most regular files as
     two separate entries in the tar archive.  The two entries have the same
     name except that the first one has ``._'' added to the beginning of the
     name.  This first entry stores the ``resource fork'' with additional
     attributes for the file.  The Mac OS X CopyFile() API is used to separate
     a file on disk into separate resource and data streams and to reassemble
     those separate streams when the file is restored to disk.
d498 9
a506 15
     One obvious extension to increase the size of files is to eliminate the
     terminating characters from the various numeric fields.  For example, the
     standard only allows the size field to contain 11 octal digits, reserving
     the twelfth byte for a trailing NUL character.  Allowing 12 octal digits
     allows file sizes up to 64 GB.

     Another extension, utilized by GNU tar, star, and other newer tar imple-
     mentations, permits binary numbers in the standard numeric fields.  This
     is flagged by setting the high bit of the first byte.  This permits
     95-bit values for the length and time fields and 63-bit values for the
     uid, gid, and device numbers.  GNU tar supports this extension for the
     length, mtime, ctime, and atime fields.  Joerg Schilling's star program
     supports this extension for all numeric fields.  Note that this extension
     is largely obsoleted by the extended attribute record provided by the pax
     interchange format.
d509 4
a512 2
     This extension was short-lived and is no longer supported by any imple-
     mentation.
d530 3
a532 6
     and formed the basis of GNU tar (circa 1988).  Joerg Shilling's star
     archiver is another open-source (GPL) archiver (originally developed
     circa 1985) which features complete support for pax interchange format.

     This documentation was written as part of the libarchive and bsdtar
     project by Tim Kientzle <kientzle@@FreeBSD.org>.
d534 1
a534 1
FreeBSD 8.0		       December 27, 2009		   FreeBSD 8.0
@


1.1.1.3
log
@libarchive-2.8.2:
- Fix NULL deference for short self-extracting zip archives
- Don't dereference symlinks on Linux when reading ACLs
- Better detection of SHA2 support for old OpenSSL versions
- Fix parsing of input files for bsdtar -T
- Do not leak setup_xattr into the global namespace
- Fix build when an older libarchive is already installed
- Use O_BINARY opening files in bsdtar
- Include missing archive_crc32.h
- Correctly include iconv.h required by libxml2
@
text
@d1 1
a1 1
tar(5)			  NetBSD File Formats Manual			tar(5)
d66 1
a66 1
	     this indicates the amount of data that follows the header.	 In
d68 1
a68 1
	     when extracting hardlinks.	 Modern writers should always store a
d81 1
a81 1
	     character.	 Note that many early implementations of tar used
d111 1
a111 1
	   The magic value is ``ustar '' (note the following space).  The
d113 1
a113 1
	   The numeric fields are generally filled with leading spaces (not
d115 1
a115 1
	   The prefix field is often not used, limiting pathnames to the 100
d192 1
a192 1
	     first portion going into the prefix field.	 If the prefix field
d243 1
a243 1
	     File access, inode change, and modification times.	 These fields
d288 1
a288 1
	     The full size of the file on disk.	 XXX explain? XXX
d313 1
a313 1
     ily large.	 All text fields are encoded in UTF8.  Compliant writers
d434 1
a434 1
	     S	     This is a ``sparse'' regular file.	 Sparse files are
d479 2
a480 2
			   char	   isextended[1];
			   char	   padding[7];
d493 1
a493 1
     format archives when you specify the --posix flag.	 This format uses cus-
d503 1
a503 1
	     the full size of the file.	 This is not the same as the size in
d512 1
a512 1
	     separated list of decimal numbers.	 Each pair of numbers indi-
d534 1
a534 1
	   Extended attributes are stored in an entry whose type is X, not
d538 1
a538 1
	   An additional A entry is used to store an ACL for the following
d565 1
a565 1
     mentations, permits binary numbers in the standard numeric fields.	 This
d601 1
a601 1
NetBSD 5.0		       December 27, 2009		    NetBSD 5.0
@


1.1.1.4
log
@libarchive-2.8.3: Build fix for Linux
@
text
@d1 1
a1 1
tar(5)			  FreeBSD File Formats Manual			tar(5)
d66 1
a66 1
	     this indicates the amount of data that follows the header.  In
d68 1
a68 1
	     when extracting hardlinks.  Modern writers should always store a
d81 1
a81 1
	     character.  Note that many early implementations of tar used
d111 1
a111 1
     o	     The magic value is ``ustar '' (note the following space).	The
d113 1
a113 1
     o	     The numeric fields are generally filled with leading spaces (not
d115 1
a115 1
     o	     The prefix field is often not used, limiting pathnames to the 100
d192 1
a192 1
	     first portion going into the prefix field.  If the prefix field
d243 1
a243 1
	     File access, inode change, and modification times.  These fields
d288 1
a288 1
	     The full size of the file on disk.  XXX explain? XXX
d313 1
a313 1
     ily large.  All text fields are encoded in UTF8.  Compliant writers
d434 1
a434 1
	     S	     This is a ``sparse'' regular file.  Sparse files are
d479 2
a480 2
			   char    isextended[1];
			   char    padding[7];
d493 1
a493 1
     format archives when you specify the --posix flag.  This format uses cus-
d503 1
a503 1
	     the full size of the file.  This is not the same as the size in
d512 1
a512 1
	     separated list of decimal numbers.  Each pair of numbers indi-
d534 1
a534 1
     o	     Extended attributes are stored in an entry whose type is X, not
d538 1
a538 1
     o	     An additional A entry is used to store an ACL for the following
d565 1
a565 1
     mentations, permits binary numbers in the standard numeric fields.  This
d601 1
a601 1
FreeBSD 9.0		       December 27, 2009		   FreeBSD 9.0
@


1.1.1.5
log
@Import libarchive-2.8.4:
- Improved reliability of hash function detection
- Fix issues on ancient FreeBSD, QNX, ancient NetBSD and Minix
@
text
@d1 1
a1 1
tar(5)			  NetBSD File Formats Manual			tar(5)
d66 1
a66 1
	     this indicates the amount of data that follows the header.	 In
d68 1
a68 1
	     when extracting hardlinks.	 Modern writers should always store a
d81 1
a81 1
	     character.	 Note that many early implementations of tar used
d111 1
a111 1
	   The magic value is ``ustar '' (note the following space).  The
d113 1
a113 1
	   The numeric fields are generally filled with leading spaces (not
d115 1
a115 1
	   The prefix field is often not used, limiting pathnames to the 100
d192 1
a192 1
	     first portion going into the prefix field.	 If the prefix field
d243 1
a243 1
	     File access, inode change, and modification times.	 These fields
d288 1
a288 1
	     The full size of the file on disk.	 XXX explain? XXX
d313 1
a313 1
     ily large.	 All text fields are encoded in UTF8.  Compliant writers
d434 1
a434 1
	     S	     This is a ``sparse'' regular file.	 Sparse files are
d479 2
a480 2
			   char	   isextended[1];
			   char	   padding[7];
d493 1
a493 1
     format archives when you specify the --posix flag.	 This format uses cus-
d503 1
a503 1
	     the full size of the file.	 This is not the same as the size in
d512 1
a512 1
	     separated list of decimal numbers.	 Each pair of numbers indi-
d534 1
a534 1
	   Extended attributes are stored in an entry whose type is X, not
d538 1
a538 1
	   An additional A entry is used to store an ACL for the following
d565 1
a565 1
     mentations, permits binary numbers in the standard numeric fields.	 This
d601 1
a601 1
NetBSD 5.0		       December 27, 2009		    NetBSD 5.0
@


1.1.1.6
log
@Import libarchive-3.2.1:
- security fixes and other bugfixes
- support for multhreading in xz 5.2+
@
text
@d1 1
a1 1
TAR(5)			    BSD File Formats Manual			TAR(5)
d4 1
a4 1
     tar — format of tape archive files
d22 8
a29 7
     records with each I/O operation.  These “blocks” are always a multiple of
     the record size.  The maximum block size supported by early implementa‐
     tions was 10240 bytes or 20 records.  This is still the default for most
     implementations although block sizes of 1MiB (2048 records) or larger are
     commonly used with modern high-speed tape drives.	(Note: the terms
     “block” and “record” here are not entirely standard; this document fol‐
     lows the convention established by John Gilmore in documenting pdtar.)
d54 1
a54 1
     name    Pathname, stored as a null-terminated string.  Early tar imple‐
d57 1
a57 1
	     character to indicate a directory name, allowing directory per‐
d66 1
a66 1
	     this indicates the amount of data that follows the header.  In
d68 1
a68 1
	     when extracting hardlinks.  Modern writers should always store a
d81 2
a82 2
	     character.  Note that many early implementations of tar used
	     signed arithmetic for the checksum field, which can cause inter‐
d91 1
a91 1
	     set to an ASCII ‘1’ and the linkname field holds the first name
d101 2
a102 2
     numeric fields with leading spaces.  This seems to have been common prac‐
     tice until the IEEE Std 1003.1-1988 (“POSIX.1”) standard was released.
d107 1
a107 1
     An early draft of IEEE Std 1003.1-1988 (“POSIX.1”) served as the basis
d111 3
a113 4
     ·	     The magic value consists of the five characters “ustar” followed
	     by a space.  The version field contains a space character fol‐
	     lowed by a null.
     ·	     The numeric fields are generally filled with leading spaces (not
d115 1
a115 1
     ·	     The prefix field is often not used, limiting pathnames to the 100
d119 4
a122 4
     IEEE Std 1003.1-1988 (“POSIX.1”) defined a standard tar file format to be
     read and written by compliant implementations of tar(1).  This format is
     often called the “ustar” format, after the magic value used in the
     header.  (The name is an acronym for “Unix Standard TAR”.)  It extends
d148 1
a148 1
	     “0”     Regular file.  NUL should be treated as a synonym, for
d150 8
a157 8
	     “1”     Hard link.
	     “2”     Symbolic link.
	     “3”     Character device node.
	     “4”     Block device node.
	     “5”     Directory.
	     “6”     FIFO node.
	     “7”     Reserved.
	     Other   A POSIX-compliant implementation must treat any unrecog‐
d159 1
a159 1
		     writers should ensure that all entries have a valid file‐
d164 1
a164 1
	     It is worth noting that the size field, in particular, has dif‐
d172 2
a173 2
     magic   Contains the magic value “ustar” followed by a NUL byte to indi‐
	     cate that this is a POSIX standard archive.  Full compliance
d177 1
a177 1
	     Version.  This should be “00” (two copies of the ASCII digit
d192 1
a192 1
	     first portion going into the prefix field.  If the prefix field
d196 1
a196 1
	     names, though most implementations still include this for compat‐
d201 1
a201 1
     Field termination is specified slightly differently by POSIX than by pre‐
d210 1
a210 1
     Currently, most tar implementations comply with the ustar format, occa‐
a213 26
   Numeric Extensions
     There have been several attempts to extend the range of sizes or times
     supported by modifying how numbers are stored in the header.

     One obvious extension to increase the size of files is to eliminate the
     terminating characters from the various numeric fields.  For example, the
     standard only allows the size field to contain 11 octal digits, reserving
     the twelfth byte for a trailing NUL character.  Allowing 12 octal digits
     allows file sizes up to 64 GB.

     Another extension, utilized by GNU tar, star, and other newer tar imple‐
     mentations, permits binary numbers in the standard numeric fields.  This
     is flagged by setting the high bit of the first byte.  The remainder of
     the field is treated as a signed twos-complement value.  This permits
     95-bit values for the length and time fields and 63-bit values for the
     uid, gid, and device numbers.  In particular, this provides a consistent
     way to handle negative time values.  GNU tar supports this extension for
     the length, mtime, ctime, and atime fields.  Joerg Schilling's star pro‐
     gram and the libarchive library support this extension for all numeric
     fields.  Note that this extension is largely obsoleted by the extended
     attribute record provided by the pax interchange format.

     Another early GNU extension allowed base-64 values rather than octal.
     This extension was short-lived and is no longer supported by any imple‐
     mentation.

d216 3
a218 3
     archive.  IEEE Std 1003.1-2001 (“POSIX.1”) defined a “pax interchange
     format” that uses two new types of entries to hold text-formatted meta‐
     data that applies to following entries.  Note that a pax interchange for‐
d220 4
a223 4
     in ustar-compatible archive entries that use the “x” or “g” typeflag.  In
     particular, older implementations that do not fully support these exten‐
     sions will extract the metadata into regular files, where the metadata
     can be examined as necessary.
d225 1
a225 1
     An entry in a pax interchange format archive consists of one or two stan‐
d228 1
a228 1
     This optional first entry has an "x" typeflag and a size field that indi‐
d239 1
a239 1
     that, unlike the historic header, numeric values are stored using deci‐
d243 1
a243 1
	     File access, inode change, and modification times.  These fields
a246 15
     hdrcharset
	     The character set used by the pax extension values.  By default,
	     all textual values in the pax extended attributes are assumed to
	     be in UTF-8, including pathnames, user names, and group names.
	     In some cases, it is not possible to translate local conventions
	     into UTF-8.  If this key is present and the value is the six-
	     character ASCII string “BINARY”, then all textual values are
	     assumed to be in a platform-dependent multi-byte encoding.  Note
	     that there are only two valid values for this key: “BINARY” or
	     “ISO-IR 10646 2000 UTF-8”.  No other values are permitted by the
	     standard, and the latter value should generally not be used as it
	     is the default when this key is not specified.  In particular,
	     this flag should not be used as a general mechanism to allow
	     filenames to be stored in arbitrary encodings.

d261 1
a261 1
	     These keys are reserved and may be used for future standardiza‐
d269 1
a269 1
	     Vendor-specific attributes used by Joerg Schilling's star imple‐
d288 1
a288 1
	     The full size of the file on disk.  XXX explain? XXX
a295 9
     LIBARCHIVE.*
	     Vendor-specific attributes used by the libarchive library and
	     programs that use it.

     LIBARCHIVE.creationtime
	     The time when the file was created.  (This should not be confused
	     with the POSIX “ctime” attribute, which refers to the time when
	     the file metadata was last changed.)

d298 5
a302 5
	     of this form.  The key value is URL-encoded: All non-ASCII char‐
	     acters and the two special characters “=” and “%” are encoded as
	     “%” followed by two uppercase hexadecimal digits.	The value of
	     this key is the extended attribute value encoded in base 64.  XXX
	     Detail the base-64 format here XXX
d312 2
a313 2
     for any of these fields.  In particular, numeric fields can be arbitrar‐
     ily large.  All text fields are encoded in UTF8.  Compliant writers
d319 1
a319 1
     also supports a g entry.  The g entry is identical in format, but speci‐
d336 1
a336 1
     be continued over multiple records; and it defined new entries that mod‐
d339 1
a339 1
     purpose x entry).	As a result, GNU tar archives are not POSIX compati‐
d382 1
a382 1
	     D	     This indicates a directory entry.	Unlike the POSIX-stan‐
d391 1
a391 1
		     on disk that did not exist in the directory when the ar‐
d400 1
a400 1
	     K	     The data for this entry is a long linkname for the fol‐
d403 1
a403 1
	     L	     The data for this entry is a long pathname for the fol‐
d410 2
a411 2
		     volume, and part stored at the beginning of the next vol‐
		     ume.  The "M" typeflag indicates that this entry contin‐
d414 1
a414 1
		     the first entry is a volume label).  The size field spec‐
d429 11
a439 11
		     “Rename %s to %s\n” or “Symlink %s to %s\n”; in either
		     case, both filenames are escaped using K&R C syntax.  Due
		     to security concerns, "N" records are now generally
		     ignored when reading archives.

	     S	     This is a “sparse” regular file.  Sparse files are stored
		     as a series of fragments.	The header contains a list of
		     fragment offset/length pairs.  If more than four such
		     entries are required, the header is extended as necessary
		     with “extra” header extensions (an older format that is
		     no longer used), or “sparse” extensions.
d445 1
a445 1
     magic   The magic field holds the five characters “ustar” followed by a
d451 1
a451 1
	     “0”.
d469 3
a471 3
	     If this is set to non-zero, the header will be followed by addi‐
	     tional “sparse header” records.  Each such record contains infor‐
	     mation about as many as 21 additional sparse blocks as shown
d479 2
a480 2
			   char    isextended[1];
			   char    padding[7];
d493 3
a495 5
     format archives when you specify the --posix flag.  This format follows
     the pax interchange format closely, using some SCHILY tags and introduc‐
     ing new keywords to store sparse file information.  There have been three
     iterations of the sparse file support, referred to as “0.0”, “0.1”, and
     “1.0”.
d499 1
a499 1
	     The “0.0” format used an initial GNU.sparse.numblocks attribute
d503 1
a503 1
	     the full size of the file.  This is not the same as the size in
d511 6
a516 6
	     The “0.1” format used a single attribute that stored a comma-sep‐
	     arated list of decimal numbers.  Each pair of numbers indicated
	     the offset and size, respectively, of a block of data.  This does
	     not work well if the archive is extracted by an archiver that
	     does not recognize this extension, since many pax implementations
	     simply discard unrecognized attributes.
d519 1
a519 1
	     The “1.0” format stores the sparse block map in one or more
d531 4
a534 4
     Solaris tar (beginning with SunOS XXX 5.7 ?? XXX) supports an “extended”
     format that is fundamentally similar to pax interchange format, with the
     following differences:
     ·	     Extended attributes are stored in an entry whose type is X, not
d538 1
a538 1
     ·	     An additional A header is used to store an ACL for the following
a547 6
     AIX Tar uses a ustar-formatted header with the type A for storing coded
     ACL information.  Unlike the Solaris format, AIX tar writes this header
     after the regular file body to which it applies.  The pathname in this
     header is either NFS4 or AIXC to indicate the type of ACL stored.	The
     actual ACL is stored in platform-specific binary format.

d550 27
a576 43
     two separate files in the tar archive.  The two files have the same name
     except that the first one has “._” prepended to the last path element.
     This special file stores an AppleDouble-encoded binary blob with addi‐
     tional metadata about the second file, including ACL, extended
     attributes, and resources.  To recreate the original file on disk, each
     separate file can be extracted and the Mac OS X copyfile() function can
     be used to unpack the separate metadata file and apply it to th regular
     file.  Conversely, the same function provides a “pack” option to encode
     the extended metadata from a file into a separate file whose contents can
     then be put into a tar archive.

     Note that the Apple extended attributes interact badly with long file‐
     names.  Since each file is stored with the full name, a separate set of
     extensions needs to be included in the archive for each one, doubling the
     overhead required for files with long names.

   Summary of tar type codes
     The following list is a condensed summary of the type codes used in tar
     header records generated by different tar implementations.  More details
     about specific implementations can be found above:
     NUL  Early tar programs stored a zero byte for regular files.
     0	  POSIX standard type code for a regular file.
     1	  POSIX standard type code for a hard link description.
     2	  POSIX standard type code for a symbolic link description.
     3	  POSIX standard type code for a character device node.
     4	  POSIX standard type code for a block device node.
     5	  POSIX standard type code for a directory.
     6	  POSIX standard type code for a FIFO.
     7	  POSIX reserved.
     7	  GNU tar used for pre-allocated files on some systems.
     A	  Solaris tar ACL description stored prior to a regular file header.
     A	  AIX tar ACL description stored after the file body.
     D	  GNU tar directory dump.
     K	  GNU tar long linkname for the following header.
     L	  GNU tar long pathname for the following header.
     M	  GNU tar multivolume marker, indicating the file is a continuation of
	  a file from the previous volume.
     N	  GNU tar long filename support.  Deprecated.
     S	  GNU tar sparse regular file.
     V	  GNU tar tape/volume header name.
     X	  Solaris tar general-purpose extension header.
     g	  POSIX pax interchange format global extensions.
     x	  POSIX pax interchange format per-file extensions.
d583 5
a587 4
     It last appeared in Version 2 of the Single UNIX Specification (“SUSv2”).
     It has been supplanted in subsequent standards by pax(1).	The ustar for‐
     mat is currently part of the specification for the pax(1) utility.  The
     pax interchange file format is new with IEEE Std 1003.1-2001 (“POSIX.1”).
d595 1
a595 1
     archiver is another open-source (CDDL) archiver (originally developed
d601 1
a601 1
BSD			       December 23, 2011			   BSD
@


1.1.1.7
log
@Import libarchive-3.3.1.
@
text
@d3 2
a4 2
1mNAME0m
     1mtar 22m— format of tape archive files
d6 2
a7 2
1mDESCRIPTION0m
     The 1mtar 22marchive format collects any number of files, directories, and
d13 2
a14 2
   1mGeneral Format0m
     A 1mtar 22marchive consists of a series of 512-byte records.  Each file system
d28 1
a28 1
     lows the convention established by John Gilmore in documenting 1mpdtar22m.)
d30 1
a30 1
   1mOld-Style Archive Format0m
d37 1
a37 1
     The header record for an old-style 1mtar 22marchive consists of the following:
d53 1
a53 1
     4mname24m	  Pathname, stored as a null-terminated string.  Early tar imple‐
d59 1
a59 1
     4mmode24m	  File mode, stored as an octal number in ASCII.
d61 1
a61 1
     4muid24m, 4mgid0m
d64 1
a64 1
     4msize24m	  Size of file, as octal number in ASCII.  For regular files only,
d70 1
a70 1
     4mmtime24m   Modification time of file, as an octal number in ASCII.  This
d75 1
a75 1
     4mchecksum0m
d86 1
a86 1
     4mlinkflag24m, 4mlinkname0m
d89 2
a90 2
	     is encountered.  The next time it is encountered, the 4mlinkflag24m is
	     set to an ASCII ‘1’ and the 4mlinkname24m field holds the first name
d92 1
a92 1
	     null value in the 4mlinkflag24m field.)
d105 1
a105 1
   1mPre-POSIX Archives0m
d107 1
a107 1
     for John Gilmore's 1mpdtar 22mprogram and many system implementations from the
d110 1
a110 1
     1m·       22mThe magic value consists of the five characters “ustar” followed
d113 1
a113 1
     1m·       22mThe numeric fields are generally filled with leading spaces (not
d115 1
a115 1
     1m·       22mThe prefix field is often not used, limiting pathnames to the 100
d118 1
a118 1
   1mPOSIX ustar Archives0m
d145 2
a146 2
     4mtypeflag0m
	     Type of entry.  POSIX extended the earlier 4mlinkflag24m field with
d164 1
a164 1
	     It is worth noting that the 4msize24m field, in particular, has dif‐
d172 1
a172 1
     4mmagic24m   Contains the magic value “ustar” followed by a NUL byte to indi‐
d176 1
a176 1
     4mversion0m
d180 1
a180 1
     4muname24m, 4mgname0m
d185 1
a185 1
     4mdevmajor24m, 4mdevminor0m
d189 1
a189 1
     4mname24m, 4mprefix0m
d191 1
a191 1
	     the standard format, it can be split at any 4m/24m character with the
d193 1
a193 1
	     is not empty, the reader will prepend the prefix value and a 4m/0m
d195 1
a195 1
	     The standard does not require a trailing 4m/24m character on directory
d202 2
a203 2
     vious implementations.  The 4mmagic24m, 4muname24m, and 4mgname24m fields must have a
     trailing NUL.  The 4mpathname24m, 4mlinkname24m, and 4mprefix24m fields must have a
d205 1
a205 1
     possible to store a 256-character pathname if it happens to have a 4m/24m as
d214 1
a214 1
   1mNumeric Extensions0m
d224 1
a224 1
     Another extension, utilized by GNU tar, star, and other newer 1mtar 22mimple‐
d240 1
a240 1
   1mPax Interchange Format0m
d268 1
a268 1
     1matime22m, 1mctime22m, 1mmtime0m
d273 1
a273 1
     1mhdrcharset0m
d288 1
a288 1
     1muname22m, 1muid22m, 1mgname22m, 1mgid0m
d294 1
a294 1
     1mlinkpath0m
d298 1
a298 1
     1mpath    22mThe full pathname of the entry.  Note that this is encoded in
d301 1
a301 1
     1mrealtime.*22m, 1msecurity.*0m
d305 1
a305 1
     1msize    22mThe size of the file.  Note that there is no length limit on this
d309 2
a310 2
     1mSCHILY.*0m
	     Vendor-specific attributes used by Joerg Schilling's 1mstar 22mimple‐
d313 8
a320 8
     1mSCHILY.acl.access22m, 1mSCHILY.acl.default, SCHILY.acl.ace0m
	     Stores the access, default and NFSv4 ACLs as textual strings in a
	     format that is an extension of the format specified by POSIX.1e
	     draft 17.	In particular, each user or group access specification
	     can include an additional colon-separated field with the numeric
	     UID or GID.  This allows ACLs to be restored on systems that may
	     not have complete user or group information available (such as
	     when NIS/YP or LDAP services are temporarily unavailable).
d322 1
a322 1
     1mSCHILY.devminor22m, 1mSCHILY.devmajor0m
d325 1
a325 1
     1mSCHILY.fflags0m
d328 1
a328 1
     1mSCHILY.realsize0m
d331 1
a331 1
     1mSCHILY.dev, SCHILY.ino22m, 1mSCHILY.nlinks0m
d334 2
a335 2
	     Joerg Schilling's 1mSCHILY.* 22mextensions can store all of the data
	     from 4mstruct24m 4mstat24m.
d337 2
a338 2
     1mLIBARCHIVE.*0m
	     Vendor-specific attributes used by the 1mlibarchive 22mlibrary and
d341 1
a341 1
     1mLIBARCHIVE.creationtime0m
d346 1
a346 1
     1mLIBARCHIVE.xattr.4m22mnamespace24m.4mkey0m
d348 1
a348 1
	     of this form.  The 4mkey24m value is URL-encoded: All non-ASCII char‐
d354 1
a354 1
     1mVENDOR.*0m
d368 2
a369 2
     In addition to the 1mx 22mentry described above, the pax interchange format
     also supports a 1mg 22mentry.  The 1mg 22mentry is identical in format, but speci‐
d371 1
a371 1
     entries.  The 1mg 22mentry is not widely used.
d373 1
a373 1
     Besides the new 1mx 22mand 1mg 22mentries, the pax interchange format has a few
d381 1
a381 1
   1mGNU Tar Archives0m
d387 1
a387 1
     ify following entries (similar in principle to the 1mx 22mentry described
d389 1
a389 1
     purpose 1mx 22mentry).  As a result, GNU tar archives are not POSIX compati‐
d423 1
a423 1
     4mtypeflag0m
d464 2
a465 2
		     the first entry is a volume label).  The 4msize24m field spec‐
		     ifies the size of this entry.  The 4moffset24m field at bytes
d467 2
a468 2
		     begins.  The 4mrealsize24m field specifies the total size of
		     the file (which must equal 4msize24m plus 4moffset24m).  When
d491 1
a491 1
	     V	     The 4mname24m field should be interpreted as a tape/volume
d495 1
a495 1
     4mmagic24m   The magic field holds the five characters “ustar” followed by a
d498 1
a498 1
     4mversion0m
d503 1
a503 1
     4matime24m, 4mctime0m
d505 1
a505 1
	     of file information, stored in octal as with 4mmtime24m.
d507 1
a507 1
     4mlongnames0m
d510 1
a510 1
     Sparse 4moffset24m 4m/24m 4mnumbytes0m
d518 1
a518 1
     4misextended0m
d533 1
a533 1
     4mrealsize0m
d535 1
a535 1
	     larger range than the POSIX file size.  In particular, with 1mM0m
d538 1
a538 1
	     entry; the 4mrealsize24m field will indicate the total size of the
d541 1
a541 1
   1mGNU tar pax archives0m
d543 2
a544 2
     format archives when you specify the 1m--posix 22mflag.  This format follows
     the pax interchange format closely, using some 1mSCHILY 22mtags and introduc‐
d549 3
a551 3
     1mGNU.sparse.numblocks22m, 1mGNU.sparse.offset22m, 1mGNU.sparse.numbytes22m,
	     1mGNU.sparse.size0m
	     The “0.0” format used an initial 1mGNU.sparse.numblocks 22mattribute
d553 2
a554 2
	     1mGNU.sparse.offset 22mand 1mGNU.sparse.numbytes 22mto indicate the offset
	     and size of each block, and a single 1mGNU.sparse.size 22mto indicate
d562 1
a562 1
     1mGNU.sparse.map0m
d570 1
a570 1
     1mGNU.sparse.major22m, 1mGNU.sparse.minor22m, 1mGNU.sparse.name22m, 1mGNU.sparse.realsize0m
d574 2
a575 2
	     1mGNU.sparse.major 22mand 1mGNU.sparse.minor 22mfields) and the full size
	     of the file.  The 1mGNU.sparse.name 22mholds the true name of the
d580 1
a580 1
   1mSolaris Tar0m
d586 3
a588 3
     1m·       22mExtended attributes are stored in an entry whose type is 1mX22m, not
	     1mx22m, as used by pax interchange format.  The detailed format of
	     this entry appears to be the same as detailed above for the 1mx0m
d590 1
a590 1
     1m·       22mAn additional 1mA 22mheader is used to store an ACL for the following
d597 1
a597 1
   1mAIX Tar0m
d600 1
a600 1
     AIX Tar uses a ustar-formatted header with the type 1mA 22mfor storing coded
d603 1
a603 1
     header is either 1mNFS4 22mor 1mAIXC 22mto indicate the type of ACL stored.  The
d606 1
a606 1
   1mMac OS X Tar0m
d613 1
a613 1
     separate file can be extracted and the Mac OS X 1mcopyfile22m() function can
d624 1
a624 1
   1mSummary of tar type codes0m
d629 15
a643 15
     1m0    22mPOSIX standard type code for a regular file.
     1m1    22mPOSIX standard type code for a hard link description.
     1m2    22mPOSIX standard type code for a symbolic link description.
     1m3    22mPOSIX standard type code for a character device node.
     1m4    22mPOSIX standard type code for a block device node.
     1m5    22mPOSIX standard type code for a directory.
     1m6    22mPOSIX standard type code for a FIFO.
     1m7    22mPOSIX reserved.
     1m7    22mGNU tar used for pre-allocated files on some systems.
     1mA    22mSolaris tar ACL description stored prior to a regular file header.
     1mA    22mAIX tar ACL description stored after the file body.
     1mD    22mGNU tar directory dump.
     1mK    22mGNU tar long linkname for the following header.
     1mL    22mGNU tar long pathname for the following header.
     1mM    22mGNU tar multivolume marker, indicating the file is a continuation of
d645 6
a650 6
     1mN    22mGNU tar long filename support.  Deprecated.
     1mS    22mGNU tar sparse regular file.
     1mV    22mGNU tar tape/volume header name.
     1mX    22mSolaris tar general-purpose extension header.
     1mg    22mPOSIX pax interchange format global extensions.
     1mx    22mPOSIX pax interchange format per-file extensions.
d652 1
a652 1
1mSEE ALSO0m
d655 2
a656 2
1mSTANDARDS0m
     The 1mtar 22mutility is no longer a part of POSIX or the Single Unix Standard.
d662 6
a667 6
1mHISTORY0m
     A 1mtar 22mcommand appeared in Seventh Edition Unix, which was released in
     January, 1979.  It replaced the 1mtp 22mprogram from Fourth Edition Unix which
     in turn replaced the 1mtap 22mprogram from First Edition Unix.  John Gilmore's
     1mpdtar 22mpublic-domain implementation (circa 1987) was highly influential
     and formed the basis of 1mGNU tar 22m(circa 1988).  Joerg Shilling's 1mstar0m
d671 1
a671 1
     This documentation was written as part of the 1mlibarchive 22mand 1mbsdtar0m
d674 1
a674 1
BSD			       December 27, 2016			   BSD
@


1.1.1.8
log
@Import libarchive-3.3.2 + 9de5f3 + f9dacbf:
- Support NFS4 ACLs on Linux
- Bugfixes
@
text
@d3 2
a4 2
NAME
     tar — format of tape archive files
d6 2
a7 2
DESCRIPTION
     The tar archive format collects any number of files, directories, and
d13 2
a14 2
   General Format
     A tar archive consists of a series of 512-byte records.  Each file system
d28 1
a28 1
     lows the convention established by John Gilmore in documenting pdtar.)
d30 1
a30 1
   Old-Style Archive Format
d37 1
a37 1
     The header record for an old-style tar archive consists of the following:
d53 1
a53 1
     name    Pathname, stored as a null-terminated string.  Early tar imple‐
d59 1
a59 1
     mode    File mode, stored as an octal number in ASCII.
d61 1
a61 1
     uid, gid
d64 1
a64 1
     size    Size of file, as octal number in ASCII.  For regular files only,
d70 1
a70 1
     mtime   Modification time of file, as an octal number in ASCII.  This
d75 1
a75 1
     checksum
d86 1
a86 1
     linkflag, linkname
d89 2
a90 2
	     is encountered.  The next time it is encountered, the linkflag is
	     set to an ASCII ‘1’ and the linkname field holds the first name
d92 1
a92 1
	     null value in the linkflag field.)
d105 1
a105 1
   Pre-POSIX Archives
d107 1
a107 1
     for John Gilmore's pdtar program and many system implementations from the
d110 1
a110 1
     ·	     The magic value consists of the five characters “ustar” followed
d113 1
a113 1
     ·	     The numeric fields are generally filled with leading spaces (not
d115 1
a115 1
     ·	     The prefix field is often not used, limiting pathnames to the 100
d118 1
a118 1
   POSIX ustar Archives
d145 2
a146 2
     typeflag
	     Type of entry.  POSIX extended the earlier linkflag field with
d164 1
a164 1
	     It is worth noting that the size field, in particular, has dif‐
d172 1
a172 1
     magic   Contains the magic value “ustar” followed by a NUL byte to indi‐
d176 1
a176 1
     version
d180 1
a180 1
     uname, gname
d185 1
a185 1
     devmajor, devminor
d189 1
a189 1
     name, prefix
d191 1
a191 1
	     the standard format, it can be split at any / character with the
d193 1
a193 1
	     is not empty, the reader will prepend the prefix value and a /
d195 1
a195 1
	     The standard does not require a trailing / character on directory
d202 2
a203 2
     vious implementations.  The magic, uname, and gname fields must have a
     trailing NUL.  The pathname, linkname, and prefix fields must have a
d205 1
a205 1
     possible to store a 256-character pathname if it happens to have a / as
d214 1
a214 1
   Numeric Extensions
d224 1
a224 1
     Another extension, utilized by GNU tar, star, and other newer tar imple‐
d240 1
a240 1
   Pax Interchange Format
d268 1
a268 1
     atime, ctime, mtime
d273 1
a273 1
     hdrcharset
d288 1
a288 1
     uname, uid, gname, gid
d294 1
a294 1
     linkpath
d298 1
a298 1
     path    The full pathname of the entry.  Note that this is encoded in
d301 1
a301 1
     realtime.*, security.*
d305 1
a305 1
     size    The size of the file.  Note that there is no length limit on this
d309 2
a310 2
     SCHILY.*
	     Vendor-specific attributes used by Joerg Schilling's star imple‐
d313 1
a313 1
     SCHILY.acl.access, SCHILY.acl.default, SCHILY.acl.ace
d322 1
a322 1
     SCHILY.devminor, SCHILY.devmajor
d325 1
a325 1
     SCHILY.fflags
d328 1
a328 1
     SCHILY.realsize
d331 1
a331 1
     SCHILY.dev, SCHILY.ino, SCHILY.nlinks
d334 2
a335 2
	     Joerg Schilling's SCHILY.* extensions can store all of the data
	     from struct stat.
d337 2
a338 2
     LIBARCHIVE.*
	     Vendor-specific attributes used by the libarchive library and
d341 1
a341 1
     LIBARCHIVE.creationtime
d346 1
a346 1
     LIBARCHIVE.xattr.namespace.key
d348 1
a348 1
	     of this form.  The key value is URL-encoded: All non-ASCII char‐
d354 1
a354 1
     VENDOR.*
d368 2
a369 2
     In addition to the x entry described above, the pax interchange format
     also supports a g entry.  The g entry is identical in format, but speci‐
d371 1
a371 1
     entries.  The g entry is not widely used.
d373 1
a373 1
     Besides the new x and g entries, the pax interchange format has a few
d381 1
a381 1
   GNU Tar Archives
d387 1
a387 1
     ify following entries (similar in principle to the x entry described
d389 1
a389 1
     purpose x entry).	As a result, GNU tar archives are not POSIX compati‐
d423 1
a423 1
     typeflag
d464 2
a465 2
		     the first entry is a volume label).  The size field spec‐
		     ifies the size of this entry.  The offset field at bytes
d467 2
a468 2
		     begins.  The realsize field specifies the total size of
		     the file (which must equal size plus offset).  When
d491 1
a491 1
	     V	     The name field should be interpreted as a tape/volume
d495 1
a495 1
     magic   The magic field holds the five characters “ustar” followed by a
d498 1
a498 1
     version
d503 1
a503 1
     atime, ctime
d505 1
a505 1
	     of file information, stored in octal as with mtime.
d507 1
a507 1
     longnames
d510 1
a510 1
     Sparse offset / numbytes
d518 1
a518 1
     isextended
d533 1
a533 1
     realsize
d535 1
a535 1
	     larger range than the POSIX file size.  In particular, with M
d538 1
a538 1
	     entry; the realsize field will indicate the total size of the
d541 1
a541 1
   GNU tar pax archives
d543 2
a544 2
     format archives when you specify the --posix flag.  This format follows
     the pax interchange format closely, using some SCHILY tags and introduc‐
d549 3
a551 3
     GNU.sparse.numblocks, GNU.sparse.offset, GNU.sparse.numbytes,
	     GNU.sparse.size
	     The “0.0” format used an initial GNU.sparse.numblocks attribute
d553 2
a554 2
	     GNU.sparse.offset and GNU.sparse.numbytes to indicate the offset
	     and size of each block, and a single GNU.sparse.size to indicate
d562 1
a562 1
     GNU.sparse.map
d570 1
a570 1
     GNU.sparse.major, GNU.sparse.minor, GNU.sparse.name, GNU.sparse.realsize
d574 2
a575 2
	     GNU.sparse.major and GNU.sparse.minor fields) and the full size
	     of the file.  The GNU.sparse.name holds the true name of the
d580 1
a580 1
   Solaris Tar
d586 3
a588 3
     ·	     Extended attributes are stored in an entry whose type is X, not
	     x, as used by pax interchange format.  The detailed format of
	     this entry appears to be the same as detailed above for the x
d590 1
a590 1
     ·	     An additional A header is used to store an ACL for the following
d597 1
a597 1
   AIX Tar
d600 1
a600 1
     AIX Tar uses a ustar-formatted header with the type A for storing coded
d603 1
a603 1
     header is either NFS4 or AIXC to indicate the type of ACL stored.	The
d606 1
a606 1
   Mac OS X Tar
d613 1
a613 1
     separate file can be extracted and the Mac OS X copyfile() function can
d624 1
a624 1
   Summary of tar type codes
d629 15
a643 15
     0	  POSIX standard type code for a regular file.
     1	  POSIX standard type code for a hard link description.
     2	  POSIX standard type code for a symbolic link description.
     3	  POSIX standard type code for a character device node.
     4	  POSIX standard type code for a block device node.
     5	  POSIX standard type code for a directory.
     6	  POSIX standard type code for a FIFO.
     7	  POSIX reserved.
     7	  GNU tar used for pre-allocated files on some systems.
     A	  Solaris tar ACL description stored prior to a regular file header.
     A	  AIX tar ACL description stored after the file body.
     D	  GNU tar directory dump.
     K	  GNU tar long linkname for the following header.
     L	  GNU tar long pathname for the following header.
     M	  GNU tar multivolume marker, indicating the file is a continuation of
d645 6
a650 6
     N	  GNU tar long filename support.  Deprecated.
     S	  GNU tar sparse regular file.
     V	  GNU tar tape/volume header name.
     X	  Solaris tar general-purpose extension header.
     g	  POSIX pax interchange format global extensions.
     x	  POSIX pax interchange format per-file extensions.
d652 1
a652 1
SEE ALSO
d655 2
a656 2
STANDARDS
     The tar utility is no longer a part of POSIX or the Single Unix Standard.
d662 6
a667 6
HISTORY
     A tar command appeared in Seventh Edition Unix, which was released in
     January, 1979.  It replaced the tp program from Fourth Edition Unix which
     in turn replaced the tap program from First Edition Unix.	John Gilmore's
     pdtar public-domain implementation (circa 1987) was highly influential
     and formed the basis of GNU tar (circa 1988).  Joerg Shilling's star
d671 1
a671 1
     This documentation was written as part of the libarchive and bsdtar
@


1.1.1.9
log
@Import libarchive 3.4.0
@
text
@d17 2
a18 2
     data.  The end of the archive is indicated by two records consisting en‐
     tirely of zero bytes.
d70 2
a71 2
     mtime   Modification time of file, as an octal number in ASCII.  This in‐
	     dicates the number of seconds since the start of the epoch,
d99 2
a100 2
     terminated by a null and a space.	Early implementations filled the nu‐
     meric fields with leading spaces.	This seems to have been common prac‐
d110 1
a110 1
     •	     The magic value consists of the five characters “ustar” followed
d113 1
a113 1
     •	     The numeric fields are generally filled with leading spaces (not
d115 1
a115 1
     •	     The prefix field is often not used, limiting pathnames to the 100
d168 3
a170 3
	     files in the directory, for use by operating systems that pre-al‐
	     locate directory space.  For all other types, it should be set to
	     zero by writers and ignored by readers.
d173 2
a174 2
	     cate that this is a POSIX standard archive.  Full compliance re‐
	     quires the uname and gname fields be properly set.
d186 2
a187 2
	     Major and minor numbers for character device or block device en‐
	     try.
d252 2
a253 2
     dard ustar entries, each with its own header and data.  The first op‐
     tional entry stores the extended attributes for the following entry.
d279 2
a280 2
	     character ASCII string “BINARY”, then all textual values are as‐
	     sumed to be in a platform-dependent multi-byte encoding.  Note
d358 9
a366 9
     values in the regular tar header.	Note that compliant readers should ig‐
     nore the regular fields when they are overridden.	This is important, as
     existing archivers are known to store non-compliant values in the stan‐
     dard header fields in this situation.  There are no limits on length for
     any of these fields.  In particular, numeric fields can be arbitrarily
     large.  All text fields are encoded in UTF8.  Compliant writers should
     store only portable 7-bit ASCII characters in the standard ustar header
     and use extended attributes whenever a text value contains non-ASCII
     characters.
d370 2
a371 2
     fies attributes that serve as defaults for all subsequent archive en‐
     tries.  The g entry is not widely used.
d382 2
a383 2
     The GNU tar program started with a pre-POSIX format similar to that de‐
     scribed earlier and has extended it using several different mechanisms:
d390 2
a391 2
     ble, although more lenient POSIX-compliant readers can successfully ex‐
     tract most GNU tar archives.
d438 5
a442 5
		     marks the end of the name list.  The purpose of this en‐
		     try is to support incremental backups; a program restor‐
		     ing from such an archive may wish to delete files on disk
		     that did not exist in the directory when the archive was
		     made.
d466 7
a472 7
		     369-380 specifies the offset where this file fragment be‐
		     gins.  The realsize field specifies the total size of the
		     file (which must equal size plus offset).	When extract‐
		     ing, GNU tar checks that the header file name is the one
		     it is expecting, that the header offset is in the correct
		     sequence, and that the sum of offset and size is equal to
		     realsize.
d477 2
a478 2
		     long names.  The contents of this record are a text de‐
		     scription of the operations to be done, in the form
d481 2
a482 2
		     to security concerns, "N" records are now generally ig‐
		     nored when reading archives.
d486 2
a487 2
		     fragment offset/length pairs.  If more than four such en‐
		     tries are required, the header is extended as necessary
d513 3
a515 3
	     each padded to a multiple of 512 bytes in the archive.  On ex‐
	     traction, the list of fragments is collected from the header (in‐
	     cluding any extension headers), and the data is then read and
d577 2
a578 2
	     header is a modified name so that extraction errors will be ap‐
	     parent to users.
d586 1
a586 1
     •	     Extended attributes are stored in an entry whose type is X, not
d588 5
a592 5
	     this entry appears to be the same as detailed above for the x en‐
	     try.
     •	     An additional A header is used to store an ACL for the following
	     regular entry.  The body of this entry contains a seven-digit oc‐
	     tal number followed by a zero byte, followed by the textual ACL
d611 2
a612 2
     tional metadata about the second file, including ACL, extended at‐
     tributes, and resources.  To recreate the original file on disk, each
@


1.1.1.10
log
@Import libarchive 3.7.2
@
text
@d65 1
a65 1
	     this indicates the amount of data that follows the header.	 In
d67 1
a67 1
	     when extracting hardlinks.	 Modern writers should always store a
d80 1
a80 1
	     character.	 Note that many early implementations of tar used
d122 1
a122 1
     header.  (The name is an acronym for “Unix Standard TAR”.)	 It extends
d192 1
a192 1
	     first portion going into the prefix field.	 If the prefix field
d225 1
a225 1
     mentations, permits binary numbers in the standard numeric fields.	 This
d269 1
a269 1
	     File access, inode change, and modification times.	 These fields
d282 1
a282 1
	     “ISO-IR 10646 2000 UTF-8”.	 No other values are permitted by the
d329 1
a329 1
	     The full size of the file on disk.	 XXX explain? XXX
d529 2
a530 2
			   char	   isextended[1];
			   char	   padding[7];
d543 1
a543 1
     format archives when you specify the --posix flag.	 This format follows
d545 1
a545 1
     ing new keywords to store sparse file information.	 There have been three
d555 1
a555 1
	     the full size of the file.	 This is not the same as the size in
d626 1
a626 1
     header records generated by different tar implementations.	 More details
d659 1
a659 1
     mat is currently part of the specification for the pax(1) utility.	 The
@


1.1.1.11
log
@libarchove: import version 3.7.7
@
text
@d1 1
a1 1
4mTAR24m(5)			   File Formats Manual			     4mTAR24m(5)
d3 2
a4 2
1mNAME0m
       tar — format of tape archive files
d6 664
a669 673
1mDESCRIPTION0m
       The  1mtar  22marchive format collects any number of files, directories, and
       other file system objects (symbolic links, device nodes, etc.)  into  a
       single  stream of bytes.	 The format was originally designed to be used
       with tape drives that operate with fixed-size  blocks,  but  is	widely
       used as a general packaging mechanism.

   1mGeneral Format0m
       A 1mtar 22marchive consists of a series of 512-byte records.  Each file sys‐
       tem  object requires a header record which stores basic metadata (path‐
       name, owner, permissions, etc.) and zero or more records containing any
       file data.  The end of the archive is indicated by two records consist‐
       ing entirely of zero bytes.

       For compatibility with tape drives that use fixed block sizes, programs
       that read or write tar files always read or write  a  fixed  number  of
       records	with each I/O operation.  These “blocks” are always a multiple
       of the record size.  The maximum block size supported by	 early	imple‐
       mentations  was	10240  bytes or 20 records.  This is still the default
       for most implementations although block sizes of 1MiB (2048 records) or
       larger are commonly used with modern high-speed	tape  drives.	(Note:
       the  terms  “block”  and	 “record” here are not entirely standard; this
       document follows the convention established by John  Gilmore  in	 docu‐
       menting 1mpdtar22m.)

   1mOld-Style Archive Format0m
       The original tar archive format has been extended many times to include
       additional information that various implementors found necessary.  This
       section	describes  the variant implemented by the tar command included
       in Version 7 AT&T UNIX, which seems to be the earliest widely-used ver‐
       sion of the tar program.

       The header record for an old-style 1mtar 22marchive consists of the  follow‐
       ing:

	     struct header_old_tar {
		     char name[100];
		     char mode[8];
		     char uid[8];
		     char gid[8];
		     char size[12];
		     char mtime[12];
		     char checksum[8];
		     char linkflag[1];
		     char linkname[100];
		     char pad[255];
	     };
       All unused bytes in the header record are filled with nulls.

       4mname24m    Pathname, stored as a null-terminated string.  Early tar imple‐
	       mentations  only	 stored	 regular files (including hardlinks to
	       those files).  One common early convention used a trailing  "/"
	       character to indicate a directory name, allowing directory per‐
	       missions and owner information to be archived and restored.

       4mmode24m    File mode, stored as an octal number in ASCII.

       4muid24m, 4mgid0m
	       User id and group id of owner, as octal numbers in ASCII.

       4msize24m    Size  of  file,  as	 octal	number in ASCII.  For regular files
	       only, this indicates  the  amount  of  data  that  follows  the
	       header.	In particular, this field was ignored by early tar im‐
	       plementations when extracting hardlinks.	 Modern writers should
	       always store a zero length for hardlink entries.

       4mmtime24m   Modification  time	of file, as an octal number in ASCII.  This
	       indicates the number of seconds since the start of  the	epoch,
	       00:00:00 UTC January 1, 1970.  Note that negative values should
	       be avoided here, as they are handled inconsistently.

       4mchecksum0m
	       Header  checksum,  stored as an octal number in ASCII.  To com‐
	       pute the checksum, set the checksum field to all	 spaces,  then
	       sum  all	 bytes	in the header using unsigned arithmetic.  This
	       field should be stored as six octal digits followed by  a  null
	       and a space character.  Note that many early implementations of
	       tar  used  signed  arithmetic for the checksum field, which can
	       cause interoperability problems when transferring archives  be‐
	       tween systems.  Modern robust readers compute the checksum both
	       ways and accept the header if either computation matches.

       4mlinkflag24m, 4mlinkname0m
	       In  order  to preserve hardlinks and conserve tape, a file with
	       multiple links is only written to the archive the first time it
	       is encountered.	The next time it is encountered, the  4mlinkflag0m
	       is  set	to an ASCII ‘1’ and the 4mlinkname24m field holds the first
	       name under which this file appears.  (Note that	regular	 files
	       have a null value in the 4mlinkflag24m field.)

       Early  tar  implementations varied in how they terminated these fields.
       The tar command in Version 7 AT&T UNIX used the	following  conventions
       (this  is  also documented in early BSD manpages): the pathname must be
       null-terminated; the mode, uid, and gid fields must end in a space  and
       a  null byte; the size and mtime fields must end in a space; the check‐
       sum is terminated by a null and a space.	 Early implementations	filled
       the numeric fields with leading spaces.	This seems to have been common
       practice	 until	the  IEEE Std 1003.1-1988 (“POSIX.1”) standard was re‐
       leased.	For best portability, modern implementations should  fill  the
       numeric fields with leading zeros.

   1mPre-POSIX Archives0m
       An  early draft of IEEE Std 1003.1-1988 (“POSIX.1”) served as the basis
       for John Gilmore's 1mpdtar 22mprogram and many system  implementations  from
       the  late  1980s	 and early 1990s.  These archives generally follow the
       POSIX ustar format described below with the following variations:
       1m•	 22mThe magic value consists of the five  characters  “ustar”  fol‐
	       lowed by a space.  The version field contains a space character
	       followed by a null.
       1m•	 22mThe	 numeric  fields  are  generally filled with leading spaces
	       (not leading zeros as recommended in the final standard).
       1m•	 22mThe prefix field is often not used, limiting pathnames  to	the
	       100 characters of old-style archives.

   1mPOSIX ustar Archives0m
       IEEE  Std 1003.1-1988 (“POSIX.1”) defined a standard tar file format to
       be read and written by compliant implementations of 4mtar24m(1).	 This  for‐
       mat  is	often called the “ustar” format, after the magic value used in
       the header.  (The name is an acronym for “Unix Standard TAR”.)  It  ex‐
       tends the historic format with new fields:

	     struct header_posix_ustar {
		     char name[100];
		     char mode[8];
		     char uid[8];
		     char gid[8];
		     char size[12];
		     char mtime[12];
		     char checksum[8];
		     char typeflag[1];
		     char linkname[100];
		     char magic[6];
		     char version[2];
		     char uname[32];
		     char gname[32];
		     char devmajor[8];
		     char devminor[8];
		     char prefix[155];
		     char pad[12];
	     };

       4mtypeflag0m
	       Type  of entry.	POSIX extended the earlier 4mlinkflag24m field with
	       several new type values:
	       “0”     Regular file.  NUL should be treated as a synonym,  for
		       compatibility purposes.
	       “1”     Hard link.
	       “2”     Symbolic link.
	       “3”     Character device node.
	       “4”     Block device node.
	       “5”     Directory.
	       “6”     FIFO node.
	       “7”     Reserved.
	       Other   A  POSIX-compliant implementation must treat any unrec‐
		       ognized typeflag value as a regular file.  In  particu‐
		       lar,  writers  should  ensure  that  all entries have a
		       valid filename so that they can be restored by  readers
		       that  do	 not support the corresponding extension.  Up‐
		       percase letters "A" through "Z" are reserved for custom
		       extensions.  Note that sockets and whiteout entries are
		       not archivable.
	       It is worth noting that the 4msize24m field, in particular, has dif‐
	       ferent meanings depending on the type.  For regular  files,  of
	       course,	it  indicates the amount of data following the header.
	       For directories, it may be used to indicate the total  size  of
	       all  files  in the directory, for use by operating systems that
	       pre-allocate directory space.  For all other types,  it	should
	       be set to zero by writers and ignored by readers.

       4mmagic24m   Contains  the magic value “ustar” followed by a NUL byte to in‐
	       dicate that this is a POSIX standard archive.  Full  compliance
	       requires the uname and gname fields be properly set.

       4mversion0m
	       Version.	  This	should	be “00” (two copies of the ASCII digit
	       zero) for POSIX standard archives.

       4muname24m, 4mgname0m
	       User and group names, as null-terminated ASCII strings.	 These
	       should  be  used	 in preference to the uid/gid values when they
	       are set and the corresponding names exist on the system.

       4mdevmajor24m, 4mdevminor0m
	       Major and minor numbers for character device  or	 block	device
	       entry.

       4mname24m, 4mprefix0m
	       If the pathname is too long to fit in the 100 bytes provided by
	       the  standard  format,  it can be split at any 4m/24m character with
	       the first portion going into the prefix field.  If  the	prefix
	       field  is  not  empty, the reader will prepend the prefix value
	       and a 4m/24m character to the regular name field to obtain the  full
	       pathname.  The standard does not require a trailing 4m/24m character
	       on  directory  names, though most implementations still include
	       this for compatibility reasons.

       Note that all unused bytes must be set to NUL.

       Field termination is specified slightly differently by  POSIX  than  by
       previous implementations.  The 4mmagic24m, 4muname24m, and 4mgname24m fields must have
       a  trailing NUL.	 The 4mpathname24m, 4mlinkname24m, and 4mprefix24m fields must have a
       trailing NUL unless they fill the entire field.	(In particular, it  is
       possible to store a 256-character pathname if it happens to have a 4m/24m as
       the  156th character.)  POSIX requires numeric fields to be zero-padded
       in the front, and requires them to be terminated with either  space  or
       NUL characters.

       Currently, most tar implementations comply with the ustar format, occa‐
       sionally extending it by adding new fields to the blank area at the end
       of the header record.

   1mNumeric Extensions0m
       There  have been several attempts to extend the range of sizes or times
       supported by modifying how numbers are stored in the header.

       One obvious extension to increase the size of files is to eliminate the
       terminating characters from the various numeric fields.	 For  example,
       the standard only allows the size field to contain 11 octal digits, re‐
       serving the twelfth byte for a trailing NUL character.  Allowing 12 oc‐
       tal digits allows file sizes up to 64 GB.

       Another	extension,  utilized by GNU tar, star, and other newer 1mtar 22mim‐
       plementations, permits binary numbers in the standard  numeric  fields.
       This is flagged by setting the high bit of the first byte.  The remain‐
       der  of	the  field is treated as a signed twos-complement value.  This
       permits 95-bit values for the length and time fields and 63-bit	values
       for  the	 uid, gid, and device numbers.	In particular, this provides a
       consistent way to handle negative time values.  GNU tar	supports  this
       extension  for  the  length,  mtime,  ctime,  and  atime fields.	 Joerg
       Schilling's star program and the libarchive library support this exten‐
       sion for all numeric fields.  Note that this extension is largely obso‐
       leted by the extended attribute record provided by the pax  interchange
       format.

       Another	early  GNU extension allowed base-64 values rather than octal.
       This extension was short-lived and is no longer supported by any imple‐
       mentation.

   1mPax Interchange Format0m
       There are many attributes that cannot be portably stored in a POSIX us‐
       tar  archive.   IEEE  Std  1003.1-2001  (“POSIX.1”)  defined   a	  “pax
       interchange  format”  that  uses two new types of entries to hold text-
       formatted metadata that applies to following entries.  Note that a  pax
       interchange  format  archive  is a ustar archive in every respect.  The
       new data is stored in ustar-compatible archive entries that use the “x”
       or “g” typeflag.	 In particular,	 older	implementations	 that  do  not
       fully  support  these extensions will extract the metadata into regular
       files, where the metadata can be examined as necessary.

       An entry in a pax interchange format archive consists  of  one  or  two
       standard	 ustar	entries, each with its own header and data.  The first
       optional entry stores the extended attributes for the following	entry.
       This optional first entry has an "x" typeflag and a size field that in‐
       dicates	the  total  size of the extended attributes.  The extended at‐
       tributes themselves are stored as a series of text-format lines encoded
       in the portable UTF-8 encoding.	Each line consists of a	 decimal  num‐
       ber,  a	space, a key string, an equals sign, a value string, and a new
       line.  The decimal number indicates the length of the entire line,  in‐
       cluding	the initial length field and the trailing newline.  An example
       of such a field is:
	     1m25 ctime=1084839148.1212\n0m
       Keys in all lowercase are standard keys.	 Vendors  can  add  their  own
       keys  by prefixing them with an all uppercase vendor name and a period.
       Note that, unlike the historic header, numeric values are stored	 using
       decimal, not octal.  A description of some common keys follows:

       1matime22m, 1mctime22m, 1mmtime0m
	       File  access,  inode  change,  and  modification	 times.	 These
	       fields can be negative or include a decimal point and  a	 frac‐
	       tional value.

       1mhdrcharset0m
	       The  character  set  used  by the pax extension values.	By de‐
	       fault, all textual values in the pax  extended  attributes  are
	       assumed	to  be	in UTF-8, including pathnames, user names, and
	       group names.  In some cases, it is not  possible	 to  translate
	       local  conventions  into UTF-8.	If this key is present and the
	       value is the six-character ASCII string “BINARY”, then all tex‐
	       tual values are assumed to be in	 a  platform-dependent	multi-
	       byte  encoding.	 Note that there are only two valid values for
	       this key: “BINARY” or “ISO-IR 10646 2000 UTF-8”.	 No other val‐
	       ues are permitted by the standard, and the latter value	should
	       generally not be used as it is the default when this key is not
	       specified.   In	particular,  this flag should not be used as a
	       general mechanism to allow filenames to be stored in  arbitrary
	       encodings.

       1muname22m, 1muid22m, 1mgname22m, 1mgid0m
	       User  name,  group  name,  and numeric UID and GID values.  The
	       user name and group name stored here are encoded	 in  UTF8  and
	       can  thus include non-ASCII characters.	The UID and GID fields
	       can be of arbitrary length.

       1mlinkpath0m
	       The full path of the linked-to file.  Note that this is encoded
	       in UTF8 and can thus include non-ASCII characters.

       1mpath	 22mThe full pathname of the entry.  Note that this is	encoded	 in
	       UTF8 and can thus include non-ASCII characters.

       1mrealtime.*22m, 1msecurity.*0m
	       These keys are reserved and may be used for future standardiza‐
	       tion.

       1msize	 22mThe	 size  of  the file.  Note that there is no length limit on
	       this field, allowing conforming archives to  store  files  much
	       larger than the historic 8GB limit.

       1mSCHILY.*0m
	       Vendor-specific	attributes  used by Joerg Schilling's 1mstar 22mim‐
	       plementation.

       1mSCHILY.acl.access22m, 1mSCHILY.acl.default22m, 1mSCHILY.acl.ace0m
	       Stores the access, default and NFSv4 ACLs as textual strings in
	       a format that is	 an  extension	of  the	 format	 specified  by
	       POSIX.1e	 draft	17.   In particular, each user or group access
	       specification can include an additional	colon-separated	 field
	       with  the  numeric UID or GID.  This allows ACLs to be restored
	       on systems that may not have complete user or group information
	       available (such as when NIS/YP or LDAP services are temporarily
	       unavailable).

       1mSCHILY.devminor22m, 1mSCHILY.devmajor0m
	       The full minor and major numbers for device nodes.

       1mSCHILY.fflags0m
	       The file flags.

       1mSCHILY.realsize0m
	       The full size of the file on disk.  XXX explain? XXX

       1mSCHILY.dev22m, 1mSCHILY.ino22m, 1mSCHILY.nlinks0m
	       The device number, inode number, and link count for the	entry.
	       In particular, note that a pax interchange format archive using
	       Joerg Schilling's 1mSCHILY.* 22mextensions can store all of the data
	       from 4mstruct24m 4mstat24m.

       1mLIBARCHIVE.*0m
	       Vendor-specific	attributes  used by the 1mlibarchive 22mlibrary and
	       programs that use it.

       1mLIBARCHIVE.creationtime0m
	       The time when the file was created.  (This should not  be  con‐
	       fused  with  the	 POSIX	“ctime” attribute, which refers to the
	       time when the file metadata was last changed.)

       1mLIBARCHIVE.xattr22m.4mnamespace24m.4mkey0m
	       Libarchive stores POSIX.1e-style extended attributes using keys
	       of this form.  The 4mkey24m  value  is  URL-encoded:  All  non-ASCII
	       characters  and	the two special characters “=” and “%” are en‐
	       coded as “%” followed by two uppercase hexadecimal digits.  The
	       value of this key is the extended attribute  value  encoded  in
	       base 64.	 XXX Detail the base-64 format here XXX

       1mVENDOR.*0m
	       XXX document other vendor-specific extensions XXX

       Any  values  stored in an extended attribute override the corresponding
       values in the regular tar header.  Note that compliant  readers	should
       ignore the regular fields when they are overridden.  This is important,
       as  existing  archivers	are known to store non-compliant values in the
       standard header fields in this  situation.   There  are	no  limits  on
       length  for  any of these fields.  In particular, numeric fields can be
       arbitrarily large.  All text fields are	encoded	 in  UTF8.   Compliant
       writers	should store only portable 7-bit ASCII characters in the stan‐
       dard ustar header and use extended attributes  whenever	a  text	 value
       contains non-ASCII characters.

       In  addition to the 1mx 22mentry described above, the pax interchange format
       also supports a 1mg 22mentry.  The 1mg 22mentry is identical in format, but spec‐
       ifies attributes that serve as defaults for all subsequent archive  en‐
       tries.  The 1mg 22mentry is not widely used.

       Besides	the  new 1mx 22mand 1mg 22mentries, the pax interchange format has a few
       other minor variations from the earlier ustar format.  The  most	 trou‐
       bling  one is that hardlinks are permitted to have data following them.
       This allows readers to restore any hardlink to a file without having to
       rewind the archive to find an earlier entry.  However, it creates  com‐
       plications  for robust readers, as it is no longer clear whether or not
       they should ignore the size field for hardlink entries.

   1mGNU Tar Archives0m
       The GNU tar program started with a pre-POSIX format similar to that de‐
       scribed earlier and has extended it using several different mechanisms:
       It added new fields to the empty space in the header (some of which was
       later used by POSIX for conflicting purposes); it allowed the header to
       be continued over multiple records; and it  defined  new	 entries  that
       modify following entries (similar in principle to the 1mx 22mentry described
       above,  but  each  GNU special entry is single-purpose, unlike the gen‐
       eral-purpose 1mx 22mentry).  As a result, GNU tar  archives  are	 not  POSIX
       compatible,  although more lenient POSIX-compliant readers can success‐
       fully extract most GNU tar archives.

	     struct header_gnu_tar {
		     char name[100];
		     char mode[8];
		     char uid[8];
		     char gid[8];
		     char size[12];
		     char mtime[12];
		     char checksum[8];
		     char typeflag[1];
		     char linkname[100];
		     char magic[6];
		     char version[2];
		     char uname[32];
		     char gname[32];
		     char devmajor[8];
		     char devminor[8];
		     char atime[12];
		     char ctime[12];
		     char offset[12];
		     char longnames[4];
		     char unused[1];
		     struct {
			     char offset[12];
			     char numbytes[12];
		     } sparse[4];
		     char isextended[1];
		     char realsize[12];
		     char pad[17];
	     };

       4mtypeflag0m
	       GNU tar uses the following special entry types, in addition  to
	       those defined by POSIX:

	       7       GNU tar treats type "7" records identically to type "0"
		       records, except on one obscure RTOS where they are used
		       to  indicate the pre-allocation of a contiguous file on
		       disk.

	       D       This indicates a directory entry.   Unlike  the	POSIX-
		       standard	 "5"  typeflag, the header is followed by data
		       records listing the names of files in  this  directory.
		       Each  name  is  preceded by an ASCII "Y" if the file is
		       stored in this archive or "N" if the file is not stored
		       in this archive.	 Each name is terminated with a	 null,
		       and  an extra null marks the end of the name list.  The
		       purpose of this entry is to support  incremental	 back‐
		       ups;  a program restoring from such an archive may wish
		       to delete files on disk that did not exist in  the  di‐
		       rectory when the archive was made.

		       Note that the "D" typeflag specifically violates POSIX,
		       which  requires that unrecognized typeflags be restored
		       as normal files.	 In this case, restoring the "D" entry
		       as a file could interfere with subsequent  creation  of
		       the like-named directory.

	       K       The data for this entry is a long linkname for the fol‐
		       lowing regular entry.

	       L       The data for this entry is a long pathname for the fol‐
		       lowing regular entry.

	       M       This is a continuation of the last file on the previous
		       volume.	 GNU multi-volume archives guarantee that each
		       volume begins with a valid  entry  header.   To	ensure
		       this,  a file may be split, with part stored at the end
		       of one volume, and part stored at the beginning of  the
		       next  volume.  The "M" typeflag indicates that this en‐
		       try continues an existing file.	Such entries can  only
		       occur  as  the first or second entry in an archive (the
		       latter only if the first entry is a volume label).  The
		       4msize24m field specifies  the  size  of	 this  entry.	The
		       4moffset24m  field  at  bytes  369-380  specifies the offset
		       where this file fragment begins.	  The  4mrealsize24m  field
		       specifies  the total size of the file (which must equal
		       4msize24m plus 4moffset24m).  When  extracting,	GNU  tar  checks
		       that  the  header file name is the one it is expecting,
		       that the header offset is in the correct sequence,  and
		       that the sum of offset and size is equal to realsize.

	       N       Type  "N"  records  are no longer generated by GNU tar.
		       They contained a list of files to be  renamed  or  sym‐
		       linked  after  extraction;  this was originally used to
		       support long names.  The contents of this record are  a
		       text  description  of the operations to be done, in the
		       form “Rename %s to %s\n” or “Symlink %s	to  %s\n”;  in
		       either  case,  both  filenames  are escaped using K&R C
		       syntax.	Due to security concerns, "N" records are  now
		       generally ignored when reading archives.

	       S       This  is	 a  “sparse”  regular  file.  Sparse files are
		       stored as a series of fragments.	 The header contains a
		       list of fragment offset/length  pairs.	If  more  than
		       four  such entries are required, the header is extended
		       as necessary with “extra” header extensions  (an	 older
		       format that is no longer used), or “sparse” extensions.

	       V       The  4mname24m  field should be interpreted as a tape/volume
		       header name.  This entry should generally be ignored on
		       extraction.

       4mmagic24m   The magic field holds the five characters “ustar” followed by a
	       space.  Note that POSIX ustar archives have a trailing null.

       4mversion0m
	       The version field holds a space character followed by  a	 null.
	       Note  that  POSIX  ustar	 archives  use two copies of the ASCII
	       digit “0”.

       4matime24m, 4mctime0m
	       The time the file was last accessed and the time of last change
	       of file information, stored in octal as with 4mmtime24m.

       4mlongnames0m
	       This field is apparently no longer used.

       Sparse 4moffset24m 4m/24m 4mnumbytes0m
	       Each such structure specifies a single  fragment	 of  a	sparse
	       file.  The two fields store values as octal numbers.  The frag‐
	       ments  are  each	 padded	 to  a	multiple  of  512 bytes in the
	       archive.	 On extraction, the list  of  fragments	 is  collected
	       from the header (including any extension headers), and the data
	       is then read and written to the file at appropriate offsets.

       4misextended0m
	       If  this is set to non-zero, the header will be followed by ad‐
	       ditional “sparse header” records.  Each	such  record  contains
	       information  about  as  many  as 21 additional sparse blocks as
	       shown here:

		     struct gnu_sparse_header {
			     struct {
				     char offset[12];
				     char numbytes[12];
			     } sparse[21];
			     char    isextended[1];
			     char    padding[7];
		     };

       4mrealsize0m
	       A binary representation of the file's  complete	size,  with  a
	       much  larger  range  than  the POSIX file size.	In particular,
	       with 1mM 22mtype files, the current entry is only a portion  of	the
	       file.   In  that	 case,	the POSIX size field will indicate the
	       size of this entry; the 4mrealsize24m field will indicate the  total
	       size of the file.

   1mGNU tar pax archives0m
       GNU  tar 1.14 (XXX check this XXX) and later will write pax interchange
       format archives when you specify the 1m--posix 22mflag.	This format follows
       the pax interchange format closely, using some 1mSCHILY 22mtags	and  intro‐
       ducing  new keywords to store sparse file information.  There have been
       three iterations of the sparse file  support,  referred	to  as	“0.0”,
       “0.1”, and “1.0”.

       1mGNU.sparse.numblocks22m,      1mGNU.sparse.offset22m,	    1mGNU.sparse.numbytes22m,
	       1mGNU.sparse.size0m
	       The “0.0” format used an initial 1mGNU.sparse.numblocks 22mattribute
	       to indicate the number  of  blocks  in  the  file,  a  pair  of
	       1mGNU.sparse.offset  22mand 1mGNU.sparse.numbytes 22mto indicate the off‐
	       set and size of each block, and a single 1mGNU.sparse.size 22mto in‐
	       dicate the full size of the file.  This is not the same as  the
	       size  in	 the  tar header because the latter value does not in‐
	       clude the size of any holes.  This format required that the or‐
	       der of attributes be preserved and relied on readers  accepting
	       multiple	 appearances of the same attribute names, which is not
	       officially permitted by the standards.

       1mGNU.sparse.map0m
	       The “0.1” format used a single attribute that stored  a	comma-
	       separated  list of decimal numbers.  Each pair of numbers indi‐
	       cated the offset and size, respectively, of a  block  of	 data.
	       This  does  not	work  well  if	the archive is extracted by an
	       archiver that does not recognize this extension, since many pax
	       implementations simply discard unrecognized attributes.

       1mGNU.sparse.major22m,	       1mGNU.sparse.minor22m,		1mGNU.sparse.name22m,
	       1mGNU.sparse.realsize0m
	       The  “1.0”  format  stores  the sparse block map in one or more
	       512-byte blocks prepended to the file data in the  entry	 body.
	       The  pax attributes indicate the existence of this map (via the
	       1mGNU.sparse.major 22mand 1mGNU.sparse.minor 22mfields) and the full size
	       of the file.  The 1mGNU.sparse.name 22mholds the true  name  of	the
	       file.   To  avoid confusion, the name stored in the regular tar
	       header is a modified name so that extraction errors will be ap‐
	       parent to users.

   1mSolaris Tar0m
       XXX More Details Needed XXX

       Solaris	tar  (beginning	 with  SunOS  XXX  5.7	??  XXX)  supports  an
       “extended” format that is fundamentally similar to pax interchange for‐
       mat, with the following differences:
       1m•	 22mExtended attributes are stored in an entry whose type is 1mX22m, not
	       1mx22m,	as  used by pax interchange format.  The detailed format of
	       this entry appears to be the same as detailed above for	the  1mx0m
	       entry.
       1m•	 22mAn	additional 1mA 22mheader is used to store an ACL for the follow‐
	       ing regular entry.  The body of this entry  contains  a	seven-
	       digit  octal  number  followed  by a zero byte, followed by the
	       textual ACL description.	 The octal value is the number of  ACL
	       entries	plus  a constant that indicates the ACL type: 01000000
	       for POSIX.1e ACLs and 03000000 for NFSv4 ACLs.

   1mAIX Tar0m
       XXX More details needed XXX

       AIX Tar uses a ustar-formatted header with the type 1mA 22mfor storing coded
       ACL information.	 Unlike the Solaris format, AIX tar writes this header
       after the regular file body to which it applies.	 The pathname in  this
       header  is either 1mNFS4 22mor 1mAIXC 22mto indicate the type of ACL stored.  The
       actual ACL is stored in platform-specific binary format.

   1mMac OS X Tar0m
       The tar distributed with Apple's Mac OS X stores most regular files  as
       two  separate  files  in	 the tar archive.  The two files have the same
       name except that the first one has “._” prepended to the last path ele‐
       ment.  This special file stores an AppleDouble-encoded binary blob with
       additional metadata about the second file, including ACL, extended  at‐
       tributes,  and  resources.  To recreate the original file on disk, each
       separate file can be extracted and the Mac OS X 1mcopyfile22m() function can
       be used to unpack the separate metadata file and apply it to th regular
       file.  Conversely, the same function provides a “pack” option to encode
       the extended metadata from a file into a separate file  whose  contents
       can then be put into a tar archive.

       Note  that the Apple extended attributes interact badly with long file‐
       names.  Since each file is stored with the full name, a separate set of
       extensions needs to be included in the archive for each	one,  doubling
       the overhead required for files with long names.

   1mSummary of tar type codes0m
       The following list is a condensed summary of the type codes used in tar
       header  records	generated  by different tar implementations.  More de‐
       tails about specific implementations can be found above:
       NUL  Early tar programs stored a zero byte for regular files.
       1m0    22mPOSIX standard type code for a regular file.
       1m1    22mPOSIX standard type code for a hard link description.
       1m2    22mPOSIX standard type code for a symbolic link description.
       1m3    22mPOSIX standard type code for a character device node.
       1m4    22mPOSIX standard type code for a block device node.
       1m5    22mPOSIX standard type code for a directory.
       1m6    22mPOSIX standard type code for a FIFO.
       1m7    22mPOSIX reserved.
       1m7    22mGNU tar used for pre-allocated files on some systems.
       1mA    22mSolaris tar ACL description stored prior to a regular file header.
       1mA    22mAIX tar ACL description stored after the file body.
       1mD    22mGNU tar directory dump.
       1mK    22mGNU tar long linkname for the following header.
       1mL    22mGNU tar long pathname for the following header.
       1mM    22mGNU tar multivolume marker, indicating the file is a  continuation
	    of a file from the previous volume.
       1mN    22mGNU tar long filename support.	 Deprecated.
       1mS    22mGNU tar sparse regular file.
       1mV    22mGNU tar tape/volume header name.
       1mX    22mSolaris tar general-purpose extension header.
       1mg    22mPOSIX pax interchange format global extensions.
       1mx    22mPOSIX pax interchange format per-file extensions.

1mSEE ALSO0m
       4mar24m(1), 4mpax24m(1), 4mtar24m(1)

1mSTANDARDS0m
       The  1mtar  22mutility is no longer a part of POSIX or the Single Unix Stan‐
       dard.  It last appeared in Version 2 of the Single  UNIX	 Specification
       (“SUSv2”).   It	has been supplanted in subsequent standards by 4mpax24m(1).
       The ustar format is currently part of the specification for the	4mpax24m(1)
       utility.	  The  pax  interchange	 file  format  is  new	with  IEEE Std
       1003.1-2001 (“POSIX.1”).

1mHISTORY0m
       A 1mtar 22mcommand appeared in Seventh Edition Unix, which was  released	 in
       January,	 1979.	 It  replaced  the 1mtp 22mprogram from Fourth Edition Unix
       which in turn replaced the 1mtap 22mprogram from First Edition  Unix.   John
       Gilmore's  1mpdtar  22mpublic-domain  implementation (circa 1987) was highly
       influential and formed the  basis  of  1mGNU  tar  22m(circa  1988).   Joerg
       Shilling's 1mstar 22marchiver is another open-source (CDDL) archiver (origi‐
       nally developed circa 1985) which features complete support for pax in‐
       terchange format.
d671 2
a672 2
       This  documentation  was	 written  as part of the 1mlibarchive 22mand 1mbsdtar0m
       project by Tim Kientzle <kientzle@@FreeBSD.org>.
d674 1
a674 1
Debian			       December 27, 2016			4mTAR24m(5)
@


