PAX(1)                     POSIX Programmer's Manual                    PAX(1)



PPRROOLLOOGG
       This manual page is part of the POSIX Programmer's Manual.  The OS
       implementation of this interface may differ (consult the corresponding
       OS manual page for details of OS behavior), or the interface may not be
       implemented on OS.

NNAAMMEE
       pax -- portable archive interchange

SSYYNNOOPPSSIISS
       pax [[-dv]] [[-c|-n]] [[-H|-L]] [[-o _o_p_t_i_o_n_s]] [[-f _a_r_c_h_i_v_e]] [[-s _r_e_p_l_s_t_r]]...
           [[_p_a_t_t_e_r_n...]]

       pax -r[[-c|-n]] [[-dikuv]] [[-H|-L]] [[-f _a_r_c_h_i_v_e]] [[-o _o_p_t_i_o_n_s]]... [[-p _s_t_r_i_n_g]]...
           [[-s _r_e_p_l_s_t_r]]... [[_p_a_t_t_e_r_n...]]

       pax -w [[-dituvX]] [[-H|-L]] [[-b _b_l_o_c_k_s_i_z_e]] [[[[-a]] [[-f _a_r_c_h_i_v_e]]]] [[-o _o_p_t_i_o_n_s]]...
           [[-s _r_e_p_l_s_t_r]]... [[-x _f_o_r_m_a_t]] [[_f_i_l_e...]]

       pax -r -w [[-diklntuvX]] [[-H|-L]] [[-o _o_p_t_i_o_n_s]]... [[-p _s_t_r_i_n_g]]...
           [[-s _r_e_p_l_s_t_r]]... [[_f_i_l_e...]] _d_i_r_e_c_t_o_r_y

DDEESSCCRRIIPPTTIIOONN
       The _p_a_x utility shall read, write, and write lists of the members of
       archive files and copy directory hierarchies. A variety of archive
       formats shall be supported; see the --xx _f_o_r_m_a_t option.

       The action to be taken depends on the presence of the --rr and --ww
       options. The four combinations of --rr and --ww are referred to as the four
       modes of operation: lliisstt, rreeaadd, wwrriittee, and ccooppyy modes, corresponding
       respectively to the four forms shown in the SYNOPSIS section.

       lliisstt      In lliisstt mode (when neither --rr nor --ww are specified), _p_a_x
                 shall write the names of the members of the archive file read
                 from the standard input, with pathnames matching the
                 specified patterns, to standard output. If a named file is of
                 type directory, the file hierarchy rooted at that file shall
                 be listed as well.

       rreeaadd      In rreeaadd mode (when --rr is specified, but --ww is not), _p_a_x shall
                 extract the members of the archive file read from the
                 standard input, with pathnames matching the specified
                 patterns. If an extracted file is of type directory, the file
                 hierarchy rooted at that file shall be extracted as well. The
                 extracted files shall be created performing pathname
                 resolution with the directory in which _p_a_x was invoked as the
                 current working directory.

                 If an attempt is made to extract a directory when the
                 directory already exists, this shall not be considered an
                 error. If an attempt is made to extract a FIFO when the FIFO
                 already exists, this shall not be considered an error.

                 The ownership, access, and modification times, and file mode
                 of the restored files are discussed under the --pp option.

       wwrriittee     In wwrriittee mode (when --ww is specified, but --rr is not), _p_a_x
                 shall write the contents of the _f_i_l_e operands to the standard
                 output in an archive format. If no _f_i_l_e operands are
                 specified, a list of files to copy, one per line, shall be
                 read from the standard input and each entry in this list
                 shall be processed as if it had been a _f_i_l_e operand on the
                 command line. A file of type directory shall include all of
                 the files in the file hierarchy rooted at the file.

       ccooppyy      In ccooppyy mode (when both --rr and --ww are specified), _p_a_x shall
                 copy the _f_i_l_e operands to the destination directory.

                 If no _f_i_l_e operands are specified, a list of files to copy,
                 one per line, shall be read from the standard input. A file
                 of type directory shall include all of the files in the file
                 hierarchy rooted at the file.

                 The effect of the ccooppyy shall be as if the copied files were
                 written to a _p_a_x format archive file and then subsequently
                 extracted, except that copying of sockets may be supported
                 even if archiving them in write mode is not supported, and
                 that there may be hard links between the original and the
                 copied files. If the destination directory is a subdirectory
                 of one of the files to be copied, the results are
                 unspecified. If the destination directory is a file of a type
                 not defined by the System Interfaces volume of POSIX.1-2017,
                 the results are implementation-defined; otherwise, it shall
                 be an error for the file named by the _d_i_r_e_c_t_o_r_y operand not
                 to exist, not be writable by the user, or not be a file of
                 type directory.

       In rreeaadd or ccooppyy modes, if intermediate directories are necessary to
       extract an archive member, _p_a_x shall perform actions equivalent to the
       _m_k_d_i_r() function defined in the System Interfaces volume of
       POSIX.1-2017, called with the following arguments:

        *  The intermediate directory used as the _p_a_t_h argument

        *  The value of the bitwise-inclusive OR of S_IRWXU, S_IRWXG, and
           S_IRWXO as the _m_o_d_e argument

       If any specified _p_a_t_t_e_r_n or _f_i_l_e operands are not matched by at least
       one file or archive member, _p_a_x shall write a diagnostic message to
       standard error for each one that did not match and exit with a non-zero
       exit status.

       The archive formats described in the EXTENDED DESCRIPTION section shall
       be automatically detected on input. The default output archive format
       shall be implementation-defined.

       A single archive can span multiple files. The _p_a_x utility shall
       determine, in an implementation-defined manner, what file to read or
       write as the next file.

       If the selected archive format supports the specification of linked
       files, it shall be an error if these files cannot be linked when the
       archive is extracted. For archive formats that do not store file
       contents with each name that causes a hard link, if the file that
       contains the data is not extracted during this _p_a_x session, either the
       data shall be restored from the original file, or a diagnostic message
       shall be displayed with the name of a file that can be used to extract
       the data. In traversing directories, _p_a_x shall detect infinite loops;
       that is, entering a previously visited directory that is an ancestor of
       the last file visited. When it detects an infinite loop, _p_a_x shall
       write a diagnostic message to standard error and shall terminate.

OOPPTTIIOONNSS
       The _p_a_x utility shall conform to the Base Definitions volume of
       POSIX.1-2017, _S_e_c_t_i_o_n _1_2_._2, _U_t_i_l_i_t_y _S_y_n_t_a_x _G_u_i_d_e_l_i_n_e_s, except that the
       order of presentation of the --oo, --pp, and --ss options is significant.

       The following options shall be supported:

       --rr        Read an archive file from standard input.

       --ww        Write files to the standard output in the specified archive
                 format.

       --aa        Append files to the end of the archive. It is implementation-
                 defined which devices on the system support appending.
                 Additional file formats unspecified by this volume of
                 POSIX.1-2017 may impose restrictions on appending.

       --bb _b_l_o_c_k_s_i_z_e
                 Block the output at a positive decimal integer number of
                 bytes per write to the archive file. Devices and archive
                 formats may impose restrictions on blocking. Blocking shall
                 be automatically determined on input. Conforming applications
                 shall not specify a _b_l_o_c_k_s_i_z_e value larger than 32256.
                 Default blocking when creating archives depends on the
                 archive format. (See the --xx option below.)

       --cc        Match all file or archive members except those specified by
                 the _p_a_t_t_e_r_n or _f_i_l_e operands.

       --dd        Cause files of type directory being copied or archived or
                 archive members of type directory being extracted or listed
                 to match only the file or archive member itself and not the
                 file hierarchy rooted at the file.

       --ff _a_r_c_h_i_v_e
                 Specify the pathname of the input or output archive,
                 overriding the default standard input (in lliisstt or rreeaadd modes)
                 or standard output (wwrriittee mode).

       --HH        If a symbolic link referencing a file of type directory is
                 specified on the command line, _p_a_x shall archive the file
                 hierarchy rooted in the file referenced by the link, using
                 the name of the link as the root of the file hierarchy.
                 Otherwise, if a symbolic link referencing a file of any other
                 file type which _p_a_x can normally archive is specified on the
                 command line, then _p_a_x shall archive the file referenced by
                 the link, using the name of the link. The default behavior,
                 when neither --HH or --LL are specified, shall be to archive the
                 symbolic link itself.

       --ii        Interactively rename files or archive members. For each
                 archive member matching a _p_a_t_t_e_r_n operand or file matching a
                 _f_i_l_e operand, a prompt shall be written to the file //ddeevv//ttttyy.
                 The prompt shall contain the name of the file or archive
                 member, but the format is otherwise unspecified. A line shall
                 then be read from //ddeevv//ttttyy.  If this line is blank, the file
                 or archive member shall be skipped. If this line consists of
                 a single period, the file or archive member shall be
                 processed with no modification to its name. Otherwise, its
                 name shall be replaced with the contents of the line. The _p_a_x
                 utility shall immediately exit with a non-zero exit status if
                 end-of-file is encountered when reading a response or if
                 //ddeevv//ttttyy cannot be opened for reading and writing.

                 The results of extracting a hard link to a file that has been
                 renamed during extraction are unspecified.

       --kk        Prevent the overwriting of existing files.

       --ll        (The letter ell.) In ccooppyy mode, hard links shall be made
                 between the source and destination file hierarchies whenever
                 possible. If specified in conjunction with --HH or --LL, when a
                 symbolic link is encountered, the hard link created in the
                 destination file hierarchy shall be to the file referenced by
                 the symbolic link. If specified when neither --HH nor --LL is
                 specified, when a symbolic link is encountered, the
                 implementation shall create a hard link to the symbolic link
                 in the source file hierarchy or copy the symbolic link to the
                 destination.

       --LL        If a symbolic link referencing a file of type directory is
                 specified on the command line or encountered during the
                 traversal of a file hierarchy, _p_a_x shall archive the file
                 hierarchy rooted in the file referenced by the link, using
                 the name of the link as the root of the file hierarchy.
                 Otherwise, if a symbolic link referencing a file of any other
                 file type which _p_a_x can normally archive is specified on the
                 command line or encountered during the traversal of a file
                 hierarchy, _p_a_x shall archive the file referenced by the link,
                 using the name of the link. The default behavior, when
                 neither --HH or --LL are specified, shall be to archive the
                 symbolic link itself.

       --nn        Select the first archive member that matches each _p_a_t_t_e_r_n
                 operand. No more than one archive member shall be matched for
                 each pattern (although members of type directory shall still
                 match the file hierarchy rooted at that file).

       --oo _o_p_t_i_o_n_s
                 Provide information to the implementation to modify the
                 algorithm for extracting or writing files. The value of
                 _o_p_t_i_o_n_s shall consist of one or more <comma>-separated
                 keywords of the form:


                     _k_e_y_w_o_r_d[[[[:]]=_v_a_l_u_e]][[,_k_e_y_w_o_r_d[[[[:]]=_v_a_l_u_e]], ...]]

                 Some keywords apply only to certain file formats, as
                 indicated with each description. Use of keywords that are
                 inapplicable to the file format being processed produces
                 undefined results.

                 Keywords in the _o_p_t_i_o_n_s argument shall be a string that would
                 be a valid portable filename as described in the Base
                 Definitions volume of POSIX.1-2017, _S_e_c_t_i_o_n _3_._2_8_2, _P_o_r_t_a_b_l_e
                 _F_i_l_e_n_a_m_e _C_h_a_r_a_c_t_e_r _S_e_t.

                 NNoottee::     Keywords are not expected to be filenames, merely
                           to follow the same character composition rules as
                           portable filenames.

                 Keywords can be preceded with white space. The _v_a_l_u_e field
                 shall consist of zero or more characters; within _v_a_l_u_e, the
                 application shall precede any literal <comma> with a
                 <backslash>, which shall be ignored, but preserves the
                 <comma> as part of _v_a_l_u_e.  A <comma> as the final character,
                 or a <comma> followed solely by white space as the final
                 characters, in _o_p_t_i_o_n_s shall be ignored. Multiple --oo options
                 can be specified; if keywords given to these multiple --oo
                 options conflict, the keywords and values appearing later in
                 command line sequence shall take precedence and the earlier
                 shall be silently ignored. The following keyword values of
                 _o_p_t_i_o_n_s shall be supported for the file formats as indicated:

                 ddeelleettee=_p_a_t_t_e_r_n
                       (Applicable only to the --xx ppaaxx format.) When used in
                       wwrriittee or ccooppyy mode, _p_a_x shall omit from extended header
                       records that it produces any keywords matching the
                       string pattern. When used in rreeaadd or lliisstt mode, _p_a_x
                       shall ignore any keywords matching the string pattern
                       in the extended header records. In both cases, matching
                       shall be performed using the pattern matching notation
                       described in _S_e_c_t_i_o_n _2_._1_3_._1, _P_a_t_t_e_r_n_s _M_a_t_c_h_i_n_g _a _S_i_n_g_l_e
                       _C_h_a_r_a_c_t_e_r and _S_e_c_t_i_o_n _2_._1_3_._2, _P_a_t_t_e_r_n_s _M_a_t_c_h_i_n_g
                       _M_u_l_t_i_p_l_e _C_h_a_r_a_c_t_e_r_s.  For example:


                           -o ddeelleettee=_s_e_c_u_r_i_t_y.*

                       would suppress security-related information. See _p_a_x
                       _E_x_t_e_n_d_e_d _H_e_a_d_e_r for extended header record keyword
                       usage.

                       When multiple --ooddeelleettee==ppaatttteerrnn options are specified,
                       the patterns shall be additive; all keywords matching
                       the specified string patterns shall be omitted from
                       extended header records that _p_a_x produces.

                 eexxtthhddrr..nnaammee=_s_t_r_i_n_g
                       (Applicable only to the --xx ppaaxx format.) This keyword
                       allows user control over the name that is written into
                       the uussttaarr header blocks for the extended header
                       produced under the circumstances described in _p_a_x
                       _H_e_a_d_e_r _B_l_o_c_k.  The name shall be the contents of
                       _s_t_r_i_n_g, after the following character substitutions
                       have been made:

                        +----------+----------------------------------------+
                        | _s_t_r_i_n_g   |                                        |
                        |IInncclluuddeess:: |              RReeppllaacceedd bbyy::              |
                        +----------+----------------------------------------+
                        |%d        | The directory name of the file,        |
                        |          | equivalent to the result of the        |
                        |          | _d_i_r_n_a_m_e utility on the translated      |
                        |          | pathname.                              |
                        |%f        | The filename of the file, equivalent   |
                        |          | to the result of the _b_a_s_e_n_a_m_e utility  |
                        |          | on the translated pathname.            |
                        |%p        | The process ID of the _p_a_x process.     |
                        |%%        | A ''%%'' character.                       |
                        +----------+----------------------------------------+
                       Any other ''%%'' characters in _s_t_r_i_n_g produce undefined
                       results.

                       If no --oo eexxtthhddrr..nnaammee==ssttrriinngg is specified, _p_a_x shall use
                       the following default value:


                           %d/PaxHeaders.%p/%f

                 gglloobbeexxtthhddrr..nnaammee=_s_t_r_i_n_g
                       (Applicable only to the --xx ppaaxx format.) When used in
                       wwrriittee or ccooppyy mode with the appropriate options, _p_a_x
                       shall create global extended header records with uussttaarr
                       header blocks that will be treated as regular files by
                       previous versions of _p_a_x.  This keyword allows user
                       control over the name that is written into the uussttaarr
                       header blocks for global extended header records. The
                       name shall be the contents of string, after the
                       following character substitutions have been made:

                        +----------+----------------------------------------+
                        | _s_t_r_i_n_g   |                                        |
                        |IInncclluuddeess:: |              RReeppllaacceedd bbyy::              |
                        +----------+----------------------------------------+
                        |%n        | An integer that represents the         |
                        |          | sequence number of the global extended |
                        |          | header record in the archive, starting |
                        |          | at 1.                                  |
                        |%p        | The process ID of the _p_a_x process.     |
                        |%%        | A ''%%'' character.                       |
                        +----------+----------------------------------------+
                       Any other ''%%'' characters in _s_t_r_i_n_g produce undefined
                       results.

                       If no --oo gglloobbeexxtthhddrr..nnaammee==ssttrriinngg is specified, _p_a_x shall
                       use the following default value:


                           $TMPDIR/GlobalHead.%p.%n

                       where $_T_M_P_D_I_R represents the value of the _T_M_P_D_I_R
                       environment variable. If _T_M_P_D_I_R is not set, _p_a_x shall
                       use //ttmmpp.

                 iinnvvaalliidd=_a_c_t_i_o_n
                       (Applicable only to the --xx ppaaxx format.) This keyword
                       allows user control over the action _p_a_x takes upon
                       encountering values in an extended header record that,
                       in rreeaadd or ccooppyy mode, are invalid in the destination
                       hierarchy or, in lliisstt mode, cannot be written in the
                       codeset and current locale of the implementation. The
                       following are invalid values that shall be recognized
                       by _p_a_x:

                       --  In rreeaadd or ccooppyy mode, a filename or link name that
                           contains character encodings invalid in the
                           destination hierarchy. (For example, the name may
                           contain embedded NULs.)

                       --  In rreeaadd or ccooppyy mode, a filename or link name that
                           is longer than the maximum allowed in the
                           destination hierarchy (for either a pathname
                           component or the entire pathname).

                       --  In lliisstt mode, any character string value (filename,
                           link name, user name, and so on) that cannot be
                           written in the codeset and current locale of the
                           implementation.

                       The following mutually-exclusive values of the _a_c_t_i_o_n
                       argument are supported:

                       bbiinnaarryy    In wwrriittee mode, _p_a_x shall generate a
                                 hhddrrcchhaarrsseett=BBIINNAARRYY extended header record for
                                 each file with a filename, link name, group
                                 name, owner name, or any other field in an
                                 extended header record that cannot be
                                 translated to the UTF-8 codeset, allowing the
                                 archive to contain the files with unencoded
                                 extended header record values. In rreeaadd or
                                 ccooppyy mode, _p_a_x shall use the values specified
                                 in the header without translation, regardless
                                 of whether this may overwrite an existing
                                 file with a valid name. In lliisstt mode, _p_a_x
                                 shall behave identically to the bbyyppaassss
                                 action.

                       bbyyppaassss    In rreeaadd or ccooppyy mode, _p_a_x shall bypass the
                                 file, causing no change to the destination
                                 hierarchy.  In lliisstt mode, _p_a_x shall write all
                                 requested valid values for the file, but its
                                 method for writing invalid values is
                                 unspecified.

                       rreennaammee    In rreeaadd or ccooppyy mode, _p_a_x shall act as if the
                                 --ii option were in effect for each file with
                                 invalid filename or link name values,
                                 allowing the user to provide a replacement
                                 name interactively.  In lliisstt mode, _p_a_x shall
                                 behave identically to the bbyyppaassss action.

                       UUTTFF--88     When used in rreeaadd, ccooppyy, or lliisstt mode and a
                                 filename, link name, owner name, or any other
                                 field in an extended header record cannot be
                                 translated from the ppaaxx UTF-8 codeset format
                                 to the codeset and current locale of the
                                 implementation, _p_a_x shall use the actual
                                 UTF-8 encoding for the name. If a hhddrrcchhaarrsseett
                                 extended header record is in effect for this
                                 file, the character set specified by that
                                 record shall be used instead of UTF-8. If a
                                 hhddrrcchhaarrsseett=BBIINNAARRYY extended header record is
                                 in effect for this file, no translation shall
                                 be performed.

                       wwrriittee     In rreeaadd or ccooppyy mode, _p_a_x shall write the
                                 file, translating the name, regardless of
                                 whether this may overwrite an existing file
                                 with a valid name. In lliisstt mode, _p_a_x shall
                                 behave identically to the bbyyppaassss action.

                       If no --oo iinnvvaalliidd==ooppttiioonn is specified, _p_a_x shall act as
                       if --ooiinnvvaalliidd==bbyyppaassss were specified. Any overwriting of
                       existing files that may be allowed by the --ooiinnvvaalliidd==
                       actions shall be subject to permission (--pp) and
                       modification time (--uu) restrictions, and shall be
                       suppressed if the --kk option is also specified.

                 lliinnkkddaattaa
                       (Applicable only to the --xx ppaaxx format.) In wwrriittee mode,
                       _p_a_x shall write the contents of a file to the archive
                       even when that file is merely a hard link to a file
                       whose contents have already been written to the
                       archive.

                 lliissttoopptt=_f_o_r_m_a_t
                       This keyword specifies the output format of the table
                       of contents produced when the --vv option is specified in
                       lliisstt mode. See _L_i_s_t _M_o_d_e _F_o_r_m_a_t _S_p_e_c_i_f_i_c_a_t_i_o_n_s.  To
                       avoid ambiguity, the lliissttoopptt==ffoorrmmaatt shall be the only
                       or final kkeeyywwoorrdd==vvaalluuee pair in a --oo option-argument;
                       all characters in the remainder of the option-argument
                       shall be considered part of the format string. When
                       multiple --oolliissttoopptt==ffoorrmmaatt options are specified, the
                       format strings shall be considered a single,
                       concatenated string, evaluated in command line order.

                 ttiimmeess
                       (Applicable only to the --xx _p_a_x format.) When used in
                       wwrriittee or ccooppyy mode, _p_a_x shall include aattiimmee and mmttiimmee
                       extended header records for each file. See _p_a_x _E_x_t_e_n_d_e_d
                       _H_e_a_d_e_r _F_i_l_e _T_i_m_e_s.

                 In addition to these keywords, if the --xx _p_a_x format is
                 specified, any of the keywords and values defined in _p_a_x
                 _E_x_t_e_n_d_e_d _H_e_a_d_e_r, including implementation extensions, can be
                 used in --oo option-arguments, in either of two modes:

                 kkeeyywwoorrdd=_v_a_l_u_e
                       When used in wwrriittee or ccooppyy mode, these keyword/value
                       pairs shall be included at the beginning of the archive
                       as ttyyppeeffllaagg gg global extended header records. When used
                       in rreeaadd or lliisstt mode, these keyword/value pairs shall
                       act as if they had been at the beginning of the archive
                       as ttyyppeeffllaagg gg global extended header records.

                 kkeeyywwoorrdd:=_v_a_l_u_e
                       When used in wwrriittee or ccooppyy mode, these keyword/value
                       pairs shall be included as records at the beginning of
                       a ttyyppeeffllaagg xx extended header for each file. (This shall
                       be equivalent to the <equals-sign> form except that it
                       creates no ttyyppeeffllaagg gg global extended header records.)
                       When used in rreeaadd or lliisstt mode, these keyword/value
                       pairs shall act as if they were included as records at
                       the end of each extended header; thus, they shall
                       override any global or file-specific extended header
                       record keywords of the same names. For example, in the
                       command:


                           pax -r -o "
                           gname:=mygroup,
                           " <archive

                       the group name will be forced to a new value for all
                       files read from the archive.

                 The precedence of --oo keywords over various fields in the
                 archive is described in _p_a_x _E_x_t_e_n_d_e_d _H_e_a_d_e_r _K_e_y_w_o_r_d
                 _P_r_e_c_e_d_e_n_c_e.  If the --oo ddeelleettee=_p_a_t_t_e_r_n, --oo kkeeyywwoorrdd=_v_a_l_u_e, or
                 --oo kkeeyywwoorrdd:=_v_a_l_u_e options are used to override or remove any
                 extended header data needed to find files in an archive
                 (e.g., --oo ddeelleettee==ssiizzee for a file whose size cannot be
                 represented in a uussttaarr header or --oo ssiizzee==110000 for a file whose
                 size is not 100 bytes), the behavior is undefined.

       --pp _s_t_r_i_n_g Specify one or more file characteristic options (privileges).
                 The _s_t_r_i_n_g option-argument shall be a string specifying file
                 characteristics to be retained or discarded on extraction.
                 The string shall consist of the specification characters aa,
                 ee, mm, oo, and pp.  Other implementation-defined characters can
                 be included. Multiple characteristics can be concatenated
                 within the same string and multiple --pp options can be
                 specified. The meaning of the specification characters are as
                 follows:

                 a     Do not preserve file access times.

                 e     Preserve the user ID, group ID, file mode bits (see the
                       Base Definitions volume of POSIX.1-2017, _S_e_c_t_i_o_n _3_._1_6_9,
                       _F_i_l_e _M_o_d_e _B_i_t_s), access time, modification time, and
                       any other implementation-defined file characteristics.

                 m     Do not preserve file modification times.

                 o     Preserve the user ID and group ID.

                 p     Preserve the file mode bits. Other implementation-
                       defined file mode attributes may be preserved.

                 In the preceding list, ``preserve'' indicates that an
                 attribute stored in the archive shall be given to the
                 extracted file, subject to the permissions of the invoking
                 process. The access and modification times of the file shall
                 be preserved unless otherwise specified with the --pp option or
                 not stored in the archive. All attributes that are not
                 preserved shall be determined as part of the normal file
                 creation action (see _S_e_c_t_i_o_n _1_._1_._1_._4, _F_i_l_e _R_e_a_d, _W_r_i_t_e, _a_n_d
                 _C_r_e_a_t_i_o_n).

                 If neither the ee nor the oo specification character is
                 specified, or the user ID and group ID are not preserved for
                 any reason, _p_a_x shall not set the S_ISUID and S_ISGID bits of
                 the file mode.

                 If the preservation of any of these items fails for any
                 reason, _p_a_x shall write a diagnostic message to standard
                 error. Failure to preserve these items shall affect the final
                 exit status, but shall not cause the extracted file to be
                 deleted.

                 If file characteristic letters in any of the _s_t_r_i_n_g option-
                 arguments are duplicated or conflict with each other, the
                 ones given last shall take precedence. For example, if --pp eemmee
                 is specified, file modification times are preserved.

       --ss _r_e_p_l_s_t_r
                 Modify file or archive member names named by _p_a_t_t_e_r_n or _f_i_l_e
                 operands according to the substitution expression _r_e_p_l_s_t_r,
                 using the syntax of the _e_d utility. The concepts of
                 ``address'' and ``line'' are meaningless in the context of
                 the _p_a_x utility, and shall not be supplied. The format shall
                 be:


                     -s /_o_l_d/_n_e_w/[[gp]]

                 where as in _e_d, _o_l_d is a basic regular expression and _n_e_w can
                 contain an <ampersand>, ''\\nn'' (where _n is a digit) back-
                 references, or subexpression matching. The _o_l_d string shall
                 also be permitted to contain <newline> characters.

                 Any non-null character can be used as a delimiter (''//'' shown
                 here). Multiple --ss expressions can be specified; the
                 expressions shall be applied in the order specified,
                 terminating with the first successful substitution.  The
                 optional trailing ''gg'' is as defined in the _e_d utility. The
                 optional trailing ''pp'' shall cause successful substitutions to
                 be written to standard error.  File or archive member names
                 that substitute to the empty string shall be ignored when
                 reading and writing archives.

       --tt        When reading files from the file system, and if the user has
                 the permissions required by _u_t_i_m_e() to do so, set the access
                 time of each file read to the access time that it had before
                 being read by _p_a_x.

       --uu        Ignore files that are older (having a less recent file
                 modification time) than a pre-existing file or archive member
                 with the same name.  In rreeaadd mode, an archive member with the
                 same name as a file in the file system shall be extracted if
                 the archive member is newer than the file. In wwrriittee mode, an
                 archive file member with the same name as a file in the file
                 system shall be superseded if the file is newer than the
                 archive member. If --aa is also specified, this is accomplished
                 by appending to the archive; otherwise, it is unspecified
                 whether this is accomplished by actual replacement in the
                 archive or by appending to the archive. In ccooppyy mode, the
                 file in the destination hierarchy shall be replaced by the
                 file in the source hierarchy or by a link to the file in the
                 source hierarchy if the file in the source hierarchy is
                 newer.

       --vv        In lliisstt mode, produce a verbose table of contents (see the
                 STDOUT section).  Otherwise, write archive member pathnames
                 to standard error (see the STDERR section).

       --xx _f_o_r_m_a_t Specify the output archive format. The _p_a_x utility shall
                 support the following formats:

                 ccppiioo      The ccppiioo interchange format; see the EXTENDED
                           DESCRIPTION section. The default _b_l_o_c_k_s_i_z_e for this
                           format for character special archive files shall be
                           5120.  Implementations shall support all _b_l_o_c_k_s_i_z_e
                           values less than or equal to 32256 that are
                           multiples of 512.

                 ppaaxx       The ppaaxx interchange format; see the EXTENDED
                           DESCRIPTION section. The default _b_l_o_c_k_s_i_z_e for this
                           format for character special archive files shall be
                           5120.  Implementations shall support all _b_l_o_c_k_s_i_z_e
                           values less than or equal to 32256 that are
                           multiples of 512.

                 uussttaarr     The ttaarr interchange format; see the EXTENDED
                           DESCRIPTION section. The default _b_l_o_c_k_s_i_z_e for this
                           format for character special archive files shall be
                           10240.  Implementations shall support all _b_l_o_c_k_s_i_z_e
                           values less than or equal to 32256 that are
                           multiples of 512.

                 Implementation-defined formats shall specify a default block
                 size as well as any other block sizes supported for character
                 special archive files.

                 Any attempt to append to an archive file in a format
                 different from the existing archive format shall cause _p_a_x to
                 exit immediately with a non-zero exit status.

       --XX        When traversing the file hierarchy specified by a pathname,
                 _p_a_x shall not descend into directories that have a different
                 device ID (_s_t___d_e_v; see the System Interfaces volume of
                 POSIX.1-2017, _s_t_a_t()).

       Specifying more than one of the mutually-exclusive options --HH and --LL
       shall not be considered an error and the last option specified shall
       determine the behavior of the utility.

       The options that operate on the names of files or archive members (--cc,
       --ii, --nn, --ss, --uu, and --vv) shall interact as follows. In rreeaadd mode, the
       archive members shall be selected based on the user-specified _p_a_t_t_e_r_n
       operands as modified by the --cc, --nn, and --uu options. Then, any --ss and --ii
       options shall modify, in that order, the names of the selected files.
       The --vv option shall write names resulting from these modifications.

       In wwrriittee mode, the files shall be selected based on the user-specified
       pathnames as modified by the --nn and --uu options. Then, any --ss and --ii
       options shall modify, in that order, the names of these selected files.
       The --vv option shall write names resulting from these modifications.

       If both the --uu and --nn options are specified, _p_a_x shall not consider a
       file selected unless it is newer than the file to which it is compared.

   LLiisstt MMooddee FFoorrmmaatt SSppeecciiffiiccaattiioonnss
       In lliisstt mode with the --oo lliissttoopptt==ffoorrmmaatt option, the _f_o_r_m_a_t argument
       shall be applied for each selected file. The _p_a_x utility shall append a
       <newline> to the lliissttoopptt output for each selected file. The _f_o_r_m_a_t
       argument shall be used as the _f_o_r_m_a_t string described in the Base
       Definitions volume of POSIX.1-2017, _C_h_a_p_t_e_r _5, _F_i_l_e _F_o_r_m_a_t _N_o_t_a_t_i_o_n,
       with the exceptions 1. through 6. defined in the EXTENDED DESCRIPTION
       section of _p_r_i_n_t_f, plus the following exceptions:

       7.    The sequence (_k_e_y_w_o_r_d) can occur before a format conversion
             specifier. The conversion argument is defined by the value of
             _k_e_y_w_o_r_d.  The implementation shall support the following
             keywords:

             --  Any of the Field Name entries in _T_a_b_l_e _4_-_1_4_, _u_s_t_a_r _H_e_a_d_e_r
                 _B_l_o_c_k and _T_a_b_l_e _4_-_1_6_, _O_c_t_e_t_-_O_r_i_e_n_t_e_d _c_p_i_o _A_r_c_h_i_v_e _E_n_t_r_y.  The
                 implementation may support the _c_p_i_o keywords without the
                 leading cc__ in addition to the form required by _T_a_b_l_e _4_-_1_6_,
                 _O_c_t_e_t_-_O_r_i_e_n_t_e_d _c_p_i_o _A_r_c_h_i_v_e _E_n_t_r_y.

             --  Any keyword defined for the extended header in _p_a_x _E_x_t_e_n_d_e_d
                 _H_e_a_d_e_r.

             --  Any keyword provided as an implementation-defined extension
                 within the extended header defined in _p_a_x _E_x_t_e_n_d_e_d _H_e_a_d_e_r.

             For example, the sequence ""%%((cchhaarrsseett))ss"" is the string value of
             the name of the character set in the extended header.

             The result of the keyword conversion argument shall be the value
             from the applicable header field or extended header, without any
             trailing NULs.

             All keyword values used as conversion arguments shall be
             translated from the UTF-8 encoding (or alternative encoding
             specified by any hhddrrcchhaarrsseett extended header record) to the
             character set appropriate for the local file system, user
             database, and so on, as applicable.

       8.    An additional conversion specifier character, TT, shall be used to
             specify time formats. The TT conversion specifier character can be
             preceded by the sequence (_k_e_y_w_o_r_d_=_s_u_b_f_o_r_m_a_t), where _s_u_b_f_o_r_m_a_t is
             a date format as defined by _d_a_t_e operands. The default _k_e_y_w_o_r_d
             shall be mmttiimmee and the default subformat shall be:


                 %b %e %H:%M %Y

       9.    An additional conversion specifier character, MM, shall be used to
             specify the file mode string as defined in _l_s Standard Output. If
             (_k_e_y_w_o_r_d) is omitted, the mmooddee keyword shall be used. For
             example, %%..11MM writes the single character corresponding to the
             <_e_n_t_r_y _t_y_p_e> field of the _l_s --ll command.

       10.   An additional conversion specifier character, DD, shall be used to
             specify the device for block or special files, if applicable, in
             an implementation-defined format. If not applicable, and
             (_k_e_y_w_o_r_d) is specified, then this conversion shall be equivalent
             to %(_k_e_y_w_o_r_d)u. If not applicable, and (_k_e_y_w_o_r_d) is omitted, then
             this conversion shall be equivalent to <space>.

       11.   An additional conversion specifier character, FF, shall be used to
             specify a pathname. The FF conversion character can be preceded by
             a sequence of <comma>-separated keywords:


                 (_k_e_y_w_o_r_d[[,_k_e_y_w_o_r_d]] ... )

             The values for all the keywords that are non-null shall be
             concatenated together, each separated by a ''//''.  The default
             shall be (ppaatthh) if the keyword ppaatthh is defined; otherwise, the
             default shall be (pprreeffiixx,nnaammee).

       12.   An additional conversion specifier character, LL, shall be used to
             specify a symbolic link expansion. If the current file is a
             symbolic link, then %%LL shall expand to:


                 "%s -> %s", <_v_a_l_u_e _o_f _k_e_y_w_o_r_d>, <_c_o_n_t_e_n_t_s _o_f _l_i_n_k>

             Otherwise, the %%LL conversion specification shall be the
             equivalent of %%FF.

OOPPEERRAANNDDSS
       The following operands shall be supported:

       _d_i_r_e_c_t_o_r_y The destination directory pathname for ccooppyy mode.

       _f_i_l_e      A pathname of a file to be copied or archived.

       _p_a_t_t_e_r_n   A pattern matching one or more pathnames of archive members.
                 A pattern must be given in the name-generating notation of
                 the pattern matching notation in _S_e_c_t_i_o_n _2_._1_3, _P_a_t_t_e_r_n
                 _M_a_t_c_h_i_n_g _N_o_t_a_t_i_o_n, including the filename expansion rules in
                 _S_e_c_t_i_o_n _2_._1_3_._3, _P_a_t_t_e_r_n_s _U_s_e_d _f_o_r _F_i_l_e_n_a_m_e _E_x_p_a_n_s_i_o_n.  The
                 default, if no _p_a_t_t_e_r_n is specified, is to select all members
                 in the archive.

SSTTDDIINN
       In wwrriittee mode, the standard input shall be used only if no _f_i_l_e
       operands are specified. It shall be a file containing a list of
       pathnames, each terminated by a <newline> character.

       In lliisstt and rreeaadd modes, if --ff is not specified, the standard input
       shall be an archive file.

       Otherwise, the standard input shall not be used.

IINNPPUUTT FFIILLEESS
       The input file named by the _a_r_c_h_i_v_e option-argument, or standard input
       when the archive is read from there, shall be a file formatted
       according to one of the specifications in the EXTENDED DESCRIPTION
       section or some other implementation-defined format.

       The file //ddeevv//ttttyy shall be used to write prompts and read responses.

EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS
       The following environment variables shall affect the execution of _p_a_x:

       _L_A_N_G      Provide a default value for the internationalization
                 variables that are unset or null. (See the Base Definitions
                 volume of POSIX.1-2017, _S_e_c_t_i_o_n _8_._2, _I_n_t_e_r_n_a_t_i_o_n_a_l_i_z_a_t_i_o_n
                 _V_a_r_i_a_b_l_e_s the precedence of internationalization variables
                 used to determine the values of locale categories.)

       _L_C___A_L_L    If set to a non-empty string value, override the values of
                 all the other internationalization variables.

       _L_C___C_O_L_L_A_T_E
                 Determine the locale for the behavior of ranges, equivalence
                 classes, and multi-character collating elements used in the
                 pattern matching expressions for the _p_a_t_t_e_r_n operand, the
                 basic regular expression for the --ss option, and the extended
                 regular expression defined for the yyeesseexxpprr locale keyword in
                 the _L_C___M_E_S_S_A_G_E_S category.

       _L_C___C_T_Y_P_E  Determine the locale for the interpretation of sequences of
                 bytes of text data as characters (for example, single-byte as
                 opposed to multi-byte characters in arguments and input
                 files), the behavior of character classes used in the
                 extended regular expression defined for the yyeesseexxpprr locale
                 keyword in the _L_C___M_E_S_S_A_G_E_S category, and pattern matching.

       _L_C___M_E_S_S_A_G_E_S
                 Determine the locale used to process affirmative responses,
                 and the locale used to affect the format and contents of
                 diagnostic messages and prompts written to standard error.

       _L_C___T_I_M_E   Determine the format and contents of date and time strings
                 when the --vv option is specified.

       _N_L_S_P_A_T_H   Determine the location of message catalogs for the processing
                 of _L_C___M_E_S_S_A_G_E_S.

       _T_M_P_D_I_R    Determine the pathname that provides part of the default
                 global extended header record file, as described for the --oo
                 gglloobbeexxtthhddrr== keyword in the OPTIONS section.

       _T_Z        Determine the timezone used to calculate date and time
                 strings when the --vv option is specified. If _T_Z is unset or
                 null, an unspecified default timezone shall be used.

AASSYYNNCCHHRROONNOOUUSS EEVVEENNTTSS
       Default.

SSTTDDOOUUTT
       In wwrriittee mode, if --ff is not specified, the standard output shall be the
       archive formatted according to one of the specifications in the
       EXTENDED DESCRIPTION section, or some other implementation-defined
       format (see --xx _f_o_r_m_a_t).

       In lliisstt mode, when the --oolliissttoopptt=_f_o_r_m_a_t has been specified, the
       selected archive members shall be written to standard output using the
       format described under _L_i_s_t _M_o_d_e _F_o_r_m_a_t _S_p_e_c_i_f_i_c_a_t_i_o_n_s.  In lliisstt mode
       without the --oolliissttoopptt=_f_o_r_m_a_t option, the table of contents of the
       selected archive members shall be written to standard output using the
       following format:


           "%s\n", <_p_a_t_h_n_a_m_e>

       If the --vv option is specified in lliisstt mode, the table of contents of
       the selected archive members shall be written to standard output using
       the following formats.

       For pathnames representing hard links to previous members of the
       archive:


           "%s == %s\n", <_l_s -l _l_i_s_t_i_n_g>, <_l_i_n_k_n_a_m_e>

       For all other pathnames:


           "%s\n", <_l_s -l _l_i_s_t_i_n_g>

       where <_l_s -l _l_i_s_t_i_n_g> shall be the format specified by the _l_s utility
       with the --ll option. When writing pathnames in this format, it is
       unspecified what is written for fields for which the underlying archive
       format does not have the correct information, although the correct
       number of <blank>-separated fields shall be written.

       In lliisstt mode, standard output shall not be buffered more than a
       pathname (plus any associated information and a <newline> terminator)
       at a time.

SSTTDDEERRRR
       If --vv is specified in rreeaadd, wwrriittee, or ccooppyy modes, _p_a_x shall write the
       pathnames it processes to the standard error output using the following
       format:


           "%s\n", <_p_a_t_h_n_a_m_e>

       These pathnames shall be written as soon as processing is begun on the
       file or archive member, and shall be flushed to standard error. The
       trailing <newline>, which shall not be buffered, is written when the
       file has been read or written.

       If the --ss option is specified, and the replacement string has a
       trailing ''pp'', substitutions shall be written to standard error in the
       following format:


           "%s >> %s\n", <_o_r_i_g_i_n_a_l _p_a_t_h_n_a_m_e>, <_n_e_w _p_a_t_h_n_a_m_e>

       In all operating modes of _p_a_x, optional messages of unspecified format
       concerning the input archive format and volume number, the number of
       files, blocks, volumes, and media parts as well as other diagnostic
       messages may be written to standard error.

       In all formats, for both standard output and standard error, it is
       unspecified how non-printable characters in pathnames or link names are
       written.

       When using the --xxppaaxx archive format, if a filename, link name, group
       name, owner name, or any other field in an extended header record
       cannot be translated between the codeset in use for that extended
       header record and the character set of the current locale, _p_a_x shall
       write a diagnostic message to standard error, shall process the file as
       described for the --oo iinnvvaalliidd== option, and then shall continue
       processing with the next file.

OOUUTTPPUUTT FFIILLEESS
       In rreeaadd mode, the extracted output files shall be of the archived file
       type.  In ccooppyy mode, the copied output files shall be the type of the
       file being copied. In either mode, existing files in the destination
       hierarchy shall be overwritten only when all permission (--pp),
       modification time (--uu), and invalid-value (--ooiinnvvaalliidd==) tests allow it.

       In wwrriittee mode, the output file named by the --ff option-argument shall be
       a file formatted according to one of the specifications in the EXTENDED
       DESCRIPTION section, or some other implementation-defined format.

EEXXTTEENNDDEEDD DDEESSCCRRIIPPTTIIOONN
   ppaaxx IInntteerrcchhaannggee FFoorrmmaatt
       A _p_a_x archive tape or file produced in the --xxppaaxx format shall contain a
       series of blocks. The physical layout of the archive shall be identical
       to the uussttaarr format described in _u_s_t_a_r _I_n_t_e_r_c_h_a_n_g_e _F_o_r_m_a_t.  Each file
       archived shall be represented by the following sequence:

        *  An optional header block with extended header records. This header
           block is of the form described in _p_a_x _H_e_a_d_e_r _B_l_o_c_k, with a _t_y_p_e_f_l_a_g
           value of xx or gg.  The extended header records, described in _p_a_x
           _E_x_t_e_n_d_e_d _H_e_a_d_e_r, shall be included as the data for this header
           block.

        *  A header block that describes the file. Any fields in the preceding
           optional extended header shall override the associated fields in
           this header block for this file.

        *  Zero or more blocks that contain the contents of the file.

       At the end of the archive file there shall be two 512-byte blocks
       filled with binary zeros, interpreted as an end-of-archive indicator.

       A schematic of an example archive with global extended header records
       and two actual files is shown in _F_i_g_u_r_e _4_-_1_, _p_a_x _F_o_r_m_a_t _A_r_c_h_i_v_e
       _E_x_a_m_p_l_e.  In the example, the second file in the archive has no
       extended header preceding it, presumably because it has no need for
       extended attributes.

                       FFiigguurree 44--11:: ppaaxx FFoorrmmaatt AArrcchhiivvee EExxaammppllee

   ppaaxx HHeeaaddeerr BBlloocckk
       The ppaaxx header block shall be identical to the uussttaarr header block
       described in _u_s_t_a_r _I_n_t_e_r_c_h_a_n_g_e _F_o_r_m_a_t, except that two additional
       _t_y_p_e_f_l_a_g values are defined:

       x     Represents extended header records for the following file in the
             archive (which shall have its own uussttaarr header block). The format
             of these extended header records shall be as described in _p_a_x
             _E_x_t_e_n_d_e_d _H_e_a_d_e_r.

       g     Represents global extended header records for the following files
             in the archive. The format of these extended header records shall
             be as described in _p_a_x _E_x_t_e_n_d_e_d _H_e_a_d_e_r.  Each value shall affect
             all subsequent files that do not override that value in their own
             extended header record and until another global extended header
             record is reached that provides another value for the same field.
             The _t_y_p_e_f_l_a_g gg global headers should not be used with interchange
             media that could suffer partial data loss in transporting the
             archive.

       For both of these types, the _s_i_z_e field shall be the size of the
       extended header records in octets. The other fields in the header block
       are not meaningful to this version of the _p_a_x utility. However, if this
       archive is read by a _p_a_x utility conforming to the ISO POSIX-2:1993
       standard, the header block fields are used to create a regular file
       that contains the extended header records as data. Therefore, header
       block field values should be selected to provide reasonable file access
       to this regular file.

       A further difference from the uussttaarr header block is that data blocks
       for files of _t_y_p_e_f_l_a_g 1 (the digit one) (hard link) may be included,
       which means that the size field may be greater than zero. Archives
       created by _p_a_x --oo lliinnkkddaattaa shall include these data blocks with the
       hard links.

   ppaaxx EExxtteennddeedd HHeeaaddeerr
       A ppaaxx extended header contains values that are inappropriate for the
       uussttaarr header block because of limitations in that format: fields
       requiring a character encoding other than that described in the
       ISO/IEC 646:1991 standard, fields representing file attributes not
       described in the uussttaarr header, and fields whose format or length do not
       fit the requirements of the uussttaarr header. The values in an extended
       header add attributes to the following file (or files; see the
       description of the _t_y_p_e_f_l_a_g gg header block) or override values in the
       following header block(s), as indicated in the following list of
       keywords.

       An extended header shall consist of one or more records, each
       constructed as follows:


           "%d %s=%s\n", <_l_e_n_g_t_h>, <_k_e_y_w_o_r_d>, <_v_a_l_u_e>

       The extended header records shall be encoded according to the
       ISO/IEC 10646-1:2000 standard UTF-8 encoding. The <_l_e_n_g_t_h> field,
       <blank>, <equals-sign>, and <newline> shown shall be limited to the
       portable character set, as encoded in UTF-8. The <_k_e_y_w_o_r_d> fields can
       be any UTF-8 characters.  The <_l_e_n_g_t_h> field shall be the decimal
       length of the extended header record in octets, including the trailing
       <newline>.  If there is a hhddrrcchhaarrsseett extended header in effect for a
       file, the _v_a_l_u_e field for any ggnnaammee, lliinnkkppaatthh, ppaatthh, and uunnaammee extended
       header records shall be encoded using the character set specified by
       the hhddrrcchhaarrsseett extended header record; otherwise, the _v_a_l_u_e field shall
       be encoded using UTF-8. The _v_a_l_u_e field for all other keywords
       specified by POSIX.1-2008 shall be encoded using UTF-8.

       The <_k_e_y_w_o_r_d> field shall be one of the entries from the following list
       or a keyword provided as an implementation extension.  Keywords
       consisting entirely of lowercase letters, digits, and periods are
       reserved for future standardization. A keyword shall not include an
       <equals-sign>.  (In the following list, the notations ``file(s)'' or
       ``block(s)'' is used to acknowledge that a keyword affects the
       following single file after a _t_y_p_e_f_l_a_g xx extended header, but possibly
       multiple files after _t_y_p_e_f_l_a_g gg.  Any requirements in the list for _p_a_x
       to include a record when in wwrriittee or ccooppyy mode shall apply only when
       such a record has not already been provided through the use of the --oo
       option. When used in ccooppyy mode, _p_a_x shall behave as if an archive had
       been created with applicable extended header records and then
       extracted.)

       aattiimmee     The file access time for the following file(s), equivalent to
                 the value of the _s_t___a_t_i_m_e member of the ssttaatt structure for a
                 file, as described by the _s_t_a_t() function. The access time
                 shall be restored if the process has appropriate privileges
                 required to do so. The format of the <_v_a_l_u_e> shall be as
                 described in _p_a_x _E_x_t_e_n_d_e_d _H_e_a_d_e_r _F_i_l_e _T_i_m_e_s.

       cchhaarrsseett   The name of the character set used to encode the data in the
                 following file(s). The entries in the following table are
                 defined to refer to known standards; additional names may be
                 agreed on between the originator and recipient.

                   +------------------------+-------------------------------+
                   |        <<vvaalluuee>>         |        FFoorrmmaall SSttaannddaarrdd        |
                   +------------------------+-------------------------------+
                   |ISO-IR 646 1990         | ISO/IEC 646:1990              |
                   |ISO-IR 8859 1 1998      | ISO/IEC 8859-1:1998           |
                   |ISO-IR 8859 2 1999      | ISO/IEC 8859-2:1999           |
                   |ISO-IR 8859 3 1999      | ISO/IEC 8859-3:1999           |
                   |ISO-IR 8859 4 1998      | ISO/IEC 8859-4:1998           |
                   |ISO-IR 8859 5 1999      | ISO/IEC 8859-5:1999           |
                   |ISO-IR 8859 6 1999      | ISO/IEC 8859-6:1999           |
                   |ISO-IR 8859 7 1987      | ISO/IEC 8859-7:1987           |
                   |ISO-IR 8859 8 1999      | ISO/IEC 8859-8:1999           |
                   |ISO-IR 8859 9 1999      | ISO/IEC 8859-9:1999           |
                   |ISO-IR 8859 10 1998     | ISO/IEC 8859-10:1998          |
                   |ISO-IR 8859 13 1998     | ISO/IEC 8859-13:1998          |
                   |ISO-IR 8859 14 1998     | ISO/IEC 8859-14:1998          |
                   |ISO-IR 8859 15 1999     | ISO/IEC 8859-15:1999          |
                   |ISO-IR 10646 2000       | ISO/IEC 10646:2000            |
                   |ISO-IR 10646 2000 UTF-8 | ISO/IEC 10646, UTF-8 encoding |
                   |BINARY                  | None.                         |
                   +------------------------+-------------------------------+
                 The encoding is included in an extended header for
                 information only; when _p_a_x is used as described in
                 POSIX.1-2008, it shall not translate the file data into any
                 other encoding. The BBIINNAARRYY entry indicates unencoded binary
                 data.

                 When used in wwrriittee or ccooppyy mode, it is implementation-defined
                 whether _p_a_x includes a cchhaarrsseett extended header record for a
                 file.

       ccoommmmeenntt   A series of characters used as a comment. All characters in
                 the <_v_a_l_u_e> field shall be ignored by _p_a_x.

       ggiidd       The group ID of the group that owns the file, expressed as a
                 decimal number using digits from the ISO/IEC 646:1991
                 standard. This record shall override the _g_i_d field in the
                 following header block(s). When used in wwrriittee or ccooppyy mode,
                 _p_a_x shall include a _g_i_d extended header record for each file
                 whose group ID is greater than 2097151 (octal 7777777).

       ggnnaammee     The group of the file(s), formatted as a group name in the
                 group database. This record shall override the _g_i_d and _g_n_a_m_e
                 fields in the following header block(s), and any _g_i_d extended
                 header record. When used in rreeaadd, ccooppyy, or lliisstt mode, _p_a_x
                 shall translate the name from the encoding in the header
                 record to the character set appropriate for the group
                 database on the receiving system. If any of the characters
                 cannot be translated, and if neither the --ooiinnvvaalliidd==UUTTFF--88
                 option nor the --ooiinnvvaalliidd==bbiinnaarryy option is specified, the
                 results are implementation-defined.  When used in wwrriittee or
                 ccooppyy mode, _p_a_x shall include a ggnnaammee extended header record
                 for each file whose group name cannot be represented entirely
                 with the letters and digits of the portable character set.

       hhddrrcchhaarrsseett
                 The name of the character set used to encode the value field
                 of the ggnnaammee, lliinnkkppaatthh, ppaatthh, and uunnaammee _p_a_x extended header
                 records. The entries in the following table are defined to
                 refer to known standards; additional names may be agreed
                 between the originator and the recipient.

                   +------------------------+-------------------------------+
                   |        <<vvaalluuee>>         |        FFoorrmmaall SSttaannddaarrdd        |
                   +------------------------+-------------------------------+
                   |ISO-IR 10646 2000 UTF-8 | ISO/IEC 10646, UTF-8 encoding |
                   |BINARY                  | None.                         |
                   +------------------------+-------------------------------+
                 If no hhddrrcchhaarrsseett extended header record is specified, the
                 default character set used to encode all values in extended
                 header records shall be the ISO/IEC 10646-1:2000 standard
                 UTF-8 encoding.

                 The BBIINNAARRYY entry indicates that all values recorded in
                 extended headers for affected files are unencoded binary data
                 from the underlying system.

       lliinnkkppaatthh  The pathname of a link being created to another file, of any
                 type, previously archived. This record shall override the
                 _l_i_n_k_n_a_m_e field in the following uussttaarr header block(s). The
                 following uussttaarr header block shall determine the type of link
                 created. If _t_y_p_e_f_l_a_g of the following header block is 1, it
                 shall be a hard link. If _t_y_p_e_f_l_a_g is 2, it shall be a
                 symbolic link and the lliinnkkppaatthh value shall be the contents of
                 the symbolic link. The _p_a_x utility shall translate the name
                 of the link (contents of the symbolic link) from the encoding
                 in the header to the character set appropriate for the local
                 file system. When used in wwrriittee or ccooppyy mode, _p_a_x shall
                 include a lliinnkkppaatthh extended header record for each link whose
                 pathname cannot be represented entirely with the members of
                 the portable character set other than NUL.

       mmttiimmee     The file modification time of the following file(s),
                 equivalent to the value of the _s_t___m_t_i_m_e member of the ssttaatt
                 structure for a file, as described in the _s_t_a_t() function.
                 This record shall override the _m_t_i_m_e field in the following
                 header block(s). The modification time shall be restored if
                 the process has appropriate privileges required to do so. The
                 format of the <_v_a_l_u_e> shall be as described in _p_a_x _E_x_t_e_n_d_e_d
                 _H_e_a_d_e_r _F_i_l_e _T_i_m_e_s.

       ppaatthh      The pathname of the following file(s). This record shall
                 override the _n_a_m_e and _p_r_e_f_i_x fields in the following header
                 block(s). The _p_a_x utility shall translate the pathname of the
                 file from the encoding in the header to the character set
                 appropriate for the local file system.

                 When used in wwrriittee or ccooppyy mode, _p_a_x shall include a _p_a_t_h
                 extended header record for each file whose pathname cannot be
                 represented entirely with the members of the portable
                 character set other than NUL.

       rreeaallttiimmee.._a_n_y
                 The keywords prefixed by ``realtime.'' are reserved for
                 future standardization.

       sseeccuurriittyy.._a_n_y
                 The keywords prefixed by ``security.'' are reserved for
                 future standardization.

       ssiizzee      The size of the file in octets, expressed as a decimal number
                 using digits from the ISO/IEC 646:1991 standard. This record
                 shall override the _s_i_z_e field in the following header
                 block(s). When used in wwrriittee or ccooppyy mode, _p_a_x shall include
                 a _s_i_z_e extended header record for each file with a size value
                 greater than 8589934591 (octal 77777777777).

       uuiidd       The user ID of the file owner, expressed as a decimal number
                 using digits from the ISO/IEC 646:1991 standard. This record
                 shall override the _u_i_d field in the following header
                 block(s). When used in wwrriittee or ccooppyy mode, _p_a_x shall include
                 a _u_i_d extended header record for each file whose owner ID is
                 greater than 2097151 (octal 7777777).

       uunnaammee     The owner of the following file(s), formatted as a user name
                 in the user database. This record shall override the _u_i_d and
                 _u_n_a_m_e fields in the following header block(s), and any _u_i_d
                 extended header record. When used in rreeaadd, ccooppyy, or lliisstt
                 mode, _p_a_x shall translate the name from the encoding in the
                 header record to the character set appropriate for the user
                 database on the receiving system. If any of the characters
                 cannot be translated, and if neither the --ooiinnvvaalliidd==UUTTFF--88
                 option nor the --ooiinnvvaalliidd==bbiinnaarryy option is specified, the
                 results are implementation-defined.  When used in wwrriittee or
                 ccooppyy mode, _p_a_x shall include a uunnaammee extended header record
                 for each file whose user name cannot be represented entirely
                 with the letters and digits of the portable character set.

       If the <_v_a_l_u_e> field is zero length, it shall delete any header block
       field, previously entered extended header value, or global extended
       header value of the same name.

       If a keyword in an extended header record (or in a --oo option-argument)
       overrides or deletes a corresponding field in the uussttaarr header block,
       _p_a_x shall ignore the contents of that header block field.

       Unlike the uussttaarr header block fields, NULs shall not delimit <_v_a_l_u_e>s;
       all characters within the <_v_a_l_u_e> field shall be considered data for
       the field. None of the length limitations of the uussttaarr header block
       fields in _T_a_b_l_e _4_-_1_4_, _u_s_t_a_r _H_e_a_d_e_r _B_l_o_c_k shall apply to the extended
       header records.

   ppaaxx EExxtteennddeedd HHeeaaddeerr KKeeyywwoorrdd PPrreecceeddeennccee
       This section describes the precedence in which the various header
       records and fields and command line options are selected to apply to a
       file in the archive. When _p_a_x is used in rreeaadd or lliisstt modes, it shall
       determine a file attribute in the following sequence:

        1. If --ooddeelleettee==kkeeyywwoorrdd--pprreeffiixx is used, the affected attributes shall
           be determined from step 7., if applicable, or ignored otherwise.

        2. If --oo_k_e_y_w_o_r_d:= is used, the affected attributes shall be ignored.

        3. If --ookkeeyywwoorrdd::==vvaalluuee is used, the affected attribute shall be
           assigned the value.

        4. If there is a _t_y_p_e_f_l_a_g xx extended header record, the affected
           attribute shall be assigned the <_v_a_l_u_e>. When extended header
           records conflict, the last one given in the header shall take
           precedence.

        5. If --ookkeeyywwoorrdd==vvaalluuee is used, the affected attribute shall be
           assigned the value.

        6. If there is a _t_y_p_e_f_l_a_g gg global extended header record, the
           affected attribute shall be assigned the <_v_a_l_u_e>. When global
           extended header records conflict, the last one given in the global
           header shall take precedence.

        7. Otherwise, the attribute shall be determined from the uussttaarr header
           block.

   ppaaxx EExxtteennddeedd HHeeaaddeerr FFiillee TTiimmeess
       The _p_a_x utility shall write an mmttiimmee record for each file in wwrriittee or
       ccooppyy modes if the file's modification time cannot be represented
       exactly in the uussttaarr header logical record described in _u_s_t_a_r
       _I_n_t_e_r_c_h_a_n_g_e _F_o_r_m_a_t.  This can occur if the time is out of uussttaarr range,
       or if the file system of the underlying implementation supports non-
       integer time granularities and the time is not an integer. All of these
       time records shall be formatted as a decimal representation of the time
       in seconds since the Epoch. If a <period> (''..'')  decimal point
       character is present, the digits to the right of the point shall
       represent the units of a subsecond timing granularity, where the first
       digit is tenths of a second and each subsequent digit is a tenth of the
       previous digit. In rreeaadd or ccooppyy mode, the _p_a_x utility shall truncate
       the time of a file to the greatest value that is not greater than the
       input header file time. In wwrriittee or ccooppyy mode, the _p_a_x utility shall
       output a time exactly if it can be represented exactly as a decimal
       number, and otherwise shall generate only enough digits so that the
       same time shall be recovered if the file is extracted on a system whose
       underlying implementation supports the same time granularity.

   uussttaarr IInntteerrcchhaannggee FFoorrmmaatt
       A uussttaarr archive tape or file shall contain a series of logical records.
       Each logical record shall be a fixed-size logical record of 512 octets
       (see below). Although this format may be thought of as being stored on
       9-track industry-standard 12.7 mm (0.5 in) magnetic tape, other types
       of transportable media are not excluded. Each file archived shall be
       represented by a header logical record that describes the file,
       followed by zero or more logical records that give the contents of the
       file. At the end of the archive file there shall be two 512-octet
       logical records filled with binary zeros, interpreted as an end-of-
       archive indicator.

       The logical records may be grouped for physical I/O operations, as
       described under the --bb_b_l_o_c_k_s_i_z_e and --xx uussttaarr options. Each group of
       logical records may be written with a single operation equivalent to
       the _w_r_i_t_e() function. On magnetic tape, the result of this write shall
       be a single tape physical block. The last physical block shall always
       be the full size, so logical records after the two zero logical records
       may contain undefined data.

       The header logical record shall be structured as shown in the following
       table. All lengths and offsets are in decimal.

                           TTaabbllee 44--1144:: uussttaarr HHeeaaddeerr BBlloocckk

                  +-----------+--------------+--------------------+
                  |FFiieelldd NNaammee | OOcctteett OOffffsseett | LLeennggtthh ((iinn OOcctteettss)) |
                  +-----------+--------------+--------------------+
                  |_n_a_m_e       |       0      |        100         |
                  |_m_o_d_e       |     100      |          8         |
                  |_u_i_d        |     108      |          8         |
                  |_g_i_d        |     116      |          8         |
                  |_s_i_z_e       |     124      |         12         |
                  |_m_t_i_m_e      |     136      |         12         |
                  |_c_h_k_s_u_m     |     148      |          8         |
                  |_t_y_p_e_f_l_a_g   |     156      |          1         |
                  |_l_i_n_k_n_a_m_e   |     157      |        100         |
                  |_m_a_g_i_c      |     257      |          6         |
                  |_v_e_r_s_i_o_n    |     263      |          2         |
                  |_u_n_a_m_e      |     265      |         32         |
                  |_g_n_a_m_e      |     297      |         32         |
                  |_d_e_v_m_a_j_o_r   |     329      |          8         |
                  |_d_e_v_m_i_n_o_r   |     337      |          8         |
                  |_p_r_e_f_i_x     |     345      |        155         |
                  +-----------+--------------+--------------------+
       All characters in the header logical record shall be represented in the
       coded character set of the ISO/IEC 646:1991 standard. For maximum
       portability between implementations, names should be selected from
       characters represented by the portable filename character set as octets
       with the most significant bit zero. If an implementation supports the
       use of characters outside of <slash> and the portable filename
       character set in names for files, users, and groups, one or more
       implementation-defined encodings of these characters shall be provided
       for interchange purposes.

       However, the _p_a_x utility shall never create filenames on the local
       system that cannot be accessed via the procedures described in
       POSIX.1-2008. If a filename is found on the medium that would create an
       invalid filename, it is implementation-defined whether the data from
       the file is stored on the file hierarchy and under what name it is
       stored. The _p_a_x utility may choose to ignore these files as long as it
       produces an error indicating that the file is being ignored.

       Each field within the header logical record is contiguous; that is,
       there is no padding used. Each character on the archive medium shall be
       stored contiguously.

       The fields _m_a_g_i_c, _u_n_a_m_e, and _g_n_a_m_e are character strings each
       terminated by a NUL character. The fields _n_a_m_e, _l_i_n_k_n_a_m_e, and _p_r_e_f_i_x
       are NUL-terminated character strings except when all characters in the
       array contain non-NUL characters including the last character. The
       _v_e_r_s_i_o_n field is two octets containing the characters ""0000"" (zero-zero).
       The _t_y_p_e_f_l_a_g contains a single character. All other fields are leading
       zero-filled octal numbers using digits from the ISO/IEC 646:1991
       standard IRV. Each numeric field is terminated by one or more <space>
       or NUL characters.

       The _n_a_m_e and the _p_r_e_f_i_x fields shall produce the pathname of the file.
       A new pathname shall be formed, if _p_r_e_f_i_x is not an empty string (its
       first character is not NUL), by concatenating _p_r_e_f_i_x (up to the first
       NUL character), a <slash> character, and _n_a_m_e; otherwise, _n_a_m_e is used
       alone. In either case, _n_a_m_e is terminated at the first NUL character.
       If _p_r_e_f_i_x begins with a NUL character, it shall be ignored. In this
       manner, pathnames of at most 256 characters can be supported. If a
       pathname does not fit in the space provided, _p_a_x shall notify the user
       of the error, and shall not store any part of the file--header or
       data--on the medium.

       The _l_i_n_k_n_a_m_e field, described below, shall not use the _p_r_e_f_i_x to
       produce a pathname. As such, a _l_i_n_k_n_a_m_e is limited to 100 characters.
       If the name does not fit in the space provided, _p_a_x shall notify the
       user of the error, and shall not attempt to store the link on the
       medium.

       The _m_o_d_e field provides 12 bits encoded in the ISO/IEC 646:1991
       standard octal digit representation.  The encoded bits shall represent
       the following values:

                               TTaabbllee:: uussttaarr _m_o_d_e FFiieelldd

   +----------+------------------+-------------------------------------------------+
   |BBiitt VVaalluuee | PPOOSSIIXX..11--22000088 BBiitt |                   DDeessccrriippttiioonn                   |
   +----------+------------------+-------------------------------------------------+
   |  04000   | S_ISUID          | Set UID on execution.                           |
   |  02000   | S_ISGID          | Set GID on execution.                           |
   |  01000   | <reserved>       | Reserved for future standardization.            |
   |  00400   | S_IRUSR          | Read permission for file owner class.           |
   |  00200   | S_IWUSR          | Write permission for file owner class.          |
   |  00100   | S_IXUSR          | Execute/search permission for file owner class. |
   |  00040   | S_IRGRP          | Read permission for file group class.           |
   |  00020   | S_IWGRP          | Write permission for file group class.          |
   |  00010   | S_IXGRP          | Execute/search permission for file group class. |
   |  00004   | S_IROTH          | Read permission for file other class.           |
   |  00002   | S_IWOTH          | Write permission for file other class.          |
   |  00001   | S_IXOTH          | Execute/search permission for file other class. |
   +----------+------------------+-------------------------------------------------+
       When appropriate privileges are required to set one of these mode bits,
       and the user restoring the files from the archive does not have
       appropriate privileges, the mode bits for which the user does not have
       appropriate privileges shall be ignored. Some of the mode bits in the
       archive format are not mentioned elsewhere in this volume of
       POSIX.1-2017. If the implementation does not support those bits, they
       may be ignored.

       The _u_i_d and _g_i_d fields are the user and group ID of the owner and group
       of the file, respectively.

       The _s_i_z_e field is the size of the file in octets. If the _t_y_p_e_f_l_a_g field
       is set to specify a file to be of type 1 (a link) or 2 (a symbolic
       link), the _s_i_z_e field shall be specified as zero. If the _t_y_p_e_f_l_a_g field
       is set to specify a file of type 5 (directory), the _s_i_z_e field shall be
       interpreted as described under the definition of that record type. No
       data logical records are stored for types 1, 2, or 5.  If the _t_y_p_e_f_l_a_g
       field is set to 3 (character special file), 4 (block special file), or
       6 (FIFO), the meaning of the _s_i_z_e field is unspecified by this volume
       of POSIX.1-2017, and no data logical records shall be stored on the
       medium. Additionally, for type 6, the _s_i_z_e field shall be ignored when
       reading. If the _t_y_p_e_f_l_a_g field is set to any other value, the number of
       logical records written following the header shall be (_s_i_z_e+511)/512,
       ignoring any fraction in the result of the division.

       The _m_t_i_m_e field shall be the modification time of the file at the time
       it was archived. It is the ISO/IEC 646:1991 standard representation of
       the octal value of the modification time obtained from the _s_t_a_t()
       function.

       The _c_h_k_s_u_m field shall be the ISO/IEC 646:1991 standard IRV
       representation of the octal value of the simple sum of all octets in
       the header logical record. Each octet in the header shall be treated as
       an unsigned value. These values shall be added to an unsigned integer,
       initialized to zero, the precision of which is not less than 17 bits.
       When calculating the checksum, the _c_h_k_s_u_m field is treated as if it
       were all <space> characters.

       The _t_y_p_e_f_l_a_g field specifies the type of file archived. If a particular
       implementation does not recognize the type, or the user does not have
       appropriate privileges to create that type, the file shall be extracted
       as if it were a regular file if the file type is defined to have a
       meaning for the _s_i_z_e field that could cause data logical records to be
       written on the medium (see the previous description for _s_i_z_e).  If
       conversion to a regular file occurs, the _p_a_x utility shall produce an
       error indicating that the conversion took place. All of the _t_y_p_e_f_l_a_g
       fields shall be coded in the ISO/IEC 646:1991 standard IRV:

       0       Represents a regular file. For backwards-compatibility, a
               _t_y_p_e_f_l_a_g value of binary zero (''\\00'') should be recognized as
               meaning a regular file when extracting files from the archive.
               Archives written with this version of the archive file format
               create regular files with a _t_y_p_e_f_l_a_g value of the
               ISO/IEC 646:1991 standard IRV ''00''.

       1       Represents a file linked to another file, of any type,
               previously archived. Such files are identified by having the
               same device and file serial numbers, and pathnames that refer
               to different directory entries. All such files shall be
               archived as linked files.  The linked-to name is specified in
               the _l_i_n_k_n_a_m_e field with a NUL-character terminator if it is
               less than 100 octets in length.

       2       Represents a symbolic link. The contents of the symbolic link
               shall be stored in the _l_i_n_k_n_a_m_e field.

       3,4     Represent character special files and block special files
               respectively.  In this case the _d_e_v_m_a_j_o_r and _d_e_v_m_i_n_o_r fields
               shall contain information defining the device, the format of
               which is unspecified by this volume of POSIX.1-2017.
               Implementations may map the device specifications to their own
               local specification or may ignore the entry.

       5       Specifies a directory or subdirectory. On systems where disk
               allocation is performed on a directory basis, the _s_i_z_e field
               shall contain the maximum number of octets (which may be
               rounded to the nearest disk block allocation unit) that the
               directory may hold.  A _s_i_z_e field of zero indicates no such
               limiting. Systems that do not support limiting in this manner
               should ignore the _s_i_z_e field.

       6       Specifies a FIFO special file. Note that the archiving of a
               FIFO file archives the existence of this file and not its
               contents.

       7       Reserved to represent a file to which an implementation has
               associated some high-performance attribute. Implementations
               without such extensions should treat this file as a regular
               file (type 0).

       A-Z     The letters ''AA'' to ''ZZ'', inclusive, are reserved for custom
               implementations. All other values are reserved for future
               versions of this standard.

       It is unspecified whether files with pathnames that refer to the same
       directory entry are archived as linked files or as separate files. If
       they are archived as linked files, this means that attempting to
       extract both pathnames from the resulting archive will always cause an
       error (unless the --uu option is used) because the link cannot be
       created.

       It is unspecified whether files with the same device and file serial
       numbers being appended to an archive are treated as linked files to
       members that were in the archive before the append.

       Attempts to archive a socket shall produce a diagnostic message when
       uussttaarr interchange format is used, but may be allowed when ppaaxx
       interchange format is used. Handling of other file types is
       implementation-defined.

       The _m_a_g_i_c field is the specification that this archive was output in
       this archive format. If this field contains uussttaarr (the five characters
       from the ISO/IEC 646:1991 standard IRV shown followed by NUL), the
       _u_n_a_m_e and _g_n_a_m_e fields shall contain the ISO/IEC 646:1991 standard IRV
       representation of the owner and group of the file, respectively
       (truncated to fit, if necessary). When the file is restored by a
       privileged, protection-preserving version of the utility, the user and
       group databases shall be scanned for these names. If found, the user
       and group IDs contained within these files shall be used rather than
       the values contained within the _u_i_d and _g_i_d fields.

   ccppiioo IInntteerrcchhaannggee FFoorrmmaatt
       The octet-oriented ccppiioo archive format shall be a series of entries,
       each comprising a header that describes the file, the name of the file,
       and then the contents of the file.

       An archive may be recorded as a series of fixed-size blocks of octets.
       This blocking shall be used only to make physical I/O more efficient.
       The last group of blocks shall always be at the full size.

       For the octet-oriented ccppiioo archive format, the individual entry
       information shall be in the order indicated and described by the
       following table; see also the _<_c_p_i_o_._h_> header.

                    TTaabbllee 44--1166:: OOcctteett--OOrriieenntteedd ccppiioo AArrcchhiivvee EEnnttrryy

            +---------------------+--------------------+-----------------+
            | HHeeaaddeerr FFiieelldd NNaammee   | LLeennggtthh ((iinn OOcctteettss)) | IInntteerrpprreetteedd aass  |
            +---------------------+--------------------+-----------------+
            |_c___m_a_g_i_c              |          6         | Octal number    |
            |_c___d_e_v                |          6         | Octal number    |
            |_c___i_n_o                |          6         | Octal number    |
            |_c___m_o_d_e               |          6         | Octal number    |
            |_c___u_i_d                |          6         | Octal number    |
            |_c___g_i_d                |          6         | Octal number    |
            |_c___n_l_i_n_k              |          6         | Octal number    |
            |_c___r_d_e_v               |          6         | Octal number    |
            |_c___m_t_i_m_e              |         11         | Octal number    |
            |_c___n_a_m_e_s_i_z_e           |          6         | Octal number    |
            |_c___f_i_l_e_s_i_z_e           |         11         | Octal number    |
            +---------------------+--------------------+-----------------+
            |FFiilleennaammee FFiieelldd NNaammee  |       LLeennggtthh       | IInntteerrpprreetteedd aass  |
            +---------------------+--------------------+-----------------+
            |_c___n_a_m_e                 _c___n_a_m_e_s_i_z_e           Pathname string |
            +---------------------+--------------------+-----------------+
            |FFiillee DDaattaa FFiieelldd NNaammee |       LLeennggtthh       | IInntteerrpprreetteedd aass  |
            +---------------------+--------------------+-----------------+
            |_c___f_i_l_e_d_a_t_a             _c___f_i_l_e_s_i_z_e           Data            |
            +------------------------------------------------------------+
   ccppiioo HHeeaaddeerr
       For each file in the archive, a header as defined previously shall be
       written. The information in the header fields is written as streams of
       the ISO/IEC 646:1991 standard characters interpreted as octal numbers.
       The octal numbers shall be extended to the necessary length by
       appending the ISO/IEC 646:1991 standard IRV zeros at the most-
       significant-digit end of the number; the result is written to the most-
       significant digit of the stream of octets first.  The fields shall be
       interpreted as follows:

       _c___m_a_g_i_c   Identify the archive as being a transportable archive by
                 containing the identifying value ""007700770077"".

       _c___d_e_v, _c___i_n_o
                 Contains values that uniquely identify the file within the
                 archive (that is, no files contain the same pair of _c___d_e_v and
                 _c___i_n_o values unless they are links to the same file). The
                 values shall be determined in an unspecified manner.

       _c___m_o_d_e    Contains the file type and access permissions as defined in
                 the following table.

                           TTaabbllee 44--1177:: VVaalluueess ffoorr ccppiioo cc__mmooddee FFiieelldd

                 |----------------------+---------+------------------------+-
                 | FFiillee PPeerrmmiissssiioonnss NNaammee|   VVaalluuee |        IInnddiiccaatteess       |
                 |----------------------+---------+------------------------+-
                 | C_IRUSR              |   000400|  Read by owner         |
                 | C_IWUSR              |   000200|  Write by owner        |
                 | C_IXUSR              |   000100|  Execute by owner      |
                 | C_IRGRP              |   000040|  Read by group         |
                 | C_IWGRP              |   000020|  Write by group        |
                 | C_IXGRP              |   000010|  Execute by group      |
                 | C_IROTH              |   000004|  Read by others        |
                 | C_IWOTH              |   000002|  Write by others       |
                 | C_IXOTH              |   000001|  Execute by others     |
                 | C_ISUID              |   004000|  Set _u_i_d               |
                 | C_ISGID              |   002000|  Set _g_i_d               |
                 | C_ISVTX              |   001000|  Reserved              |
                 |----------------------+---------+------------------------+-
                 |    FFiillee TTyyppee NNaammee    |   VVaalluuee |        IInnddiiccaatteess       |
                 |----------------------+---------+------------------------+-
                 | C_ISDIR              |   040000|  Directory             |
                 | C_ISFIFO             |   010000|  FIFO                  |
                 | C_ISREG              |  0100000|  Regular file          |
                 | C_ISLNK              |  0120000|  Symbolic link         |
                 |                      |         |                        |
                 |C_ISBLK               |  060000 | Block special file     |
                 |C_ISCHR               |  020000 | Character special file |
                 |C_ISSOCK              | 0140000 | Socket                 |
                 |                      |         |                        |
                 |C_ISCTG               | 0110000 | Reserved               |
                 +----------------------+---------+------------------------+
                 Directories, FIFOs, symbolic links, and regular files shall
                 be supported on a system conforming to this volume of
                 POSIX.1-2017; additional values defined previously are
                 reserved for compatibility with existing systems.  Additional
                 file types may be supported; however, such files should not
                 be written to archives intended to be transported to other
                 systems.

       _c___u_i_d     Contains the user ID of the owner.

       _c___g_i_d     Contains the group ID of the group.

       _c___n_l_i_n_k   Contains a number greater than or equal to the number of
                 links in the archive referencing the file. If the --aa option
                 is used to append to a _c_p_i_o archive, then the _p_a_x utility
                 need not account for the files in the existing part of the
                 archive when calculating the _c___n_l_i_n_k values for the appended
                 part of the archive, and need not alter the _c___n_l_i_n_k values in
                 the existing part of the archive if additional files with the
                 same _c___d_e_v and _c___i_n_o values are appended to the archive.

       _c___r_d_e_v    Contains implementation-defined information for character or
                 block special files.

       _c___m_t_i_m_e   Contains the latest time of modification of the file at the
                 time the archive was created.

       _c___n_a_m_e_s_i_z_e
                 Contains the length of the pathname, including the
                 terminating NUL character.

       _c___f_i_l_e_s_i_z_e
                 Contains the length in octets of the data section following
                 the header structure.

   ccppiioo FFiilleennaammee
       The _c___n_a_m_e field shall contain the pathname of the file. The length of
       this field in octets is the value of _c___n_a_m_e_s_i_z_e.

       If a filename is found on the medium that would create an invalid
       pathname, it is implementation-defined whether the data from the file
       is stored on the file hierarchy and under what name it is stored.

       All characters shall be represented in the ISO/IEC 646:1991 standard
       IRV. For maximum portability between implementations, names should be
       selected from characters represented by the portable filename character
       set as octets with the most significant bit zero. If an implementation
       supports the use of characters outside the portable filename character
       set in names for files, users, and groups, one or more implementation-
       defined encodings of these characters shall be provided for interchange
       purposes. However, the _p_a_x utility shall never create filenames on the
       local system that cannot be accessed via the procedures described
       previously in this volume of POSIX.1-2017. If a filename is found on
       the medium that would create an invalid filename, it is implementation-
       defined whether the data from the file is stored on the local file
       system and under what name it is stored. The _p_a_x utility may choose to
       ignore these files as long as it produces an error indicating that the
       file is being ignored.

   ccppiioo FFiillee DDaattaa
       Following _c___n_a_m_e, there shall be _c___f_i_l_e_s_i_z_e octets of data.
       Interpretation of such data occurs in a manner dependent on the file.
       For regular files, the data shall consist of the contents of the file.
       For symbolic links, the data shall consist of the contents of the
       symbolic link. If _c___f_i_l_e_s_i_z_e is zero, no data shall be contained in
       _c___f_i_l_e_d_a_t_a.

       When restoring from an archive:

        *  If the user does not have appropriate privileges to create a file
           of the specified type, _p_a_x shall ignore the entry and write an
           error message to standard error.

        *  Only regular files and symbolic links have data to be restored.
           Presuming a regular file meets any selection criteria that might be
           imposed on the format-reading utility by the user, such data shall
           be restored.

        *  If a user does not have appropriate privileges to set a particular
           mode flag, the flag shall be ignored. Some of the mode flags in the
           archive format are not mentioned elsewhere in this volume of
           POSIX.1-2017. If the implementation does not support those flags,
           they may be ignored.

   ccppiioo SSppeecciiaall EEnnttrriieess
       FIFO special files, directories, and the trailer shall be recorded with
       _c___f_i_l_e_s_i_z_e equal to zero. Symbolic links shall be recorded with
       _c___f_i_l_e_s_i_z_e equal to the length of the contents of the symbolic link.
       For other special files, _c___f_i_l_e_s_i_z_e is unspecified by this volume of
       POSIX.1-2017. The header for the next file entry in the archive shall
       be written directly after the last octet of the file entry preceding
       it. A header denoting the filename TTRRAAIILLEERR!!!!!!  shall indicate the end
       of the archive; the contents of octets in the last block of the archive
       following such a header are undefined.

EEXXIITT SSTTAATTUUSS
       The following exit values shall be returned:

        0    All files were processed successfully.

       >0    An error occurred.

CCOONNSSEEQQUUEENNCCEESS OOFF EERRRROORRSS
       If _p_a_x cannot create a file or a link when reading an archive or cannot
       find a file when writing an archive, or cannot preserve the user ID,
       group ID, or file mode when the --pp option is specified, a diagnostic
       message shall be written to standard error and a non-zero exit status
       shall be returned, but processing shall continue. In the case where _p_a_x
       cannot create a link to a file, _p_a_x shall not, by default, create a
       second copy of the file.

       If the extraction of a file from an archive is prematurely terminated
       by a signal or error, _p_a_x may have only partially extracted the file or
       (if the --nn option was not specified) may have extracted a file of the
       same name as that specified by the user, but which is not the file the
       user wanted.  Additionally, the file modes of extracted directories may
       have additional bits from the S_IRWXU mask set as well as incorrect
       modification and access times.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       Caution is advised when using the --aa option to append to a _c_p_i_o format
       archive. If any of the files being appended happen to be given the same
       _c___d_e_v and _c___i_n_o values as a file in the existing part of the archive,
       then they may be treated as links to that file on extraction. Thus, it
       is risky to use --aa with _c_p_i_o format except when it is done on the same
       system that the original archive was created on, and with the same _p_a_x
       utility, and in the knowledge that there has been little or no file
       system activity since the original archive was created that could lead
       to any of the files appended being given the same _c___d_e_v and _c___i_n_o
       values as an unrelated file in the existing part of the archive. Also,
       when (intentionally) appending additional links to a file in the
       existing part of the archive, the _c___n_l_i_n_k values in the modified
       archive can be smaller than the number of links to the file in the
       archive, which may mean that the links are not preserved on extraction.

       The --pp (privileges) option was invented to reconcile differences
       between historical _t_a_r and _c_p_i_o implementations. In particular, the two
       utilities use --mm in diametrically opposed ways. The --pp option also
       provides a consistent means of extending the ways in which future file
       attributes can be addressed, such as for enhanced security systems or
       high-performance files. Although it may seem complex, there are really
       two modes that are most commonly used:

       --pp ee    ``Preserve everything''. This would be used by the historical
               superuser, someone with all appropriate privileges, to preserve
               all aspects of the files as they are recorded in the archive.
               The ee flag is the sum of oo and pp, and other implementation-
               defined attributes.

       --pp pp    ``Preserve'' the file mode bits. This would be used by the user
               with regular privileges who wished to preserve aspects of the
               file other than the ownership. The file times are preserved by
               default, but two other flags are offered to disable these and
               use the time of extraction.

       The one pathname per line format of standard input precludes pathnames
       containing <newline> characters. Although such pathnames violate the
       portable filename guidelines, they may exist and their presence may
       inhibit usage of _p_a_x within shell scripts. This problem is inherited
       from historical archive programs. The problem can be avoided by listing
       filename arguments on the command line instead of on standard input.

       It is almost certain that appropriate privileges are required for _p_a_x
       to accomplish parts of this volume of POSIX.1-2017. Specifically,
       creating files of type block special or character special, restoring
       file access times unless the files are owned by the user (the --tt
       option), or preserving file owner, group, and mode (the --pp option) all
       probably require appropriate privileges.

       In rreeaadd mode, implementations are permitted to overwrite files when the
       archive has multiple members with the same name. This may fail if
       permissions on the first version of the file do not permit it to be
       overwritten.

       The ccppiioo and uussttaarr formats can only support files up to 8589934592
       bytes (8 * 2^30) in size.

       When archives containing binary header information are listed , the
       filenames printed may cause strange behavior on some terminals.

       When all of the following are true:

        1. A file of type directory is being placed into an archive.

        2. The uussttaarr archive format is being used.

        3. The pathname of the directory is less than or equal to 155 bytes
           long (it will fit in the _p_r_e_f_i_x field in the uussttaarr header block).

        4. The last component of the pathname of the directory is longer than
           100 bytes long (it will not fit in the _n_a_m_e field in the uussttaarr
           header block).

       some implementations of the _p_a_x utility will place the entire directory
       pathname in the _p_r_e_f_i_x field, set the _n_a_m_e field to an empty string,
       and place the directory in the archive.  Other implementations of the
       _p_a_x utility will give an error under these conditions because the _n_a_m_e
       field is not large enough to hold the last component of the directory
       name.  This standard allows either behavior. However, when extracting a
       directory from a uussttaarr format archive, this standard requires that all
       implementations be able to extract a directory even if the _n_a_m_e field
       contains an empty string as long as the _p_r_e_f_i_x field does not also
       contain an empty string.

EEXXAAMMPPLLEESS
       The following command:


           pax -w -f /dev/rmt/1m .

       copies the contents of the current directory to tape drive 1, medium
       density (assuming historical System V device naming procedures--the
       historical BSD device name would be //ddeevv//rrmmtt99).

       The following commands:


           mkdir _n_e_w_d_i_r
           pax -rw _o_l_d_d_i_r _n_e_w_d_i_r

       copy the _o_l_d_d_i_r directory hierarchy to _n_e_w_d_i_r.


           pax -r -s ',^//*usr//*,,' -f a.pax

       reads the archive aa..ppaaxx, with all files rooted in //uussrr in the archive
       extracted relative to the current directory.

       Using the option:


           -o listopt="%M %(atime)T %(size)D %(name)s"

       overrides the default output description in Standard Output and instead
       writes:


           -rw-rw--- Jan 12 15:53 2003 1492 /usr/foo/bar

       Using the options:


           -o listopt='%L\t%(size)D\n%.7' \
           -o listopt='(name)s\n%(atime)T\n%T'

       overrides the default output description in Standard Output and instead
       writes:


           /usr/foo/bar -> /tmp   1492
           /usr/fo
           Jan 12 15:53 1991
           Jan 31 15:53 2003

RRAATTIIOONNAALLEE
       The _p_a_x utility was new for the ISO POSIX-2:1993 standard. It
       represents a peaceful compromise between advocates of the historical
       _t_a_r and _c_p_i_o utilities.

       A fundamental difference between _c_p_i_o and _t_a_r was in the way
       directories were treated. The _c_p_i_o utility did not treat directories
       differently from other files, and to select a directory and its
       contents required that each file in the hierarchy be explicitly
       specified. For _t_a_r, a directory matched every file in the file
       hierarchy it rooted.

       The _p_a_x utility offers both interfaces; by default, directories map
       into the file hierarchy they root. The --dd option causes _p_a_x to skip any
       file not explicitly referenced, as _c_p_i_o historically did. The _t_a_r
       --_s_t_y_l_e behavior was chosen as the default because it was believed that
       this was the more common usage and because _t_a_r is the more commonly
       available interface, as it was historically provided on both System V
       and BSD implementations.

       The data interchange format specification in this volume of
       POSIX.1-2017 requires that processes with ``appropriate privileges''
       shall always restore the ownership and permissions of extracted files
       exactly as archived. If viewed from the historic equivalence between
       superuser and ``appropriate privileges'', there are two problems with
       this requirement. First, users running as superusers may unknowingly
       set dangerous permissions on extracted files. Second, it is needlessly
       limiting, in that superusers cannot extract files and own them as
       superuser unless the archive was created by the superuser. (It should
       be noted that restoration of ownerships and permissions for the
       superuser, by default, is historical practice in _c_p_i_o, but not in _t_a_r.)
       In order to avoid these two problems, the _p_a_x specification has an
       additional ``privilege'' mechanism, the --pp option. Only a _p_a_x
       invocation with the privileges needed, and which has the --pp option set
       using the ee specification character, has appropriate privileges to
       restore full ownership and permission information.

       Note also that this volume of POSIX.1-2017 requires that the file
       ownership and access permissions shall be set, on extraction, in the
       same fashion as the _c_r_e_a_t() function when provided with the mode stored
       in the archive. This means that the file creation mask of the user is
       applied to the file permissions.

       Users should note that directories may be created by _p_a_x while
       extracting files with permissions that are different from those that
       existed at the time the archive was created. When extracting sensitive
       information into a directory hierarchy that no longer exists, users are
       encouraged to set their file creation mask appropriately to protect
       these files during extraction.

       The table of contents output is written to standard output to
       facilitate pipeline processing.

       An early proposal had hard links displaying for all pathnames. This was
       removed because it complicates the output of the case where --vv is not
       specified and does not match historical _c_p_i_o usage. The hard-link
       information is available in the --vv display.

       The description of the --ll option allows implementations to make hard
       links to symbolic links.  Earlier versions of this standard did not
       specify any way to create a hard link to a symbolic link, but many
       implementations provided this capability as an extension. If there are
       hard links to symbolic links when an archive is created, the
       implementation is required to archive the hard link in the archive
       (unless --HH or --LL is specified). When in rreeaadd mode and in ccooppyy mode,
       implementations supporting hard links to symbolic links should use them
       when appropriate.

       The archive formats inherited from the POSIX.1-1990 standard have
       certain restrictions that have been brought along from historical
       usage. For example, there are restrictions on the length of pathnames
       stored in the archive.  When _p_a_x is used in ccooppyy(--rrww) mode (copying
       directory hierarchies), the ability to use extensions from the --xxppaaxx
       format overcomes these restrictions.

       The default _b_l_o_c_k_s_i_z_e value of 5120 bytes for _c_p_i_o was selected because
       it is one of the standard block-size values for _c_p_i_o, set when the --BB
       option is specified. (The other default block-size value for _c_p_i_o is
       512 bytes, and this was considered to be too small.) The default block
       value of 10240 bytes for _t_a_r was selected because that is the standard
       block-size value for BSD _t_a_r.  The maximum block size of 32256 bytes
       (215-512 bytes) is the largest multiple of 512 bytes that fits into a
       signed 16-bit tape controller transfer register. There are known
       limitations in some historical systems that would prevent larger blocks
       from being accepted. Historical values were chosen to improve
       compatibility with historical scripts using _d_d or similar utilities to
       manipulate archives. Also, default block sizes for any file type other
       than character special file has been deleted from this volume of
       POSIX.1-2017 as unimportant and not likely to affect the structure of
       the resulting archive.

       Implementations are permitted to modify the block-size value based on
       the archive format or the device to which the archive is being written.
       This is to provide implementations with the opportunity to take
       advantage of special types of devices, and it should not be used
       without a great deal of consideration as it almost certainly decreases
       archive portability.

       The intended use of the --nn option was to permit extraction of one or
       more files from the archive without processing the entire archive. This
       was viewed by the standard developers as offering significant
       performance advantages over historical implementations. The --nn option
       in early proposals had three effects; the first was to cause special
       characters in patterns to not be treated specially. The second was to
       cause only the first file that matched a pattern to be extracted. The
       third was to cause _p_a_x to write a diagnostic message to standard error
       when no file was found matching a specified pattern. Only the second
       behavior is retained by this volume of POSIX.1-2017, for many reasons.
       First, it is in general not acceptable for a single option to have
       multiple effects. Second, the ability to make pattern matching
       characters act as normal characters is useful for parts of _p_a_x other
       than file extraction. Third, a finer degree of control over the special
       characters is useful because users may wish to normalize only a single
       special character in a single filename. Fourth, given a more general
       escape mechanism, the previous behavior of the --nn option can be easily
       obtained using the --ss option or a _s_e_d script. Finally, writing a
       diagnostic message when a pattern specified by the user is unmatched by
       any file is useful behavior in all cases.

       In this version, the --nn was removed from the ccooppyy mode synopsis of _p_a_x;
       it is inapplicable because there are no pattern operands specified in
       this mode.

       There is another method than _p_a_x for copying subtrees in POSIX.1-2008
       described as part of the _c_p utility. Both methods are historical
       practice: _c_p provides a simpler, more intuitive interface, while _p_a_x
       offers a finer granularity of control. Each provides additional
       functionality to the other; in particular, _p_a_x maintains the hard-link
       structure of the hierarchy while _c_p does not. It is the intention of
       the standard developers that the results be similar (using appropriate
       option combinations in both utilities). The results are not required to
       be identical; there seemed insufficient gain to applications to balance
       the difficulty of implementations having to guarantee that the results
       would be exactly identical.

       A single archive may span more than one file. It is suggested that
       implementations provide informative messages to the user on standard
       error whenever the archive file is changed.

       The --dd option (do not create intermediate directories not listed in the
       archive) found in early proposals was originally provided as a
       complement to the historic --dd option of _c_p_i_o.  It has been deleted.

       The --ss option in early proposals specified a subset of the substitution
       command from the _e_d utility. As there was no reason for only a subset
       to be supported, the --ss option is now compatible with the current _e_d
       specification. Since the delimiter can be any non-null character, the
       following usage with single <space> characters is valid:


           pax -s " foo bar " ...

       The --tt description is worded so as to note that this may cause the
       access time update caused by some other activity (which occurs while
       the file is being read) to be overwritten.

       The default behavior of _p_a_x with regard to file modification times is
       the same as historical implementations of _t_a_r.  It is not the
       historical behavior of _c_p_i_o.

       Because the --ii option uses //ddeevv//ttttyy, utilities without a controlling
       terminal are not able to use this option.

       The --yy option, found in early proposals, has been deleted because a
       line containing a single <period> for the --ii option has equivalent
       functionality. The special lines for the --ii option (a single <period>
       and the empty line) are historical practice in _c_p_i_o.

       In early drafts, a --ee_c_h_a_r_m_a_p option was included to increase
       portability of files between systems using different coded character
       sets. This option was omitted because it was apparent that consensus
       could not be formed for it. In this version, the use of UTF-8 should be
       an adequate substitute.

       The ISO POSIX-2:1993 standard and ISO POSIX-1 standard requirements for
       _p_a_x, however, made it very difficult to create a single archive
       containing files created using extended characters provided by
       different locales.  This version adds the hhddrrcchhaarrsseett keyword to make it
       possible to archive files in these cases without dropping files due to
       translation errors.

       Translating filenames and other attributes from a locale's encoding to
       UTF-8 and then back again can lose information, as the resulting
       filename might not be byte-for-byte equivalent to the original. To
       avoid this problem, users can specify the --oo hhddrrcchhaarrsseett==bbiinnaarryy option,
       which will cause the resulting archive to use binary format for all
       names and attributes. Such archives are not portable among hosts that
       use different native encodings (e.g., EBCDIC _v_e_r_s_u_s ASCII-based
       encodings), but they will allow interchange among the vast majority of
       POSIX file systems in practical use. Also, the --oo hhddrrcchhaarrsseett==bbiinnaarryy
       option will cause _p_a_x in ccooppyy mode to behave more like other standard
       utilities such as _c_p.

       If the values specified by the --oo eexxtthhddrr..nnaammee==vvaalluuee, --oo
       gglloobbeexxtthhddrr..nnaammee==vvaalluuee, or by $$TTMMPPDDIIRR (if --oo gglloobbeexxtthhddrr..nnaammee is not
       specified) require a character encoding other than that described in
       the ISO/IEC 646:1991 standard, a ppaatthh extended header record will have
       to be created for the file. If a hhddrrcchhaarrsseett extended header record is
       active for such headers, it will determine the codeset used for the
       value field in these extended ppaatthh header records. These ppaatthh extended
       header records always need to be created when writing an archive even
       if hhddrrcchhaarrsseett==bbiinnaarryy has been specified and would contain the same
       (binary) data that appears in the uussttaarr header record prefix and _n_a_m_e
       fields. (In other words, an extended header ppaatthh record is always
       required to be generated if the _p_r_e_f_i_x or _n_a_m_e fields contain non-ASCII
       characters even when hhddrrcchhaarrsseett==bbiinnaarryy is also in effect for that
       file.)

       The --kk option was added to address international concerns about the
       dangers involved in the character set transformations of --ee (if the
       target character set were different from the source, the filenames
       might be transformed into names matching existing files) and also was
       made more general to protect files transferred between file systems
       with different {NAME_MAX} values (truncating a filename on a smaller
       system might also inadvertently overwrite existing files). As stated,
       it prevents any overwriting, even if the target file is older than the
       source. This version adds more granularity of options to solve this
       problem by introducing the --ooiinnvvaalliidd==ooppttiioonn--specifically the UUTTFF--88 and
       bbiinnaarryy actions. (Note that an existing file is still subject to
       overwriting in this case. The --kk option closes that loophole.)

       Some of the file characteristics referenced in this volume of
       POSIX.1-2017 might not be supported by some archive formats. For
       example, neither the ttaarr nor ccppiioo formats contain the file access time.
       For this reason, the ee specification character has been provided,
       intended to cause all file characteristics specified in the archive to
       be retained.

       It is required that extracted directories, by default, have their
       access and modification times and permissions set to the values
       specified in the archive. This has obvious problems in that the
       directories are almost certainly modified after being extracted and
       that directory permissions may not permit file creation. One possible
       solution is to create directories with the mode specified in the
       archive, as modified by the _u_m_a_s_k of the user, with sufficient
       permissions to allow file creation. After all files have been
       extracted, _p_a_x would then reset the access and modification times and
       permissions as necessary.

       The list-mode formatting description borrows heavily from the one
       defined by the _p_r_i_n_t_f utility. However, since there is no separate
       operand list to get conversion arguments, the format was extended to
       allow specifying the name of the conversion argument as part of the
       conversion specification.

       The TT conversion specifier allows time fields to be displayed in any of
       the date formats. Unlike the _l_s utility, _p_a_x does not adjust the format
       when the date is less than six months in the past. This makes parsing
       the output more predictable.

       The DD conversion specifier handles the ability to display the
       major/minor or file size, as with _l_s, by using %-8(_s_i_z_e)D.

       The LL conversion specifier handles the _l_s display for symbolic links.

       Conversion specifiers were added to generate existing known types used
       for _l_s.

   ppaaxx IInntteerrcchhaannggee FFoorrmmaatt
       The new POSIX data interchange format was developed primarily to
       satisfy international concerns that the uussttaarr and ccppiioo formats did not
       provide for file, user, and group names encoded in characters outside a
       subset of the ISO/IEC 646:1991 standard. The standard developers
       realized that this new POSIX data interchange format should be very
       extensible because there were other requirements they foresaw in the
       near future:

        *  Support international character encodings and locale information

        *  Support security information (ACLs, and so on)

        *  Support future file types, such as realtime or contiguous files

        *  Include data areas for implementation use

        *  Support systems with words larger than 32 bits and timers with
           subsecond granularity

       The following were not goals for this format because these are better
       handled by separate utilities or are inappropriate for a portable
       format:

        *  Encryption

        *  Compression

        *  Data translation between locales and codesets

        *  _i_n_o_d_e storage

       The format chosen to support the goals is an extension of the uussttaarr
       format. Of the two formats previously available, only the uussttaarr format
       was selected for extensions because:

        *  It was easier to extend in an upwards-compatible way. It offered
           version flags and header block type fields with room for future
           standardization. The ccppiioo format, while possessing a more flexible
           file naming methodology, could not be extended without breaking
           some theoretical implementation or using a dummy filename that
           could be a legitimate filename.

        *  Industry experience since the original ``_t_a_r wars'' fought in
           developing the ISO POSIX-1 standard has clearly been in favor of
           the uussttaarr format, which is generally the default output format
           selected for _p_a_x implementations on new systems.

       The new format was designed with one additional goal in mind:
       reasonable behavior when an older _t_a_r or _p_a_x utility happened to read
       an archive. Since the POSIX.1-1990 standard mandated that a ``format-
       reading utility'' had to treat unrecognized _t_y_p_e_f_l_a_g values as regular
       files, this allowed the format to include all the extended information
       in a pseudo-regular file that preceded each real file. An option is
       given that allows the archive creator to set up reasonable names for
       these files on the older systems. Also, the normative text suggests
       that reasonable file access values be used for this uussttaarr header block.
       Making these header files inaccessible for convenient reading and
       deleting would not be reasonable. File permissions of 600 or 700 are
       suggested.

       The uussttaarr _t_y_p_e_f_l_a_g field was used to accommodate the additional
       functionality of the new format rather than magic or version because
       the POSIX.1-1990 standard (and, by reference, the previous version of
       _p_a_x), mandated the behavior of the format-reading utility when it
       encountered an unknown _t_y_p_e_f_l_a_g, but was silent about the other two
       fields.

       Early proposals for the first version of this standard contained a
       proposed archive format that was based on compatibility with the
       standard for tape files (ISO 1001, similar to the format used
       historically on many mainframes and minicomputers). This format was
       overly complex and required considerable overhead in volume and header
       records. Furthermore, the standard developers felt that it would not be
       acceptable to the community of POSIX developers, so it was later
       changed to be a format more closely related to historical practice on
       POSIX systems.

       The prefix and name split of pathnames in uussttaarr was replaced by the
       single path extended header record for simplicity.

       The concept of a global extended header (_t_y_p_e_f_l_a_ggg) was controversial.
       If this were applied to an archive being recorded on magnetic tape, a
       few unreadable blocks at the beginning of the tape could be a serious
       problem; a utility attempting to extract as many files as possible from
       a damaged archive could lose a large percentage of file header
       information in this case. However, if the archive were on a reliable
       medium, such as a CD-ROM, the global extended header offers
       considerable potential size reductions by eliminating redundant
       information. Thus, the text warns against using the global method for
       unreliable media and provides a method for implanting global
       information in the extended header for each file, rather than in the
       _t_y_p_e_f_l_a_g gg records.

       No facility for data translation or filtering on a per-file basis is
       included because the standard developers could not invent an interface
       that would allow this in an efficient manner. If a filter, such as
       encryption or compression, is to be applied to all the files, it is
       more efficient to apply the filter to the entire archive as a single
       file. The standard developers considered interfaces that would invoke a
       shell script for each file going into or out of the archive, but the
       system overhead in this approach was considered to be too high.

       One such approach would be to have ffiilltteerr== records that give a pathname
       for an executable. When the program is invoked, the file and archive
       would be open for standard input/output and all the header fields would
       be available as environment variables or command-line arguments. The
       standard developers did discuss such schemes, but they were omitted
       from POSIX.1-2008 due to concerns about excessive overhead. Also, the
       program itself would need to be in the archive if it were to be used
       portably.

       There is currently no portable means of identifying the character
       set(s) used for a file in the file system. Therefore, _p_a_x has not been
       given a mechanism to generate charset records automatically. The only
       portable means of doing this is for the user to write the archive using
       the --oocchhaarrsseett==ssttrriinngg command line option. This assumes that all of the
       files in the archive use the same encoding. The ``implementation-
       defined'' text is included to allow for a system that can identify the
       encodings used for each of its files.

       The table of standards that accompanies the charset record description
       is acknowledged to be very limited. Only a limited number of character
       set standards is reasonable for maximal interchange. Any character set
       is, of course, possible by prior agreement. It was suggested that
       EBCDIC be listed, but it was omitted because it is not defined by a
       formal standard. Formal standards, and then only those with reasonably
       large followings, can be included here, simply as a matter of
       practicality. The <_v_a_l_u_e>s represent names of officially registered
       character sets in the format required by the ISO 2375:1985 standard.

       The normal <comma> or <blank>-separated list rules are not followed in
       the case of keyword options to allow ease of argument parsing for
       _g_e_t_o_p_t_s.

       Further information on character encodings is in _p_a_x _A_r_c_h_i_v_e _C_h_a_r_a_c_t_e_r
       _S_e_t _E_n_c_o_d_i_n_g_/_D_e_c_o_d_i_n_g.

       The standard developers have reserved keyword name space for vendor
       extensions. It is suggested that the format to be used is:


           _V_E_N_D_O_R_._k_e_y_w_o_r_d

       where _V_E_N_D_O_R is the name of the vendor or organization in all uppercase
       letters. It is further suggested that the keyword following the
       <period> be named differently than any of the standard keywords so that
       it could be used for future standardization, if appropriate, by
       omitting the _V_E_N_D_O_R prefix.

       The <_l_e_n_g_t_h> field in the extended header record was included to make
       it simpler to step through the records, even if a record contains an
       unknown format (to a particular _p_a_x) with complex interactions of
       special characters. It also provides a minor integrity checkpoint
       within the records to aid a program attempting to recover files from a
       damaged archive.

       There are no extended header versions of the _d_e_v_m_a_j_o_r and _d_e_v_m_i_n_o_r
       fields because the unspecified format uussttaarr header field should be
       sufficient. If they are not, vendor-specific extended keywords (such as
       _V_E_N_D_O_R_._d_e_v_m_a_j_o_r) should be used.

       Device and _i-number labeling of files was not adopted from _c_p_i_o; files
       are interchanged strictly on a symbolic name basis, as in uussttaarr.

       Just as with the uussttaarr format descriptions, the new format makes no
       special arrangements for multi-volume archives. Each of the _p_a_x archive
       types is assumed to be inside a single POSIX file and splitting that
       file over multiple volumes (diskettes, tape cartridges, and so on),
       processing their labels, and mounting each in the proper sequence are
       considered to be implementation details that cannot be described
       portably.

       The ppaaxx format is intended for interchange, not only for backup on a
       single (family of) systems. It is not as densely packed as might be
       possible for backup:

        *  It contains information as coded characters that could be coded in
           binary.

        *  It identifies extended records with name fields that could be
           omitted in favor of a fixed-field layout.

        *  It translates names into a portable character set and identifies
           locale-related information, both of which are probably unnecessary
           for backup.

       The requirements on restoring from an archive are slightly different
       from the historical wording, allowing for non-monolithic privilege to
       bring forward as much as possible. In particular, attributes such as
       ``high performance file'' might be broadly but not universally granted
       while set-user-ID or _c_h_o_w_n() might be much more restricted. There is no
       implication in POSIX.1-2008 that the security information be honored
       after it is restored to the file hierarchy, in spite of what might be
       improperly inferred by the silence on that topic. That is a topic for
       another standard.

       Links are recorded in the fashion described here because a link can be
       to any file type. It is desirable in general to be able to restore part
       of an archive selectively and restore all of those files completely. If
       the data is not associated with each link, it is not possible to do
       this. However, the data associated with a file can be large, and when
       selective restoration is not needed, this can be a significant burden.
       The archive is structured so that files that have no associated data
       can always be restored by the name of any link name of any link, and
       the user may choose whether data is recorded with each instance of a
       file that contains data. The format permits mixing of both types of
       links in a single archive; this can be done for special needs, and _p_a_x
       is expected to interpret such archives on input properly, despite the
       fact that there is no _p_a_x option that would force this mixed case on
       output. (When --oo lliinnkkddaattaa is used, the output must contain the
       duplicate data, but the implementation is free to include it or omit it
       when --oo lliinnkkddaattaa is not used.)

       The time values are included as extended header records for those
       implementations needing more than the eleven octal digits allowed by
       the uussttaarr format. Portable file timestamps cannot be negative. If _p_a_x
       encounters a file with a negative timestamp in ccooppyy or wwrriittee mode, it
       can reject the file, substitute a non-negative timestamp, or generate a
       non-portable timestamp with a leading ''--''.  Even though some
       implementations can support finer file-time granularities than seconds,
       the normative text requires support only for seconds since the Epoch
       because the ISO POSIX-1 standard states them that way. The uussttaarr format
       includes only _m_t_i_m_e; the new format adds _a_t_i_m_e and _c_t_i_m_e for symmetry.
       The _a_t_i_m_e access time restored to the file system will be affected by
       the --pp aa and --pp ee options. The _c_t_i_m_e creation time (actually _i_n_o_d_e
       modification time) is described with appropriate privileges so that it
       can be ignored when writing to the file system. POSIX does not provide
       a portable means to change file creation time. Nothing is intended to
       prevent a non-portable implementation of _p_a_x from restoring the value.

       The _g_i_d, _s_i_z_e, and _u_i_d extended header records were included to allow
       expansion beyond the sizes specified in the regular _t_a_r header. New
       file system architectures are emerging that will exhaust the 12-digit
       size field. There are probably not many systems requiring more than 8
       digits for user and group IDs, but the extended header values were
       included for completeness, allowing overrides for all of the decimal
       values in the _t_a_r header.

       The standard developers intended to describe the effective results of
       _p_a_x with regard to file ownerships and permissions; implementations are
       not restricted in timing or sequencing the restoration of such,
       provided the results are as specified.

       Much of the text describing the extended headers refers to use in
       ``wwrriittee or ccooppyy modes''. The ccooppyy mode references are due to the
       normative text: ``The effect of the copy shall be as if the copied
       files were written to an archive file and then subsequently extracted
       ...''. There is certainly no way to test whether _p_a_x is actually
       generating the extended headers in ccooppyy mode, but the effects must be
       as if it had.

   ppaaxx AArrcchhiivvee CChhaarraacctteerr SSeett EEnnccooddiinngg//DDeeccooddiinngg
       There is a need to exchange archives of files between systems of
       different native codesets. Filenames, group names, and user names must
       be preserved to the fullest extent possible when an archive is read on
       the receiving platform. Translation of the contents of files is not
       within the scope of the _p_a_x utility.

       There will also be the need to represent characters that are not
       available on the receiving platform. These unsupported characters
       cannot be automatically folded to the local set of characters due to
       the chance of collisions. This could result in overwriting previous
       extracted files from the archive or pre-existing files on the system.

       For these reasons, the codeset used to represent characters within the
       extended header records of the _p_a_x archive must be sufficiently rich to
       handle all commonly used character sets. The fields requiring
       translation include, at a minimum, filenames, user names, group names,
       and link pathnames. Implementations may wish to have localized extended
       keywords that use non-portable characters.

       The standard developers considered the following options:

        *  The archive creator specifies the well-defined name of the source
           codeset. The receiver must then recognize the codeset name and
           perform the appropriate translations to the destination codeset.

        *  The archive creator includes within the archive the character
           mapping table for the source codeset used to encode extended header
           records.  The receiver must then read the character mapping table
           and perform the appropriate translations to the destination
           codeset.

        *  The archive creator translates the extended header records in the
           source codeset into a canonical form. The receiver must then
           perform the appropriate translations to the destination codeset.

       The approach that incorporates the name of the source codeset poses the
       problem of codeset name registration, and makes the archive useless to
       _p_a_x archive decoders that do not recognize that codeset.

       Because parts of an archive may be corrupted, the standard developers
       felt that including the character map of the source codeset was too
       fragile. The loss of this one key component could result in making the
       entire archive useless. (The difference between this and the global
       extended header decision was that the latter has a workaround--
       duplicating extended header records on unreliable media--but this would
       be too burdensome for large character set maps.)

       Both of the above approaches also put an undue burden on the _p_a_x
       archive receiver to handle the cross-product of all source and
       destination codesets.

       To simplify the translation from the source codeset to the canonical
       form and from the canonical form to the destination codeset, the
       standard developers decided that the internal representation should be
       a stateless encoding. A stateless encoding is one where each codepoint
       has the same meaning, without regard to the decoder being in a specific
       state. An example of a stateful encoding would be the Japanese Shift-
       JIS; an example of a stateless encoding would be the ISO/IEC 646:1991
       standard (equivalent to 7-bit ASCII).

       For these reasons, the standard developers decided to adopt a canonical
       format for the representation of file information strings. The obvious,
       well-endorsed candidate is the ISO/IEC 10646-1:2000 standard (based in
       part on Unicode), which can be used to represent the characters of
       virtually all standardized character sets. The standard developers
       initially agreed upon using UCS2 (16-bit Unicode) as the internal
       representation. This repertoire of characters provides a sufficiently
       rich set to represent all commonly-used codesets.

       However, the standard developers found that the 16-bit Unicode
       representation had some problems. It forced the issue of standardizing
       byte ordering. The 2-byte length of each character made the extended
       header records twice as long for the case of strings coded entirely
       from historical 7-bit ASCII. For these reasons, the standard developers
       chose the UTF-8 defined in the ISO/IEC 10646-1:2000 standard. This
       multi-byte representation encodes UCS2 or UCS4 characters reliably and
       deterministically, eliminating the need for a canonical byte ordering.
       In addition, NUL octets and other characters possibly confusing to
       POSIX file systems do not appear, except to represent themselves. It
       was realized that certain national codesets take up more space after
       the encoding, due to their placement within the UCS range; it was felt
       that the usefulness of the encoding of the names outweighs the
       disadvantage of size increase for file, user, and group names.

       The encoding of UTF-8 is as follows:


           UCS4 Hex Encoding  UTF-8 Binary Encoding

           00000000-0000007F  0xxxxxxx
           00000080-000007FF  110xxxxx 10xxxxxx
           00000800-0000FFFF  1110xxxx 10xxxxxx 10xxxxxx
           00010000-001FFFFF  11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
           00200000-03FFFFFF  111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
           04000000-7FFFFFFF  1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx

       where each ''xx'' represents a bit value from the character being
       translated.

   uussttaarr IInntteerrcchhaannggee FFoorrmmaatt
       The description of the uussttaarr format reflects numerous enhancements over
       pre-1988 versions of the historical _t_a_r utility. The goal of these
       changes was not only to provide the functional enhancements desired,
       but also to retain compatibility between new and old versions. This
       compatibility has been retained.  Archives written using the old
       archive format are compatible with the new format.

       Implementors should be aware that the previous file format did not
       include a mechanism to archive directory type files. For this reason,
       the convention of using a filename ending with <slash> was adopted to
       specify a directory on the archive.

       The total size of the _n_a_m_e and _p_r_e_f_i_x fields have been set to meet the
       minimum requirements for {PATH_MAX}.  If a pathname will fit within the
       _n_a_m_e field, it is recommended that the pathname be stored there without
       the use of the _p_r_e_f_i_x field. Although the name field is known to be too
       small to contain {PATH_MAX} characters, the value was not changed in
       this version of the archive file format to retain backwards-
       compatibility, and instead the prefix was introduced. Also, because of
       the earlier version of the format, there is no way to remove the
       restriction on the _l_i_n_k_n_a_m_e field being limited in size to just that of
       the _n_a_m_e field.

       The _s_i_z_e field is required to be meaningful in all implementation
       extensions, although it could be zero. This is required so that the
       data blocks can always be properly counted.

       It is suggested that if device special files need to be represented
       that cannot be represented in the standard format, that one of the
       extension types (AA-ZZ) be used, and that the additional information for
       the special file be represented as data and be reflected in the _s_i_z_e
       field.

       Attempting to restore a special file type, where it is converted to
       ordinary data and conflicts with an existing filename, need not be
       specially detected by the utility. If run as an ordinary user, _p_a_x
       should not be able to overwrite the entries in, for example, //ddeevv in
       any case (whether the file is converted to another type or not). If run
       as a privileged user, it should be able to do so, and it would be
       considered a bug if it did not. The same is true of ordinary data files
       and similarly named special files; it is impossible to anticipate the
       needs of the user (who could really intend to overwrite the file), so
       the behavior should be predictable (and thus regular) and rely on the
       protection system as required.

       The value 7 in the _t_y_p_e_f_l_a_g field is intended to define how contiguous
       files can be stored in a uussttaarr archive. POSIX.1-2008 does not require
       the contiguous file extension, but does define a standard way of
       archiving such files so that all conforming systems can interpret these
       file types in a meaningful and consistent manner. On a system that does
       not support extended file types, the _p_a_x utility should do the best it
       can with the file and go on to the next.

       The file protection modes are those conventionally used by the _l_s
       utility. This is extended beyond the usage in the ISO POSIX-2 standard
       to support the ``shared text'' or ``sticky'' bit. It is intended that
       the conformance document should not document anything beyond the
       existence of and support of such a mode. Further extensions are
       expected to these bits, particularly with overloading the set-user-ID
       and set-group-ID flags.

   ccppiioo IInntteerrcchhaannggee FFoorrmmaatt
       The reference to appropriate privileges in the ccppiioo format refers to an
       error on standard output; the uussttaarr format does not make comparable
       statements.

       The model for this format was the historical System V _c_p_i_o--cc data
       interchange format. This model documents the portable version of the
       ccppiioo format and not the binary version. It has the flexibility to
       transfer data of any type described within POSIX.1-2008, yet is
       extensible to transfer data types specific to extensions beyond
       POSIX.1-2008 (for example, contiguous files). Because it describes
       existing practice, there is no question of maintaining upwards-
       compatibility.

   ccppiioo HHeeaaddeerr
       There has been some concern that the size of the _c___i_n_o field of the
       header is too small to handle those systems that have very large _i_n_o_d_e
       numbers. However, the _c___i_n_o field in the header is used strictly as a
       hard-link resolution mechanism for archives. It is not necessarily the
       same value as the _i_n_o_d_e number of the file in the location from which
       that file is extracted.

       The name _c___m_a_g_i_c is based on historical usage.

   ccppiioo FFiilleennaammee
       For most historical implementations of the _c_p_i_o utility, {PATH_MAX}
       octets can be used to describe the pathname without the addition of any
       other header fields (the NUL character would be included in this
       count).  {PATH_MAX} is the minimum value for pathname size, documented
       as 256 bytes.  However, an implementation may use _c___n_a_m_e_s_i_z_e to
       determine the exact length of the pathname. With the current
       description of the _<_c_p_i_o_._h_> header, this pathname size can be as large
       as a number that is described in six octal digits.

       Two values are documented under the _c___m_o_d_e field values to provide for
       extensibility for known file types:

       00111100 000000  Reserved for contiguous files. The implementation may treat
                 the rest of the information for this archive like a regular
                 file. If this file type is undefined, the implementation may
                 create the file as a regular file.

       This provides for extensibility of the ccppiioo format while allowing for
       the ability to read old archives. Files of an unknown type may be read
       as ``regular files'' on some implementations.  On a system that does
       not support extended file types, the _p_a_x utility should do the best it
       can with the file and go on to the next.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _C_h_a_p_t_e_r _2, _S_h_e_l_l _C_o_m_m_a_n_d _L_a_n_g_u_a_g_e, _c_p, _e_d, _g_e_t_o_p_t_s, _l_s, _p_r_i_n_t_f

       The Base Definitions volume of POSIX.1-2017, _S_e_c_t_i_o_n _3_._1_6_9, _F_i_l_e _M_o_d_e
       _B_i_t_s, _C_h_a_p_t_e_r _5, _F_i_l_e _F_o_r_m_a_t _N_o_t_a_t_i_o_n, _C_h_a_p_t_e_r _8, _E_n_v_i_r_o_n_m_e_n_t
       _V_a_r_i_a_b_l_e_s, _S_e_c_t_i_o_n _1_2_._2, _U_t_i_l_i_t_y _S_y_n_t_a_x _G_u_i_d_e_l_i_n_e_s, <<ccppiioo..hh>>, <<ttaarr..hh>>

       The System Interfaces volume of POSIX.1-2017, _c_h_o_w_n(), _c_r_e_a_t(),
       _f_s_t_a_t_a_t(), _m_k_d_i_r(), _m_k_f_i_f_o(), _u_t_i_m_e(), _w_r_i_t_e()

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1-2017, Standard for Information Technology --
       Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the
       Institute of Electrical and Electronics Engineers, Inc and The Open
       Group.  In the event of any discrepancy between this version and the
       original IEEE and The Open Group Standard, the original IEEE and The
       Open Group Standard is the referee document. The original Standard can
       be obtained online at http://www.opengroup.org/unix/online.html .

       Any typographical or formatting errors that appear in this page are
       most likely to have been introduced during the conversion of the source
       files to man page format. To report such errors, see
       https://www.kernel.org/doc/man-pages/reporting_bugs.html .



IEEE/The Open Group                  2017                               PAX(1)
