tar_pax.txt 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. 'pax headers' is POSIX 2003 (iirc) addition designed to fix
  2. tar format limitations - older tar format has fixed fields
  3. for everything (filename, uid, filesize etc) which can overflow.
  4. pax Header Block
  5. The pax header block shall be identical to the ustar header block
  6. described in ustar Interchange Format, except that two additional
  7. typeflag values are defined:
  8. x
  9. Represents extended header records for the following file in
  10. the archive (which shall have its own ustar header block).
  11. g
  12. Represents global extended header records for the following
  13. files in the archive. Each value shall affect all subsequent files
  14. that do not override that value in their own extended header
  15. record and until another global extended header record is reached
  16. that provides another value for the same field. The typeflag g
  17. global headers should not be used with interchange media that
  18. could suffer partial data loss in transporting the archive.
  19. For both of these types, the size field shall be the size of the
  20. extended header records in octets. The other fields in the header
  21. block are not meaningful to this version of the pax utility.
  22. However, if this archive is read by a pax utility conforming to
  23. the ISO POSIX-2:1993 standard, the header block fields are used to
  24. create a regular file that contains the extended header records as
  25. data. Therefore, header block field values should be selected to
  26. provide reasonable file access to this regular file.
  27. A further difference from the ustar header block is that data
  28. blocks for files of typeflag 1 (the digit one) (hard link) may be
  29. included, which means that the size field may be greater than
  30. zero.
  31. pax Extended Header
  32. An extended header shall consist of one or more records, each
  33. constructed as follows:
  34. "%d %s=%s\n", <length>, <keyword>, <value>
  35. The <length> field shall be the decimal length of the extended
  36. header record in octets, including length string itself and the
  37. trailing <newline>.
  38. [skip]
  39. atime
  40. The file access time for the following file(s), equivalent to
  41. the value of the st_atime member of the stat structure for a file,
  42. as described by the stat() function. The access time shall be
  43. restored if the process has the appropriate privilege required to
  44. do so. The format of the <value> shall be as described in pax
  45. Extended Header File Times.
  46. charset
  47. The name of the character set used to encode the data in the
  48. following file(s).
  49. The encoding is included in an extended header for information
  50. only; when pax is used as described in IEEE Std 1003.1-2001, it
  51. shall not translate the file data into any other encoding. The
  52. BINARY entry indicates unencoded binary data.
  53. When used in write or copy mode, it is implementation-defined
  54. whether pax includes a charset extended header record for a file.
  55. comment
  56. A series of characters used as a comment. All characters in
  57. the <value> field shall be ignored by pax.
  58. gid
  59. The group ID of the group that owns the file, expressed as a
  60. decimal number using digits from the ISO/IEC 646:1991 standard.
  61. This record shall override the gid field in the following header
  62. block(s). When used in write or copy mode, pax shall include a gid
  63. extended header record for each file whose group ID is greater
  64. than 2097151 (octal 7777777).
  65. gname
  66. The group of the file(s), formatted as a group name in the
  67. group database. This record shall override the gid and gname
  68. fields in the following header block(s), and any gid extended
  69. header record. When used in read, copy, or list mode, pax shall
  70. translate the name from the UTF-8 encoding in the header record to
  71. the character set appropriate for the group database on the
  72. receiving system. If any of the UTF-8 characters cannot be
  73. translated, and if the -o invalid= UTF-8 option is not specified,
  74. the results are implementation-defined. When used in write or copy
  75. mode, pax shall include a gname extended header record for each
  76. file whose group name cannot be represented entirely with the
  77. letters and digits of the portable character set.
  78. linkpath
  79. The pathname of a link being created to another file, of any
  80. type, previously archived. This record shall override the linkname
  81. field in the following ustar header block(s). The following ustar
  82. header block shall determine the type of link created. If typeflag
  83. of the following header block is 1, it shall be a hard link. If
  84. typeflag is 2, it shall be a symbolic link and the linkpath value
  85. shall be the contents of the symbolic link. The pax utility shall
  86. translate the name of the link (contents of the symbolic link)
  87. from the UTF-8 encoding to the character set appropriate for the
  88. local file system. When used in write or copy mode, pax shall
  89. include a linkpath extended header record for each link whose
  90. pathname cannot be represented entirely with the members of the
  91. portable character set other than NUL.
  92. mtime
  93. The file modification time of the following file(s),
  94. equivalent to the value of the st_mtime member of the stat
  95. structure for a file, as described in the stat() function. This
  96. record shall override the mtime field in the following header
  97. block(s). The modification time shall be restored if the process
  98. has the appropriate privilege required to do so. The format of the
  99. <value> shall be as described in pax Extended Header File Times.
  100. path
  101. The pathname of the following file(s). This record shall
  102. override the name and prefix fields in the following header
  103. block(s). The pax utility shall translate the pathname of the file
  104. from the UTF-8 encoding to the character set appropriate for the
  105. local file system.
  106. When used in write or copy mode, pax shall include a path
  107. extended header record for each file whose pathname cannot be
  108. represented entirely with the members of the portable character
  109. set other than NUL.
  110. realtime.any
  111. The keywords prefixed by "realtime." are reserved for future
  112. standardization.
  113. security.any
  114. The keywords prefixed by "security." are reserved for future
  115. standardization.
  116. size
  117. The size of the file in octets, expressed as a decimal number
  118. using digits from the ISO/IEC 646:1991 standard. This record shall
  119. override the size field in the following header block(s). When
  120. used in write or copy mode, pax shall include a size extended
  121. header record for each file with a size value greater than
  122. 8589934591 (octal 77777777777).
  123. uid
  124. The user ID of the file owner, expressed as a decimal number
  125. using digits from the ISO/IEC 646:1991 standard. This record shall
  126. override the uid field in the following header block(s). When used
  127. in write or copy mode, pax shall include a uid extended header
  128. record for each file whose owner ID is greater than 2097151 (octal
  129. 7777777).
  130. uname
  131. The owner of the following file(s), formatted as a user name
  132. in the user database. This record shall override the uid and uname
  133. fields in the following header block(s), and any uid extended
  134. header record. When used in read, copy, or list mode, pax shall
  135. translate the name from the UTF-8 encoding in the header record to
  136. the character set appropriate for the user database on the
  137. receiving system. If any of the UTF-8 characters cannot be
  138. translated, and if the -o invalid= UTF-8 option is not specified,
  139. the results are implementation-defined. When used in write or copy
  140. mode, pax shall include a uname extended header record for each
  141. file whose user name cannot be represented entirely with the
  142. letters and digits of the portable character set.
  143. If the <value> field is zero length, it shall delete any header
  144. block field, previously entered extended header value, or global
  145. extended header value of the same name.
  146. If a keyword in an extended header record (or in a -o
  147. option-argument) overrides or deletes a corresponding field in the
  148. ustar header block, pax shall ignore the contents of that header
  149. block field.
  150. Unlike the ustar header block fields, NULs shall not delimit
  151. <value>s; all characters within the <value> field shall be
  152. considered data for the field. None of the length limitations of
  153. the ustar header block fields in ustar Header Block shall apply to
  154. the extended header records.
  155. pax Extended Header File Times
  156. Time records shall be formatted as a decimal representation of the
  157. time in seconds since the Epoch. If a period ( '.' ) decimal point
  158. character is present, the digits to the right of the point shall
  159. represent the units of a subsecond timing granularity. In read or
  160. copy mode, the pax utility shall truncate the time of a file to
  161. the greatest value that is not greater than the input header
  162. file time. In write or copy mode, the pax utility shall output a
  163. time exactly if it can be represented exactly as a decimal number,
  164. and otherwise shall generate only enough digits so that the same
  165. time shall be recovered if the file is extracted on a system whose
  166. underlying implementation supports the same time granularity.
  167. Example from Linux kernel archive tarball:
  168. 00000000 70 61 78 5f 67 6c 6f 62 61 6c 5f 68 65 61 64 65 |pax_global_heade|
  169. 00000010 72 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |r...............|
  170. 00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  171. 00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  172. 00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  173. 00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  174. 00000060 00 00 00 00 30 30 30 30 36 36 36 00 30 30 30 30 |....0000666.0000|
  175. 00000070 30 30 30 00 30 30 30 30 30 30 30 00 30 30 30 30 |000.0000000.0000|
  176. 00000080 30 30 30 30 30 36 34 00 30 30 30 30 30 30 30 30 |0000064.00000000|
  177. 00000090 30 30 30 00 30 30 31 34 30 35 33 00 67 00 00 00 |000.0014053.g...|
  178. 000000a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  179. 000000b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  180. 000000c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  181. 000000d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  182. 000000e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  183. 000000f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  184. 00000100 00 75 73 74 61 72 00 30 30 67 69 74 00 00 00 00 |.ustar.00git....|
  185. 00000110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  186. 00000120 00 00 00 00 00 00 00 00 00 67 69 74 00 00 00 00 |.........git....|
  187. 00000130 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  188. 00000140 00 00 00 00 00 00 00 00 00 30 30 30 30 30 30 30 |.........0000000|
  189. 00000150 00 30 30 30 30 30 30 30 00 00 00 00 00 00 00 00 |.0000000........|
  190. 00000160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  191. 00000170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  192. 00000180 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  193. 00000190 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  194. 000001a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  195. 000001b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  196. 000001c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  197. 000001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  198. 000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  199. 000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  200. 00000200 35 32 20 63 6f 6d 6d 65 6e 74 3d 62 31 30 35 30 |52 comment=b1050|
  201. 00000210 32 62 32 32 61 31 32 30 39 64 36 62 34 37 36 33 |2b22a1209d6b4763|
  202. 00000220 39 64 38 38 62 38 31 32 62 32 31 66 62 35 39 34 |9d88b812b21fb594|
  203. 00000230 39 65 34 0a 00 00 00 00 00 00 00 00 00 00 00 00 |9e4.............|
  204. 00000240 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  205. ...