This is the command paxposix that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator
PROGRAM:
NAME
pax — portable archive interchange
SYNOPSIS
pax [−dv] [−c|−n] [−H|−L] [−o options] [−f archive] [−s replstr]...
[pattern...]
pax −r[−c|−n] [−dikuv] [−H|−L] [−f archive] [−o options]... [−p string]...
[−s replstr]... [pattern...]
pax −w [−dituvX] [−H|−L] [−b blocksize] [[−a] [−f archive]] [−o options]...
[−s replstr]... [−x format] [file...]
pax −r −w [−diklntuvX] [−H|−L] [−o options]... [−p string]...
[−s replstr]... [file...] directory
DESCRIPTION
The pax 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 −x
format option.
The action to be taken depends on the presence of the −r and −w options. The four
combinations of −r and −w are referred to as the four modes of operation: list, read,
write, and copy modes, corresponding respectively to the four forms shown in the SYNOPSIS
section.
list In list mode (when neither −r nor −w are specified), pax 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.
read In read mode (when −r is specified, but −w is not), pax 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 pax 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 −p option.
write In write mode (when −w is specified, but −r is not), pax shall write the
contents of the file operands to the standard output in an archive format. If no
file 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 file operand on the command line. A file of type directory
shall include all of the files in the file hierarchy rooted at the file.
copy In copy mode (when both −r and −w are specified), pax shall copy the file
operands to the destination directory.
If no file 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 copy shall be as if the copied files were written to a pax
format archive file and then subsequently extracted, except 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‐2008, the results are implementation-
defined; otherwise, it shall be an error for the file named by the directory
operand not to exist, not be writable by the user, or not be a file of type
directory.
In read or copy modes, if intermediate directories are necessary to extract an archive
member, pax shall perform actions equivalent to the mkdir() function defined in the System
Interfaces volume of POSIX.1‐2008, called with the following arguments:
* The intermediate directory used as the path argument
* The value of the bitwise-inclusive OR of S_IRWXU, S_IRWXG, and S_IRWXO as the mode
argument
If any specified pattern or file operands are not matched by at least one file or archive
member, pax 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 pax 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 pax 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, pax 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, pax shall write a
diagnostic message to standard error and shall terminate.
OPTIONS
The pax utility shall conform to the Base Definitions volume of POSIX.1‐2008, Section
12.2, Utility Syntax Guidelines, except that the order of presentation of the −o, −p, and
−s options is significant.
The following options shall be supported:
−r Read an archive file from standard input.
−w Write files to the standard output in the specified archive format.
−a 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‐2008 may impose restrictions on appending.
−b blocksize
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 blocksize value larger than 32256. Default blocking when
creating archives depends on the archive format. (See the −x option below.)
−c Match all file or archive members except those specified by the pattern or file
operands.
−d 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.
−f archive
Specify the pathname of the input or output archive, overriding the default
standard input (in list or read modes) or standard output (write mode).
−H If a symbolic link referencing a file of type directory is specified on the
command line, pax 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
pax can normally archive is specified on the command line, then pax shall
archive the file referenced by the link, using the name of the link. The default
behavior, when neither −H or −L are specified, shall be to archive the symbolic
link itself.
−i Interactively rename files or archive members. For each archive member matching
a pattern operand or file matching a file operand, a prompt shall be written to
the file /dev/tty. 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
/dev/tty. 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 pax utility shall immediately exit
with a non-zero exit status if end-of-file is encountered when reading a
response or if /dev/tty 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.
−k Prevent the overwriting of existing files.
−l (The letter ell.) In copy mode, hard links shall be made between the source and
destination file hierarchies whenever possible. If specified in conjunction with
−H or −L, 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 −H nor −L 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.
−L 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, pax 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 pax can normally archive is
specified on the command line or encountered during the traversal of a file
hierarchy, pax shall archive the file referenced by the link, using the name of
the link. The default behavior, when neither −H or −L are specified, shall be to
archive the symbolic link itself.
−n Select the first archive member that matches each pattern 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).
−o options
Provide information to the implementation to modify the algorithm for extracting
or writing files. The value of options shall consist of one or more
<comma>-separated keywords of the form:
keyword[[:]=value][,keyword[[:]=value], ...]
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 options argument shall be a string that would be a valid
portable filename as described in the Base Definitions volume of POSIX.1‐2008,
Section 3.278, Portable Filename Character Set.
Note: 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 value field shall consist of zero
or more characters; within value, the application shall precede any literal
<comma> with a <backslash>, which shall be ignored, but preserves the <comma> as
part of value. A <comma> as the final character, or a <comma> followed solely
by white space as the final characters, in options shall be ignored. Multiple −o
options can be specified; if keywords given to these multiple −o 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 options shall be supported for the file formats as indicated:
delete=pattern
(Applicable only to the −x pax format.) When used in write or copy mode,
pax shall omit from extended header records that it produces any keywords
matching the string pattern. When used in read or list mode, pax 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 Section 2.13.1, Patterns Matching a Single
Character and Section 2.13.2, Patterns Matching Multiple Characters. For
example:
−o delete=security.*
would suppress security-related information. See pax Extended Header for
extended header record keyword usage.
When multiple −odelete=pattern options are specified, the patterns shall
be additive; all keywords matching the specified string patterns shall be
omitted from extended header records that pax produces.
exthdr.name=string
(Applicable only to the −x pax format.) This keyword allows user control
over the name that is written into the ustar header blocks for the
extended header produced under the circumstances described in pax Header
Block. The name shall be the contents of string, after the following
character substitutions have been made:
┌──────────┬────────────────────────────────────────┐
│ string │ │
│Includes: │ Replaced by: │
├──────────┼────────────────────────────────────────┤
│%d │ The directory name of the file, │
│ │ equivalent to the result of the │
│ │ dirname utility on the translated │
│ │ pathname. │
│%f │ The filename of the file, equivalent │
│ │ to the result of the basename utility │
│ │ on the translated pathname. │
│%p │ The process ID of the pax process. │
│%% │ A '%' character. │
└──────────┴────────────────────────────────────────┘
Any other '%' characters in string produce undefined results.
If no −o exthdr.name=string is specified, pax shall use the following
default value:
%d/PaxHeaders.%p/%f
globexthdr.name=string
(Applicable only to the −x pax format.) When used in write or copy mode
with the appropriate options, pax shall create global extended header
records with ustar header blocks that will be treated as regular files by
previous versions of pax. This keyword allows user control over the name
that is written into the ustar header blocks for global extended header
records. The name shall be the contents of string, after the following
character substitutions have been made:
┌──────────┬────────────────────────────────────────┐
│ string │ │
│Includes: │ Replaced by: │
├──────────┼────────────────────────────────────────┤
│%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 pax process. │
│%% │ A '%' character. │
└──────────┴────────────────────────────────────────┘
Any other '%' characters in string produce undefined results.
If no −o globexthdr.name=string is specified, pax shall use the following
default value:
$TMPDIR/GlobalHead.%p.%n
where $TMPDIR represents the value of the TMPDIR environment variable. If
TMPDIR is not set, pax shall use /tmp.
invalid=action
(Applicable only to the −x pax format.) This keyword allows user control
over the action pax takes upon encountering values in an extended header
record that, in read or copy mode, are invalid in the destination
hierarchy or, in list mode, cannot be written in the codeset and current
locale of the implementation. The following are invalid values that shall
be recognized by pax:
-- In read or copy mode, a filename or link name that contains character
encodings invalid in the destination hierarchy. (For example, the name
may contain embedded NULs.)
-- In read or copy 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 list 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 action argument are
supported:
binary In write mode, pax shall generate a hdrcharset=BINARY 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 read or copy mode, pax shall use the values
specified in the header without translation, regardless of
whether this may overwrite an existing file with a valid name.
In list mode, pax shall behave identically to the bypass action.
bypass In read or copy mode, pax shall bypass the file, causing no
change to the destination hierarchy. In list mode, pax shall
write all requested valid values for the file, but its method
for writing invalid values is unspecified.
rename In read or copy mode, pax shall act as if the −i option were in
effect for each file with invalid filename or link name values,
allowing the user to provide a replacement name interactively.
In list mode, pax shall behave identically to the bypass action.
UTF‐8 When used in read, copy, or list mode and a filename, link name,
owner name, or any other field in an extended header record
cannot be translated from the pax UTF‐8 codeset format to the
codeset and current locale of the implementation, pax shall use
the actual UTF‐8 encoding for the name. If a hdrcharset 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
hdrcharset=BINARY extended header record is in effect for this
file, no translation shall be performed.
write In read or copy mode, pax shall write the file, translating the
name, regardless of whether this may overwrite an existing file
with a valid name. In list mode, pax shall behave identically to
the bypass action.
If no −o invalid=option is specified, pax shall act as if −oinvalid=bypass
were specified. Any overwriting of existing files that may be allowed by
the −oinvalid= actions shall be subject to permission (−p) and
modification time (−u) restrictions, and shall be suppressed if the −k
option is also specified.
linkdata
(Applicable only to the −x pax format.) In write mode, pax 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.
listopt=format
This keyword specifies the output format of the table of contents produced
when the −v option is specified in list mode. See List Mode Format
Specifications. To avoid ambiguity, the listopt=format shall be the only
or final keyword=value pair in a −o option-argument; all characters in the
remainder of the option-argument shall be considered part of the format
string. When multiple −olistopt=format options are specified, the format
strings shall be considered a single, concatenated string, evaluated in
command line order.
times
(Applicable only to the −x pax format.) When used in write or copy mode,
pax shall include atime and mtime extended header records for each file.
See pax Extended Header File Times.
In addition to these keywords, if the −x pax format is specified, any of the
keywords and values defined in pax Extended Header, including implementation
extensions, can be used in −o option-arguments, in either of two modes:
keyword=value
When used in write or copy mode, these keyword/value pairs shall be
included at the beginning of the archive as typeflag g global extended
header records. When used in read or list mode, these keyword/value pairs
shall act as if they had been at the beginning of the archive as typeflag
g global extended header records.
keyword:=value
When used in write or copy mode, these keyword/value pairs shall be
included as records at the beginning of a typeflag x extended header for
each file. (This shall be equivalent to the <equals-sign> form except that
it creates no typeflag g global extended header records.) When used in
read or list 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 −o keywords over various fields in the archive is described in
pax Extended Header Keyword Precedence.
−p string Specify one or more file characteristic options (privileges). The string option-
argument shall be a string specifying file characteristics to be retained or
discarded on extraction. The string shall consist of the specification
characters a, e, m, o, and p. Other implementation-defined characters can be
included. Multiple characteristics can be concatenated within the same string
and multiple −p 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‐2008, Section 3.169, File Mode Bits), 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 −p 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 Section 1.1.1.4, File Read, Write, and
Creation).
If neither the e nor the o specification character is specified, or the user ID
and group ID are not preserved for any reason, pax 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, pax 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 string option-arguments are
duplicated or conflict with each other, the ones given last shall take
precedence. For example, if −p eme is specified, file modification times are
preserved.
−s replstr
Modify file or archive member names named by pattern or file operands according
to the substitution expression replstr, using the syntax of the ed utility. The
concepts of ``address'' and ``line'' are meaningless in the context of the pax
utility, and shall not be supplied. The format shall be:
−s /old/new/[gp]
where as in ed, old is a basic regular expression and new can contain an
<ampersand>, '\n' (where n is a digit) back-references, or subexpression
matching. The old string shall also be permitted to contain <newline>
characters.
Any non-null character can be used as a delimiter ('/' shown here). Multiple −s
expressions can be specified; the expressions shall be applied in the order
specified, terminating with the first successful substitution. The optional
trailing 'g' is as defined in the ed utility. The optional trailing 'p' 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.
−t When reading files from the file system, and if the user has the permissions
required by utime() to do so, set the access time of each file read to the
access time that it had before being read by pax.
−u 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 read 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 write 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 −a 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 copy 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.
−v In list mode, produce a verbose table of contents (see the STDOUT section).
Otherwise, write archive member pathnames to standard error (see the STDERR
section).
−x format Specify the output archive format. The pax utility shall support the following
formats:
cpio The cpio interchange format; see the EXTENDED DESCRIPTION section. The
default blocksize for this format for character special archive files
shall be 5120. Implementations shall support all blocksize values
less than or equal to 32256 that are multiples of 512.
pax The pax interchange format; see the EXTENDED DESCRIPTION section. The
default blocksize for this format for character special archive files
shall be 5120. Implementations shall support all blocksize values
less than or equal to 32256 that are multiples of 512.
ustar The tar interchange format; see the EXTENDED DESCRIPTION section. The
default blocksize for this format for character special archive files
shall be 10240. Implementations shall support all blocksize 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 pax to exit immediately with a non-zero exit status.
−X When traversing the file hierarchy specified by a pathname, pax shall not
descend into directories that have a different device ID (st_dev; see the System
Interfaces volume of POSIX.1‐2008, stat()).
Specifying more than one of the mutually-exclusive options −H and −L 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 (−c, −i, −n, −s, −u, and
−v) shall interact as follows. In read mode, the archive members shall be selected based
on the user-specified pattern operands as modified by the −c, −n, and −u options. Then,
any −s and −i options shall modify, in that order, the names of the selected files. The
−v option shall write names resulting from these modifications.
In write mode, the files shall be selected based on the user-specified pathnames as
modified by the −n and −u options. Then, any −s and −i options shall modify, in that
order, the names of these selected files. The −v option shall write names resulting from
these modifications.
If both the −u and −n options are specified, pax shall not consider a file selected unless
it is newer than the file to which it is compared.
List Mode Format Specifications
In list mode with the −o listopt=format option, the format argument shall be applied for
each selected file. The pax utility shall append a <newline> to the listopt output for
each selected file. The format argument shall be used as the format string described in
the Base Definitions volume of POSIX.1‐2008, Chapter 5, File Format Notation, with the
exceptions 1. through 6. defined in the EXTENDED DESCRIPTION section of printf, plus the
following exceptions:
7. The sequence (keyword) can occur before a format conversion specifier. The
conversion argument is defined by the value of keyword. The implementation shall
support the following keywords:
-- Any of the Field Name entries in Table 4-14, ustar Header Block and Table 4-16,
Octet-Oriented cpio Archive Entry. The implementation may support the cpio
keywords without the leading c_ in addition to the form required by Table 4-16,
Octet-Oriented cpio Archive Entry.
-- Any keyword defined for the extended header in pax Extended Header.
-- Any keyword provided as an implementation-defined extension within the extended
header defined in pax Extended Header.
For example, the sequence "%(charset)s" 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 hdrcharset 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, T, shall be used to specify time
formats. The T conversion specifier character can be preceded by the sequence
(keyword=subformat), where subformat is a date format as defined by date operands.
The default keyword shall be mtime and the default subformat shall be:
%b %e %H:%M %Y
9. An additional conversion specifier character, M, shall be used to specify the file
mode string as defined in ls Standard Output. If (keyword) is omitted, the mode
keyword shall be used. For example, %.1M writes the single character corresponding
to the <entry type> field of the ls −l command.
10. An additional conversion specifier character, D, shall be used to specify the device
for block or special files, if applicable, in an implementation-defined format. If
not applicable, and (keyword) is specified, then this conversion shall be equivalent
to %(keyword)u. If not applicable, and (keyword) is omitted, then this conversion
shall be equivalent to <space>.
11. An additional conversion specifier character, F, shall be used to specify a
pathname. The F conversion character can be preceded by a sequence of
<comma>-separated keywords:
(keyword[,keyword] ... )
The values for all the keywords that are non-null shall be concatenated together,
each separated by a '/'. The default shall be (path) if the keyword path is
defined; otherwise, the default shall be (prefix,name).
12. An additional conversion specifier character, L, shall be used to specify a symbolic
link expansion. If the current file is a symbolic link, then %L shall expand to:
"%s −> %s", <value of keyword>, <contents of link>
Otherwise, the %L conversion specification shall be the equivalent of %F.
OPERANDS
The following operands shall be supported:
directory The destination directory pathname for copy mode.
file A pathname of a file to be copied or archived.
pattern 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
Section 2.13, Pattern Matching Notation, including the filename expansion rules
in Section 2.13.3, Patterns Used for Filename Expansion. The default, if no
pattern is specified, is to select all members in the archive.
STDIN
In write mode, the standard input shall be used only if no file operands are specified. It
shall be a file containing a list of pathnames, each terminated by a <newline> character.
In list and read modes, if −f is not specified, the standard input shall be an archive
file.
Otherwise, the standard input shall not be used.
INPUT FILES
The input file named by the archive 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 /dev/tty shall be used to write prompts and read responses.
ENVIRONMENT VARIABLES
The following environment variables shall affect the execution of pax:
LANG Provide a default value for the internationalization variables that are unset or
null. (See the Base Definitions volume of POSIX.1‐2008, Section 8.2,
Internationalization Variables the precedence of internationalization variables
used to determine the values of locale categories.)
LC_ALL If set to a non-empty string value, override the values of all the other
internationalization variables.
LC_COLLATE
Determine the locale for the behavior of ranges, equivalence classes, and multi-
character collating elements used in the pattern matching expressions for the
pattern operand, the basic regular expression for the −s option, and the
extended regular expression defined for the yesexpr locale keyword in the
LC_MESSAGES category.
LC_CTYPE 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 yesexpr locale keyword in the
LC_MESSAGES category, and pattern matching.
LC_MESSAGES
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.
LC_TIME Determine the format and contents of date and time strings when the −v option is
specified.
NLSPATH Determine the location of message catalogs for the processing of LC_MESSAGES.
TMPDIR Determine the pathname that provides part of the default global extended header
record file, as described for the −o globexthdr= keyword in the OPTIONS section.
TZ Determine the timezone used to calculate date and time strings when the −v
option is specified. If TZ is unset or null, an unspecified default timezone
shall be used.
ASYNCHRONOUS EVENTS
Default.
STDOUT
In write mode, if −f 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 −x format).
In list mode, when the −olistopt=format has been specified, the selected archive members
shall be written to standard output using the format described under List Mode Format
Specifications. In list mode without the −olistopt=format option, the table of contents
of the selected archive members shall be written to standard output using the following
format:
"%s\n", <pathname>
If the −v option is specified in list 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", <ls −l listing>, <linkname>
For all other pathnames:
"%s\n", <ls −l listing>
where <ls −l listing> shall be the format specified by the ls utility with the −l 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 list mode, standard output shall not be buffered more than a pathname (plus any
associated information and a <newline> terminator) at a time.
STDERR
If −v is specified in read, write, or copy modes, pax shall write the pathnames it
processes to the standard error output using the following format:
"%s\n", <pathname>
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 −s option is specified, and the replacement string has a trailing 'p',
substitutions shall be written to standard error in the following format:
"%s >> %s\n", <original pathname>, <new pathname>
In all operating modes of pax, 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 −xpax 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, pax shall
write a diagnostic message to standard error, shall process the file as described for the
−o invalid= option, and then shall continue processing with the next file.
OUTPUT FILES
In read mode, the extracted output files shall be of the archived file type. In copy
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
(−p), modification time (−u), and invalid-value (−oinvalid=) tests allow it.
In write mode, the output file named by the −f option-argument shall be a file formatted
according to one of the specifications in the EXTENDED DESCRIPTION section, or some other
implementation-defined format.
EXTENDED DESCRIPTION
pax Interchange Format
A pax archive tape or file produced in the −xpax format shall contain a series of blocks.
The physical layout of the archive shall be identical to the ustar format described in
ustar Interchange Format. 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 pax Header Block, with a typeflag value of x or g. The extended
header records, described in pax Extended Header, 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 Figure 4-1, pax Format Archive Example. In the example, the second file in
the archive has no extended header preceding it, presumably because it has no need for
extended attributes.
Figure 4-1: pax Format Archive Example
pax Header Block
The pax header block shall be identical to the ustar header block described in ustar
Interchange Format, except that two additional typeflag values are defined:
x Represents extended header records for the following file in the archive (which
shall have its own ustar header block). The format of these extended header records
shall be as described in pax Extended Header.
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 pax Extended
Header. 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 typeflag g
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 size 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
pax utility. However, if this archive is read by a pax 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 ustar header block is that data blocks for files of typeflag
1 (the digit one) (hard link) may be included, which means that the size field may be
greater than zero. Archives created by pax −o linkdata shall include these data blocks
with the hard links.
pax Extended Header
A pax extended header contains values that are inappropriate for the ustar 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 ustar header, and fields whose format or length do not fit the
requirements of the ustar header. The values in an extended header add attributes to the
following file (or files; see the description of the typeflag g 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", <length>, <keyword>, <value>
The extended header records shall be encoded according to the ISO/IEC 10646‐1:2000
standard UTF‐8 encoding. The <length> field, <blank>, <equals-sign>, and <newline> shown
shall be limited to the portable character set, as encoded in UTF‐8. The <keyword> fields
can be any UTF‐8 characters. The <length> field shall be the decimal length of the
extended header record in octets, including the trailing <newline>. If there is a
hdrcharset extended header in effect for a file, the value field for any gname, linkpath,
path, and uname extended header records shall be encoded using the character set specified
by the hdrcharset extended header record; otherwise, the value field shall be encoded
using UTF‐8. The value field for all other keywords specified by POSIX.1‐2008 shall be
encoded using UTF‐8.
The <keyword> 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 typeflag x extended header, but possibly multiple files after typeflag g. Any
requirements in the list for pax to include a record when in write or copy mode shall
apply only when such a record has not already been provided through the use of the −o
option. When used in copy mode, pax shall behave as if an archive had been created with
applicable extended header records and then extracted.)
atime The file access time for the following file(s), equivalent to the value of the
st_atime member of the stat structure for a file, as described by the stat()
function. The access time shall be restored if the process has appropriate
privileges required to do so. The format of the <value> shall be as described in
pax Extended Header File Times.
charset 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.
┌────────────────────────┬───────────────────────────────┐
│ <value> │ Formal Standard │
├────────────────────────┼───────────────────────────────┤
│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 pax is
used as described in POSIX.1‐2008, it shall not translate the file data into any
other encoding. The BINARY entry indicates unencoded binary data.
When used in write or copy mode, it is implementation-defined whether pax
includes a charset extended header record for a file.
comment A series of characters used as a comment. All characters in the <value> field
shall be ignored by pax.
gid 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
gid field in the following header block(s). When used in write or copy mode, pax
shall include a gid extended header record for each file whose group ID is
greater than 2097151 (octal 7777777).
gname The group of the file(s), formatted as a group name in the group database. This
record shall override the gid and gname fields in the following header block(s),
and any gid extended header record. When used in read, copy, or list mode, pax
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 −oinvalid=UTF‐8 option nor
the −oinvalid=binary option is specified, the results are implementation-
defined. When used in write or copy mode, pax shall include a gname extended
header record for each file whose group name cannot be represented entirely with
the letters and digits of the portable character set.
hdrcharset
The name of the character set used to encode the value field of the gname,
linkpath, path, and uname pax 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.
┌────────────────────────┬───────────────────────────────┐
│ <value> │ Formal Standard │
├────────────────────────┼───────────────────────────────┤
│ISO-IR 10646 2000 UTF-8 │ ISO/IEC 10646, UTF-8 encoding │
│BINARY │ None. │
└────────────────────────┴───────────────────────────────┘
If no hdrcharset 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 BINARY entry indicates that all values recorded in extended headers for
affected files are unencoded binary data from the underlying system.
linkpath The pathname of a link being created to another file, of any type, previously
archived. This record shall override the linkname field in the following ustar
header block(s). The following ustar header block shall determine the type of
link created. If typeflag of the following header block is 1, it shall be a hard
link. If typeflag is 2, it shall be a symbolic link and the linkpath value shall
be the contents of the symbolic link. The pax 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 write or
copy mode, pax shall include a linkpath extended header record for each link
whose pathname cannot be represented entirely with the members of the portable
character set other than NUL.
mtime The file modification time of the following file(s), equivalent to the value of
the st_mtime member of the stat structure for a file, as described in the stat()
function. This record shall override the mtime 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 <value> shall be as described in
pax Extended Header File Times.
path The pathname of the following file(s). This record shall override the name and
prefix fields in the following header block(s). The pax 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 write or copy mode, pax shall include a path extended header record
for each file whose pathname cannot be represented entirely with the members of
the portable character set other than NUL.
realtime.any
The keywords prefixed by ``realtime.'' are reserved for future standardization.
security.any
The keywords prefixed by ``security.'' are reserved for future standardization.
size 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 size field in the
following header block(s). When used in write or copy mode, pax shall include a
size extended header record for each file with a size value greater than
8589934591 (octal 77777777777).
uid 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 uid field in the
following header block(s). When used in write or copy mode, pax shall include a
uid extended header record for each file whose owner ID is greater than 2097151
(octal 7777777).
uname The owner of the following file(s), formatted as a user name in the user
database. This record shall override the uid and uname fields in the following
header block(s), and any uid extended header record. When used in read, copy, or
list mode, pax 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
−oinvalid=UTF‐8 option nor the −oinvalid=binary option is specified, the results
are implementation-defined. When used in write or copy mode, pax shall include
a uname 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 <value> 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 −o option-argument) overrides or
deletes a corresponding field in the ustar header block, pax shall ignore the contents of
that header block field.
Unlike the ustar header block fields, NULs shall not delimit <value>s; all characters
within the <value> field shall be considered data for the field. None of the length
limitations of the ustar header block fields in Table 4-14, ustar Header Block shall apply
to the extended header records.
pax Extended Header Keyword Precedence
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 pax is used in
read or list modes, it shall determine a file attribute in the following sequence:
1. If −odelete=keyword-prefix is used, the affected attributes shall be determined from
step 7., if applicable, or ignored otherwise.
2. If −okeyword:= is used, the affected attributes shall be ignored.
3. If −okeyword:=value is used, the affected attribute shall be assigned the value.
4. If there is a typeflag x extended header record, the affected attribute shall be
assigned the <value>. When extended header records conflict, the last one given in the
header shall take precedence.
5. If −okeyword=value is used, the affected attribute shall be assigned the value.
6. If there is a typeflag g global extended header record, the affected attribute shall
be assigned the <value>. 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 ustar header block.
pax Extended Header File Times
The pax utility shall write an mtime record for each file in write or copy modes if the
file's modification time cannot be represented exactly in the ustar header logical record
described in ustar Interchange Format. This can occur if the time is out of ustar 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 read or copy mode, the pax
utility shall truncate the time of a file to the greatest value that is not greater than
the input header file time. In write or copy mode, the pax 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.
ustar Interchange Format
A ustar 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
−bblocksize and −x ustar options. Each group of logical records may be written with a
single operation equivalent to the write() 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.
Table 4-14: ustar Header Block
┌───────────┬──────────────┬────────────────────┐
│Field Name │ Octet Offset │ Length (in Octets) │
├───────────┼──────────────┼────────────────────┤
│name │ 0 │ 100 │
│mode │ 100 │ 8 │
│uid │ 108 │ 8 │
│gid │ 116 │ 8 │
│size │ 124 │ 12 │
│mtime │ 136 │ 12 │
│chksum │ 148 │ 8 │
│typeflag │ 156 │ 1 │
│linkname │ 157 │ 100 │
│magic │ 257 │ 6 │
│version │ 263 │ 2 │
│uname │ 265 │ 32 │
│gname │ 297 │ 32 │
│devmajor │ 329 │ 8 │
│devminor │ 337 │ 8 │
│prefix │ 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 pax 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
pax 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 magic, uname, and gname are character strings each terminated by a NUL
character. The fields name, linkname, and prefix are NUL-terminated character strings
except when all characters in the array contain non-NUL characters including the last
character. The version field is two octets containing the characters "00" (zero-zero). The
typeflag 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 name and the prefix fields shall produce the pathname of the file. A new pathname
shall be formed, if prefix is not an empty string (its first character is not NUL), by
concatenating prefix (up to the first NUL character), a <slash> character, and name;
otherwise, name is used alone. In either case, name is terminated at the first NUL
character. If prefix 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, pax shall notify the user of the error, and shall not store any part of
the file—header or data—on the medium.
The linkname field, described below, shall not use the prefix to produce a pathname. As
such, a linkname is limited to 100 characters. If the name does not fit in the space
provided, pax shall notify the user of the error, and shall not attempt to store the link
on the medium.
The mode field provides 12 bits encoded in the ISO/IEC 646:1991 standard octal digit
representation. The encoded bits shall represent the following values:
Table: ustar mode Field
┌──────────┬──────────────────┬─────────────────────────────────────────────────┐
│Bit Value │ POSIX.1‐2008 Bit │ Description │
├──────────┼──────────────────┼─────────────────────────────────────────────────┤
│ 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‐2008. If
the implementation does not support those bits, they may be ignored.
The uid and gid fields are the user and group ID of the owner and group of the file,
respectively.
The size field is the size of the file in octets. If the typeflag field is set to specify
a file to be of type 1 (a link) or 2 (a symbolic link), the size field shall be specified
as zero. If the typeflag field is set to specify a file of type 5 (directory), the size
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 typeflag field is set to 3
(character special file), 4 (block special file), or 6 (FIFO), the meaning of the size
field is unspecified by this volume of POSIX.1‐2008, and no data logical records shall be
stored on the medium. Additionally, for type 6, the size field shall be ignored when
reading. If the typeflag field is set to any other value, the number of logical records
written following the header shall be (size+511)/512, ignoring any fraction in the result
of the division.
The mtime 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 stat() function.
The chksum 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 chksum field is treated as if it were all <space>
characters.
The typeflag 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 size field that could cause data logical records to be
written on the medium (see the previous description for size). If conversion to a regular
file occurs, the pax utility shall produce an error indicating that the conversion took
place. All of the typeflag fields shall be coded in the ISO/IEC 646:1991 standard IRV:
0 Represents a regular file. For backwards-compatibility, a typeflag value of binary
zero ('\0') 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 typeflag value of the ISO/IEC 646:1991 standard IRV
'0'.
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 linkname 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 linkname field.
3,4 Represent character special files and block special files respectively. In this
case the devmajor and devminor fields shall contain information defining the
device, the format of which is unspecified by this volume of POSIX.1‐2008.
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 size 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 size field of zero indicates no such limiting. Systems that
do not support limiting in this manner should ignore the size 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 'A' to 'Z', 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 −u 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 using ustar interchange format shall produce a diagnostic
message. Handling of other file types is implementation-defined.
The magic field is the specification that this archive was output in this archive format.
If this field contains ustar (the five characters from the ISO/IEC 646:1991 standard IRV
shown followed by NUL), the uname and gname 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 uid and gid fields.
cpio Interchange Format
The octet-oriented cpio 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 cpio archive format, the individual entry information shall be in
the order indicated and described by the following table; see also the <cpio.h> header.
Table 4-16: Octet-Oriented cpio Archive Entry
┌─────────────────────┬────────────────────┬─────────────────┐
│ Header Field Name │ Length (in Octets) │ Interpreted as │
├─────────────────────┼────────────────────┼─────────────────┤
│c_magic │ 6 │ Octal number │
│c_dev │ 6 │ Octal number │
│c_ino │ 6 │ Octal number │
│c_mode │ 6 │ Octal number │
│c_uid │ 6 │ Octal number │
│c_gid │ 6 │ Octal number │
│c_nlink │ 6 │ Octal number │
│c_rdev │ 6 │ Octal number │
│c_mtime │ 11 │ Octal number │
│c_namesize │ 6 │ Octal number │
│c_filesize │ 11 │ Octal number │
├─────────────────────┼────────────────────┼─────────────────┤
│Filename Field Name │ Length │ Interpreted as │
├─────────────────────┴────────────────────┴─────────────────┤
│c_name c_namesize Pathname string │
├─────────────────────┬────────────────────┬─────────────────┤
│File Data Field Name │ Length │ Interpreted as │
├─────────────────────┴────────────────────┴─────────────────┤
│c_filedata c_filesize Data │
└────────────────────────────────────────────────────────────┘
cpio Header
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_magic Identify the archive as being a transportable archive by containing the
identifying value "070707".
c_dev, c_ino
Contains values that uniquely identify the file within the archive (that is, no
files contain the same pair of c_dev and c_ino values unless they are links to
the same file). The values shall be determined in an unspecified manner.
c_mode Contains the file type and access permissions as defined in the following table.
Table 4-17: Values for cpio c_mode Field
│ ────────────┬─────────┬────────────────────────┬───────────
Binary file (standard input) matches
Use paxposix online using onworks.net services