logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

pax.1p (125851B)


  1. '\" et
  2. .TH PAX "1P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. pax
  12. \(em portable archive interchange
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. pax \fB[\fR-dv\fB] [\fR-c|-n\fB] [\fR-H|-L\fB] [\fR-o \fIoptions\fB] [\fR-f \fIarchive\fB] [\fR-s \fIreplstr\fB]\fR...
  17. \fB[\fIpattern\fR...\fB]\fR
  18. .P
  19. pax -r\fB[\fR-c|-n\fB] [\fR-dikuv\fB] [\fR-H|-L\fB] [\fR-f \fIarchive\fB] [\fR-o \fIoptions\fB]\fR... \fB[\fR-p \fIstring\fB]\fR...
  20. \fB[\fR-s \fIreplstr\fB]\fR... \fB[\fIpattern\fR...\fB]\fR
  21. .P
  22. pax -w \fB[\fR-dituvX\fB] [\fR-H|-L\fB] [\fR-b \fIblocksize\fB] [[\fR-a\fB] [\fR-f \fIarchive\fB]] [\fR-o \fIoptions\fB]\fR...
  23. \fB[\fR-s \fIreplstr\fB]\fR... \fB[\fR-x \fIformat\fB] [\fIfile\fR...\fB]\fR
  24. .P
  25. pax -r -w \fB[\fR-diklntuvX\fB] [\fR-H|-L\fB] [\fR-o \fIoptions\fB]\fR... \fB[\fR-p \fIstring\fB]\fR...
  26. \fB[\fR-s \fIreplstr\fB]\fR... \fB[\fIfile\fR...\fB] \fIdirectory\fR
  27. .fi
  28. .SH DESCRIPTION
  29. The
  30. .IR pax
  31. utility shall read, write, and write lists of the members of archive
  32. files and copy directory hierarchies. A variety of archive formats
  33. shall be supported; see the
  34. .BR \-x
  35. .IR format
  36. option.
  37. .P
  38. The action to be taken depends on the presence of the
  39. .BR \-r
  40. and
  41. .BR \-w
  42. options. The four combinations of
  43. .BR \-r
  44. and
  45. .BR \-w
  46. are referred to as the four modes of operation:
  47. .BR list ,
  48. .BR read ,
  49. .BR write ,
  50. and
  51. .BR copy
  52. modes, corresponding respectively to the four forms shown in the
  53. SYNOPSIS section.
  54. .IP "\fBlist\fP" 10
  55. In
  56. .BR list
  57. mode (when neither
  58. .BR \-r
  59. nor
  60. .BR \-w
  61. are specified),
  62. .IR pax
  63. shall write the names of the members of the archive file read from the
  64. standard input, with pathnames matching the specified patterns, to
  65. standard output. If a named file is of type directory, the file
  66. hierarchy rooted at that file shall be listed as well.
  67. .IP "\fBread\fP" 10
  68. In
  69. .BR read
  70. mode (when
  71. .BR \-r
  72. is specified, but
  73. .BR \-w
  74. is not),
  75. .IR pax
  76. shall extract the members of the archive file read from the standard
  77. input, with pathnames matching the specified patterns. If an extracted
  78. file is of type directory, the file hierarchy rooted at that file shall
  79. be extracted as well. The extracted files shall be created performing
  80. pathname resolution with the directory in which
  81. .IR pax
  82. was invoked as the current working directory.
  83. .RS 10
  84. .P
  85. If an attempt is made to extract a directory when the directory
  86. already exists, this shall not be considered an error. If
  87. an attempt is made to extract a FIFO when the FIFO already exists,
  88. this shall not be considered an error.
  89. .P
  90. The ownership, access, and modification times, and file mode of the
  91. restored files are discussed under the
  92. .BR \-p
  93. option.
  94. .RE
  95. .IP "\fBwrite\fP" 10
  96. In
  97. .BR write
  98. mode (when
  99. .BR \-w
  100. is specified, but
  101. .BR \-r
  102. is not),
  103. .IR pax
  104. shall write the contents of the
  105. .IR file
  106. operands to the standard output in an archive format. If no
  107. .IR file
  108. operands are specified, a list of files to copy, one per line, shall be
  109. read from the standard input and each entry in this list shall be
  110. processed as if it had been a
  111. .IR file
  112. operand on the command line. A file of type directory shall include
  113. all of the files in the file hierarchy rooted at the file.
  114. .IP "\fBcopy\fP" 10
  115. In
  116. .BR copy
  117. mode (when both
  118. .BR \-r
  119. and
  120. .BR \-w
  121. are specified),
  122. .IR pax
  123. shall copy the
  124. .IR file
  125. operands to the destination directory.
  126. .RS 10
  127. .P
  128. If no
  129. .IR file
  130. operands are specified, a list of files to copy, one per line, shall be
  131. read from the standard input. A file of type directory shall include
  132. all of the files in the file hierarchy rooted at the file.
  133. .P
  134. The effect of the
  135. .BR copy
  136. shall be as if the copied files were written to a
  137. .IR pax
  138. format archive file and then subsequently extracted, except that
  139. copying of sockets may be supported even if archiving them in write
  140. mode is not supported, and that there may be hard links between the
  141. original and the copied files. If the destination directory is a
  142. subdirectory of one of the files to be copied, the results
  143. are unspecified. If the destination directory is a file of a
  144. type not defined by the System Interfaces volume of POSIX.1\(hy2017, the results are implementation-defined;
  145. otherwise, it shall be an error for the file named by the
  146. .IR directory
  147. operand not to exist, not be writable by the user, or not be a file of
  148. type directory.
  149. .RE
  150. .P
  151. In
  152. .BR read
  153. or
  154. .BR copy
  155. modes, if intermediate directories are necessary to extract an archive
  156. member,
  157. .IR pax
  158. shall perform actions equivalent to the
  159. \fImkdir\fR()
  160. function defined in the System Interfaces volume of POSIX.1\(hy2017, called with the following arguments:
  161. .IP " *" 4
  162. The intermediate directory used as the
  163. .IR path
  164. argument
  165. .IP " *" 4
  166. The value of the bitwise-inclusive OR of S_IRWXU, S_IRWXG, and S_IRWXO
  167. as the
  168. .IR mode
  169. argument
  170. .P
  171. If any specified
  172. .IR pattern
  173. or
  174. .IR file
  175. operands are not matched by at least one file or archive member,
  176. .IR pax
  177. shall write a diagnostic message to standard error for each one that
  178. did not match and exit with a non-zero exit status.
  179. .P
  180. The archive formats described in the EXTENDED DESCRIPTION section shall
  181. be automatically detected on input. The default output archive format
  182. shall be implementation-defined.
  183. .P
  184. A single archive can span multiple files. The
  185. .IR pax
  186. utility shall determine, in an implementation-defined manner, what
  187. file to read or write as the next file.
  188. .P
  189. If the selected archive format supports the specification of linked files,
  190. it shall be an error if these files cannot be linked when the archive
  191. is extracted. For archive formats that do not store file contents with
  192. each name that causes a hard link, if the file that contains the data
  193. is not extracted during this
  194. .IR pax
  195. session, either the data shall be restored from the original file, or a
  196. diagnostic message shall be displayed with the name of a file that can
  197. be used to extract the data. In traversing directories,
  198. .IR pax
  199. shall detect infinite loops; that is, entering a previously visited
  200. directory that is an ancestor of the last file visited. When it detects
  201. an infinite loop,
  202. .IR pax
  203. shall write a diagnostic message to standard error and shall
  204. terminate.
  205. .SH OPTIONS
  206. The
  207. .IR pax
  208. utility shall conform to the Base Definitions volume of POSIX.1\(hy2017,
  209. .IR "Section 12.2" ", " "Utility Syntax Guidelines",
  210. except that the order of presentation of the
  211. .BR \-o ,
  212. .BR \-p ,
  213. and
  214. .BR \-s
  215. options is significant.
  216. .P
  217. The following options shall be supported:
  218. .IP "\fB\-r\fP" 10
  219. Read an archive file from standard input.
  220. .IP "\fB\-w\fP" 10
  221. Write files to the standard output in the specified archive format.
  222. .IP "\fB\-a\fP" 10
  223. Append files to the end of the archive. It is implementation-defined
  224. which devices on the system support appending. Additional file formats
  225. unspecified by this volume of POSIX.1\(hy2017 may impose restrictions on appending.
  226. .IP "\fB\-b\ \fIblocksize\fR" 10
  227. Block the output at a positive decimal integer number of bytes per
  228. write to the archive file. Devices and archive formats may impose
  229. restrictions on blocking. Blocking shall be automatically determined on
  230. input. Conforming applications shall not specify a
  231. .IR blocksize
  232. value larger than 32\|256. Default blocking when creating archives
  233. depends on the archive format. (See the
  234. .BR \-x
  235. option below.)
  236. .IP "\fB\-c\fP" 10
  237. Match all file or archive members except those specified by the
  238. .IR pattern
  239. or
  240. .IR file
  241. operands.
  242. .IP "\fB\-d\fP" 10
  243. Cause files of type directory being copied or archived or archive
  244. members of type directory being extracted or listed to match only the
  245. file or archive member itself and not the file hierarchy rooted at the
  246. file.
  247. .IP "\fB\-f\ \fIarchive\fR" 10
  248. Specify the pathname of the input or output archive, overriding the
  249. default standard input (in
  250. .BR list
  251. or
  252. .BR read
  253. modes) or standard output (\c
  254. .BR write
  255. mode).
  256. .IP "\fB\-H\fP" 10
  257. If a symbolic link referencing a file of type directory is specified on
  258. the command line,
  259. .IR pax
  260. shall archive the file hierarchy rooted in the file referenced by the
  261. link, using the name of the link as the root of the file hierarchy.
  262. Otherwise, if a symbolic link referencing a file of any other file type
  263. which
  264. .IR pax
  265. can normally archive is specified on the command line, then
  266. .IR pax
  267. shall archive the file referenced by the link, using the name of the
  268. link. The default behavior, when neither
  269. .BR \-H
  270. or
  271. .BR \-L
  272. are specified, shall be to archive the symbolic link itself.
  273. .IP "\fB\-i\fP" 10
  274. Interactively rename files or archive members. For each archive member
  275. matching a
  276. .IR pattern
  277. operand or file matching a
  278. .IR file
  279. operand, a prompt shall be written to the file
  280. .BR /dev/tty .
  281. The prompt shall contain the name of the file or archive member, but
  282. the format is otherwise unspecified. A line shall then be read from
  283. .BR /dev/tty .
  284. If this line is blank, the file or archive member shall be skipped. If
  285. this line consists of a single period, the file or archive member shall
  286. be processed with no modification to its name. Otherwise, its name
  287. shall be replaced with the contents of the line. The
  288. .IR pax
  289. utility shall immediately exit with a non-zero exit status if
  290. end-of-file is encountered when reading a response or if
  291. .BR /dev/tty
  292. cannot be opened for reading and writing.
  293. .RS 10
  294. .P
  295. The results of extracting a hard link to a file that has been renamed
  296. during extraction are unspecified.
  297. .RE
  298. .IP "\fB\-k\fP" 10
  299. Prevent the overwriting of existing files.
  300. .IP "\fB\-l\fP" 10
  301. (The letter ell.) In
  302. .BR copy
  303. mode, hard links shall be made between the source and destination file
  304. hierarchies whenever possible. If specified in conjunction with
  305. .BR \-H
  306. or
  307. .BR \-L ,
  308. when a symbolic link is encountered, the hard link created in the
  309. destination file hierarchy shall be to the file referenced by the
  310. symbolic link. If specified when neither
  311. .BR \-H
  312. nor
  313. .BR \-L
  314. is specified, when a symbolic link is encountered, the implementation
  315. shall create a hard link to the symbolic link in the source file
  316. hierarchy or copy the symbolic link to the destination.
  317. .IP "\fB\-L\fP" 10
  318. If a symbolic link referencing a file of type directory is specified on
  319. the command line or encountered during the traversal of a file
  320. hierarchy,
  321. .IR pax
  322. shall archive the file hierarchy rooted in the file referenced by the
  323. link, using the name of the link as the root of the file hierarchy.
  324. Otherwise, if a symbolic link referencing a file of any other file type
  325. which
  326. .IR pax
  327. can normally archive is specified on the command line or encountered
  328. during the traversal of a file hierarchy,
  329. .IR pax
  330. shall archive the file referenced by the link, using the name of the
  331. link. The default behavior, when neither
  332. .BR \-H
  333. or
  334. .BR \-L
  335. are specified, shall be to archive the symbolic link itself.
  336. .IP "\fB\-n\fP" 10
  337. Select the first archive member that matches each
  338. .IR pattern
  339. operand. No more than one archive member shall be matched for each
  340. pattern (although members of type directory shall still match the file
  341. hierarchy rooted at that file).
  342. .IP "\fB\-o\ \fIoptions\fR" 10
  343. Provide information to the implementation to modify the algorithm for
  344. extracting or writing files. The value of
  345. .IR options
  346. shall consist of one or more
  347. <comma>-separated
  348. keywords of the form:
  349. .RS 10
  350. .sp
  351. .RS 4
  352. .nf
  353. \fIkeyword\fB[[\fR:\fB]\fR=\fIvalue\fB][\fR,\fIkeyword\fB[[\fR:\fB]\fR=\fIvalue\fB]\fR, ...\fB]\fR
  354. .fi
  355. .P
  356. .RE
  357. .P
  358. Some keywords apply only to certain file formats, as indicated with
  359. each description. Use of keywords that are inapplicable to the file
  360. format being processed produces undefined results.
  361. .P
  362. Keywords in the
  363. .IR options
  364. argument shall be a string that would be a valid portable filename as
  365. described in the Base Definitions volume of POSIX.1\(hy2017,
  366. .IR "Section 3.282" ", " "Portable Filename Character Set".
  367. .TP 10
  368. .BR Note:
  369. Keywords are not expected to be filenames, merely to follow the same
  370. character composition rules as portable filenames.
  371. .P
  372. .P
  373. Keywords can be preceded with white space. The
  374. .IR value
  375. field shall consist of zero or more characters; within
  376. .IR value ,
  377. the application shall precede any literal
  378. <comma>
  379. with a
  380. <backslash>,
  381. which shall be ignored, but preserves the
  382. <comma>
  383. as part of
  384. .IR value .
  385. A
  386. <comma>
  387. as the final character, or a
  388. <comma>
  389. followed solely by white space as the final characters, in
  390. .IR options
  391. shall be ignored. Multiple
  392. .BR \-o
  393. options can be specified; if keywords given to these multiple
  394. .BR \-o
  395. options conflict, the keywords and values appearing later in command
  396. line sequence shall take precedence and the earlier shall be silently
  397. ignored. The following keyword values of
  398. .IR options
  399. shall be supported for the file formats as indicated:
  400. .IP "\fBdelete\fR=\fIpattern\fR" 6
  401. .br
  402. (Applicable only to the
  403. .BR \-x
  404. .BR pax
  405. format.) When used in
  406. .BR write
  407. or
  408. .BR copy
  409. mode,
  410. .IR pax
  411. shall omit from extended header records that it produces any keywords
  412. matching the string pattern. When used in
  413. .BR read
  414. or
  415. .BR list
  416. mode,
  417. .IR pax
  418. shall ignore any keywords matching the string pattern in the extended
  419. header records. In both cases, matching shall be performed using the
  420. pattern matching notation described in
  421. .IR "Section 2.13.1" ", " "Patterns Matching a Single Character"
  422. and
  423. .IR "Section 2.13.2" ", " "Patterns Matching Multiple Characters".
  424. For example:
  425. .RS 6
  426. .sp
  427. .RS 4
  428. .nf
  429. -o \fBdelete\fR=\fIsecurity\fR.*
  430. .fi
  431. .P
  432. .RE
  433. .P
  434. would suppress security-related information. See
  435. .IR "pax Extended Header"
  436. for extended header record keyword usage.
  437. .P
  438. When multiple
  439. .BR \-o \c
  440. .BR delete=pattern
  441. options are specified, the patterns shall be additive; all keywords
  442. matching the specified string patterns shall be omitted from extended
  443. header records that
  444. .IR pax
  445. produces.
  446. .RE
  447. .IP "\fBexthdr.name\fR=\fIstring\fR" 6
  448. .br
  449. (Applicable only to the
  450. .BR \-x
  451. .BR pax
  452. format.) This keyword allows user control over the name that is written
  453. into the
  454. .BR ustar
  455. header blocks for the extended header produced under the circumstances
  456. described in
  457. .IR "pax Header Block".
  458. The name shall be the contents of
  459. .IR string ,
  460. after the following character substitutions have been made:
  461. .TS
  462. center box tab(!);
  463. cB | cB
  464. cB | cB
  465. lf5 | lw(3.8i).
  466. \fIstring\fP
  467. Includes:!Replaced by:
  468. _
  469. %d!T{
  470. The directory name of the file, equivalent to the result of the
  471. .IR dirname
  472. utility on the translated pathname.
  473. T}
  474. %f!T{
  475. The filename of the file, equivalent to the result of the
  476. .IR basename
  477. utility on the translated pathname.
  478. T}
  479. %p!T{
  480. The process ID of the
  481. .IR pax
  482. process.
  483. T}
  484. %%!T{
  485. A
  486. .BR '%'
  487. character.
  488. T}
  489. .TE
  490. .RS 6
  491. .P
  492. Any other
  493. .BR '%'
  494. characters in
  495. .IR string
  496. produce undefined results.
  497. .P
  498. If no
  499. .BR \-o
  500. .BR exthdr.name=string
  501. is specified,
  502. .IR pax
  503. shall use the following default value:
  504. .sp
  505. .RS 4
  506. .nf
  507. %d/PaxHeaders.%p/%f
  508. .fi
  509. .P
  510. .RE
  511. .RE
  512. .IP "\fBglobexthdr.name\fR=\fIstring\fR" 6
  513. .br
  514. (Applicable only to the
  515. .BR \-x
  516. .BR pax
  517. format.) When used in
  518. .BR write
  519. or
  520. .BR copy
  521. mode with the appropriate options,
  522. .IR pax
  523. shall create global extended header records with
  524. .BR ustar
  525. header blocks that will be treated as regular files by previous
  526. versions of
  527. .IR pax .
  528. This keyword allows user control over the name that is written into the
  529. .BR ustar
  530. header blocks for global extended header records. The name shall be the
  531. contents of string, after the following character substitutions have
  532. been made:
  533. .TS
  534. center box tab(!);
  535. cB | cB
  536. cB | cB
  537. lf5 | lw(3.8i).
  538. \fIstring\fP
  539. Includes:!Replaced by:
  540. _
  541. %n!T{
  542. An integer that represents the sequence number of the global extended
  543. header record in the archive, starting at 1.
  544. T}
  545. %p!T{
  546. The process ID of the
  547. .IR pax
  548. process.
  549. T}
  550. %%!T{
  551. A
  552. .BR '%'
  553. character.
  554. T}
  555. .TE
  556. .RS 6
  557. .P
  558. Any other
  559. .BR '%'
  560. characters in
  561. .IR string
  562. produce undefined results.
  563. .P
  564. If no
  565. .BR \-o
  566. .BR globexthdr.name=string
  567. is specified,
  568. .IR pax
  569. shall use the following default value:
  570. .sp
  571. .RS 4
  572. .nf
  573. $TMPDIR/GlobalHead.%p.%n
  574. .fi
  575. .P
  576. .RE
  577. .P
  578. where $\c
  579. .IR TMPDIR
  580. represents the value of the
  581. .IR TMPDIR
  582. environment variable. If
  583. .IR TMPDIR
  584. is not set,
  585. .IR pax
  586. shall use
  587. .BR /tmp .
  588. .RE
  589. .IP "\fBinvalid\fR=\fIaction\fR" 6
  590. .br
  591. (Applicable only to the
  592. .BR \-x
  593. .BR pax
  594. format.) This keyword allows user control over the action
  595. .IR pax
  596. takes upon encountering values in an extended header record that, in
  597. .BR read
  598. or
  599. .BR copy
  600. mode, are invalid in the destination hierarchy or, in
  601. .BR list
  602. mode, cannot be written in the codeset and current locale of the
  603. implementation. The following are invalid values that shall be
  604. recognized by
  605. .IR pax :
  606. .RS 6
  607. .IP -- 4
  608. In
  609. .BR read
  610. or
  611. .BR copy
  612. mode, a filename or link name that contains character encodings
  613. invalid in the destination hierarchy. (For example, the name may
  614. contain embedded NULs.)
  615. .IP -- 4
  616. In
  617. .BR read
  618. or
  619. .BR copy
  620. mode, a filename or link name that is longer than the maximum allowed
  621. in the destination hierarchy (for either a pathname component or the
  622. entire pathname).
  623. .IP -- 4
  624. In
  625. .BR list
  626. mode, any character string value (filename, link name, user name, and
  627. so on) that cannot be written in the codeset and current locale of the
  628. implementation.
  629. .P
  630. The following mutually-exclusive values of the
  631. .IR action
  632. argument are supported:
  633. .IP "\fBbinary\fR" 10
  634. In
  635. .BR write
  636. mode,
  637. .IR pax
  638. shall generate a
  639. .BR hdrcharset = BINARY
  640. extended header record for each file with a filename, link name, group
  641. name, owner name, or any other field in an extended header record that
  642. cannot be translated to the UTF\(hy8 codeset, allowing the archive to
  643. contain the files with unencoded extended header record values. In
  644. .BR read
  645. or
  646. .BR copy
  647. mode,
  648. .IR pax
  649. shall use the values specified in the header without translation,
  650. regardless of whether this may overwrite an existing file with a valid
  651. name. In
  652. .BR list
  653. mode,
  654. .IR pax
  655. shall behave identically to the
  656. .BR bypass
  657. action.
  658. .IP "\fBbypass\fR" 10
  659. In
  660. .BR read
  661. or
  662. .BR copy
  663. mode,
  664. .IR pax
  665. shall bypass the file, causing no change to the destination hierarchy.
  666. In
  667. .BR list
  668. mode,
  669. .IR pax
  670. shall write all requested valid values for the file, but its method for
  671. writing invalid values is unspecified.
  672. .IP "\fBrename\fR" 10
  673. In
  674. .BR read
  675. or
  676. .BR copy
  677. mode,
  678. .IR pax
  679. shall act as if the
  680. .BR \-i
  681. option were in effect for each file with invalid filename or link name
  682. values, allowing the user to provide a replacement name interactively.
  683. In
  684. .BR list
  685. mode,
  686. .IR pax
  687. shall behave identically to the
  688. .BR bypass
  689. action.
  690. .IP "\fBUTF\(hy8\fR" 10
  691. When used in
  692. .BR read ,
  693. .BR copy ,
  694. or
  695. .BR list
  696. mode and a filename, link name, owner name, or any other field in an
  697. extended header record cannot be translated from the
  698. .BR pax
  699. UTF\(hy8 codeset format to the codeset and current locale of the
  700. implementation,
  701. .IR pax
  702. shall use the actual UTF\(hy8 encoding for the name. If a
  703. .BR hdrcharset
  704. extended header record is in effect for this file, the character set
  705. specified by that record shall be used instead of UTF\(hy8. If a
  706. .BR hdrcharset = BINARY
  707. extended header record is in effect for this file, no translation shall
  708. be performed.
  709. .IP "\fBwrite\fR" 10
  710. In
  711. .BR read
  712. or
  713. .BR copy
  714. mode,
  715. .IR pax
  716. shall write the file, translating the name, regardless of whether this
  717. may overwrite an existing file with a valid name. In
  718. .BR list
  719. mode,
  720. .IR pax
  721. shall behave identically to the
  722. .BR bypass
  723. action.
  724. .P
  725. If no
  726. .BR \-o
  727. .BR invalid=option
  728. is specified,
  729. .IR pax
  730. shall act as if
  731. .BR \-o \c
  732. .BR invalid=bypass
  733. were specified. Any overwriting of existing files that may be allowed
  734. by the
  735. .BR \-o \c
  736. .BR invalid=
  737. actions shall be subject to permission (\c
  738. .BR \-p )
  739. and modification time (\c
  740. .BR \-u )
  741. restrictions, and shall be suppressed if the
  742. .BR \-k
  743. option is also specified.
  744. .RE
  745. .IP "\fBlinkdata\fP" 6
  746. .br
  747. (Applicable only to the
  748. .BR \-x
  749. .BR pax
  750. format.) In
  751. .BR write
  752. mode,
  753. .IR pax
  754. shall write the contents of a file to the archive even when that file
  755. is merely a hard link to a file whose contents have already been
  756. written to the archive.
  757. .IP "\fBlistopt\fR=\fIformat\fP" 6
  758. .br
  759. This keyword specifies the output format of the table of contents
  760. produced when the
  761. .BR \-v
  762. option is specified in
  763. .BR list
  764. mode. See
  765. .IR "List Mode Format Specifications".
  766. To avoid ambiguity, the
  767. .BR listopt=format
  768. shall be the only or final
  769. .BR keyword=value
  770. pair in a
  771. .BR \-o
  772. option-argument; all characters in the remainder of the option-argument
  773. shall be considered part of the format string. When multiple
  774. .BR \-o \c
  775. .BR listopt=format
  776. options are specified, the format strings shall be considered a single,
  777. concatenated string, evaluated in command line order.
  778. .IP "\fBtimes\fR" 6
  779. .br
  780. (Applicable only to the
  781. .BR \-x
  782. .IR pax
  783. format.) When used in
  784. .BR write
  785. or
  786. .BR copy
  787. mode,
  788. .IR pax
  789. shall include
  790. .BR atime
  791. and
  792. .BR mtime
  793. extended header records for each file. See
  794. .IR "pax Extended Header File Times".
  795. .P
  796. In addition to these keywords, if the
  797. .BR \-x
  798. .IR pax
  799. format is specified, any of the keywords and values defined in
  800. .IR "pax Extended Header",
  801. including implementation extensions, can be used in
  802. .BR \-o
  803. option-arguments, in either of two modes:
  804. .IP "\fBkeyword\fR=\fIvalue\fR" 6
  805. .br
  806. When used in
  807. .BR write
  808. or
  809. .BR copy
  810. mode, these keyword/value pairs shall be included at the beginning of
  811. the archive as
  812. .BR typeflag
  813. .BR g
  814. global extended header records. When used in
  815. .BR read
  816. or
  817. .BR list
  818. mode, these keyword/value pairs shall act as if they had been at the
  819. beginning of the archive as
  820. .BR typeflag
  821. .BR g
  822. global extended header records.
  823. .IP "\fBkeyword\fR:=\fIvalue\fR" 6
  824. .br
  825. When used in
  826. .BR write
  827. or
  828. .BR copy
  829. mode, these keyword/value pairs shall be included as records at the
  830. beginning of a
  831. .BR typeflag
  832. .BR x
  833. extended header for each file. (This shall be equivalent to the
  834. <equals-sign>
  835. form except that it creates no
  836. .BR typeflag
  837. .BR g
  838. global extended header records.) When used in
  839. .BR read
  840. or
  841. .BR list
  842. mode, these keyword/value pairs shall act as if they were included as
  843. records at the end of each extended header; thus, they shall override
  844. any global or file-specific extended header record keywords of the same
  845. names. For example, in the command:
  846. .RS 6
  847. .sp
  848. .RS 4
  849. .nf
  850. pax -r -o "
  851. gname:=mygroup,
  852. " <archive
  853. .fi
  854. .P
  855. .RE
  856. .P
  857. the group name will be forced to a new value for all files read from
  858. the archive.
  859. .RE
  860. .P
  861. The precedence of
  862. .BR \-o
  863. keywords over various fields in the archive is described in
  864. .IR "pax Extended Header Keyword Precedence".
  865. If the
  866. .BR \-o
  867. .BR delete =\c
  868. .IR pattern ,
  869. .BR \-o
  870. .BR keyword =\c
  871. .IR value ,
  872. or
  873. .BR \-o
  874. .BR keyword :=\c
  875. .IR value
  876. options are used to override or remove any extended header data needed
  877. to find files in an archive (e.g.,
  878. .BR "-o delete=size"
  879. for a file whose size cannot be represented in a
  880. .BR ustar
  881. header or
  882. .BR "-o size=100"
  883. for a file whose size is not 100 bytes), the behavior is undefined.
  884. .RE
  885. .IP "\fB\-p\ \fIstring\fR" 10
  886. Specify one or more file characteristic options (privileges). The
  887. .IR string
  888. option-argument shall be a string specifying file characteristics to be
  889. retained or discarded on extraction. The string shall consist of the
  890. specification characters
  891. .BR a ,
  892. .BR e ,
  893. .BR m ,
  894. .BR o ,
  895. and
  896. .BR p .
  897. Other implementation-defined characters can be included. Multiple
  898. characteristics can be concatenated within the same string and multiple
  899. .BR \-p
  900. options can be specified. The meaning of the specification characters
  901. are as follows:
  902. .RS 10
  903. .IP "\fRa\fP" 6
  904. Do not preserve file access times.
  905. .IP "\fRe\fP" 6
  906. Preserve the user ID, group ID, file mode bits (see the Base Definitions volume of POSIX.1\(hy2017,
  907. .IR "Section 3.169" ", " "File Mode Bits"),
  908. access time, modification time, and any other implementation-defined
  909. file characteristics.
  910. .IP "\fRm\fP" 6
  911. Do not preserve file modification times.
  912. .IP "\fRo\fP" 6
  913. Preserve the user ID and group ID.
  914. .IP "\fRp\fP" 6
  915. Preserve the file mode bits. Other implementation-defined file mode
  916. attributes may be preserved.
  917. .P
  918. In the preceding list, ``preserve'' indicates that an attribute stored
  919. in the archive shall be given to the extracted file, subject to the
  920. permissions of the invoking process. The access and modification times
  921. of the file shall be preserved unless otherwise specified with the
  922. .BR \-p
  923. option or not stored in the archive. All attributes that are not
  924. preserved shall be determined as part of the normal file creation
  925. action (see
  926. .IR "Section 1.1.1.4" ", " "File Read" ", " "Write" ", " "and Creation").
  927. .P
  928. If neither the
  929. .BR e
  930. nor the
  931. .BR o
  932. specification character is specified, or the user ID and group ID are
  933. not preserved for any reason,
  934. .IR pax
  935. shall not set the S_ISUID and S_ISGID bits of the file mode.
  936. .P
  937. If the preservation of any of these items fails for any reason,
  938. .IR pax
  939. shall write a diagnostic message to standard error. Failure to preserve
  940. these items shall affect the final exit status, but shall not cause the
  941. extracted file to be deleted.
  942. .P
  943. If file characteristic letters in any of the
  944. .IR string
  945. option-arguments are duplicated or conflict with each other, the ones
  946. given last shall take precedence. For example, if
  947. .BR \-p
  948. .BR eme
  949. is specified, file modification times are preserved.
  950. .RE
  951. .IP "\fB\-s\ \fIreplstr\fR" 10
  952. Modify file or archive member names named by
  953. .IR pattern
  954. or
  955. .IR file
  956. operands according to the substitution expression
  957. .IR replstr ,
  958. using the syntax of the
  959. .IR ed
  960. utility. The concepts of ``address'' and ``line'' are meaningless in
  961. the context of the
  962. .IR pax
  963. utility, and shall not be supplied. The format shall be:
  964. .RS 10
  965. .sp
  966. .RS 4
  967. .nf
  968. -s /\fIold\fR/\fInew\fR/\fB[\fRgp\fB]\fR
  969. .fi
  970. .P
  971. .RE
  972. .P
  973. where as in
  974. .IR ed ,
  975. .IR old
  976. is a basic regular expression and
  977. .IR new
  978. can contain an
  979. <ampersand>,
  980. .BR '\en'
  981. (where
  982. .IR n
  983. is a digit) back-references, or subexpression matching. The
  984. .IR old
  985. string shall also be permitted to contain
  986. <newline>
  987. characters.
  988. .P
  989. Any non-null character can be used as a delimiter (\c
  990. .BR '/'
  991. shown here). Multiple
  992. .BR \-s
  993. expressions can be specified; the expressions shall be applied in the
  994. order specified, terminating with the first successful substitution.
  995. The optional trailing
  996. .BR 'g'
  997. is as defined in the
  998. .IR ed
  999. utility. The optional trailing
  1000. .BR 'p'
  1001. shall cause successful substitutions to be written to standard error.
  1002. File or archive member names that substitute to the empty string shall
  1003. be ignored when reading and writing archives.
  1004. .RE
  1005. .IP "\fB\-t\fP" 10
  1006. When reading files from the file system, and if the user has the
  1007. permissions required by
  1008. \fIutime\fR()
  1009. to do so, set the access time of each file read to the access time that
  1010. it had before being read by
  1011. .IR pax .
  1012. .IP "\fB\-u\fP" 10
  1013. Ignore files that are older (having a less recent file modification
  1014. time) than a pre-existing file or archive member with the same name.
  1015. In
  1016. .BR read
  1017. mode, an archive member with the same name as a file in the file system
  1018. shall be extracted if the archive member is newer than the file. In
  1019. .BR write
  1020. mode, an archive file member with the same name as a file in the file
  1021. system shall be superseded if the file is newer than the archive
  1022. member. If
  1023. .BR \-a
  1024. is also specified, this is accomplished by appending to the archive;
  1025. otherwise, it is unspecified whether this is accomplished by actual
  1026. replacement in the archive or by appending to the archive. In
  1027. .BR copy
  1028. mode, the file in the destination hierarchy shall be replaced by the
  1029. file in the source hierarchy or by a link to the file in the source
  1030. hierarchy if the file in the source hierarchy is newer.
  1031. .IP "\fB\-v\fP" 10
  1032. In
  1033. .BR list
  1034. mode, produce a verbose table of contents (see the STDOUT section).
  1035. Otherwise, write archive member pathnames to standard error (see the
  1036. STDERR section).
  1037. .IP "\fB\-x\ \fIformat\fR" 10
  1038. Specify the output archive format. The
  1039. .IR pax
  1040. utility shall support the following formats:
  1041. .RS 10
  1042. .IP "\fBcpio\fR" 10
  1043. The
  1044. .BR cpio
  1045. interchange format; see the EXTENDED DESCRIPTION section. The default
  1046. .IR blocksize
  1047. for this format for character special archive files shall be 5\|120.
  1048. Implementations shall support all
  1049. .IR blocksize
  1050. values less than or equal to 32\|256 that are multiples of 512.
  1051. .IP "\fBpax\fR" 10
  1052. The
  1053. .BR pax
  1054. interchange format; see the EXTENDED DESCRIPTION section. The default
  1055. .IR blocksize
  1056. for this format for character special archive files shall be 5\|120.
  1057. Implementations shall support all
  1058. .IR blocksize
  1059. values less than or equal to 32\|256 that are multiples of 512.
  1060. .IP "\fBustar\fR" 10
  1061. The
  1062. .BR tar
  1063. interchange format; see the EXTENDED DESCRIPTION section. The default
  1064. .IR blocksize
  1065. for this format for character special archive files shall be 10\|240.
  1066. Implementations shall support all
  1067. .IR blocksize
  1068. values less than or equal to 32\|256 that are multiples of 512.
  1069. .P
  1070. Implementation-defined formats shall specify a default block size as
  1071. well as any other block sizes supported for character special archive
  1072. files.
  1073. .P
  1074. Any attempt to append to an archive file in a format different from the
  1075. existing archive format shall cause
  1076. .IR pax
  1077. to exit immediately with a non-zero exit status.
  1078. .RE
  1079. .IP "\fB\-X\fP" 10
  1080. When traversing the file hierarchy specified by a pathname,
  1081. .IR pax
  1082. shall not descend into directories that have a different device ID (\c
  1083. .IR st_dev ;
  1084. see the System Interfaces volume of POSIX.1\(hy2017,
  1085. \fIstat\fR()).
  1086. .P
  1087. Specifying more than one of the mutually-exclusive options
  1088. .BR \-H
  1089. and
  1090. .BR \-L
  1091. shall not be considered an error and the last option specified shall
  1092. determine the behavior of the utility.
  1093. .P
  1094. The options that operate on the names of files or archive members (\c
  1095. .BR \-c ,
  1096. .BR \-i ,
  1097. .BR \-n ,
  1098. .BR \-s ,
  1099. .BR \-u ,
  1100. and
  1101. .BR \-v )
  1102. shall interact as follows. In
  1103. .BR read
  1104. mode, the archive members shall be selected based on the user-specified
  1105. .IR pattern
  1106. operands as modified by the
  1107. .BR \-c ,
  1108. .BR \-n ,
  1109. and
  1110. .BR \-u
  1111. options. Then, any
  1112. .BR \-s
  1113. and
  1114. .BR \-i
  1115. options shall modify, in that order, the names of the selected files.
  1116. The
  1117. .BR \-v
  1118. option shall write names resulting from these modifications.
  1119. .P
  1120. In
  1121. .BR write
  1122. mode, the files shall be selected based on the user-specified
  1123. pathnames as modified by the
  1124. .BR \-n
  1125. and
  1126. .BR \-u
  1127. options. Then, any
  1128. .BR \-s
  1129. and
  1130. .BR \-i
  1131. options shall modify, in that order, the names of these selected files.
  1132. The
  1133. .BR \-v
  1134. option shall write names resulting from these modifications.
  1135. .P
  1136. If both the
  1137. .BR \-u
  1138. and
  1139. .BR \-n
  1140. options are specified,
  1141. .IR pax
  1142. shall not consider a file selected unless it is newer than the file to
  1143. which it is compared.
  1144. .SS "List Mode Format Specifications"
  1145. .P
  1146. In
  1147. .BR list
  1148. mode with the
  1149. .BR \-o
  1150. .BR listopt=format
  1151. option, the
  1152. .IR format
  1153. argument shall be applied for each selected file. The
  1154. .IR pax
  1155. utility shall append a
  1156. <newline>
  1157. to the
  1158. .BR listopt
  1159. output for each selected file. The
  1160. .IR format
  1161. argument shall be used as the
  1162. .IR format
  1163. string described in the Base Definitions volume of POSIX.1\(hy2017,
  1164. .IR "Chapter 5" ", " "File Format Notation",
  1165. with the exceptions 1. through 6. defined in the EXTENDED DESCRIPTION
  1166. section of
  1167. .IR printf ,
  1168. plus the following exceptions:
  1169. .IP 7. 6
  1170. The sequence (\c
  1171. .IR keyword )
  1172. can occur before a format conversion specifier. The conversion
  1173. argument is defined by the value of
  1174. .IR keyword .
  1175. The implementation shall support the following keywords:
  1176. .RS 6
  1177. .IP -- 4
  1178. Any of the Field Name entries in
  1179. .IR "Table 4-14, ustar Header Block"
  1180. and
  1181. .IR "Table 4-16, Octet-Oriented cpio Archive Entry".
  1182. The implementation may support the
  1183. .IR cpio
  1184. keywords without the leading
  1185. .BR c_
  1186. in addition to the form required by
  1187. .IR "Table 4-16, Octet-Oriented cpio Archive Entry".
  1188. .IP -- 4
  1189. Any keyword defined for the extended header in
  1190. .IR "pax Extended Header".
  1191. .IP -- 4
  1192. Any keyword provided as an implementation-defined extension within
  1193. the extended header defined in
  1194. .IR "pax Extended Header".
  1195. .P
  1196. For example, the sequence
  1197. .BR \(dq%(charset)s\(dq
  1198. is the string value of the name of the character set in the extended
  1199. header.
  1200. .P
  1201. The result of the keyword conversion argument shall be the value from
  1202. the applicable header field or extended header, without any trailing
  1203. NULs.
  1204. .P
  1205. All keyword values used as conversion arguments shall be translated
  1206. from the UTF\(hy8 encoding (or alternative encoding specified by any
  1207. .BR hdrcharset
  1208. extended header record) to the character set appropriate for the local
  1209. file system, user database, and so on, as applicable.
  1210. .RE
  1211. .IP 8. 6
  1212. An additional conversion specifier character,
  1213. .BR T ,
  1214. shall be used to specify time formats. The
  1215. .BR T
  1216. conversion specifier character can be preceded by the sequence (\c
  1217. .IR keyword= \c
  1218. .IR subformat ),
  1219. where
  1220. .IR subformat
  1221. is a date format as defined by
  1222. .IR date
  1223. operands. The default
  1224. .IR keyword
  1225. shall be
  1226. .BR mtime
  1227. and the default subformat shall be:
  1228. .RS 6
  1229. .sp
  1230. .RS 4
  1231. .nf
  1232. %b %e %H:%M %Y
  1233. .fi
  1234. .P
  1235. .RE
  1236. .RE
  1237. .IP 9. 6
  1238. An additional conversion specifier character,
  1239. .BR M ,
  1240. shall be used to specify the file mode string as defined in
  1241. .IR ls
  1242. Standard Output. If (\c
  1243. .IR keyword )
  1244. is omitted, the
  1245. .BR mode
  1246. keyword shall be used. For example,
  1247. .BR %.1M
  1248. writes the single character corresponding to the <\fIentry\ type\fP>
  1249. field of the
  1250. .IR ls
  1251. .BR \-l
  1252. command.
  1253. .IP 10. 6
  1254. An additional conversion specifier character,
  1255. .BR D ,
  1256. shall be used to specify the device for block or special files, if
  1257. applicable, in an implementation-defined format. If not applicable,
  1258. and (\c
  1259. .IR keyword )
  1260. is specified, then this conversion shall be equivalent to
  1261. \fR%(\fIkeyword\fR)u\fR. If not applicable, and (\c
  1262. .IR keyword )
  1263. is omitted, then this conversion shall be equivalent to
  1264. <space>.
  1265. .IP 11. 6
  1266. An additional conversion specifier character,
  1267. .BR F ,
  1268. shall be used to specify a pathname. The
  1269. .BR F
  1270. conversion character can be preceded by a sequence of
  1271. <comma>-separated
  1272. keywords:
  1273. .RS 6
  1274. .sp
  1275. .RS 4
  1276. .nf
  1277. (\fIkeyword\fB[\fR,\fIkeyword\fB]\fR ... )
  1278. .fi
  1279. .P
  1280. .RE
  1281. .P
  1282. The values for all the keywords that are non-null shall be concatenated
  1283. together, each separated by a
  1284. .BR '/' .
  1285. The default shall be (\c
  1286. .BR path )
  1287. if the keyword
  1288. .BR path
  1289. is defined; otherwise, the default shall be (\c
  1290. .BR prefix ,\c
  1291. .BR name ).
  1292. .RE
  1293. .IP 12. 6
  1294. An additional conversion specifier character,
  1295. .BR L ,
  1296. shall be used to specify a symbolic link expansion. If the current
  1297. file is a symbolic link, then
  1298. .BR %L
  1299. shall expand to:
  1300. .RS 6
  1301. .sp
  1302. .RS 4
  1303. .nf
  1304. "%s -> %s", <\fIvalue of keyword\fR>, <\fIcontents of link\fR>
  1305. .fi
  1306. .P
  1307. .RE
  1308. .P
  1309. Otherwise, the
  1310. .BR %L
  1311. conversion specification shall be the equivalent of
  1312. .BR %F .
  1313. .RE
  1314. .SH OPERANDS
  1315. The following operands shall be supported:
  1316. .IP "\fIdirectory\fR" 10
  1317. The destination directory pathname for
  1318. .BR copy
  1319. mode.
  1320. .IP "\fIfile\fR" 10
  1321. A pathname of a file to be copied or archived.
  1322. .IP "\fIpattern\fR" 10
  1323. A pattern matching one or more pathnames of archive members. A pattern
  1324. must be given in the name-generating notation of the pattern matching
  1325. notation in
  1326. .IR "Section 2.13" ", " "Pattern Matching Notation",
  1327. including the filename expansion rules in
  1328. .IR "Section 2.13.3" ", " "Patterns Used for Filename Expansion".
  1329. The default, if no
  1330. .IR pattern
  1331. is specified, is to select all members in the archive.
  1332. .SH STDIN
  1333. In
  1334. .BR write
  1335. mode, the standard input shall be used only if no
  1336. .IR file
  1337. operands are specified. It shall be a file containing a list of
  1338. pathnames, each terminated by a
  1339. <newline>
  1340. character.
  1341. .P
  1342. In
  1343. .BR list
  1344. and
  1345. .BR read
  1346. modes, if
  1347. .BR \-f
  1348. is not specified, the standard input shall be an archive file.
  1349. .P
  1350. Otherwise, the standard input shall not be used.
  1351. .SH "INPUT FILES"
  1352. The input file named by the
  1353. .IR archive
  1354. option-argument, or standard input when the archive is read from there,
  1355. shall be a file formatted according to one of the specifications in the
  1356. EXTENDED DESCRIPTION section or some other implementation-defined
  1357. format.
  1358. .P
  1359. The file
  1360. .BR /dev/tty
  1361. shall be used to write prompts and read responses.
  1362. .SH "ENVIRONMENT VARIABLES"
  1363. The following environment variables shall affect the execution of
  1364. .IR pax :
  1365. .IP "\fILANG\fP" 10
  1366. Provide a default value for the internationalization variables that are
  1367. unset or null. (See the Base Definitions volume of POSIX.1\(hy2017,
  1368. .IR "Section 8.2" ", " "Internationalization Variables"
  1369. the precedence of internationalization variables used to determine the
  1370. values of locale categories.)
  1371. .IP "\fILC_ALL\fP" 10
  1372. If set to a non-empty string value, override the values of all the
  1373. other internationalization variables.
  1374. .IP "\fILC_COLLATE\fP" 10
  1375. .br
  1376. Determine the locale for the behavior of ranges, equivalence classes,
  1377. and multi-character collating elements used in the pattern matching
  1378. expressions for the
  1379. .IR pattern
  1380. operand, the basic regular expression for the
  1381. .BR \-s
  1382. option, and the extended regular expression defined for the
  1383. .BR yesexpr
  1384. locale keyword in the
  1385. .IR LC_MESSAGES
  1386. category.
  1387. .IP "\fILC_CTYPE\fP" 10
  1388. Determine the locale for the interpretation of sequences of bytes of
  1389. text data as characters (for example, single-byte as opposed to
  1390. multi-byte characters in arguments and input files), the behavior of
  1391. character classes used in the extended regular expression defined for
  1392. the
  1393. .BR yesexpr
  1394. locale keyword in the
  1395. .IR LC_MESSAGES
  1396. category, and pattern matching.
  1397. .IP "\fILC_MESSAGES\fP" 10
  1398. .br
  1399. Determine the locale used to process affirmative responses, and the
  1400. locale used to affect the format and contents of diagnostic messages
  1401. and prompts written to standard error.
  1402. .IP "\fILC_TIME\fP" 10
  1403. Determine the format and contents of date and time strings when the
  1404. .BR \-v
  1405. option is specified.
  1406. .IP "\fINLSPATH\fP" 10
  1407. Determine the location of message catalogs for the processing of
  1408. .IR LC_MESSAGES .
  1409. .IP "\fITMPDIR\fP" 10
  1410. Determine the pathname that provides part of the default global
  1411. extended header record file, as described for the
  1412. .BR \-o
  1413. .BR globexthdr=
  1414. keyword in the OPTIONS section.
  1415. .IP "\fITZ\fP" 10
  1416. Determine the timezone used to calculate date and time strings when the
  1417. .BR \-v
  1418. option is specified. If
  1419. .IR TZ
  1420. is unset or null, an unspecified default timezone shall be used.
  1421. .SH "ASYNCHRONOUS EVENTS"
  1422. Default.
  1423. .SH STDOUT
  1424. In
  1425. .BR write
  1426. mode, if
  1427. .BR \-f
  1428. is not specified, the standard output shall be the archive formatted
  1429. according to one of the specifications in the EXTENDED DESCRIPTION
  1430. section, or some other implementation-defined format (see
  1431. .BR \-x
  1432. .IR format ).
  1433. .P
  1434. In
  1435. .BR list
  1436. mode, when the
  1437. .BR \-o \c
  1438. .BR listopt =\c
  1439. .IR format
  1440. has been specified, the selected archive members shall be written to
  1441. standard output using the format described under
  1442. .IR "List Mode Format Specifications".
  1443. In
  1444. .BR list
  1445. mode without the
  1446. .BR \-o \c
  1447. .BR listopt =\c
  1448. .IR format
  1449. option, the table of contents of the selected archive members shall
  1450. be written to standard output using the following format:
  1451. .sp
  1452. .RS 4
  1453. .nf
  1454. "%s\en", <\fIpathname\fR>
  1455. .fi
  1456. .P
  1457. .RE
  1458. .P
  1459. If the
  1460. .BR \-v
  1461. option is specified in
  1462. .BR list
  1463. mode, the table of contents of the selected archive members shall be
  1464. written to standard output using the following formats.
  1465. .P
  1466. For pathnames representing hard links to previous members of the
  1467. archive:
  1468. .sp
  1469. .RS 4
  1470. .nf
  1471. "%s == %s\en", <\fIls\fR -l \fIlisting\fR>, <\fIlinkname\fR>
  1472. .fi
  1473. .P
  1474. .RE
  1475. .P
  1476. For all other pathnames:
  1477. .sp
  1478. .RS 4
  1479. .nf
  1480. "%s\en", <\fIls\fR -l \fIlisting\fR>
  1481. .fi
  1482. .P
  1483. .RE
  1484. .P
  1485. where <\fIls\ \fR\-l\ \fIlisting\fR> shall be the format specified by
  1486. the
  1487. .IR ls
  1488. utility with the
  1489. .BR \-l
  1490. option. When writing pathnames in this format, it is unspecified what
  1491. is written for fields for which the underlying archive format does not
  1492. have the correct information, although the correct number of
  1493. <blank>-separated
  1494. fields shall be written.
  1495. .P
  1496. In
  1497. .BR list
  1498. mode, standard output shall not be buffered more than a pathname
  1499. (plus any associated information and a
  1500. <newline>
  1501. terminator) at a time.
  1502. .SH STDERR
  1503. If
  1504. .BR \-v
  1505. is specified in
  1506. .BR read ,
  1507. .BR write ,
  1508. or
  1509. .BR copy
  1510. modes,
  1511. .IR pax
  1512. shall write the pathnames it processes to the standard error output
  1513. using the following format:
  1514. .sp
  1515. .RS 4
  1516. .nf
  1517. "%s\en", <\fIpathname\fR>
  1518. .fi
  1519. .P
  1520. .RE
  1521. .P
  1522. These pathnames shall be written as soon as processing is begun on the
  1523. file or archive member, and shall be flushed to standard error. The
  1524. trailing
  1525. <newline>,
  1526. which shall not be buffered, is written when the file has been read or
  1527. written.
  1528. .P
  1529. If the
  1530. .BR \-s
  1531. option is specified, and the replacement string has a trailing
  1532. .BR 'p' ,
  1533. substitutions shall be written to standard error in the following
  1534. format:
  1535. .sp
  1536. .RS 4
  1537. .nf
  1538. "%s >> %s\en", <\fIoriginal pathname\fR>, <\fInew pathname\fR>
  1539. .fi
  1540. .P
  1541. .RE
  1542. .P
  1543. In all operating modes of
  1544. .IR pax ,
  1545. optional messages of unspecified format concerning the input archive
  1546. format and volume number, the number of files, blocks, volumes, and
  1547. media parts as well as other diagnostic messages may be written to
  1548. standard error.
  1549. .P
  1550. In all formats, for both standard output and standard error, it is
  1551. unspecified how non-printable characters in pathnames or link names
  1552. are written.
  1553. .P
  1554. When using the
  1555. .BR \-x \c
  1556. .BR pax
  1557. archive format, if a filename, link name, group name, owner name, or
  1558. any other field in an extended header record cannot be translated
  1559. between the codeset in use for that extended header record and the
  1560. character set of the current locale,
  1561. .IR pax
  1562. shall write a diagnostic message to standard error, shall process the
  1563. file as described for the
  1564. .BR \-o
  1565. .BR invalid=
  1566. option, and then shall continue processing with the next file.
  1567. .SH "OUTPUT FILES"
  1568. In
  1569. .BR read
  1570. mode, the extracted output files shall be of the archived file type.
  1571. In
  1572. .BR copy
  1573. mode, the copied output files shall be the type of the file being
  1574. copied. In either mode, existing files in the destination hierarchy
  1575. shall be overwritten only when all permission (\c
  1576. .BR \-p ),
  1577. modification time (\c
  1578. .BR \-u ),
  1579. and invalid-value (\c
  1580. .BR \-o \c
  1581. .BR invalid= )
  1582. tests allow it.
  1583. .P
  1584. In
  1585. .BR write
  1586. mode, the output file named by the
  1587. .BR \-f
  1588. option-argument shall be a file formatted according to one of the
  1589. specifications in the EXTENDED DESCRIPTION section, or some other
  1590. implementation-defined format.
  1591. .SH "EXTENDED DESCRIPTION"
  1592. .SS "pax Interchange Format"
  1593. .P
  1594. A
  1595. .IR pax
  1596. archive tape or file produced in the
  1597. .BR \-x \c
  1598. .BR pax
  1599. format shall contain a series of blocks. The physical layout of the
  1600. archive shall be identical to the
  1601. .BR ustar
  1602. format described in
  1603. .IR "ustar Interchange Format".
  1604. Each file archived shall be represented by the following sequence:
  1605. .IP " *" 4
  1606. An optional header block with extended header records. This header
  1607. block is of the form described in
  1608. .IR "pax Header Block",
  1609. with a
  1610. .IR typeflag
  1611. value of
  1612. .BR x
  1613. or
  1614. .BR g .
  1615. The extended header records, described in
  1616. .IR "pax Extended Header",
  1617. shall be included as the data for this header block.
  1618. .IP " *" 4
  1619. A header block that describes the file. Any fields in the preceding
  1620. optional extended header shall override the associated fields in
  1621. this header block for this file.
  1622. .IP " *" 4
  1623. Zero or more blocks that contain the contents of the file.
  1624. .P
  1625. At the end of the archive file there shall be two 512-byte blocks
  1626. filled with binary zeros, interpreted as an end-of-archive indicator.
  1627. .P
  1628. A schematic of an example archive with global extended header records
  1629. and two actual files is shown in
  1630. .IR "Figure 4-1, pax Format Archive Example".
  1631. In the example, the second file in the archive has no extended header
  1632. preceding it, presumably because it has no need for extended
  1633. attributes.
  1634. .sp
  1635. .ce 1
  1636. \fBFigure 4-1: pax Format Archive Example\fR
  1637. .SS "pax Header Block"
  1638. .P
  1639. The
  1640. .BR pax
  1641. header block shall be identical to the
  1642. .BR ustar
  1643. header block described in
  1644. .IR "ustar Interchange Format",
  1645. except that two additional
  1646. .IR typeflag
  1647. values are defined:
  1648. .IP "\fRx\fP" 6
  1649. Represents extended header records for the following file in the
  1650. archive (which shall have its own
  1651. .BR ustar
  1652. header block). The format of these extended header records shall be as
  1653. described in
  1654. .IR "pax Extended Header".
  1655. .IP "\fRg\fR" 6
  1656. Represents global extended header records for the following files in
  1657. the archive. The format of these extended header records shall be as
  1658. described in
  1659. .IR "pax Extended Header".
  1660. Each value shall affect all subsequent files that do not override that
  1661. value in their own extended header record and until another global
  1662. extended header record is reached that provides another value for the
  1663. same field. The
  1664. .IR typeflag
  1665. .BR g
  1666. global headers should not be used with interchange media that could
  1667. suffer partial data loss in transporting the archive.
  1668. .P
  1669. For both of these types, the
  1670. .IR size
  1671. field shall be the size of the extended header records in octets. The
  1672. other fields in the header block are not meaningful to this version of
  1673. the
  1674. .IR pax
  1675. utility. However, if this archive is read by a
  1676. .IR pax
  1677. utility conforming to the ISO\ POSIX\(hy2:\|1993 standard, the header block fields are used to
  1678. create a regular file that contains the extended header records as
  1679. data. Therefore, header block field values should be selected to
  1680. provide reasonable file access to this regular file.
  1681. .P
  1682. A further difference from the
  1683. .BR ustar
  1684. header block is that data blocks for files of
  1685. .IR typeflag
  1686. 1 (the digit one) (hard link) may be included, which means that the
  1687. size field may be greater than zero. Archives created by
  1688. .IR pax
  1689. .BR \-o
  1690. .BR linkdata
  1691. shall include these data blocks with the hard links.
  1692. .SS "pax Extended Header"
  1693. .P
  1694. A
  1695. .BR pax
  1696. extended header contains values that are inappropriate for the
  1697. .BR ustar
  1698. header block because of limitations in that format: fields requiring a
  1699. character encoding other than that described in the ISO/IEC\ 646:\|1991 standard, fields
  1700. representing file attributes not described in the
  1701. .BR ustar
  1702. header, and fields whose format or length do not fit the requirements
  1703. of the
  1704. .BR ustar
  1705. header. The values in an extended header add attributes to the
  1706. following file (or files; see the description of the
  1707. .IR typeflag
  1708. .BR g
  1709. header block) or override values in the following header block(s), as
  1710. indicated in the following list of keywords.
  1711. .P
  1712. An extended header shall consist of one or more records, each
  1713. constructed as follows:
  1714. .sp
  1715. .RS 4
  1716. .nf
  1717. "%d %s=%s\en", <\fIlength\fR>, <\fIkeyword\fR>, <\fIvalue\fR>
  1718. .fi
  1719. .P
  1720. .RE
  1721. .P
  1722. The extended header records shall be encoded according to the ISO/IEC\ 10646\(hy1:\|2000 standard
  1723. UTF\(hy8 encoding. The <\fIlength\fP> field,
  1724. <blank>,
  1725. <equals-sign>,
  1726. and
  1727. <newline>
  1728. shown shall be limited to the portable character set, as encoded in
  1729. UTF\(hy8. The <\fIkeyword\fP> fields can be any UTF\(hy8 characters.
  1730. The <\fIlength\fP> field shall be the decimal length of the extended
  1731. header record in octets, including the trailing
  1732. <newline>.
  1733. If there is a
  1734. .BR hdrcharset
  1735. extended header in effect for a file, the
  1736. .IR value
  1737. field for any
  1738. .BR gname ,
  1739. .BR linkpath ,
  1740. .BR path ,
  1741. and
  1742. .BR uname
  1743. extended header records shall be encoded using the character set
  1744. specified by the
  1745. .BR hdrcharset
  1746. extended header record; otherwise, the
  1747. .IR value
  1748. field shall be encoded using UTF\(hy8. The
  1749. .IR value
  1750. field for all other keywords specified by POSIX.1\(hy2008 shall be
  1751. encoded using UTF\(hy8.
  1752. .P
  1753. The <\fIkeyword\fP> field shall be one of the entries from the
  1754. following list or a keyword provided as an implementation extension.
  1755. Keywords consisting entirely of lowercase letters, digits, and periods
  1756. are reserved for future standardization. A keyword shall not include an
  1757. <equals-sign>.
  1758. (In the following list, the notations ``file(s)'' or ``block(s)'' is used
  1759. to acknowledge that a keyword affects the following single file after a
  1760. .IR typeflag
  1761. .BR x
  1762. extended header, but possibly multiple files after
  1763. .IR typeflag
  1764. .BR g .
  1765. Any requirements in the list for
  1766. .IR pax
  1767. to include a record when in
  1768. .BR write
  1769. or
  1770. .BR copy
  1771. mode shall apply only when such a record has not already been provided
  1772. through the use of the
  1773. .BR \-o
  1774. option. When used in
  1775. .BR copy
  1776. mode,
  1777. .IR pax
  1778. shall behave as if an archive had been created with applicable extended
  1779. header records and then extracted.)
  1780. .IP "\fBatime\fP" 10
  1781. The file access time for the following file(s), equivalent to the value
  1782. of the
  1783. .IR st_atime
  1784. member of the
  1785. .BR stat
  1786. structure for a file, as described by the
  1787. \fIstat\fR()
  1788. function. The access time shall be restored if the process has
  1789. appropriate privileges required to do so. The format of the
  1790. <\fIvalue\fP> shall be as described in
  1791. .IR "pax Extended Header File Times".
  1792. .IP "\fBcharset\fP" 10
  1793. The name of the character set used to encode the data in the following
  1794. file(s). The entries in the following table are defined to refer to
  1795. known standards; additional names may be agreed on between the
  1796. originator and recipient.
  1797. .TS
  1798. center box tab(!);
  1799. cB | cB
  1800. lf5 | l.
  1801. <value>!Formal Standard
  1802. _
  1803. ISO-IR 646 1990!ISO/IEC 646:\|1990
  1804. ISO-IR 8859 1 1998!ISO/IEC 8859\(hy1:\|1998
  1805. ISO-IR 8859 2 1999!ISO/IEC 8859\(hy2:\|1999
  1806. ISO-IR 8859 3 1999!ISO/IEC 8859\(hy3:\|1999
  1807. ISO-IR 8859 4 1998!ISO/IEC 8859\(hy4:\|1998
  1808. ISO-IR 8859 5 1999!ISO/IEC 8859\(hy5:\|1999
  1809. ISO-IR 8859 6 1999!ISO/IEC 8859\(hy6:\|1999
  1810. ISO-IR 8859 7 1987!ISO/IEC 8859\(hy7:\|1987
  1811. ISO-IR 8859 8 1999!ISO/IEC 8859\(hy8:\|1999
  1812. ISO-IR 8859 9 1999!ISO/IEC 8859\(hy9:\|1999
  1813. ISO-IR 8859 10 1998!ISO/IEC 8859\(hy10:\|1998
  1814. ISO-IR 8859 13 1998!ISO/IEC 8859\(hy13:\|1998
  1815. ISO-IR 8859 14 1998!ISO/IEC 8859\(hy14:\|1998
  1816. ISO-IR 8859 15 1999!ISO/IEC 8859\(hy15:\|1999
  1817. ISO-IR 10646 2000!ISO/IEC 10646:\|2000
  1818. ISO-IR 10646 2000 UTF-8!ISO/IEC 10646, UTF-8 encoding
  1819. BINARY!None.
  1820. .TE
  1821. .RS 10
  1822. .P
  1823. The encoding is included in an extended header for information only;
  1824. when
  1825. .IR pax
  1826. is used as described in POSIX.1\(hy2008, it shall not translate the file data
  1827. into any other encoding. The
  1828. .BR BINARY
  1829. entry indicates unencoded binary data.
  1830. .P
  1831. When used in
  1832. .BR write
  1833. or
  1834. .BR copy
  1835. mode, it is implementation-defined whether
  1836. .IR pax
  1837. includes a
  1838. .BR charset
  1839. extended header record for a file.
  1840. .RE
  1841. .IP "\fBcomment\fP" 10
  1842. A series of characters used as a comment. All characters in the
  1843. <\fIvalue\fP> field shall be ignored by
  1844. .IR pax .
  1845. .IP "\fBgid\fP" 10
  1846. The group ID of the group that owns the file, expressed as a decimal
  1847. number using digits from the ISO/IEC\ 646:\|1991 standard. This record shall override the
  1848. .IR gid
  1849. field in the following header block(s). When used in
  1850. .BR write
  1851. or
  1852. .BR copy
  1853. mode,
  1854. .IR pax
  1855. shall include a
  1856. .IR gid
  1857. extended header record for each file whose group ID is greater than
  1858. 2\|097\|151 (octal 7\|777\|777).
  1859. .IP "\fBgname\fP" 10
  1860. The group of the file(s), formatted as a group name in the group
  1861. database. This record shall override the
  1862. .IR gid
  1863. and
  1864. .IR gname
  1865. fields in the following header block(s), and any
  1866. .IR gid
  1867. extended header record. When used in
  1868. .BR read ,
  1869. .BR copy ,
  1870. or
  1871. .BR list
  1872. mode,
  1873. .IR pax
  1874. shall translate the name from the encoding in the header record to
  1875. the character set appropriate for the group database on the
  1876. receiving system. If any of the characters cannot be
  1877. translated, and if neither the
  1878. .BR \-o \c
  1879. .BR invalid=UTF\(hy8
  1880. option nor the
  1881. .BR \-o \c
  1882. .BR invalid=binary
  1883. option is specified, the results are implementation-defined.
  1884. When used in
  1885. .BR write
  1886. or
  1887. .BR copy
  1888. mode,
  1889. .IR pax
  1890. shall include a
  1891. .BR gname
  1892. extended header record for each file whose group name cannot be
  1893. represented entirely with the letters and digits of the portable
  1894. character set.
  1895. .IP "\fBhdrcharset\fR" 10
  1896. The name of the character set used to encode the value field of the
  1897. .BR gname ,
  1898. .BR linkpath ,
  1899. .BR path ,
  1900. and
  1901. .BR uname
  1902. .IR pax
  1903. extended header records. The entries in the following table are defined
  1904. to refer to known standards; additional names may be agreed between the
  1905. originator and the recipient.
  1906. .br
  1907. .TS
  1908. center box tab(!);
  1909. cB | cB
  1910. lf5 | l.
  1911. <value>!Formal Standard
  1912. _
  1913. ISO-IR 10646 2000 UTF-8!ISO/IEC 10646, UTF-8 encoding
  1914. BINARY!None.
  1915. .TE
  1916. .RS 10
  1917. .P
  1918. If no
  1919. .BR hdrcharset
  1920. extended header record is specified, the default character set used to
  1921. encode all values in extended header records shall be the ISO/IEC\ 10646\(hy1:\|2000 standard
  1922. UTF\(hy8 encoding.
  1923. .P
  1924. The
  1925. .BR BINARY
  1926. entry indicates that all values recorded in extended headers for
  1927. affected files are unencoded binary data from the underlying system.
  1928. .RE
  1929. .IP "\fBlinkpath\fP" 10
  1930. The pathname of a link being created to another file, of any type,
  1931. previously archived. This record shall override the
  1932. .IR linkname
  1933. field in the following
  1934. .BR ustar
  1935. header block(s). The following
  1936. .BR ustar
  1937. header block shall determine the type of link created. If
  1938. .IR typeflag
  1939. of the following header block is 1, it shall be a hard link. If
  1940. .IR typeflag
  1941. is 2, it shall be a symbolic link and the
  1942. .BR linkpath
  1943. value shall be the contents of the symbolic link. The
  1944. .IR pax
  1945. utility shall translate the name of the link (contents of the symbolic
  1946. link) from the encoding in the header to the character set appropriate
  1947. for the local file system. When used in
  1948. .BR write
  1949. or
  1950. .BR copy
  1951. mode,
  1952. .IR pax
  1953. shall include a
  1954. .BR linkpath
  1955. extended header record for each link whose pathname cannot be
  1956. represented entirely with the members of the portable character set
  1957. other than NUL.
  1958. .IP "\fBmtime\fP" 10
  1959. The file modification time of the following file(s), equivalent to the
  1960. value of the
  1961. .IR st_mtime
  1962. member of the
  1963. .BR stat
  1964. structure for a file, as described in the
  1965. \fIstat\fR()
  1966. function. This record shall override the
  1967. .IR mtime
  1968. field in the following header block(s). The modification time shall be
  1969. restored if the process has appropriate privileges required to do
  1970. so. The format of the <\fIvalue\fP> shall be as described in
  1971. .IR "pax Extended Header File Times".
  1972. .IP "\fBpath\fP" 10
  1973. The pathname of the following file(s). This record shall override the
  1974. .IR name
  1975. and
  1976. .IR prefix
  1977. fields in the following header block(s). The
  1978. .IR pax
  1979. utility shall translate the pathname of the file from the encoding in
  1980. the header to the character set appropriate for the local file system.
  1981. .RS 10
  1982. .P
  1983. When used in
  1984. .BR write
  1985. or
  1986. .BR copy
  1987. mode,
  1988. .IR pax
  1989. shall include a
  1990. .IR path
  1991. extended header record for each file whose pathname cannot be
  1992. represented entirely with the members of the portable character set
  1993. other than NUL.
  1994. .RE
  1995. .IP "\fBrealtime.\fIany\fR" 10
  1996. The keywords prefixed by ``realtime.'' are reserved for future
  1997. standardization.
  1998. .IP "\fBsecurity.\fIany\fR" 10
  1999. The keywords prefixed by ``security.'' are reserved for future
  2000. standardization.
  2001. .IP "\fBsize\fP" 10
  2002. The size of the file in octets, expressed as a decimal number using
  2003. digits from the ISO/IEC\ 646:\|1991 standard. This record shall override the
  2004. .IR size
  2005. field in the following header block(s). When used in
  2006. .BR write
  2007. or
  2008. .BR copy
  2009. mode,
  2010. .IR pax
  2011. shall include a
  2012. .IR size
  2013. extended header record for each file with a size value greater than
  2014. 8\|589\|934\|591 (octal 77\|777\|777\|777).
  2015. .IP "\fBuid\fP" 10
  2016. The user ID of the file owner, expressed as a decimal number using
  2017. digits from the ISO/IEC\ 646:\|1991 standard. This record shall override the
  2018. .IR uid
  2019. field in the following header block(s). When used in
  2020. .BR write
  2021. or
  2022. .BR copy
  2023. mode,
  2024. .IR pax
  2025. shall include a
  2026. .IR uid
  2027. extended header record for each file whose owner ID is greater than
  2028. 2\|097\|151 (octal 7\|777\|777).
  2029. .IP "\fBuname\fP" 10
  2030. The owner of the following file(s), formatted as a user name in the
  2031. user database. This record shall override the
  2032. .IR uid
  2033. and
  2034. .IR uname
  2035. fields in the following header block(s), and any
  2036. .IR uid
  2037. extended header record. When used in
  2038. .BR read ,
  2039. .BR copy ,
  2040. or
  2041. .BR list
  2042. mode,
  2043. .IR pax
  2044. shall translate the name from the encoding in the header record to the
  2045. character set appropriate for the user database on the receiving
  2046. system. If any of the characters cannot be translated, and if neither
  2047. the
  2048. .BR \-o \c
  2049. .BR invalid=UTF\(hy8
  2050. option nor the
  2051. .BR \-o \c
  2052. .BR invalid=binary
  2053. option is specified, the results are implementation-defined.
  2054. When used in
  2055. .BR write
  2056. or
  2057. .BR copy
  2058. mode,
  2059. .IR pax
  2060. shall include a
  2061. .BR uname
  2062. extended header record for each file whose user name cannot be
  2063. represented entirely with the letters and digits of the portable
  2064. character set.
  2065. .P
  2066. If the <\fIvalue\fP> field is zero length, it shall delete any header
  2067. block field, previously entered extended header value, or global
  2068. extended header value of the same name.
  2069. .P
  2070. If a keyword in an extended header record (or in a
  2071. .BR \-o
  2072. option-argument) overrides or deletes a corresponding field in the
  2073. .BR ustar
  2074. header block,
  2075. .IR pax
  2076. shall ignore the contents of that header block field.
  2077. .P
  2078. Unlike the
  2079. .BR ustar
  2080. header block fields, NULs shall not delimit <\fIvalue\fP>s; all
  2081. characters within the <\fIvalue\fP> field shall be considered data for
  2082. the field. None of the length limitations of the
  2083. .BR ustar
  2084. header block fields in
  2085. .IR "Table 4-14, ustar Header Block"
  2086. shall apply to the extended header records.
  2087. .SS "pax Extended Header Keyword Precedence"
  2088. .P
  2089. This section describes the precedence in which the various header
  2090. records and fields and command line options are selected to apply to a
  2091. file in the archive. When
  2092. .IR pax
  2093. is used in
  2094. .BR read
  2095. or
  2096. .BR list
  2097. modes, it shall determine a file attribute in the following sequence:
  2098. .IP " 1." 4
  2099. If
  2100. .BR \-o \c
  2101. .BR delete=keyword-prefix
  2102. is used, the affected attributes shall be determined from step 7., if
  2103. applicable, or ignored otherwise.
  2104. .IP " 2." 4
  2105. If
  2106. .BR \-o \c
  2107. .IR keyword :=
  2108. is used, the affected attributes shall be ignored.
  2109. .IP " 3." 4
  2110. If
  2111. .BR \-o \c
  2112. .BR keyword:=value
  2113. is used, the affected attribute shall be assigned the value.
  2114. .IP " 4." 4
  2115. If there is a
  2116. .IR typeflag
  2117. .BR x
  2118. extended header record, the affected attribute shall be assigned the
  2119. <\fIvalue\fP>. When extended header records conflict, the last one
  2120. given in the header shall take precedence.
  2121. .IP " 5." 4
  2122. If
  2123. .BR \-o \c
  2124. .BR keyword=value
  2125. is used, the affected attribute shall be assigned the value.
  2126. .IP " 6." 4
  2127. If there is a
  2128. .IR typeflag
  2129. .BR g
  2130. global extended header record, the affected attribute shall be assigned
  2131. the <\fIvalue\fP>. When global extended header records conflict, the
  2132. last one given in the global header shall take precedence.
  2133. .IP " 7." 4
  2134. Otherwise, the attribute shall be determined from the
  2135. .BR ustar
  2136. header block.
  2137. .SS "pax Extended Header File Times"
  2138. .P
  2139. The
  2140. .IR pax
  2141. utility shall write an
  2142. .BR mtime
  2143. record for each file in
  2144. .BR write
  2145. or
  2146. .BR copy
  2147. modes if the file's modification time cannot be represented exactly in
  2148. the
  2149. .BR ustar
  2150. header logical record described in
  2151. .IR "ustar Interchange Format".
  2152. This can occur if the time is out of
  2153. .BR ustar
  2154. range, or if the file system of the underlying implementation supports
  2155. non-integer time granularities and the time is not an integer. All of
  2156. these time records shall be formatted as a decimal representation of
  2157. the time in seconds since the Epoch. If a
  2158. <period>
  2159. (\c
  2160. .BR '.' )
  2161. decimal point character is present, the digits to the right of the
  2162. point shall represent the units of a subsecond timing granularity,
  2163. where the first digit is tenths of a second and each subsequent digit
  2164. is a tenth of the previous digit. In
  2165. .BR read
  2166. or
  2167. .BR copy
  2168. mode, the
  2169. .IR pax
  2170. utility shall truncate the time of a file to the greatest value that is
  2171. not greater than the input header file time. In
  2172. .BR write
  2173. or
  2174. .BR copy
  2175. mode, the
  2176. .IR pax
  2177. utility shall output a time exactly if it can be represented exactly as
  2178. a decimal number, and otherwise shall generate only enough digits so
  2179. that the same time shall be recovered if the file is extracted on a
  2180. system whose underlying implementation supports the same time
  2181. granularity.
  2182. .SS "ustar Interchange Format"
  2183. .P
  2184. A
  2185. .BR ustar
  2186. archive tape or file shall contain a series of logical records. Each
  2187. logical record shall be a fixed-size logical record of 512 octets (see
  2188. below). Although this format may be thought of as being stored on
  2189. 9-track industry-standard 12.7 mm (0.5 in) magnetic tape, other types of
  2190. transportable media are not excluded. Each file archived shall be
  2191. represented by a header logical record that describes the file,
  2192. followed by zero or more logical records that give the contents of the
  2193. file. At the end of the archive file there shall be two 512-octet
  2194. logical records filled with binary zeros, interpreted as an
  2195. end-of-archive indicator.
  2196. .P
  2197. The logical records may be grouped for physical I/O operations, as
  2198. described under the
  2199. .BR \-b \c
  2200. .IR blocksize
  2201. and
  2202. .BR \-x
  2203. .BR ustar
  2204. options. Each group of logical records may be written with a single
  2205. operation equivalent to the
  2206. \fIwrite\fR()
  2207. function. On magnetic tape, the result of this write shall be a single
  2208. tape physical block. The last physical block shall always be the full
  2209. size, so logical records after the two zero logical records may contain
  2210. undefined data.
  2211. .P
  2212. The header logical record shall be structured as shown in the following
  2213. table. All lengths and offsets are in decimal.
  2214. .br
  2215. .sp
  2216. .ce 1
  2217. \fBTable 4-14: ustar Header Block\fR
  2218. .TS
  2219. center box tab(@);
  2220. cB | cB | cB
  2221. lI | n | n.
  2222. Field Name@Octet Offset@Length (in Octets)
  2223. _
  2224. name@0@100
  2225. mode@100@8
  2226. uid@108@8
  2227. gid@116@8
  2228. size@124@12
  2229. mtime@136@12
  2230. chksum@148@8
  2231. typeflag@156@1
  2232. linkname@157@100
  2233. magic@257@6
  2234. version@263@2
  2235. uname@265@32
  2236. gname@297@32
  2237. devmajor@329@8
  2238. devminor@337@8
  2239. prefix@345@155
  2240. .TE
  2241. .P
  2242. All characters in the header logical record shall be represented in the
  2243. coded character set of the ISO/IEC\ 646:\|1991 standard. For maximum portability between
  2244. implementations, names should be selected from characters represented
  2245. by the portable filename character set as octets with the most
  2246. significant bit zero. If an implementation supports the use of
  2247. characters outside of
  2248. <slash>
  2249. and the portable filename character set in names for files, users, and
  2250. groups, one or more implementation-defined encodings of these characters
  2251. shall be provided for interchange purposes.
  2252. .P
  2253. However, the
  2254. .IR pax
  2255. utility shall never create filenames on the local system that cannot
  2256. be accessed via the procedures described in POSIX.1\(hy2008. If a filename is
  2257. found on the medium that would create an invalid filename, it is
  2258. implementation-defined whether the data from the file is stored on the
  2259. file hierarchy and under what name it is stored. The
  2260. .IR pax
  2261. utility may choose to ignore these files as long as it produces an
  2262. error indicating that the file is being ignored.
  2263. .P
  2264. Each field within the header logical record is contiguous; that is,
  2265. there is no padding used. Each character on the archive medium shall be
  2266. stored contiguously.
  2267. .P
  2268. The fields
  2269. .IR magic ,
  2270. .IR uname ,
  2271. and
  2272. .IR gname
  2273. are character strings each terminated by a NUL character. The fields
  2274. .IR name ,
  2275. .IR linkname ,
  2276. and
  2277. .IR prefix
  2278. are NUL-terminated character strings except when all characters in the
  2279. array contain non-NUL characters including the last character. The
  2280. .IR version
  2281. field is two octets containing the characters
  2282. .BR \(dq00\(dq
  2283. (zero-zero). The
  2284. .IR typeflag
  2285. contains a single character. All other fields are leading zero-filled
  2286. octal numbers using digits from the ISO/IEC\ 646:\|1991 standard IRV. Each numeric field is
  2287. terminated by one or more
  2288. <space>
  2289. or NUL characters.
  2290. .P
  2291. The
  2292. .IR name
  2293. and the
  2294. .IR prefix
  2295. fields shall produce the pathname of the file. A new pathname shall
  2296. be formed, if
  2297. .IR prefix
  2298. is not an empty string (its first character is not NUL), by
  2299. concatenating
  2300. .IR prefix
  2301. (up to the first NUL character), a
  2302. <slash>
  2303. character, and
  2304. .IR name ;
  2305. otherwise,
  2306. .IR name
  2307. is used alone. In either case,
  2308. .IR name
  2309. is terminated at the first NUL character. If
  2310. .IR prefix
  2311. begins with a NUL character, it shall be ignored. In this manner,
  2312. pathnames of at most 256 characters can be supported. If a pathname
  2313. does not fit in the space provided,
  2314. .IR pax
  2315. shall notify the user of the error, and shall not store any part of the
  2316. file\(emheader or data\(emon the medium.
  2317. .P
  2318. The
  2319. .IR linkname
  2320. field, described below, shall not use the
  2321. .IR prefix
  2322. to produce a pathname. As such, a
  2323. .IR linkname
  2324. is limited to 100 characters. If the name does not fit in the space
  2325. provided,
  2326. .IR pax
  2327. shall notify the user of the error, and shall not attempt to store the
  2328. link on the medium.
  2329. .P
  2330. The
  2331. .IR mode
  2332. field provides 12 bits encoded in the ISO/IEC\ 646:\|1991 standard octal digit representation.
  2333. The encoded bits shall represent the following values:
  2334. .br
  2335. .sp
  2336. .ce 1
  2337. \fBTable: ustar \fImode\fP Field\fR
  2338. .TS
  2339. tab(!) center box;
  2340. cB | cB | cB
  2341. n | l | l.
  2342. Bit Value!POSIX.1\(hy2008 Bit!Description
  2343. _
  2344. 04\|000!S_ISUID!Set UID on execution.
  2345. 02\|000!S_ISGID!Set GID on execution.
  2346. 01\|000!<reserved>!Reserved for future standardization.
  2347. 00\|400!S_IRUSR!Read permission for file owner class.
  2348. 00\|200!S_IWUSR!Write permission for file owner class.
  2349. 00\|100!S_IXUSR!Execute/search permission for file owner class.
  2350. 00\|040!S_IRGRP!Read permission for file group class.
  2351. 00\|020!S_IWGRP!Write permission for file group class.
  2352. 00\|010!S_IXGRP!Execute/search permission for file group class.
  2353. 00\|004!S_IROTH!Read permission for file other class.
  2354. 00\|002!S_IWOTH!Write permission for file other class.
  2355. 00\|001!S_IXOTH!Execute/search permission for file other class.
  2356. .TE
  2357. .P
  2358. When appropriate privileges are required to set one of these mode bits,
  2359. and the user restoring the files from the archive does not have
  2360. appropriate privileges, the mode bits for which the user does not have
  2361. appropriate privileges shall be ignored. Some of the mode bits in the
  2362. archive format are not mentioned elsewhere in this volume of POSIX.1\(hy2017. If the
  2363. implementation does not support those bits, they may be ignored.
  2364. .P
  2365. The
  2366. .IR uid
  2367. and
  2368. .IR gid
  2369. fields are the user and group ID of the owner and group of the file,
  2370. respectively.
  2371. .P
  2372. The
  2373. .IR size
  2374. field is the size of the file in octets. If the
  2375. .IR typeflag
  2376. field is set to specify a file to be of type 1 (a link) or 2 (a
  2377. symbolic link), the
  2378. .IR size
  2379. field shall be specified as zero. If the
  2380. .IR typeflag
  2381. field is set to specify a file of type 5 (directory), the
  2382. .IR size
  2383. field shall be interpreted as described under the definition of that
  2384. record type. No data logical records are stored for types 1, 2, or 5.
  2385. If the
  2386. .IR typeflag
  2387. field is set to 3 (character special file), 4 (block special file), or
  2388. 6 (FIFO), the meaning of the
  2389. .IR size
  2390. field is unspecified by this volume of POSIX.1\(hy2017, and no data logical records shall be
  2391. stored on the medium. Additionally, for type 6, the
  2392. .IR size
  2393. field shall be ignored when reading. If the
  2394. .IR typeflag
  2395. field is set to any other value, the number of logical records written
  2396. following the header shall be (\c
  2397. .IR size +511)/512,
  2398. ignoring any fraction in the result of the division.
  2399. .P
  2400. The
  2401. .IR mtime
  2402. field shall be the modification time of the file at the time it was
  2403. archived. It is the ISO/IEC\ 646:\|1991 standard representation of the octal value of the
  2404. modification time obtained from the
  2405. \fIstat\fR()
  2406. function.
  2407. .P
  2408. The
  2409. .IR chksum
  2410. field shall be the ISO/IEC\ 646:\|1991 standard IRV representation of the octal value of the
  2411. simple sum of all octets in the header logical record. Each octet in
  2412. the header shall be treated as an unsigned value. These values shall be
  2413. added to an unsigned integer, initialized to zero, the precision of
  2414. which is not less than 17 bits. When calculating the checksum, the
  2415. .IR chksum
  2416. field is treated as if it were all
  2417. <space>
  2418. characters.
  2419. .P
  2420. The
  2421. .IR typeflag
  2422. field specifies the type of file archived. If a particular
  2423. implementation does not recognize the type, or the user does not have
  2424. appropriate privileges to create that type, the file shall be extracted
  2425. as if it were a regular file if the file type is defined to have a
  2426. meaning for the
  2427. .IR size
  2428. field that could cause data logical records to be written on the medium
  2429. (see the previous description for
  2430. .IR size ).
  2431. If conversion to a regular file occurs, the
  2432. .IR pax
  2433. utility shall produce an error indicating that the conversion took
  2434. place. All of the
  2435. .IR typeflag
  2436. fields shall be coded in the ISO/IEC\ 646:\|1991 standard IRV:
  2437. .IP "\fR0\fR" 8
  2438. Represents a regular file. For backwards-compatibility, a
  2439. .IR typeflag
  2440. value of binary zero (\c
  2441. .BR '\e0' )
  2442. should be recognized as meaning a regular file when extracting files
  2443. from the archive. Archives written with this version of the archive
  2444. file format create regular files with a
  2445. .IR typeflag
  2446. value of the ISO/IEC\ 646:\|1991 standard IRV
  2447. .BR '0' .
  2448. .IP "\fR1\fR" 8
  2449. Represents a file linked to another file, of any type, previously
  2450. archived. Such files are identified by having the same device
  2451. and file serial numbers, and pathnames that refer to different
  2452. directory entries. All such files shall be archived as linked files.
  2453. The linked-to name is specified in the
  2454. .IR linkname
  2455. field with a NUL-character terminator if it is less than 100 octets in
  2456. length.
  2457. .IP "\fR2\fR" 8
  2458. Represents a symbolic link. The contents of the symbolic link shall be
  2459. stored in the
  2460. .IR linkname
  2461. field.
  2462. .IP "\fR3,4\fR" 8
  2463. Represent character special files and block special files respectively.
  2464. In this case the
  2465. .IR devmajor
  2466. and
  2467. .IR devminor
  2468. fields shall contain information defining the device, the format of
  2469. which is unspecified by this volume of POSIX.1\(hy2017. Implementations may map the device
  2470. specifications to their own local specification or may ignore the
  2471. entry.
  2472. .IP "\fR5\fR" 8
  2473. Specifies a directory or subdirectory. On systems where disk allocation
  2474. is performed on a directory basis, the
  2475. .IR size
  2476. field shall contain the maximum number of octets (which may be rounded
  2477. to the nearest disk block allocation unit) that the directory may hold.
  2478. A
  2479. .IR size
  2480. field of zero indicates no such limiting. Systems that do not support
  2481. limiting in this manner should ignore the
  2482. .IR size
  2483. field.
  2484. .IP "\fR6\fR" 8
  2485. Specifies a FIFO special file. Note that the archiving of a FIFO file
  2486. archives the existence of this file and not its contents.
  2487. .IP "\fR7\fR" 8
  2488. Reserved to represent a file to which an implementation has associated
  2489. some high-performance attribute. Implementations without such
  2490. extensions should treat this file as a regular file (type 0).
  2491. .IP "\fRA\(hyZ\fR" 8
  2492. The letters
  2493. .BR 'A'
  2494. to
  2495. .BR 'Z' ,
  2496. inclusive, are reserved for custom implementations. All other values
  2497. are reserved for future versions of this standard.
  2498. .P
  2499. It is unspecified whether files with pathnames that refer to the same
  2500. directory entry are archived as linked files or as separate files. If
  2501. they are archived as linked files, this means that attempting to
  2502. extract both pathnames from the resulting archive will always cause an
  2503. error (unless the
  2504. .BR \-u
  2505. option is used) because the link cannot be created.
  2506. .P
  2507. It is unspecified whether files with the same device and file serial
  2508. numbers being appended to an archive are treated as linked files to
  2509. members that were in the archive before the append.
  2510. .P
  2511. Attempts to archive a socket shall produce a diagnostic message when
  2512. .BR ustar
  2513. interchange format is used, but may be allowed when
  2514. .BR pax
  2515. interchange format is used. Handling of other file types is
  2516. implementation-defined.
  2517. .P
  2518. The
  2519. .IR magic
  2520. field is the specification that this archive was output in this archive
  2521. format. If this field contains
  2522. .BR ustar
  2523. (the five characters from the ISO/IEC\ 646:\|1991 standard IRV shown followed by NUL), the
  2524. .IR uname
  2525. and
  2526. .IR gname
  2527. fields shall contain the ISO/IEC\ 646:\|1991 standard IRV representation of the owner and
  2528. group of the file, respectively (truncated to fit, if necessary). When
  2529. the file is restored by a privileged, protection-preserving version of
  2530. the utility, the user and group databases shall be scanned for these
  2531. names. If found, the user and group IDs contained within these files
  2532. shall be used rather than the values contained within the
  2533. .IR uid
  2534. and
  2535. .IR gid
  2536. fields.
  2537. .SS "cpio Interchange Format"
  2538. .P
  2539. The octet-oriented
  2540. .BR cpio
  2541. archive format shall be a series of entries, each comprising a header
  2542. that describes the file, the name of the file, and then the contents of
  2543. the file.
  2544. .P
  2545. An archive may be recorded as a series of fixed-size blocks of octets.
  2546. This blocking shall be used only to make physical I/O more efficient.
  2547. The last group of blocks shall always be at the full size.
  2548. .P
  2549. For the octet-oriented
  2550. .BR cpio
  2551. archive format, the individual entry information shall be in the order
  2552. indicated and described by the following table; see also the
  2553. .IR <cpio.h>
  2554. header.
  2555. .br
  2556. .sp
  2557. .ce 1
  2558. \fBTable 4-16: Octet-Oriented cpio Archive Entry\fR
  2559. .TS
  2560. center box tab(!);
  2561. cB | cB | cB
  2562. lI | n | l.
  2563. Header Field Name!Length (in Octets)!Interpreted as
  2564. _
  2565. c_magic!6!Octal number
  2566. c_dev!6!Octal number
  2567. c_ino!6!Octal number
  2568. c_mode!6!Octal number
  2569. c_uid!6!Octal number
  2570. c_gid!6!Octal number
  2571. c_nlink!6!Octal number
  2572. c_rdev!6!Octal number
  2573. c_mtime!11!Octal number
  2574. c_namesize!6!Octal number
  2575. c_filesize!11!Octal number
  2576. _
  2577. .T&
  2578. cB | cB | cB
  2579. lI lI l.
  2580. Filename Field Name!Length!Interpreted as
  2581. _
  2582. c_name!c_namesize!Pathname string
  2583. _
  2584. .T&
  2585. cB | cB | cB
  2586. lI lI l.
  2587. File Data Field Name!Length!Interpreted as
  2588. _
  2589. c_filedata!c_filesize!Data
  2590. .TE
  2591. .SS "cpio Header"
  2592. .P
  2593. For each file in the archive, a header as defined previously shall be
  2594. written. The information in the header fields is written as streams of
  2595. the ISO/IEC\ 646:\|1991 standard characters interpreted as octal numbers. The octal numbers
  2596. shall be extended to the necessary length by appending the ISO/IEC\ 646:\|1991 standard IRV
  2597. zeros at the most-significant-digit end of the number; the result is
  2598. written to the most-significant digit of the stream of octets first.
  2599. The fields shall be interpreted as follows:
  2600. .IP "\fIc_magic\fR" 10
  2601. Identify the archive as being a transportable archive by containing the
  2602. identifying value
  2603. .BR \(dq070707\(dq .
  2604. .IP "\fIc_dev\fR,\ \fIc_ino\fR" 10
  2605. Contains values that uniquely identify the file within the archive
  2606. (that is, no files contain the same pair of
  2607. .IR c_dev
  2608. and
  2609. .IR c_ino
  2610. values unless they are links to the same file). The values shall be
  2611. determined in an unspecified manner.
  2612. .IP "\fIc_mode\fR" 10
  2613. Contains the file type and access permissions as defined in the
  2614. following table.
  2615. .br
  2616. .sp
  2617. .ce 1
  2618. \fBTable 4-17: Values for cpio c_mode Field\fR
  2619. .TS
  2620. center box tab(@);
  2621. cB | cB | cB
  2622. l | n | l.
  2623. File Permissions Name@Value@Indicates
  2624. _
  2625. C_IRUSR@000\|400@Read by owner
  2626. C_IWUSR@000\|200@Write by owner
  2627. C_IXUSR@000\|100@Execute by owner
  2628. C_IRGRP@000\|040@Read by group
  2629. C_IWGRP@000\|020@Write by group
  2630. C_IXGRP@000\|010@Execute by group
  2631. C_IROTH@000\|004@Read by others
  2632. C_IWOTH@000\|002@Write by others
  2633. C_IXOTH@000\|001@Execute by others
  2634. C_ISUID@004\|000@Set \fIuid\fP
  2635. C_ISGID@002\|000@Set \fIgid\fP
  2636. C_ISVTX@001\|000@Reserved
  2637. _
  2638. .T&
  2639. cB | cB | cB
  2640. l | n | l.
  2641. File Type Name@Value@Indicates
  2642. _
  2643. C_ISDIR@040\|000@Directory
  2644. C_ISFIFO@010\|000@FIFO
  2645. C_ISREG@0100\|000@Regular file
  2646. C_ISLNK@0120\|000@Symbolic link
  2647. .RS 10
  2648. .P
  2649. C_ISBLK@060\|000@Block special file
  2650. C_ISCHR@020\|000@Character special file
  2651. C_ISSOCK@0140\|000@Socket
  2652. .P
  2653. C_ISCTG@0110\|000@Reserved
  2654. .TE
  2655. .P
  2656. Directories, FIFOs, symbolic links, and regular files shall be
  2657. supported on a system conforming to this volume of POSIX.1\(hy2017; additional values defined
  2658. previously are reserved for compatibility with existing systems.
  2659. Additional file types may be supported; however, such files should not
  2660. be written to archives intended to be transported to other systems.
  2661. .RE
  2662. .IP "\fIc_uid\fR" 10
  2663. Contains the user ID of the owner.
  2664. .IP "\fIc_gid\fR" 10
  2665. Contains the group ID of the group.
  2666. .IP "\fIc_nlink\fR" 10
  2667. Contains a number greater than or equal to the number of links in the
  2668. archive referencing the file. If the
  2669. .BR \-a
  2670. option is used to append to a
  2671. .IR cpio
  2672. archive, then the
  2673. .IR pax
  2674. utility need not account for the files in the existing part of the
  2675. archive when calculating the
  2676. .IR c_nlink
  2677. values for the appended part of the archive, and need not alter the
  2678. .IR c_nlink
  2679. values in the existing part of the archive if additional files with the
  2680. same
  2681. .IR c_dev
  2682. and
  2683. .IR c_ino
  2684. values are appended to the archive.
  2685. .IP "\fIc_rdev\fR" 10
  2686. Contains implementation-defined information for character or block
  2687. special files.
  2688. .IP "\fIc_mtime\fR" 10
  2689. Contains the latest time of modification of the file at the time the
  2690. archive was created.
  2691. .IP "\fIc_namesize\fR" 10
  2692. Contains the length of the pathname, including the terminating NUL
  2693. character.
  2694. .IP "\fIc_filesize\fR" 10
  2695. Contains the length in octets of the data section following the
  2696. header structure.
  2697. .SS "cpio Filename"
  2698. .P
  2699. The
  2700. .IR c_name
  2701. field shall contain the pathname of the file. The length of this field
  2702. in octets is the value of
  2703. .IR c_namesize .
  2704. .P
  2705. If a filename is found on the medium that would create an invalid
  2706. pathname, it is implementation-defined whether the data from the file
  2707. is stored on the file hierarchy and under what name it is stored.
  2708. .P
  2709. All characters shall be represented in the ISO/IEC\ 646:\|1991 standard IRV. For maximum
  2710. portability between implementations, names should be selected from
  2711. characters represented by the portable filename character set as
  2712. octets with the most significant bit zero. If an implementation
  2713. supports the use of characters outside the portable filename character
  2714. set in names for files, users, and groups, one or more
  2715. implementation-defined encodings of these characters shall be provided
  2716. for interchange purposes. However, the
  2717. .IR pax
  2718. utility shall never create filenames on the local system that cannot
  2719. be accessed via the procedures described previously in this volume of POSIX.1\(hy2017. If a
  2720. filename is found on the medium that would create an invalid filename,
  2721. it is implementation-defined whether the data from the file is stored on
  2722. the local file system and under what name it is stored. The
  2723. .IR pax
  2724. utility may choose to ignore these files as long as it produces an
  2725. error indicating that the file is being ignored.
  2726. .SS "cpio File Data"
  2727. .P
  2728. Following
  2729. .IR c_name ,
  2730. there shall be
  2731. .IR c_filesize
  2732. octets of data. Interpretation of such data occurs in a manner
  2733. dependent on the file. For regular files, the data shall consist
  2734. of the contents of the file. For symbolic links, the data shall
  2735. consist of the contents of the symbolic link. If
  2736. .IR c_filesize
  2737. is zero, no data shall be contained in
  2738. .IR c_filedata .
  2739. .P
  2740. When restoring from an archive:
  2741. .IP " *" 4
  2742. If the user does not have appropriate privileges to create a file of
  2743. the specified type,
  2744. .IR pax
  2745. shall ignore the entry and write an error message to standard error.
  2746. .IP " *" 4
  2747. Only regular files and symbolic links have data to be restored. Presuming
  2748. a regular file meets any selection criteria that might be imposed on
  2749. the format-reading utility by the user, such data shall be restored.
  2750. .IP " *" 4
  2751. If a user does not have appropriate privileges to set a particular mode
  2752. flag, the flag shall be ignored. Some of the mode flags in the archive
  2753. format are not mentioned elsewhere in this volume of POSIX.1\(hy2017. If the implementation does
  2754. not support those flags, they may be ignored.
  2755. .SS "cpio Special Entries"
  2756. .P
  2757. FIFO special files, directories, and the trailer shall be recorded with
  2758. .IR c_filesize
  2759. equal to zero. Symbolic links shall be recorded with
  2760. .IR c_filesize
  2761. equal to the length of the contents of the symbolic link.
  2762. For other special files,
  2763. .IR c_filesize
  2764. is unspecified by this volume of POSIX.1\(hy2017. The header for the next file entry in the
  2765. archive shall be written directly after the last octet of the file
  2766. entry preceding it. A header denoting the filename
  2767. .BR TRAILER!!!
  2768. shall indicate the end of the archive; the contents of octets in the
  2769. last block of the archive following such a header are undefined.
  2770. .SH "EXIT STATUS"
  2771. The following exit values shall be returned:
  2772. .IP "\00" 6
  2773. All files were processed successfully.
  2774. .IP >0 6
  2775. An error occurred.
  2776. .SH "CONSEQUENCES OF ERRORS"
  2777. If
  2778. .IR pax
  2779. cannot create a file or a link when reading an archive or cannot find a
  2780. file when writing an archive, or cannot preserve the user ID, group ID,
  2781. or file mode when the
  2782. .BR \-p
  2783. option is specified, a diagnostic message shall be written to standard
  2784. error and a non-zero exit status shall be returned, but processing
  2785. shall continue. In the case where
  2786. .IR pax
  2787. cannot create a link to a file,
  2788. .IR pax
  2789. shall not, by default, create a second copy of the file.
  2790. .P
  2791. If the extraction of a file from an archive is prematurely terminated
  2792. by a signal or error,
  2793. .IR pax
  2794. may have only partially extracted the file or (if the
  2795. .BR \-n
  2796. option was not specified) may have extracted a file of the same name as
  2797. that specified by the user, but which is not the file the user wanted.
  2798. Additionally, the file modes of extracted directories may have
  2799. additional bits from the S_IRWXU mask set as well as incorrect
  2800. modification and access times.
  2801. .LP
  2802. .IR "The following sections are informative."
  2803. .SH "APPLICATION USAGE"
  2804. Caution is advised when using the
  2805. .BR \-a
  2806. option to append to a
  2807. .IR cpio
  2808. format archive. If any of the files being appended happen to be given
  2809. the same
  2810. .IR c_dev
  2811. and
  2812. .IR c_ino
  2813. values as a file in the existing part of the archive, then they may be
  2814. treated as links to that file on extraction. Thus, it is risky to use
  2815. .BR \-a
  2816. with
  2817. .IR cpio
  2818. format except when it is done on the same system that the original
  2819. archive was created on, and with the same
  2820. .IR pax
  2821. utility, and in the knowledge that there has been little or no file
  2822. system activity since the original archive was created that could lead
  2823. to any of the files appended being given the same
  2824. .IR c_dev
  2825. and
  2826. .IR c_ino
  2827. values as an unrelated file in the existing part of the archive. Also,
  2828. when (intentionally) appending additional links to a file in the
  2829. existing part of the archive, the
  2830. .IR c_nlink
  2831. values in the modified archive can be smaller than the number of links
  2832. to the file in the archive, which may mean that the links are not
  2833. preserved on extraction.
  2834. .P
  2835. The
  2836. .BR \-p
  2837. (privileges) option was invented to reconcile differences between
  2838. historical
  2839. .IR tar
  2840. and
  2841. .IR cpio
  2842. implementations. In particular, the two utilities use
  2843. .BR \-m
  2844. in diametrically opposed ways. The
  2845. .BR \-p
  2846. option also provides a consistent means of extending the ways in which
  2847. future file attributes can be addressed, such as for enhanced security
  2848. systems or high-performance files. Although it may seem complex, there
  2849. are really two modes that are most commonly used:
  2850. .IP "\fB\-p\ e\fR" 8
  2851. ``Preserve everything''. This would be used by the historical
  2852. superuser, someone with all appropriate privileges, to preserve all
  2853. aspects of the files as they are recorded in the archive. The
  2854. .BR e
  2855. flag is the sum of
  2856. .BR o
  2857. and
  2858. .BR p ,
  2859. and other implementation-defined attributes.
  2860. .IP "\fB\-p\ p\fR" 8
  2861. ``Preserve'' the file mode bits. This would be used by the user with
  2862. regular privileges who wished to preserve aspects of the file other
  2863. than the ownership. The file times are preserved by default, but two
  2864. other flags are offered to disable these and use the time of
  2865. extraction.
  2866. .P
  2867. The one pathname per line format of standard input precludes
  2868. pathnames containing
  2869. <newline>
  2870. characters. Although such pathnames violate the portable filename
  2871. guidelines, they may exist and their presence may inhibit usage of
  2872. .IR pax
  2873. within shell scripts. This problem is inherited from historical archive
  2874. programs. The problem can be avoided by listing filename arguments on
  2875. the command line instead of on standard input.
  2876. .P
  2877. It is almost certain that appropriate privileges are required for
  2878. .IR pax
  2879. to accomplish parts of this volume of POSIX.1\(hy2017. Specifically, creating files of type
  2880. block special or character special, restoring file access times unless
  2881. the files are owned by the user (the
  2882. .BR \-t
  2883. option), or preserving file owner, group, and mode (the
  2884. .BR \-p
  2885. option) all probably require appropriate privileges.
  2886. .P
  2887. In
  2888. .BR read
  2889. mode, implementations are permitted to overwrite files when the archive
  2890. has multiple members with the same name. This may fail if permissions
  2891. on the first version of the file do not permit it to be overwritten.
  2892. .P
  2893. The
  2894. .BR cpio
  2895. and
  2896. .BR ustar
  2897. formats can only support files up to 8\|589\|934\|592 bytes
  2898. (8 \(** 2^30) in size.
  2899. .P
  2900. When archives containing binary header information are listed , the
  2901. filenames printed may cause strange behavior on some terminals.
  2902. .P
  2903. When all of the following are true:
  2904. .IP " 1." 4
  2905. A file of type directory is being placed into an archive.
  2906. .IP " 2." 4
  2907. The
  2908. .BR ustar
  2909. archive format is being used.
  2910. .IP " 3." 4
  2911. The pathname of the directory is less than or equal to 155 bytes long
  2912. (it will fit in the
  2913. .IR prefix
  2914. field in the
  2915. .BR ustar
  2916. header block).
  2917. .IP " 4." 4
  2918. The last component of the pathname of the directory is longer than 100
  2919. bytes long (it will not fit in the
  2920. .IR name
  2921. field in the
  2922. .BR ustar
  2923. header block).
  2924. .P
  2925. some implementations of the
  2926. .IR pax
  2927. utility will place the entire directory pathname in the
  2928. .IR prefix
  2929. field, set the
  2930. .IR name
  2931. field to an empty string, and place the directory in the archive.
  2932. Other implementations of the
  2933. .IR pax
  2934. utility will give an error under these conditions because the
  2935. .IR name
  2936. field is not large enough to hold the last component of the directory name.
  2937. This standard allows either behavior. However, when extracting a directory
  2938. from a
  2939. .BR ustar
  2940. format archive, this standard requires that all implementations be able
  2941. to extract a directory even if the
  2942. .IR name
  2943. field contains an empty string as long as the
  2944. .IR prefix
  2945. field does not also contain an empty string.
  2946. .SH EXAMPLES
  2947. The following command:
  2948. .sp
  2949. .RS 4
  2950. .nf
  2951. pax -w -f /dev/rmt/1m .
  2952. .fi
  2953. .P
  2954. .RE
  2955. .P
  2956. copies the contents of the current directory to tape drive 1, medium
  2957. density (assuming historical System V device naming procedures\(emthe
  2958. historical BSD device name would be
  2959. .BR /dev/rmt9 ).
  2960. .P
  2961. The following commands:
  2962. .sp
  2963. .RS 4
  2964. .nf
  2965. mkdir \fInewdir\fR
  2966. pax -rw \fIolddir newdir\fR
  2967. .fi
  2968. .P
  2969. .RE
  2970. .P
  2971. copy the
  2972. .IR olddir
  2973. directory hierarchy to
  2974. .IR newdir .
  2975. .sp
  2976. .RS 4
  2977. .nf
  2978. pax -r -s \(aq,\(ha//*usr//*,,\(aq -f a.pax
  2979. .fi
  2980. .P
  2981. .RE
  2982. .P
  2983. reads the archive
  2984. .BR a.pax ,
  2985. with all files rooted in
  2986. .BR /usr
  2987. in the archive extracted relative to the current directory.
  2988. .P
  2989. Using the option:
  2990. .sp
  2991. .RS 4
  2992. .nf
  2993. -o listopt="%M %(atime)T %(size)D %(name)s"
  2994. .fi
  2995. .P
  2996. .RE
  2997. .P
  2998. overrides the default output description in Standard Output and instead
  2999. writes:
  3000. .sp
  3001. .RS 4
  3002. .nf
  3003. -rw-rw--- Jan 12 15:53 2003 1492 /usr/foo/bar
  3004. .fi
  3005. .P
  3006. .RE
  3007. .P
  3008. Using the options:
  3009. .sp
  3010. .RS 4
  3011. .nf
  3012. -o listopt=\(aq%L\et%(size)D\en%.7\(aq \e
  3013. -o listopt=\(aq(name)s\en%(atime)T\en%T\(aq
  3014. .fi
  3015. .P
  3016. .RE
  3017. .P
  3018. overrides the default output description in Standard Output and instead
  3019. writes:
  3020. .sp
  3021. .RS 4
  3022. .nf
  3023. /usr/foo/bar -> /tmp 1492
  3024. /usr/fo
  3025. Jan 12 15:53 1991
  3026. Jan 31 15:53 2003
  3027. .fi
  3028. .P
  3029. .RE
  3030. .SH RATIONALE
  3031. The
  3032. .IR pax
  3033. utility was new for the ISO\ POSIX\(hy2:\|1993 standard. It represents a peaceful
  3034. compromise between advocates of the historical
  3035. .IR tar
  3036. and
  3037. .IR cpio
  3038. utilities.
  3039. .P
  3040. A fundamental difference between
  3041. .IR cpio
  3042. and
  3043. .IR tar
  3044. was in the way directories were treated. The
  3045. .IR cpio
  3046. utility did not treat directories differently from other files, and to
  3047. select a directory and its contents required that each file in the
  3048. hierarchy be explicitly specified. For
  3049. .IR tar ,
  3050. a directory matched every file in the file hierarchy it rooted.
  3051. .P
  3052. The
  3053. .IR pax
  3054. utility offers both interfaces; by default, directories map into the
  3055. file hierarchy they root. The
  3056. .BR \-d
  3057. option causes
  3058. .IR pax
  3059. to skip any file not explicitly referenced, as
  3060. .IR cpio
  3061. historically did. The
  3062. .IR tar
  3063. .BR \- \c
  3064. .IR style
  3065. behavior was chosen as the default because it was believed that this
  3066. was the more common usage and because
  3067. .IR tar
  3068. is the more commonly available interface, as it was historically
  3069. provided on both System V and BSD implementations.
  3070. .P
  3071. The data interchange format specification in this volume of POSIX.1\(hy2017 requires that
  3072. processes with ``appropriate privileges'' shall always restore the
  3073. ownership and permissions of extracted files exactly as archived. If
  3074. viewed from the historic equivalence between superuser and
  3075. ``appropriate privileges'', there are two problems
  3076. with this requirement. First, users running as superusers may
  3077. unknowingly set dangerous permissions on extracted files. Second, it is
  3078. needlessly limiting, in that superusers cannot extract files and own
  3079. them as superuser unless the archive was created by the superuser. (It
  3080. should be noted that restoration of ownerships and permissions for the
  3081. superuser, by default, is historical practice in
  3082. .IR cpio ,
  3083. but not in
  3084. .IR tar .)
  3085. In order to avoid these two problems, the
  3086. .IR pax
  3087. specification has an additional ``privilege'' mechanism, the
  3088. .BR \-p
  3089. option. Only a
  3090. .IR pax
  3091. invocation with the privileges needed, and which has the
  3092. .BR \-p
  3093. option set using the
  3094. .BR e
  3095. specification character, has appropriate privileges to restore
  3096. full ownership and permission information.
  3097. .P
  3098. Note also that this volume of POSIX.1\(hy2017 requires that the file ownership and access
  3099. permissions shall be set, on extraction, in the same fashion as the
  3100. \fIcreat\fR()
  3101. function when provided with the mode stored in the archive. This means
  3102. that the file creation mask of the user is applied to the file
  3103. permissions.
  3104. .P
  3105. Users should note that directories may be created by
  3106. .IR pax
  3107. while extracting files with permissions that are different from those
  3108. that existed at the time the archive was created. When extracting
  3109. sensitive information into a directory hierarchy that no longer exists,
  3110. users are encouraged to set their file creation mask appropriately to
  3111. protect these files during extraction.
  3112. .P
  3113. The table of contents output is written to standard output to
  3114. facilitate pipeline processing.
  3115. .P
  3116. An early proposal had hard links displaying for all pathnames. This
  3117. was removed because it complicates the output of the case where
  3118. .BR \-v
  3119. is not specified and does not match historical
  3120. .IR cpio
  3121. usage. The hard-link information is available in the
  3122. .BR \-v
  3123. display.
  3124. .P
  3125. The description of the
  3126. .BR \-l
  3127. option allows implementations to make hard links to symbolic links.
  3128. Earlier versions of this standard did not specify any way to create a
  3129. hard link to a symbolic link, but many implementations provided this
  3130. capability as an extension. If there are hard links to symbolic links
  3131. when an archive is created, the implementation is required to archive
  3132. the hard link in the archive (unless
  3133. .BR \-H
  3134. or
  3135. .BR \-L
  3136. is specified). When in
  3137. .BR read
  3138. mode and in
  3139. .BR copy
  3140. mode, implementations supporting hard links to symbolic links should
  3141. use them when appropriate.
  3142. .P
  3143. The archive formats inherited from the POSIX.1\(hy1990 standard have certain restrictions
  3144. that have been brought along from historical usage. For example, there
  3145. are restrictions on the length of pathnames stored in the archive.
  3146. When
  3147. .IR pax
  3148. is used in
  3149. .BR copy (\c
  3150. .BR \-rw )
  3151. mode (copying directory hierarchies), the ability to use extensions
  3152. from the
  3153. .BR \-x \c
  3154. .BR pax
  3155. format overcomes these restrictions.
  3156. .P
  3157. The default
  3158. .IR blocksize
  3159. value of 5\|120 bytes for
  3160. .IR cpio
  3161. was selected because it is one of the standard block-size values for
  3162. .IR cpio ,
  3163. set when the
  3164. .BR \-B
  3165. option is specified. (The other default block-size value for
  3166. .IR cpio
  3167. is 512 bytes, and this was considered to be too small.) The default
  3168. block value of 10\|240 bytes for
  3169. .IR tar
  3170. was selected because that is the standard block-size value for BSD
  3171. .IR tar .
  3172. The maximum block size of 32\|256 bytes (2\s-3\u15\d\s+3\-512 bytes)
  3173. is the largest multiple of 512 bytes that fits into a signed 16-bit
  3174. tape controller transfer register. There are known limitations in some
  3175. historical systems that would prevent larger blocks from being
  3176. accepted. Historical values were chosen to improve compatibility with
  3177. historical scripts using
  3178. .IR dd
  3179. or similar utilities to manipulate archives. Also, default block sizes
  3180. for any file type other than character special file has been deleted
  3181. from this volume of POSIX.1\(hy2017 as unimportant and not likely to affect the structure of the
  3182. resulting archive.
  3183. .P
  3184. Implementations are permitted to modify the block-size value based on
  3185. the archive format or the device to which the archive is being
  3186. written. This is to provide implementations with the opportunity to
  3187. take advantage of special types of devices, and it should not be used
  3188. without a great deal of consideration as it almost certainly decreases
  3189. archive portability.
  3190. .P
  3191. The intended use of the
  3192. .BR \-n
  3193. option was to permit extraction of one or more files from the archive
  3194. without processing the entire archive. This was viewed by the standard
  3195. developers as offering significant performance advantages over
  3196. historical implementations. The
  3197. .BR \-n
  3198. option in early proposals had three effects; the first was to cause
  3199. special characters in patterns to not be treated specially. The second
  3200. was to cause only the first file that matched a pattern to be
  3201. extracted. The third was to cause
  3202. .IR pax
  3203. to write a diagnostic message to standard error when no file was found
  3204. matching a specified pattern. Only the second behavior is retained by
  3205. this volume of POSIX.1\(hy2017, for many reasons. First, it is in general not acceptable for a
  3206. single option to have multiple effects. Second, the ability to make
  3207. pattern matching characters act as normal characters
  3208. is useful for parts of
  3209. .IR pax
  3210. other than file extraction. Third, a finer degree of control over the
  3211. special characters is useful because users may wish to normalize only a
  3212. single special character in a single filename. Fourth, given a more
  3213. general escape mechanism, the previous behavior of the
  3214. .BR \-n
  3215. option can be easily obtained using the
  3216. .BR \-s
  3217. option or a
  3218. .IR sed
  3219. script. Finally, writing a diagnostic message when a pattern specified
  3220. by the user is unmatched by any file is useful behavior in all cases.
  3221. .P
  3222. In this version, the
  3223. .BR \-n
  3224. was removed from the
  3225. .BR copy
  3226. mode synopsis of
  3227. .IR pax ;
  3228. it is inapplicable because there are no pattern operands specified in
  3229. this mode.
  3230. .P
  3231. There is another method than
  3232. .IR pax
  3233. for copying subtrees in POSIX.1\(hy2008 described as part of the
  3234. .IR cp
  3235. utility. Both methods are historical practice:
  3236. .IR cp
  3237. provides a simpler, more intuitive interface, while
  3238. .IR pax
  3239. offers a finer granularity of control. Each provides additional
  3240. functionality to the other; in particular,
  3241. .IR pax
  3242. maintains the hard-link structure of the hierarchy while
  3243. .IR cp
  3244. does not. It is the intention of the standard developers that the
  3245. results be similar (using appropriate option combinations in both
  3246. utilities). The results are not required to be identical; there seemed
  3247. insufficient gain to applications to balance the difficulty of
  3248. implementations having to guarantee that the results would be exactly
  3249. identical.
  3250. .P
  3251. A single archive may span more than one file. It is suggested that
  3252. implementations provide informative messages to the user on standard
  3253. error whenever the archive file is changed.
  3254. .P
  3255. The
  3256. .BR \-d
  3257. option (do not create intermediate directories not listed in the
  3258. archive) found in early proposals was originally provided as a
  3259. complement to the historic
  3260. .BR \-d
  3261. option of
  3262. .IR cpio .
  3263. It has been deleted.
  3264. .P
  3265. The
  3266. .BR \-s
  3267. option in early proposals specified a subset of the substitution
  3268. command from the
  3269. .IR ed
  3270. utility. As there was no reason for only a subset to be supported, the
  3271. .BR \-s
  3272. option is now compatible with the current
  3273. .IR ed
  3274. specification. Since the delimiter can be any non-null character, the
  3275. following usage with single
  3276. <space>
  3277. characters is valid:
  3278. .sp
  3279. .RS 4
  3280. .nf
  3281. pax -s " foo bar " ...
  3282. .fi
  3283. .P
  3284. .RE
  3285. .P
  3286. The
  3287. .BR \-t
  3288. description is worded so as to note that this may cause the access time
  3289. update caused by some other activity (which occurs while the file is
  3290. being read) to be overwritten.
  3291. .P
  3292. The default behavior of
  3293. .IR pax
  3294. with regard to file modification times is the same as historical
  3295. implementations of
  3296. .IR tar .
  3297. It is not the historical behavior of
  3298. .IR cpio .
  3299. .P
  3300. Because the
  3301. .BR \-i
  3302. option uses
  3303. .BR /dev/tty ,
  3304. utilities without a controlling terminal are not able to use this
  3305. option.
  3306. .P
  3307. The
  3308. .BR \-y
  3309. option, found in early proposals, has been deleted because a line
  3310. containing a single
  3311. <period>
  3312. for the
  3313. .BR \-i
  3314. option has equivalent functionality. The special lines for the
  3315. .BR \-i
  3316. option (a single
  3317. <period>
  3318. and the empty line) are historical practice in
  3319. .IR cpio .
  3320. .P
  3321. In early drafts, a
  3322. .BR \-e \c
  3323. .IR charmap
  3324. option was included to increase portability of files between systems
  3325. using different coded character sets. This option was omitted because
  3326. it was apparent that consensus could not be formed for it. In this
  3327. version, the use of UTF\(hy8 should be an adequate substitute.
  3328. .P
  3329. The ISO\ POSIX\(hy2:\|1993 standard and ISO\ POSIX\(hy1 standard requirements for
  3330. .IR pax ,
  3331. however, made it very difficult to create a single archive containing
  3332. files created using extended characters provided by different locales.
  3333. This version adds the
  3334. .BR hdrcharset
  3335. keyword to make it possible to archive files in these cases without
  3336. dropping files due to translation errors.
  3337. .P
  3338. Translating filenames and other attributes from a locale's encoding to
  3339. UTF\(hy8 and then back again can lose information, as the resulting
  3340. filename might not be byte-for-byte equivalent to the original. To
  3341. avoid this problem, users can specify the
  3342. .BR \-o
  3343. .BR hdrcharset=binary
  3344. option, which will cause the resulting archive to use binary
  3345. format for all names and attributes. Such archives are not portable
  3346. among hosts that use different native encodings (e.g., EBCDIC
  3347. \fIversus\fR ASCII-based encodings), but they will allow interchange
  3348. among the vast majority of POSIX file systems in practical use. Also,
  3349. the
  3350. .BR \-o
  3351. .BR hdrcharset=binary
  3352. option will cause
  3353. .IR pax
  3354. in
  3355. .BR copy
  3356. mode to behave more like other standard utilities such as
  3357. .IR cp .
  3358. .P
  3359. If the values specified by the
  3360. .BR \-o
  3361. .BR exthdr.name=value ,
  3362. .BR \-o
  3363. .BR globexthdr.name=value ,
  3364. or by
  3365. .BR $TMPDIR
  3366. (if
  3367. .BR \-o
  3368. .BR globexthdr.name
  3369. is not specified) require a character encoding other than that
  3370. described in the ISO/IEC\ 646:\|1991 standard, a
  3371. .BR path
  3372. extended header record will have to be created for the file. If a
  3373. .BR hdrcharset
  3374. extended header record is active for such headers, it will determine
  3375. the codeset used for the value field in these extended
  3376. .BR path
  3377. header records. These
  3378. .BR path
  3379. extended header records always need to be created when writing an
  3380. archive even if
  3381. .BR hdrcharset=binary
  3382. has been specified and would contain the same (binary) data that
  3383. appears in the
  3384. .BR ustar
  3385. header record prefix and
  3386. .IR name
  3387. fields. (In other words, an extended header
  3388. .BR path
  3389. record is always required to be generated if the
  3390. .IR prefix
  3391. or
  3392. .IR name
  3393. fields contain non-ASCII characters even when
  3394. .BR hdrcharset=binary
  3395. is also in effect for that file.)
  3396. .P
  3397. The
  3398. .BR \-k
  3399. option was added to address international concerns about the dangers
  3400. involved in the character set transformations of
  3401. .BR \-e
  3402. (if the target character set were different from the source, the
  3403. filenames might be transformed into names matching existing files) and
  3404. also was made more general to protect files transferred between file
  3405. systems with different
  3406. {NAME_MAX}
  3407. values (truncating a filename on a smaller system might also
  3408. inadvertently overwrite existing files). As stated, it prevents any
  3409. overwriting, even if the target file is older than the source. This
  3410. version adds more granularity of options to solve this problem by
  3411. introducing the
  3412. .BR \-o \c
  3413. .BR invalid=option \c
  3414. \(emspecifically the
  3415. .BR UTF\(hy8
  3416. and
  3417. .BR binary
  3418. actions. (Note that an existing file is still subject to overwriting in
  3419. this case. The
  3420. .BR \-k
  3421. option closes that loophole.)
  3422. .P
  3423. Some of the file characteristics referenced in this volume of POSIX.1\(hy2017 might not be
  3424. supported by some archive formats. For example, neither the
  3425. .BR tar
  3426. nor
  3427. .BR cpio
  3428. formats contain the file access time. For this reason, the
  3429. .BR e
  3430. specification character has been provided, intended to cause all file
  3431. characteristics specified in the archive to be retained.
  3432. .P
  3433. It is required that extracted directories, by default, have their
  3434. access and modification times and permissions set to the values
  3435. specified in the archive. This has obvious problems in that the
  3436. directories are almost certainly modified after being extracted and
  3437. that directory permissions may not permit file creation. One possible
  3438. solution is to create directories with the mode specified in the
  3439. archive, as modified by the
  3440. .IR umask
  3441. of the user, with sufficient permissions to allow file creation. After
  3442. all files have been extracted,
  3443. .IR pax
  3444. would then reset the access and modification times and permissions as
  3445. necessary.
  3446. .P
  3447. The list-mode formatting description borrows heavily from the one
  3448. defined by the
  3449. .IR printf
  3450. utility. However, since there is no separate operand list to get
  3451. conversion arguments, the format was extended to allow specifying the
  3452. name of the conversion argument as part of the conversion
  3453. specification.
  3454. .P
  3455. The
  3456. .BR T
  3457. conversion specifier allows time fields to be displayed in any of
  3458. the date formats. Unlike the
  3459. .IR ls
  3460. utility,
  3461. .IR pax
  3462. does not adjust the format when the date is less than six months in the
  3463. past. This makes parsing the output more predictable.
  3464. .P
  3465. The
  3466. .BR D
  3467. conversion specifier handles the ability to display the major/minor
  3468. or file size, as with
  3469. .IR ls ,
  3470. by using \fR%\-8(\fIsize\fR)D\fR.
  3471. .P
  3472. The
  3473. .BR L
  3474. conversion specifier handles the
  3475. .IR ls
  3476. display for symbolic links.
  3477. .P
  3478. Conversion specifiers were added to generate existing known types used
  3479. for
  3480. .IR ls .
  3481. .SS "pax Interchange Format"
  3482. .P
  3483. The new POSIX data interchange format was developed primarily to
  3484. satisfy international concerns that the
  3485. .BR ustar
  3486. and
  3487. .BR cpio
  3488. formats did not provide for file, user, and group names encoded in
  3489. characters outside a subset of the ISO/IEC\ 646:\|1991 standard. The standard developers
  3490. realized that this new POSIX data interchange format should be very
  3491. extensible because there were other requirements they foresaw in the
  3492. near future:
  3493. .IP " *" 4
  3494. Support international character encodings and locale information
  3495. .IP " *" 4
  3496. Support security information (ACLs, and so on)
  3497. .IP " *" 4
  3498. Support future file types, such as realtime or contiguous files
  3499. .IP " *" 4
  3500. Include data areas for implementation use
  3501. .IP " *" 4
  3502. Support systems with words larger than 32 bits and timers with
  3503. subsecond granularity
  3504. .P
  3505. The following were not goals for this format because these are better
  3506. handled by separate utilities or are inappropriate for a portable
  3507. format:
  3508. .IP " *" 4
  3509. Encryption
  3510. .IP " *" 4
  3511. Compression
  3512. .IP " *" 4
  3513. Data translation between locales and codesets
  3514. .IP " *" 4
  3515. .IR inode
  3516. storage
  3517. .P
  3518. The format chosen to support the goals is an extension of the
  3519. .BR ustar
  3520. format. Of the two formats previously available, only the
  3521. .BR ustar
  3522. format was selected for extensions because:
  3523. .IP " *" 4
  3524. It was easier to extend in an upwards-compatible way. It offered version
  3525. flags and header block type fields with room for future
  3526. standardization. The
  3527. .BR cpio
  3528. format, while possessing a more flexible file naming methodology, could
  3529. not be extended without breaking some theoretical implementation
  3530. or using a dummy filename that could be a legitimate filename.
  3531. .IP " *" 4
  3532. Industry experience since the original ``\c
  3533. .IR tar
  3534. wars'' fought in developing the ISO\ POSIX\(hy1 standard has clearly been in favor of the
  3535. .BR ustar
  3536. format, which is generally the default output format selected for
  3537. .IR pax
  3538. implementations on new systems.
  3539. .P
  3540. The new format was designed with one additional goal in mind:
  3541. reasonable behavior when an older
  3542. .IR tar
  3543. or
  3544. .IR pax
  3545. utility happened to read an archive. Since the POSIX.1\(hy1990 standard mandated that a
  3546. ``format-reading utility'' had to treat unrecognized
  3547. .IR typeflag
  3548. values as regular files, this allowed the format to include all the
  3549. extended information in a pseudo-regular file that preceded each real
  3550. file. An option is given that allows the archive creator to set up
  3551. reasonable names for these files on the older systems. Also, the
  3552. normative text suggests that reasonable file access values be used for
  3553. this
  3554. .BR ustar
  3555. header block. Making these header files inaccessible for convenient
  3556. reading and deleting would not be reasonable. File permissions of 600
  3557. or 700 are suggested.
  3558. .P
  3559. The
  3560. .BR ustar
  3561. .IR typeflag
  3562. field was used to accommodate the additional functionality of the new
  3563. format rather than magic or version because the POSIX.1\(hy1990 standard (and, by
  3564. reference, the previous version of
  3565. .IR pax ),
  3566. mandated the behavior of the format-reading utility when it encountered
  3567. an unknown
  3568. .IR typeflag ,
  3569. but was silent about the other two fields.
  3570. .P
  3571. Early proposals for the first version of this standard contained a proposed
  3572. archive format that was based on compatibility with the standard for
  3573. tape files (ISO\ 1001, similar to the format used historically on many
  3574. mainframes and minicomputers). This format was overly complex and required
  3575. considerable overhead in volume and header records. Furthermore, the
  3576. standard developers felt that it would not be acceptable to the community
  3577. of POSIX developers, so it was later changed to be a format more closely
  3578. related to historical practice on POSIX systems.
  3579. .P
  3580. The prefix and name split of pathnames in
  3581. .BR ustar
  3582. was replaced by the single path extended header record for simplicity.
  3583. .P
  3584. The concept of a global extended header (\c
  3585. .IR typeflag \c
  3586. .BR g )
  3587. was controversial. If this were applied to an archive being recorded on
  3588. magnetic tape, a few unreadable blocks at the beginning of the tape
  3589. could be a serious problem; a utility attempting to extract as many
  3590. files as possible from a damaged archive could lose a large percentage
  3591. of file header information in this case. However, if the archive were
  3592. on a reliable medium, such as a CD\(hyROM, the global extended header
  3593. offers considerable potential size reductions by eliminating redundant
  3594. information. Thus, the text warns against using the global method for
  3595. unreliable media and provides a method for implanting global
  3596. information in the extended header for each file, rather than in the
  3597. .IR typeflag
  3598. .BR g
  3599. records.
  3600. .P
  3601. No facility for data translation or filtering on a per-file basis is
  3602. included because the standard developers could not invent an interface
  3603. that would allow this in an efficient manner. If a filter, such as
  3604. encryption or compression, is to be applied to all the files, it is
  3605. more efficient to apply the filter to the entire archive as a single
  3606. file. The standard developers considered interfaces that would invoke a
  3607. shell script for each file going into or out of the archive, but the
  3608. system overhead in this approach was considered to be too high.
  3609. .P
  3610. One such approach would be to have
  3611. .BR filter=
  3612. records that give a pathname for an executable. When the program is
  3613. invoked, the file and archive would be open for standard input/output
  3614. and all the header fields would be available as environment variables
  3615. or command-line arguments. The standard developers did discuss such
  3616. schemes, but they were omitted from POSIX.1\(hy2008 due to concerns about
  3617. excessive overhead. Also, the program itself would need to be in the
  3618. archive if it were to be used portably.
  3619. .P
  3620. There is currently no portable means of identifying the character
  3621. set(s) used for a file in the file system. Therefore,
  3622. .IR pax
  3623. has not been given a mechanism to generate charset records
  3624. automatically. The only portable means of doing this is for the user to
  3625. write the archive using the
  3626. .BR \-o \c
  3627. .BR charset=string
  3628. command line option. This assumes that all of the files in the archive
  3629. use the same encoding. The ``implementation-defined'' text is
  3630. included to allow for a system that can identify the encodings used for
  3631. each of its files.
  3632. .P
  3633. The table of standards that accompanies the charset record description
  3634. is acknowledged to be very limited. Only a limited number of character
  3635. set standards is reasonable for maximal interchange. Any character set
  3636. is, of course, possible by prior agreement. It was suggested that
  3637. EBCDIC be listed, but it was omitted because it is not defined by a
  3638. formal standard. Formal standards, and then only those with reasonably
  3639. large followings, can be included here, simply as a matter of
  3640. practicality. The <\fIvalue\fP>s represent names of officially
  3641. registered character sets in the format required by the ISO\ 2375:\|1985 standard.
  3642. .P
  3643. The normal
  3644. <comma>
  3645. or
  3646. <blank>-separated
  3647. list rules are not followed in the case of keyword options to allow
  3648. ease of argument parsing for
  3649. .IR getopts .
  3650. .P
  3651. Further information on character encodings is in
  3652. .IR "pax Archive Character Set Encoding/Decoding".
  3653. .P
  3654. The standard developers have reserved keyword name space for vendor
  3655. extensions. It is suggested that the format to be used is:
  3656. .sp
  3657. .RS 4
  3658. .nf
  3659. \fIVENDOR.keyword\fR
  3660. .fi
  3661. .P
  3662. .RE
  3663. .P
  3664. where
  3665. .IR VENDOR
  3666. is the name of the vendor or organization in all uppercase letters. It
  3667. is further suggested that the keyword following the
  3668. <period>
  3669. be named differently than any of the standard keywords so that it could
  3670. be used for future standardization, if appropriate, by omitting the
  3671. .IR VENDOR
  3672. prefix.
  3673. .P
  3674. The <\fIlength\fP> field in the extended header record was included to
  3675. make it simpler to step through the records, even if a record contains
  3676. an unknown format (to a particular
  3677. .IR pax )
  3678. with complex interactions of special characters. It also provides a
  3679. minor integrity checkpoint within the records to aid a program
  3680. attempting to recover files from a damaged archive.
  3681. .P
  3682. There are no extended header versions of the
  3683. .IR devmajor
  3684. and
  3685. .IR devminor
  3686. fields because the unspecified format
  3687. .BR ustar
  3688. header field should be sufficient. If they are not, vendor-specific
  3689. extended keywords (such as
  3690. .IR VENDOR.devmajor )
  3691. should be used.
  3692. .P
  3693. Device and
  3694. .IR i -number
  3695. labeling of files was not adopted from
  3696. .IR cpio ;
  3697. files are interchanged strictly on a symbolic name basis, as in
  3698. .BR ustar .
  3699. .P
  3700. Just as with the
  3701. .BR ustar
  3702. format descriptions, the new format makes no special arrangements for
  3703. multi-volume archives. Each of the
  3704. .IR pax
  3705. archive types is assumed to be inside a single POSIX file and splitting
  3706. that file over multiple volumes (diskettes, tape cartridges, and so
  3707. on), processing their labels, and mounting each in the proper sequence
  3708. are considered to be implementation details that cannot be described
  3709. portably.
  3710. .P
  3711. The
  3712. .BR pax
  3713. format is intended for interchange, not only for backup on a single
  3714. (family of) systems. It is not as densely packed as might be possible
  3715. for backup:
  3716. .IP " *" 4
  3717. It contains information as coded characters that could be coded in
  3718. binary.
  3719. .IP " *" 4
  3720. It identifies extended records with name fields that could be omitted
  3721. in favor of a fixed-field layout.
  3722. .IP " *" 4
  3723. It translates names into a portable character set and identifies
  3724. locale-related information, both of which are probably unnecessary for
  3725. backup.
  3726. .P
  3727. The requirements on restoring from an archive are slightly different
  3728. from the historical wording, allowing for non-monolithic privilege to
  3729. bring forward as much as possible. In particular, attributes such as
  3730. ``high performance file'' might be broadly but not universally granted
  3731. while set-user-ID or
  3732. \fIchown\fR()
  3733. might be much more restricted. There is no implication in POSIX.1\(hy2008 that
  3734. the security information be honored after it is restored to the file
  3735. hierarchy, in spite of what might be improperly inferred by the silence
  3736. on that topic. That is a topic for another standard.
  3737. .P
  3738. Links are recorded in the fashion described here because a link can be
  3739. to any file type. It is desirable in general to be able to restore part
  3740. of an archive selectively and restore all of those files completely. If
  3741. the data is not associated with each link, it is not possible to do
  3742. this. However, the data associated with a file can be large, and when
  3743. selective restoration is not needed, this can be a significant burden.
  3744. The archive is structured so that files that have no associated data
  3745. can always be restored by the name of any link name of any link, and
  3746. the user may choose whether data is recorded with each instance of a
  3747. file that contains data. The format permits mixing of both types of
  3748. links in a single archive; this can be done for special needs, and
  3749. .IR pax
  3750. is expected to interpret such archives on input properly, despite the
  3751. fact that there is no
  3752. .IR pax
  3753. option that would force this mixed case on output. (When
  3754. .BR \-o
  3755. .BR linkdata
  3756. is used, the output must contain the duplicate data, but the
  3757. implementation is free to include it or omit it when
  3758. .BR \-o
  3759. .BR linkdata
  3760. is not used.)
  3761. .P
  3762. The time values are included as extended header records for those
  3763. implementations needing more than the eleven octal digits allowed by
  3764. the
  3765. .BR ustar
  3766. format. Portable file timestamps cannot be negative. If
  3767. .IR pax
  3768. encounters a file with a negative timestamp in
  3769. .BR copy
  3770. or
  3771. .BR write
  3772. mode, it can reject the file, substitute a non-negative timestamp, or
  3773. generate a non-portable timestamp with a leading
  3774. .BR '\-' .
  3775. Even though some implementations can support finer file-time
  3776. granularities than seconds, the normative text requires support only
  3777. for seconds since the Epoch because the ISO\ POSIX\(hy1 standard states them that way. The
  3778. .BR ustar
  3779. format includes only
  3780. .IR mtime ;
  3781. the new format adds
  3782. .IR atime
  3783. and
  3784. .IR ctime
  3785. for symmetry. The
  3786. .IR atime
  3787. access time restored to the file system will be affected by the
  3788. .BR \-p
  3789. .BR a
  3790. and
  3791. .BR \-p
  3792. .BR e
  3793. options. The
  3794. .IR ctime
  3795. creation time (actually
  3796. .IR inode
  3797. modification time) is described with appropriate privileges so that
  3798. it can be ignored when writing to the file system. POSIX does not
  3799. provide a portable means to change file creation time. Nothing is
  3800. intended to prevent a non-portable implementation of
  3801. .IR pax
  3802. from restoring the value.
  3803. .P
  3804. The
  3805. .IR gid ,
  3806. .IR size ,
  3807. and
  3808. .IR uid
  3809. extended header records were included to allow expansion beyond the
  3810. sizes specified in the regular
  3811. .IR tar
  3812. header. New file system architectures are emerging that will exhaust
  3813. the 12-digit size field. There are probably not many systems requiring
  3814. more than 8 digits for user and group IDs, but the extended header
  3815. values were included for completeness, allowing overrides for all of
  3816. the decimal values in the
  3817. .IR tar
  3818. header.
  3819. .P
  3820. The standard developers intended to describe the effective results of
  3821. .IR pax
  3822. with regard to file ownerships and permissions; implementations are not
  3823. restricted in timing or sequencing the restoration of such, provided
  3824. the results are as specified.
  3825. .P
  3826. Much of the text describing the extended headers refers to use in ``\c
  3827. .BR write
  3828. or
  3829. .BR copy
  3830. modes''. The
  3831. .BR copy
  3832. mode references are due to the normative text: ``The effect of the
  3833. copy shall be as if the copied files were written to an archive file
  3834. and then subsequently extracted .\|.\|.''. There is certainly no way to
  3835. test whether
  3836. .IR pax
  3837. is actually generating the extended headers in
  3838. .BR copy
  3839. mode, but the effects must be as if it had.
  3840. .SS "pax Archive Character Set Encoding/Decoding"
  3841. .P
  3842. There is a need to exchange archives of files between systems of
  3843. different native codesets. Filenames, group names, and user names must
  3844. be preserved to the fullest extent possible when an archive is read on
  3845. the receiving platform. Translation of the contents of files is not
  3846. within the scope of the
  3847. .IR pax
  3848. utility.
  3849. .P
  3850. There will also be the need to represent characters that are not
  3851. available on the receiving platform. These unsupported characters
  3852. cannot be automatically folded to the local set of characters due to
  3853. the chance of collisions. This could result in overwriting previous
  3854. extracted files from the archive or pre-existing files on the system.
  3855. .P
  3856. For these reasons, the codeset used to represent characters within the
  3857. extended header records of the
  3858. .IR pax
  3859. archive must be sufficiently rich to handle all commonly used character
  3860. sets. The fields requiring translation include, at a minimum,
  3861. filenames, user names, group names, and link pathnames. Implementations
  3862. may wish to have localized extended keywords that use non-portable
  3863. characters.
  3864. .P
  3865. The standard developers considered the following options:
  3866. .IP " *" 4
  3867. The archive creator specifies the well-defined name of the source
  3868. codeset. The receiver must then recognize the codeset name and perform
  3869. the appropriate translations to the destination codeset.
  3870. .IP " *" 4
  3871. The archive creator includes within the archive the character mapping
  3872. table for the source codeset used to encode extended header records.
  3873. The receiver must then read the character mapping table and perform the
  3874. appropriate translations to the destination codeset.
  3875. .IP " *" 4
  3876. The archive creator translates the extended header records in the
  3877. source codeset into a canonical form. The receiver must then perform
  3878. the appropriate translations to the destination codeset.
  3879. .P
  3880. The approach that incorporates the name of the source codeset poses the
  3881. problem of codeset name registration, and makes the archive useless to
  3882. .IR pax
  3883. archive decoders that do not recognize that codeset.
  3884. .P
  3885. Because parts of an archive may be corrupted, the standard developers
  3886. felt that including the character map of the source codeset was too
  3887. fragile. The loss of this one key component could result in making the
  3888. entire archive useless. (The difference between this and the global
  3889. extended header decision was that the latter has a
  3890. workaround\(emduplicating extended header records on unreliable
  3891. media\(embut this would be too burdensome for large character set
  3892. maps.)
  3893. .P
  3894. Both of the above approaches also put an undue burden on the
  3895. .IR pax
  3896. archive receiver to handle the cross-product of all source and
  3897. destination codesets.
  3898. .P
  3899. To simplify the translation from the source codeset to the canonical
  3900. form and from the canonical form to the destination codeset, the
  3901. standard developers decided that the internal representation should be
  3902. a stateless encoding. A stateless encoding is one where each codepoint
  3903. has the same meaning, without regard to the decoder being in a specific
  3904. state. An example of a stateful encoding would be the Japanese
  3905. Shift-JIS; an example of a stateless encoding would be the ISO/IEC\ 646:\|1991 standard
  3906. (equivalent to 7-bit ASCII).
  3907. .P
  3908. For these reasons, the standard developers decided to adopt a canonical
  3909. format for the representation of file information strings. The obvious,
  3910. well-endorsed candidate is the ISO/IEC\ 10646\(hy1:\|2000 standard (based in part on Unicode), which
  3911. can be used to represent the characters of virtually all standardized
  3912. character sets. The standard developers initially agreed upon using
  3913. UCS2 (16-bit Unicode) as the internal representation. This repertoire
  3914. of characters provides a sufficiently rich set to represent all
  3915. commonly-used codesets.
  3916. .P
  3917. However, the standard developers found that the 16-bit Unicode
  3918. representation had some problems. It forced the issue of standardizing
  3919. byte ordering. The 2-byte length of each character made the extended
  3920. header records twice as long for the case of strings coded entirely
  3921. from historical 7-bit ASCII. For these reasons, the standard developers
  3922. chose the UTF\(hy8 defined in the ISO/IEC\ 10646\(hy1:\|2000 standard. This multi-byte representation
  3923. encodes UCS2 or UCS4 characters reliably and deterministically,
  3924. eliminating the need for a canonical byte ordering. In addition, NUL
  3925. octets and other characters possibly confusing to POSIX file systems do
  3926. not appear, except to represent themselves. It was realized that
  3927. certain national codesets take up more space after the encoding, due to
  3928. their placement within the UCS range; it was felt that the usefulness
  3929. of the encoding of the names outweighs the disadvantage of size
  3930. increase for file, user, and group names.
  3931. .P
  3932. The encoding of UTF\(hy8 is as follows:
  3933. .sp
  3934. .RS 4
  3935. .nf
  3936. UCS4 Hex Encoding UTF-8 Binary Encoding
  3937. .P
  3938. 00000000-0000007F 0xxxxxxx
  3939. 00000080-000007FF 110xxxxx 10xxxxxx
  3940. 00000800-0000FFFF 1110xxxx 10xxxxxx 10xxxxxx
  3941. 00010000-001FFFFF 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
  3942. 00200000-03FFFFFF 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
  3943. 04000000-7FFFFFFF 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
  3944. .fi
  3945. .P
  3946. .RE
  3947. .P
  3948. where each
  3949. .BR 'x'
  3950. represents a bit value from the character being translated.
  3951. .SS "ustar Interchange Format"
  3952. .P
  3953. The description of the
  3954. .BR ustar
  3955. format reflects numerous enhancements over pre-1988 versions of the
  3956. historical
  3957. .IR tar
  3958. utility. The goal of these changes was not only to provide the
  3959. functional enhancements desired, but also to retain compatibility
  3960. between new and old versions. This compatibility has been retained.
  3961. Archives written using the old archive format are compatible with the
  3962. new format.
  3963. .P
  3964. Implementors should be aware that the previous file format did not
  3965. include a mechanism to archive directory type files. For this reason,
  3966. the convention of using a filename ending with
  3967. <slash>
  3968. was adopted to specify a directory on the archive.
  3969. .P
  3970. The total size of the
  3971. .IR name
  3972. and
  3973. .IR prefix
  3974. fields have been set to meet the minimum requirements for
  3975. {PATH_MAX}.
  3976. If a pathname will fit within the
  3977. .IR name
  3978. field, it is recommended that the pathname be stored there without the
  3979. use of the
  3980. .IR prefix
  3981. field. Although the name field is known to be too small to contain
  3982. {PATH_MAX}
  3983. characters, the value was not changed in this version of the archive
  3984. file format to retain backwards-compatibility, and instead the prefix
  3985. was introduced. Also, because of the earlier version of the format,
  3986. there is no way to remove the restriction on the
  3987. .IR linkname
  3988. field being limited in size to just that of the
  3989. .IR name
  3990. field.
  3991. .P
  3992. The
  3993. .IR size
  3994. field is required to be meaningful in all implementation extensions,
  3995. although it could be zero. This is required so that the data blocks can
  3996. always be properly counted.
  3997. .P
  3998. It is suggested that if device special files need to be represented
  3999. that cannot be represented in the standard format, that one of the
  4000. extension types (\c
  4001. .BR A \(hy\c
  4002. .BR Z )
  4003. be used, and that the additional information for the special file be
  4004. represented as data and be reflected in the
  4005. .IR size
  4006. field.
  4007. .P
  4008. Attempting to restore a special file type, where it is converted to
  4009. ordinary data and conflicts with an existing filename, need not be
  4010. specially detected by the utility. If run as an ordinary user,
  4011. .IR pax
  4012. should not be able to overwrite the entries in, for example,
  4013. .BR /dev
  4014. in any case (whether the file is converted to another type or not). If
  4015. run as a privileged user, it should be able to do so, and it would be
  4016. considered a bug if it did not. The same is true of ordinary data files
  4017. and similarly named special files; it is impossible to anticipate the
  4018. needs of the user (who could really intend to overwrite the file), so
  4019. the behavior should be predictable (and thus regular) and rely on the
  4020. protection system as required.
  4021. .P
  4022. The value 7 in the
  4023. .IR typeflag
  4024. field is intended to define how contiguous files can be stored in a
  4025. .BR ustar
  4026. archive. POSIX.1\(hy2008 does not require the contiguous file extension, but does
  4027. define a standard way of archiving such files so that all conforming
  4028. systems can interpret these file types in a meaningful and consistent
  4029. manner. On a system that does not support extended file types, the
  4030. .IR pax
  4031. utility should do the best it can with the file and go on to the next.
  4032. .P
  4033. The file protection modes are those conventionally used by the
  4034. .IR ls
  4035. utility. This is extended beyond the usage in the ISO\ POSIX\(hy2 standard to support the
  4036. ``shared text'' or ``sticky'' bit. It is intended that the conformance
  4037. document should not document anything beyond the existence of and
  4038. support of such a mode. Further extensions are expected to these bits,
  4039. particularly with overloading the set-user-ID and set-group-ID flags.
  4040. .SS "cpio Interchange Format"
  4041. .P
  4042. The reference to appropriate privileges in the
  4043. .BR cpio
  4044. format refers to an error on standard output; the
  4045. .BR ustar
  4046. format does not make comparable statements.
  4047. .P
  4048. The model for this format was the historical System V
  4049. .IR cpio \c
  4050. .BR \-c
  4051. data interchange format. This model documents the portable version of
  4052. the
  4053. .BR cpio
  4054. format and not the binary version. It has the flexibility to transfer
  4055. data of any type described within POSIX.1\(hy2008, yet is extensible to transfer
  4056. data types specific to extensions beyond POSIX.1\(hy2008 (for example, contiguous
  4057. files). Because it describes existing practice, there is no question of
  4058. maintaining upwards-compatibility.
  4059. .SS "cpio Header"
  4060. .P
  4061. There has been some concern that the size of the
  4062. .IR c_ino
  4063. field of the header is too small to handle those systems that have very
  4064. large
  4065. .IR inode
  4066. numbers. However, the
  4067. .IR c_ino
  4068. field in the header is used strictly as a hard-link resolution
  4069. mechanism for archives. It is not necessarily the same value as the
  4070. .IR inode
  4071. number of the file in the location from which that file is extracted.
  4072. .P
  4073. The name
  4074. .IR c_magic
  4075. is based on historical usage.
  4076. .SS "cpio Filename"
  4077. .P
  4078. For most historical implementations of the
  4079. .IR cpio
  4080. utility,
  4081. {PATH_MAX}
  4082. octets can be used to describe the pathname without the addition of
  4083. any other header fields (the NUL character would be included in this
  4084. count).
  4085. {PATH_MAX}
  4086. is the minimum value for pathname size, documented as 256 bytes.
  4087. However, an implementation may use
  4088. .IR c_namesize
  4089. to determine the exact length of the pathname. With the current
  4090. description of the
  4091. .IR <cpio.h>
  4092. header, this pathname size can be as large as a number that is
  4093. described in six octal digits.
  4094. .P
  4095. Two values are documented under the
  4096. .IR c_mode
  4097. field values to provide for extensibility for known file types:
  4098. .IP "\fB0110\ 000\fP" 10
  4099. Reserved for contiguous files. The implementation may treat the rest of
  4100. the information for this archive like a regular file. If this file type
  4101. is undefined, the implementation may create the file as a regular
  4102. file.
  4103. .P
  4104. This provides for extensibility of the
  4105. .BR cpio
  4106. format while allowing for the ability to read old archives. Files of an
  4107. unknown type may be read as ``regular files'' on some implementations.
  4108. On a system that does not support extended file types, the
  4109. .IR pax
  4110. utility should do the best it can with the file and go on to the next.
  4111. .SH "FUTURE DIRECTIONS"
  4112. None.
  4113. .SH "SEE ALSO"
  4114. .IR "Chapter 2" ", " "Shell Command Language",
  4115. .IR "\fIcp\fR\^",
  4116. .IR "\fIed\fR\^",
  4117. .IR "\fIgetopts\fR\^",
  4118. .IR "\fIls\fR\^",
  4119. .IR "\fIprintf\fR\^"
  4120. .P
  4121. The Base Definitions volume of POSIX.1\(hy2017,
  4122. .IR "Section 3.169" ", " "File Mode Bits",
  4123. .IR "Chapter 5" ", " "File Format Notation",
  4124. .IR "Chapter 8" ", " "Environment Variables",
  4125. .IR "Section 12.2" ", " "Utility Syntax Guidelines",
  4126. .IR "\fB<cpio.h>\fP",
  4127. .IR "\fB<tar.h>\fP"
  4128. .P
  4129. The System Interfaces volume of POSIX.1\(hy2017,
  4130. .IR "\fIchown\fR\^(\|)",
  4131. .IR "\fIcreat\fR\^(\|)",
  4132. .IR "\fIfstatat\fR\^(\|)",
  4133. .IR "\fImkdir\fR\^(\|)",
  4134. .IR "\fImkfifo\fR\^(\|)",
  4135. .IR "\fIutime\fR\^(\|)",
  4136. .IR "\fIwrite\fR\^(\|)"
  4137. .\"
  4138. .SH COPYRIGHT
  4139. Portions of this text are reprinted and reproduced in electronic form
  4140. from IEEE Std 1003.1-2017, Standard for Information Technology
  4141. -- Portable Operating System Interface (POSIX), The Open Group Base
  4142. Specifications Issue 7, 2018 Edition,
  4143. Copyright (C) 2018 by the Institute of
  4144. Electrical and Electronics Engineers, Inc and The Open Group.
  4145. In the event of any discrepancy between this version and the original IEEE and
  4146. The Open Group Standard, the original IEEE and The Open Group Standard
  4147. is the referee document. The original Standard can be obtained online at
  4148. http://www.opengroup.org/unix/online.html .
  4149. .PP
  4150. Any typographical or formatting errors that appear
  4151. in this page are most likely
  4152. to have been introduced during the conversion of the source files to
  4153. man page format. To report such errors, see
  4154. https://www.kernel.org/doc/man-pages/reporting_bugs.html .