обмен переносными архивами (portable archive interchange)
Описание (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 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 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‐2017, 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.