summaryrefslogtreecommitdiff
path: root/archivers/libarchive/files/doc/html/tar.5.html
blob: a718b1d2f7e440a42ebf0a2247d38f46ecb8943d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
<!-- Creator     : groff version 1.22.4 -->
<!-- CreationDate: Wed Jun 12 21:10:19 2019 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="Content-Style" content="text/css">
<style type="text/css">
       p       { margin-top: 0; margin-bottom: 0; vertical-align: top }
       pre     { margin-top: 0; margin-bottom: 0; vertical-align: top }
       table   { margin-top: 0; margin-bottom: 0; vertical-align: top }
       h1      { text-align: center }
</style>
<title></title>
</head>
<body>

<hr>


<p>TAR(5) BSD File Formats Manual TAR(5)</p>

<p style="margin-top: 1em"><b>NAME</b></p>

<p style="margin-left:6%;"><b>tar</b> &mdash; format of
tape archive files</p>

<p style="margin-top: 1em"><b>DESCRIPTION</b></p>

<p style="margin-left:6%;">The <b>tar</b> archive format
collects any number of files, directories, and other file
system objects (symbolic links, device nodes, etc.) into a
single stream of bytes. The format was originally designed
to be used with tape drives that operate with fixed-size
blocks, but is widely used as a general packaging
mechanism.</p>

<p style="margin-left:6%; margin-top: 1em"><b>General
Format</b> <br>
A <b>tar</b> archive consists of a series of 512-byte
records. Each file system object requires a header record
which stores basic metadata (pathname, owner, permissions,
etc.) and zero or more records containing any file data. The
end of the archive is indicated by two records consisting
entirely of zero bytes.</p>

<p style="margin-left:6%; margin-top: 1em">For
compatibility with tape drives that use fixed block sizes,
programs that read or write tar files always read or write a
fixed number of records with each I/O operation. These
&ldquo;blocks&rdquo; are always a multiple of the record
size. The maximum block size supported by early
implementations was 10240 bytes or 20 records. This is still
the default for most implementations although block sizes of
1MiB (2048 records) or larger are commonly used with modern
high-speed tape drives. (Note: the terms &ldquo;block&rdquo;
and &ldquo;record&rdquo; here are not entirely standard;
this document follows the convention established by John
Gilmore in documenting <b>pdtar</b>.)</p>

<p style="margin-left:6%; margin-top: 1em"><b>Old-Style
Archive Format</b> <br>
The original tar archive format has been extended many times
to include additional information that various implementors
found necessary. This section describes the variant
implemented by the tar command included in Version&nbsp;7
AT&amp;T UNIX, which seems to be the earliest widely-used
version of the tar program.</p>

<p style="margin-left:6%; margin-top: 1em">The header
record for an old-style <b>tar</b> archive consists of the
following:</p>

<p style="margin-left:14%; margin-top: 1em">struct
header_old_tar {</p>

<table width="100%" border="0" rules="none" frame="void"
       cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char name[100];</p></td>
<td width="65%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char mode[8];</p></td>
<td width="65%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char uid[8];</p></td>
<td width="65%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char gid[8];</p></td>
<td width="65%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char size[12];</p></td>
<td width="65%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char mtime[12];</p></td>
<td width="65%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char checksum[8];</p></td>
<td width="65%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char linkflag[1];</p></td>
<td width="65%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char linkname[100];</p></td>
<td width="65%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char pad[255];</p></td>
<td width="65%">
</td></tr>
</table>

<p style="margin-left:14%;">};</p>

<p style="margin-left:6%;">All unused bytes in the header
record are filled with nulls.</p>

<p style="margin-top: 1em"><i>name</i></p>

<p style="margin-left:17%; margin-top: 1em">Pathname,
stored as a null-terminated string. Early tar
implementations only stored regular files (including
hardlinks to those files). One common early convention used
a trailing &quot;/&quot; character to indicate a directory
name, allowing directory permissions and owner information
to be archived and restored.</p>

<p style="margin-top: 1em"><i>mode</i></p>

<p style="margin-left:17%; margin-top: 1em">File mode,
stored as an octal number in ASCII.</p>

<p style="margin-top: 1em"><i>uid</i>, <i>gid</i></p>

<p style="margin-left:17%;">User id and group id of owner,
as octal numbers in ASCII.</p>

<p style="margin-top: 1em"><i>size</i></p>

<p style="margin-left:17%; margin-top: 1em">Size of file,
as octal number in ASCII. For regular files only, this
indicates the amount of data that follows the header. In
particular, this field was ignored by early tar
implementations when extracting hardlinks. Modern writers
should always store a zero length for hardlink entries.</p>

<p style="margin-top: 1em"><i>mtime</i></p>

<p style="margin-left:17%; margin-top: 1em">Modification
time of file, as an octal number in ASCII. This indicates
the number of seconds since the start of the epoch, 00:00:00
UTC January 1, 1970. Note that negative values should be
avoided here, as they are handled inconsistently.</p>

<p style="margin-top: 1em"><i>checksum</i></p>

<p style="margin-left:17%;">Header checksum, stored as an
octal number in ASCII. To compute the checksum, set the
checksum field to all spaces, then sum all bytes in the
header using unsigned arithmetic. This field should be
stored as six octal digits followed by a null and a space
character. Note that many early implementations of tar used
signed arithmetic for the checksum field, which can cause
interoperability problems when transferring archives between
systems. Modern robust readers compute the checksum both
ways and accept the header if either computation
matches.</p>

<p style="margin-top: 1em"><i>linkflag</i>,
<i>linkname</i></p>

<p style="margin-left:17%;">In order to preserve hardlinks
and conserve tape, a file with multiple links is only
written to the archive the first time it is encountered. The
next time it is encountered, the <i>linkflag</i> is set to
an ASCII &rsquo;1&rsquo; and the <i>linkname</i> field holds
the first name under which this file appears. (Note that
regular files have a null value in the <i>linkflag</i>
field.)</p>

<p style="margin-left:6%; margin-top: 1em">Early tar
implementations varied in how they terminated these fields.
The tar command in Version&nbsp;7 AT&amp;T UNIX used the
following conventions (this is also documented in early BSD
manpages): the pathname must be null-terminated; the mode,
uid, and gid fields must end in a space and a null byte; the
size and mtime fields must end in a space; the checksum is
terminated by a null and a space. Early implementations
filled the numeric fields with leading spaces. This seems to
have been common practice until the IEEE Std 1003.1-1988
(&ldquo;POSIX.1&rdquo;) standard was released. For best
portability, modern implementations should fill the numeric
fields with leading zeros.</p>

<p style="margin-left:6%; margin-top: 1em"><b>Pre-POSIX
Archives</b> <br>
An early draft of IEEE Std 1003.1-1988
(&ldquo;POSIX.1&rdquo;) served as the basis for John
Gilmore&rsquo;s <b>pdtar</b> program and many system
implementations from the late 1980s and early 1990s. These
archives generally follow the POSIX ustar format described
below with the following variations:</p>

<p><b>&bull;</b></p>

<p style="margin-left:17%;">The magic value consists of the
five characters &ldquo;ustar&rdquo; followed by a space. The
version field contains a space character followed by a
null.</p>

<p><b>&bull;</b></p>

<p style="margin-left:17%;">The numeric fields are
generally filled with leading spaces (not leading zeros as
recommended in the final standard).</p>

<p><b>&bull;</b></p>

<p style="margin-left:17%;">The prefix field is often not
used, limiting pathnames to the 100 characters of old-style
archives.</p>

<p style="margin-left:6%; margin-top: 1em"><b>POSIX ustar
Archives</b> <br>
IEEE Std 1003.1-1988 (&ldquo;POSIX.1&rdquo;) defined a
standard tar file format to be read and written by compliant
implementations of tar(1). This format is often called the
&ldquo;ustar&rdquo; format, after the magic value used in
the header. (The name is an acronym for &ldquo;Unix Standard
TAR&rdquo;.) It extends the historic format with new
fields:</p>

<p style="margin-left:14%; margin-top: 1em">struct
header_posix_ustar {</p>

<table width="100%" border="0" rules="none" frame="void"
       cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char name[100];</p></td>
<td width="65%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char mode[8];</p></td>
<td width="65%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char uid[8];</p></td>
<td width="65%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char gid[8];</p></td>
<td width="65%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char size[12];</p></td>
<td width="65%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char mtime[12];</p></td>
<td width="65%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char checksum[8];</p></td>
<td width="65%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char typeflag[1];</p></td>
<td width="65%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char linkname[100];</p></td>
<td width="65%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char magic[6];</p></td>
<td width="65%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char version[2];</p></td>
<td width="65%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char uname[32];</p></td>
<td width="65%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char gname[32];</p></td>
<td width="65%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char devmajor[8];</p></td>
<td width="65%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char devminor[8];</p></td>
<td width="65%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char prefix[155];</p></td>
<td width="65%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char pad[12];</p></td>
<td width="65%">
</td></tr>
</table>

<p style="margin-left:14%;">};</p>

<p style="margin-top: 1em"><i>typeflag</i></p>

<p style="margin-left:17%;">Type of entry. POSIX extended
the earlier <i>linkflag</i> field with several new type
values:</p>

<p>&ldquo;0&rdquo;</p>

<p style="margin-left:27%; margin-top: 1em">Regular file.
NUL should be treated as a synonym, for compatibility
purposes.</p>

<p>&ldquo;1&rdquo;</p>

<p style="margin-left:27%; margin-top: 1em">Hard link.</p>

<p>&ldquo;2&rdquo;</p>

<p style="margin-left:27%; margin-top: 1em">Symbolic
link.</p>

<p>&ldquo;3&rdquo;</p>

<p style="margin-left:27%; margin-top: 1em">Character
device node.</p>

<p>&ldquo;4&rdquo;</p>

<p style="margin-left:27%; margin-top: 1em">Block device
node.</p>

<p>&ldquo;5&rdquo;</p>

<p style="margin-left:27%; margin-top: 1em">Directory.</p>

<p>&ldquo;6&rdquo;</p>

<p style="margin-left:27%; margin-top: 1em">FIFO node.</p>

<p>&ldquo;7&rdquo;</p>

<p style="margin-left:27%; margin-top: 1em">Reserved.</p>

<p>Other</p>

<p style="margin-left:27%; margin-top: 1em">A
POSIX-compliant implementation must treat any unrecognized
typeflag value as a regular file. In particular, writers
should ensure that all entries have a valid filename so that
they can be restored by readers that do not support the
corresponding extension. Uppercase letters &quot;A&quot;
through &quot;Z&quot; are reserved for custom extensions.
Note that sockets and whiteout entries are not
archivable.</p>

<p style="margin-left:17%;">It is worth noting that the
<i>size</i> field, in particular, has different meanings
depending on the type. For regular files, of course, it
indicates the amount of data following the header. For
directories, it may be used to indicate the total size of
all files in the directory, for use by operating systems
that pre-allocate directory space. For all other types, it
should be set to zero by writers and ignored by readers.</p>

<p style="margin-top: 1em"><i>magic</i></p>

<p style="margin-left:17%; margin-top: 1em">Contains the
magic value &ldquo;ustar&rdquo; followed by a NUL byte to
indicate that this is a POSIX standard archive. Full
compliance requires the uname and gname fields be properly
set.</p>

<p style="margin-top: 1em"><i>version</i></p>

<p style="margin-left:17%;">Version. This should be
&ldquo;00&rdquo; (two copies of the ASCII digit zero) for
POSIX standard archives.</p>

<p style="margin-top: 1em"><i>uname</i>, <i>gname</i></p>

<p style="margin-left:17%;">User and group names, as
null-terminated ASCII strings. These should be used in
preference to the uid/gid values when they are set and the
corresponding names exist on the system.</p>

<p style="margin-top: 1em"><i>devmajor</i>,
<i>devminor</i></p>

<p style="margin-left:17%;">Major and minor numbers for
character device or block device entry.</p>

<p style="margin-top: 1em"><i>name</i>, <i>prefix</i></p>

<p style="margin-left:17%;">If the pathname is too long to
fit in the 100 bytes provided by the standard format, it can
be split at any <i>/</i> character with the first portion
going into the prefix field. If the prefix field is not
empty, the reader will prepend the prefix value and a
<i>/</i> character to the regular name field to obtain the
full pathname. The standard does not require a trailing
<i>/</i> character on directory names, though most
implementations still include this for compatibility
reasons.</p>

<p style="margin-left:6%; margin-top: 1em">Note that all
unused bytes must be set to NUL.</p>

<p style="margin-left:6%; margin-top: 1em">Field
termination is specified slightly differently by POSIX than
by previous implementations. The <i>magic</i>, <i>uname</i>,
and <i>gname</i> fields must have a trailing NUL. The
<i>pathname</i>, <i>linkname</i>, and <i>prefix</i> fields
must have a trailing NUL unless they fill the entire field.
(In particular, it is possible to store a 256-character
pathname if it happens to have a <i>/</i> as the 156th
character.) POSIX requires numeric fields to be zero-padded
in the front, and requires them to be terminated with either
space or NUL characters.</p>

<p style="margin-left:6%; margin-top: 1em">Currently, most
tar implementations comply with the ustar format,
occasionally extending it by adding new fields to the blank
area at the end of the header record.</p>

<p style="margin-left:6%; margin-top: 1em"><b>Numeric
Extensions</b> <br>
There have been several attempts to extend the range of
sizes or times supported by modifying how numbers are stored
in the header.</p>

<p style="margin-left:6%; margin-top: 1em">One obvious
extension to increase the size of files is to eliminate the
terminating characters from the various numeric fields. For
example, the standard only allows the size field to contain
11 octal digits, reserving the twelfth byte for a trailing
NUL character. Allowing 12 octal digits allows file sizes up
to 64 GB.</p>

<p style="margin-left:6%; margin-top: 1em">Another
extension, utilized by GNU tar, star, and other newer
<b>tar</b> implementations, permits binary numbers in the
standard numeric fields. This is flagged by setting the high
bit of the first byte. The remainder of the field is treated
as a signed twos-complement value. This permits 95-bit
values for the length and time fields and 63-bit values for
the uid, gid, and device numbers. In particular, this
provides a consistent way to handle negative time values.
GNU tar supports this extension for the length, mtime,
ctime, and atime fields. Joerg Schilling&rsquo;s star
program and the libarchive library support this extension
for all numeric fields. Note that this extension is largely
obsoleted by the extended attribute record provided by the
pax interchange format.</p>

<p style="margin-left:6%; margin-top: 1em">Another early
GNU extension allowed base-64 values rather than octal. This
extension was short-lived and is no longer supported by any
implementation.</p>

<p style="margin-left:6%; margin-top: 1em"><b>Pax
Interchange Format</b> <br>
There are many attributes that cannot be portably stored in
a POSIX ustar archive. IEEE Std 1003.1-2001
(&ldquo;POSIX.1&rdquo;) defined a &ldquo;pax interchange
format&rdquo; that uses two new types of entries to hold
text-formatted metadata that applies to following entries.
Note that a pax interchange format archive is a ustar
archive in every respect. The new data is stored in
ustar-compatible archive entries that use the
&ldquo;x&rdquo; or &ldquo;g&rdquo; typeflag. In particular,
older implementations that do not fully support these
extensions will extract the metadata into regular files,
where the metadata can be examined as necessary.</p>

<p style="margin-left:6%; margin-top: 1em">An entry in a
pax interchange format archive consists of one or two
standard ustar entries, each with its own header and data.
The first optional entry stores the extended attributes for
the following entry. This optional first entry has an
&quot;x&quot; typeflag and a size field that indicates the
total size of the extended attributes. The extended
attributes themselves are stored as a series of text-format
lines encoded in the portable UTF-8 encoding. Each line
consists of a decimal number, a space, a key string, an
equals sign, a value string, and a new line. The decimal
number indicates the length of the entire line, including
the initial length field and the trailing newline. An
example of such a field is:</p>

<p style="margin-left:14%;">25 ctime=1084839148.1212\n</p>

<p style="margin-left:6%;">Keys in all lowercase are
standard keys. Vendors can add their own keys by prefixing
them with an all uppercase vendor name and a period. Note
that, unlike the historic header, numeric values are stored
using decimal, not octal. A description of some common keys
follows:</p>

<p style="margin-top: 1em"><b>atime</b>, <b>ctime</b>,
<b>mtime</b></p>

<p style="margin-left:17%;">File access, inode change, and
modification times. These fields can be negative or include
a decimal point and a fractional value.</p>

<p style="margin-top: 1em"><b>hdrcharset</b></p>

<p style="margin-left:17%;">The character set used by the
pax extension values. By default, all textual values in the
pax extended attributes are assumed to be in UTF-8,
including pathnames, user names, and group names. In some
cases, it is not possible to translate local conventions
into UTF-8. If this key is present and the value is the
six-character ASCII string &ldquo;BINARY&rdquo;, then all
textual values are assumed to be in a platform-dependent
multi-byte encoding. Note that there are only two valid
values for this key: &ldquo;BINARY&rdquo; or
&ldquo;ISO-IR&nbsp;10646&nbsp;2000&nbsp;UTF-8&rdquo;. No
other values are permitted by the standard, and the latter
value should generally not be used as it is the default when
this key is not specified. In particular, this flag should
not be used as a general mechanism to allow filenames to be
stored in arbitrary encodings.</p>

<p style="margin-top: 1em"><b>uname</b>, <b>uid</b>,
<b>gname</b>, <b>gid</b></p>

<p style="margin-left:17%;">User name, group name, and
numeric UID and GID values. The user name and group name
stored here are encoded in UTF8 and can thus include
non-ASCII characters. The UID and GID fields can be of
arbitrary length.</p>

<p style="margin-top: 1em"><b>linkpath</b></p>

<p style="margin-left:17%;">The full path of the linked-to
file. Note that this is encoded in UTF8 and can thus include
non-ASCII characters.</p>

<p style="margin-top: 1em"><b>path</b></p>

<p style="margin-left:17%; margin-top: 1em">The full
pathname of the entry. Note that this is encoded in UTF8 and
can thus include non-ASCII characters.</p>

<p style="margin-top: 1em"><b>realtime.*</b>,
<b>security.*</b></p>

<p style="margin-left:17%;">These keys are reserved and may
be used for future standardization.</p>

<p style="margin-top: 1em"><b>size</b></p>

<p style="margin-left:17%; margin-top: 1em">The size of the
file. Note that there is no length limit on this field,
allowing conforming archives to store files much larger than
the historic 8GB limit.</p>

<p style="margin-top: 1em"><b>SCHILY.*</b></p>

<p style="margin-left:17%;">Vendor-specific attributes used
by Joerg Schilling&rsquo;s <b>star</b> implementation.</p>

<p style="margin-top: 1em"><b>SCHILY.acl.access</b>,
<b>SCHILY.acl.default, SCHILY.acl.ace</b></p>

<p style="margin-left:17%;">Stores the access, default and
NFSv4 ACLs as textual strings in a format that is an
extension of the format specified by POSIX.1e draft 17. In
particular, each user or group access specification can
include an additional colon-separated field with the numeric
UID or GID. This allows ACLs to be restored on systems that
may not have complete user or group information available
(such as when NIS/YP or LDAP services are temporarily
unavailable).</p>

<p style="margin-top: 1em"><b>SCHILY.devminor</b>,
<b>SCHILY.devmajor</b></p>

<p style="margin-left:17%;">The full minor and major
numbers for device nodes.</p>

<p style="margin-top: 1em"><b>SCHILY.fflags</b></p>

<p style="margin-left:17%;">The file flags.</p>

<p style="margin-top: 1em"><b>SCHILY.realsize</b></p>

<p style="margin-left:17%;">The full size of the file on
disk. XXX explain? XXX</p>

<p style="margin-top: 1em"><b>SCHILY.dev, SCHILY.ino</b>,
<b>SCHILY.nlinks</b></p>

<p style="margin-left:17%;">The device number, inode
number, and link count for the entry. In particular, note
that a pax interchange format archive using Joerg
Schilling&rsquo;s <b>SCHILY.*</b> extensions can store all
of the data from <i>struct stat</i>.</p>

<p style="margin-top: 1em"><b>LIBARCHIVE.*</b></p>

<p style="margin-left:17%;">Vendor-specific attributes used
by the <b>libarchive</b> library and programs that use
it.</p>


<p style="margin-top: 1em"><b>LIBARCHIVE.creationtime</b></p>

<p style="margin-left:17%;">The time when the file was
created. (This should not be confused with the POSIX
&ldquo;ctime&rdquo; attribute, which refers to the time when
the file metadata was last changed.)</p>


<p style="margin-top: 1em"><b>LIBARCHIVE.xattr.</b><i>namespace</i>.<i>key</i></p>

<p style="margin-left:17%;">Libarchive stores
POSIX.1e-style extended attributes using keys of this form.
The <i>key</i> value is URL-encoded: All non-ASCII
characters and the two special characters &ldquo;=&rdquo;
and &ldquo;%&rdquo; are encoded as &ldquo;%&rdquo; followed
by two uppercase hexadecimal digits. The value of this key
is the extended attribute value encoded in base 64. XXX
Detail the base-64 format here XXX</p>

<p style="margin-top: 1em"><b>VENDOR.*</b></p>

<p style="margin-left:17%;">XXX document other
vendor-specific extensions XXX</p>

<p style="margin-left:6%; margin-top: 1em">Any values
stored in an extended attribute override the corresponding
values in the regular tar header. Note that compliant
readers should ignore the regular fields when they are
overridden. This is important, as existing archivers are
known to store non-compliant values in the standard header
fields in this situation. There are no limits on length for
any of these fields. In particular, numeric fields can be
arbitrarily large. All text fields are encoded in UTF8.
Compliant writers should store only portable 7-bit ASCII
characters in the standard ustar header and use extended
attributes whenever a text value contains non-ASCII
characters.</p>

<p style="margin-left:6%; margin-top: 1em">In addition to
the <b>x</b> entry described above, the pax interchange
format also supports a <b>g</b> entry. The <b>g</b> entry is
identical in format, but specifies attributes that serve as
defaults for all subsequent archive entries. The <b>g</b>
entry is not widely used.</p>

<p style="margin-left:6%; margin-top: 1em">Besides the new
<b>x</b> and <b>g</b> entries, the pax interchange format
has a few other minor variations from the earlier ustar
format. The most troubling one is that hardlinks are
permitted to have data following them. This allows readers
to restore any hardlink to a file without having to rewind
the archive to find an earlier entry. However, it creates
complications for robust readers, as it is no longer clear
whether or not they should ignore the size field for
hardlink entries.</p>

<p style="margin-left:6%; margin-top: 1em"><b>GNU Tar
Archives</b> <br>
The GNU tar program started with a pre-POSIX format similar
to that described earlier and has extended it using several
different mechanisms: It added new fields to the empty space
in the header (some of which was later used by POSIX for
conflicting purposes); it allowed the header to be continued
over multiple records; and it defined new entries that
modify following entries (similar in principle to the
<b>x</b> entry described above, but each GNU special entry
is single-purpose, unlike the general-purpose <b>x</b>
entry). As a result, GNU tar archives are not POSIX
compatible, although more lenient POSIX-compliant readers
can successfully extract most GNU tar archives.</p>

<p style="margin-left:14%; margin-top: 1em">struct
header_gnu_tar {</p>

<table width="100%" border="0" rules="none" frame="void"
       cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char name[100];</p></td>
<td width="10%"></td>
<td width="55%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char mode[8];</p></td>
<td width="10%"></td>
<td width="55%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char uid[8];</p></td>
<td width="10%"></td>
<td width="55%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char gid[8];</p></td>
<td width="10%"></td>
<td width="55%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char size[12];</p></td>
<td width="10%"></td>
<td width="55%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char mtime[12];</p></td>
<td width="10%"></td>
<td width="55%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char checksum[8];</p></td>
<td width="10%"></td>
<td width="55%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char typeflag[1];</p></td>
<td width="10%"></td>
<td width="55%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char linkname[100];</p></td>
<td width="10%"></td>
<td width="55%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char magic[6];</p></td>
<td width="10%"></td>
<td width="55%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char version[2];</p></td>
<td width="10%"></td>
<td width="55%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char uname[32];</p></td>
<td width="10%"></td>
<td width="55%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char gname[32];</p></td>
<td width="10%"></td>
<td width="55%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char devmajor[8];</p></td>
<td width="10%"></td>
<td width="55%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char devminor[8];</p></td>
<td width="10%"></td>
<td width="55%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char atime[12];</p></td>
<td width="10%"></td>
<td width="55%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char ctime[12];</p></td>
<td width="10%"></td>
<td width="55%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char offset[12];</p></td>
<td width="10%"></td>
<td width="55%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char longnames[4];</p></td>
<td width="10%"></td>
<td width="55%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char unused[1];</p></td>
<td width="10%"></td>
<td width="55%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>struct {</p></td>
<td width="10%"></td>
<td width="55%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">
</td>
<td width="10%">


<p>char offset[12];</p></td>
<td width="55%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">
</td>
<td width="10%">


<p>char numbytes[12];</p></td>
<td width="55%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>} sparse[4];</p></td>
<td width="10%"></td>
<td width="55%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char isextended[1];</p></td>
<td width="10%"></td>
<td width="55%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char realsize[12];</p></td>
<td width="10%"></td>
<td width="55%">
</td></tr>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="11%">


<p>char pad[17];</p></td>
<td width="10%"></td>
<td width="55%">
</td></tr>
</table>

<p style="margin-left:14%;">};</p>

<p style="margin-top: 1em"><i>typeflag</i></p>

<p style="margin-left:17%;">GNU tar uses the following
special entry types, in addition to those defined by
POSIX:</p>

<p style="margin-top: 1em">7</p>

<p style="margin-left:27%; margin-top: 1em">GNU tar treats
type &quot;7&quot; records identically to type &quot;0&quot;
records, except on one obscure RTOS where they are used to
indicate the pre-allocation of a contiguous file on
disk.</p>

<p style="margin-top: 1em">D</p>

<p style="margin-left:27%; margin-top: 1em">This indicates
a directory entry. Unlike the POSIX-standard &quot;5&quot;
typeflag, the header is followed by data records listing the
names of files in this directory. Each name is preceded by
an ASCII &quot;Y&quot; if the file is stored in this archive
or &quot;N&quot; if the file is not stored in this archive.
Each name is terminated with a null, and an extra null marks
the end of the name list. The purpose of this entry is to
support incremental backups; a program restoring from such
an archive may wish to delete files on disk that did not
exist in the directory when the archive was made.</p>

<p style="margin-left:27%; margin-top: 1em">Note that the
&quot;D&quot; typeflag specifically violates POSIX, which
requires that unrecognized typeflags be restored as normal
files. In this case, restoring the &quot;D&quot; entry as a
file could interfere with subsequent creation of the
like-named directory.</p>

<p style="margin-top: 1em">K</p>

<p style="margin-left:27%; margin-top: 1em">The data for
this entry is a long linkname for the following regular
entry.</p>

<p style="margin-top: 1em">L</p>

<p style="margin-left:27%; margin-top: 1em">The data for
this entry is a long pathname for the following regular
entry.</p>

<p style="margin-top: 1em">M</p>

<p style="margin-left:27%; margin-top: 1em">This is a
continuation of the last file on the previous volume. GNU
multi-volume archives guarantee that each volume begins with
a valid entry header. To ensure this, a file may be split,
with part stored at the end of one volume, and part stored
at the beginning of the next volume. The &quot;M&quot;
typeflag indicates that this entry continues an existing
file. Such entries can only occur as the first or second
entry in an archive (the latter only if the first entry is a
volume label). The <i>size</i> field specifies the size of
this entry. The <i>offset</i> field at bytes 369-380
specifies the offset where this file fragment begins. The
<i>realsize</i> field specifies the total size of the file
(which must equal <i>size</i> plus <i>offset</i>). When
extracting, GNU tar checks that the header file name is the
one it is expecting, that the header offset is in the
correct sequence, and that the sum of offset and size is
equal to realsize.</p>

<p style="margin-top: 1em">N</p>

<p style="margin-left:27%; margin-top: 1em">Type
&quot;N&quot; records are no longer generated by GNU tar.
They contained a list of files to be renamed or symlinked
after extraction; this was originally used to support long
names. The contents of this record are a text description of
the operations to be done, in the form &ldquo;Rename %s to
%s\n&rdquo; or &ldquo;Symlink %s to %s\n&rdquo;; in either
case, both filenames are escaped using K&amp;R C syntax. Due
to security concerns, &quot;N&quot; records are now
generally ignored when reading archives.</p>

<p style="margin-top: 1em">S</p>

<p style="margin-left:27%; margin-top: 1em">This is a
&ldquo;sparse&rdquo; regular file. Sparse files are stored
as a series of fragments. The header contains a list of
fragment offset/length pairs. If more than four such entries
are required, the header is extended as necessary with
&ldquo;extra&rdquo; header extensions (an older format that
is no longer used), or &ldquo;sparse&rdquo; extensions.</p>

<p style="margin-top: 1em">V</p>

<p style="margin-left:27%; margin-top: 1em">The <i>name</i>
field should be interpreted as a tape/volume header name.
This entry should generally be ignored on extraction.</p>

<p style="margin-top: 1em"><i>magic</i></p>

<p style="margin-left:17%; margin-top: 1em">The magic field
holds the five characters &ldquo;ustar&rdquo; followed by a
space. Note that POSIX ustar archives have a trailing
null.</p>

<p style="margin-top: 1em"><i>version</i></p>

<p style="margin-left:17%;">The version field holds a space
character followed by a null. Note that POSIX ustar archives
use two copies of the ASCII digit &ldquo;0&rdquo;.</p>

<p style="margin-top: 1em"><i>atime</i>, <i>ctime</i></p>

<p style="margin-left:17%;">The time the file was last
accessed and the time of last change of file information,
stored in octal as with <i>mtime</i>.</p>

<p style="margin-top: 1em"><i>longnames</i></p>

<p style="margin-left:17%;">This field is apparently no
longer used.</p>

<p style="margin-top: 1em">Sparse <i>offset /
numbytes</i></p>

<p style="margin-left:17%;">Each such structure specifies a
single fragment of a sparse file. The two fields store
values as octal numbers. The fragments are each padded to a
multiple of 512 bytes in the archive. On extraction, the
list of fragments is collected from the header (including
any extension headers), and the data is then read and
written to the file at appropriate offsets.</p>

<p style="margin-top: 1em"><i>isextended</i></p>

<p style="margin-left:17%;">If this is set to non-zero, the
header will be followed by additional &ldquo;sparse
header&rdquo; records. Each such record contains information
about as many as 21 additional sparse blocks as shown
here:</p>

<p style="margin-left:24%; margin-top: 1em">struct
gnu_sparse_header {</p>

<table width="100%" border="0" rules="none" frame="void"
       cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="35%"></td>
<td width="10%">


<p>struct {</p></td>
<td width="10%"></td>
<td width="45%">
</td></tr>
<tr valign="top" align="left">
<td width="35%"></td>
<td width="10%">
</td>
<td width="10%">


<p>char offset[12];</p></td>
<td width="45%">
</td></tr>
<tr valign="top" align="left">
<td width="35%"></td>
<td width="10%">
</td>
<td width="10%">


<p>char numbytes[12];</p></td>
<td width="45%">
</td></tr>
<tr valign="top" align="left">
<td width="35%"></td>
<td width="10%">


<p>} sparse[21];</p></td>
<td width="10%"></td>
<td width="45%">
</td></tr>
<tr valign="top" align="left">
<td width="35%"></td>
<td width="10%">


<p>char isextended[1];</p></td>
<td width="10%"></td>
<td width="45%">
</td></tr>
<tr valign="top" align="left">
<td width="35%"></td>
<td width="10%">


<p>char padding[7];</p></td>
<td width="10%"></td>
<td width="45%">
</td></tr>
</table>

<p style="margin-left:24%;">};</p>

<p style="margin-top: 1em"><i>realsize</i></p>

<p style="margin-left:17%;">A binary representation of the
file&rsquo;s complete size, with a much larger range than
the POSIX file size. In particular, with <b>M</b> type
files, the current entry is only a portion of the file. In
that case, the POSIX size field will indicate the size of
this entry; the <i>realsize</i> field will indicate the
total size of the file.</p>

<p style="margin-left:6%; margin-top: 1em"><b>GNU tar pax
archives</b> <br>
GNU tar 1.14 (XXX check this XXX) and later will write pax
interchange format archives when you specify the
<b>--posix</b> flag. This format follows the pax interchange
format closely, using some <b>SCHILY</b> tags and
introducing new keywords to store sparse file information.
There have been three iterations of the sparse file support,
referred to as &ldquo;0.0&rdquo;, &ldquo;0.1&rdquo;, and
&ldquo;1.0&rdquo;.</p>

<p style="margin-top: 1em"><b>GNU.sparse.numblocks</b>,
<b>GNU.sparse.offset</b>, <b>GNU.sparse.numbytes</b>,
<b>GNU.sparse.size</b></p>

<p style="margin-left:17%;">The &ldquo;0.0&rdquo; format
used an initial <b>GNU.sparse.numblocks</b> attribute to
indicate the number of blocks in the file, a pair of
<b>GNU.sparse.offset</b> and <b>GNU.sparse.numbytes</b> to
indicate the offset and size of each block, and a single
<b>GNU.sparse.size</b> to indicate the full size of the
file. This is not the same as the size in the tar header
because the latter value does not include the size of any
holes. This format required that the order of attributes be
preserved and relied on readers accepting multiple
appearances of the same attribute names, which is not
officially permitted by the standards.</p>

<p style="margin-top: 1em"><b>GNU.sparse.map</b></p>

<p style="margin-left:17%;">The &ldquo;0.1&rdquo; format
used a single attribute that stored a comma-separated list
of decimal numbers. Each pair of numbers indicated the
offset and size, respectively, of a block of data. This does
not work well if the archive is extracted by an archiver
that does not recognize this extension, since many pax
implementations simply discard unrecognized attributes.</p>

<p style="margin-top: 1em"><b>GNU.sparse.major</b>,
<b>GNU.sparse.minor</b>, <b>GNU.sparse.name</b>,
<b>GNU.sparse.realsize</b></p>

<p style="margin-left:17%;">The &ldquo;1.0&rdquo; format
stores the sparse block map in one or more 512-byte blocks
prepended to the file data in the entry body. The pax
attributes indicate the existence of this map (via the
<b>GNU.sparse.major</b> and <b>GNU.sparse.minor</b> fields)
and the full size of the file. The <b>GNU.sparse.name</b>
holds the true name of the file. To avoid confusion, the
name stored in the regular tar header is a modified name so
that extraction errors will be apparent to users.</p>

<p style="margin-left:6%; margin-top: 1em"><b>Solaris
Tar</b> <br>
XXX More Details Needed XXX</p>

<p style="margin-left:6%; margin-top: 1em">Solaris tar
(beginning with SunOS XXX 5.7 ?? XXX) supports an
&ldquo;extended&rdquo; format that is fundamentally similar
to pax interchange format, with the following
differences:</p>

<p><b>&bull;</b></p>

<p style="margin-left:17%;">Extended attributes are stored
in an entry whose type is <b>X</b>, not <b>x</b>, as used by
pax interchange format. The detailed format of this entry
appears to be the same as detailed above for the <b>x</b>
entry.</p>

<p><b>&bull;</b></p>

<p style="margin-left:17%;">An additional <b>A</b> header
is used to store an ACL for the following regular entry. The
body of this entry contains a seven-digit octal number
followed by a zero byte, followed by the textual ACL
description. The octal value is the number of ACL entries
plus a constant that indicates the ACL type: 01000000 for
POSIX.1e ACLs and 03000000 for NFSv4 ACLs.</p>

<p style="margin-left:6%; margin-top: 1em"><b>AIX Tar</b>
<br>
XXX More details needed XXX</p>

<p style="margin-left:6%; margin-top: 1em">AIX Tar uses a
ustar-formatted header with the type <b>A</b> for storing
coded ACL information. Unlike the Solaris format, AIX tar
writes this header after the regular file body to which it
applies. The pathname in this header is either <b>NFS4</b>
or <b>AIXC</b> to indicate the type of ACL stored. The
actual ACL is stored in platform-specific binary format.</p>

<p style="margin-left:6%; margin-top: 1em"><b>Mac OS X
Tar</b> <br>
The tar distributed with Apple&rsquo;s Mac OS X stores most
regular files as two separate files in the tar archive. The
two files have the same name except that the first one has
&ldquo;._&rdquo; prepended to the last path element. This
special file stores an AppleDouble-encoded binary blob with
additional metadata about the second file, including ACL,
extended attributes, and resources. To recreate the original
file on disk, each separate file can be extracted and the
Mac OS X <b>copyfile</b>() function can be used to unpack
the separate metadata file and apply it to th regular file.
Conversely, the same function provides a &ldquo;pack&rdquo;
option to encode the extended metadata from a file into a
separate file whose contents can then be put into a tar
archive.</p>

<p style="margin-left:6%; margin-top: 1em">Note that the
Apple extended attributes interact badly with long
filenames. Since each file is stored with the full name, a
separate set of extensions needs to be included in the
archive for each one, doubling the overhead required for
files with long names.</p>

<p style="margin-left:6%; margin-top: 1em"><b>Summary of
tar type codes</b> <br>
The following list is a condensed summary of the type codes
used in tar header records generated by different tar
implementations. More details about specific implementations
can be found above:</p>

<p>NUL</p>

<p style="margin-left:13%; margin-top: 1em">Early tar
programs stored a zero byte for regular files.</p>

<p><b>0</b></p>

<p style="margin-left:13%; margin-top: 1em">POSIX standard
type code for a regular file.</p>

<p><b>1</b></p>

<p style="margin-left:13%; margin-top: 1em">POSIX standard
type code for a hard link description.</p>

<p><b>2</b></p>

<p style="margin-left:13%; margin-top: 1em">POSIX standard
type code for a symbolic link description.</p>

<p><b>3</b></p>

<p style="margin-left:13%; margin-top: 1em">POSIX standard
type code for a character device node.</p>

<p><b>4</b></p>

<p style="margin-left:13%; margin-top: 1em">POSIX standard
type code for a block device node.</p>

<p><b>5</b></p>

<p style="margin-left:13%; margin-top: 1em">POSIX standard
type code for a directory.</p>

<p><b>6</b></p>

<p style="margin-left:13%; margin-top: 1em">POSIX standard
type code for a FIFO.</p>

<p><b>7</b></p>

<p style="margin-left:13%; margin-top: 1em">POSIX
reserved.</p>

<p><b>7</b></p>

<p style="margin-left:13%; margin-top: 1em">GNU tar used
for pre-allocated files on some systems.</p>

<p><b>A</b></p>

<p style="margin-left:13%; margin-top: 1em">Solaris tar ACL
description stored prior to a regular file header.</p>

<p><b>A</b></p>

<p style="margin-left:13%; margin-top: 1em">AIX tar ACL
description stored after the file body.</p>

<p><b>D</b></p>

<p style="margin-left:13%; margin-top: 1em">GNU tar
directory dump.</p>

<p><b>K</b></p>

<p style="margin-left:13%; margin-top: 1em">GNU tar long
linkname for the following header.</p>

<p><b>L</b></p>

<p style="margin-left:13%; margin-top: 1em">GNU tar long
pathname for the following header.</p>

<p><b>M</b></p>

<p style="margin-left:13%; margin-top: 1em">GNU tar
multivolume marker, indicating the file is a continuation of
a file from the previous volume.</p>

<p><b>N</b></p>

<p style="margin-left:13%; margin-top: 1em">GNU tar long
filename support. Deprecated.</p>

<p><b>S</b></p>

<p style="margin-left:13%; margin-top: 1em">GNU tar sparse
regular file.</p>

<p><b>V</b></p>

<p style="margin-left:13%; margin-top: 1em">GNU tar
tape/volume header name.</p>

<p><b>X</b></p>

<p style="margin-left:13%; margin-top: 1em">Solaris tar
general-purpose extension header.</p>

<p><b>g</b></p>

<p style="margin-left:13%; margin-top: 1em">POSIX pax
interchange format global extensions.</p>

<p><b>x</b></p>

<p style="margin-left:13%; margin-top: 1em">POSIX pax
interchange format per-file extensions.</p>

<p style="margin-top: 1em"><b>SEE ALSO</b></p>

<p style="margin-left:6%;">ar(1), pax(1), tar(1)</p>

<p style="margin-top: 1em"><b>STANDARDS</b></p>

<p style="margin-left:6%;">The <b>tar</b> utility is no
longer a part of POSIX or the Single Unix Standard. It last
appeared in Version&nbsp;2 of the Single UNIX Specification
(&ldquo;SUSv2&rdquo;). It has been supplanted in subsequent
standards by pax(1). The ustar format is currently part of
the specification for the pax(1) utility. The pax
interchange file format is new with IEEE Std 1003.1-2001
(&ldquo;POSIX.1&rdquo;).</p>

<p style="margin-top: 1em"><b>HISTORY</b></p>

<p style="margin-left:6%;">A <b>tar</b> command appeared in
Seventh Edition Unix, which was released in January, 1979.
It replaced the <b>tp</b> program from Fourth Edition Unix
which in turn replaced the <b>tap</b> program from First
Edition Unix. John Gilmore&rsquo;s <b>pdtar</b>
public-domain implementation (circa 1987) was highly
influential and formed the basis of <b>GNU tar</b> (circa
1988). Joerg Shilling&rsquo;s <b>star</b> archiver is
another open-source (CDDL) archiver (originally developed
circa 1985) which features complete support for pax
interchange format.</p>

<p style="margin-left:6%; margin-top: 1em">This
documentation was written as part of the <b>libarchive</b>
and <b>bsdtar</b> project by Tim Kientzle
&lt;kientzle@FreeBSD.org&gt;.</p>

<p style="margin-left:6%; margin-top: 1em">BSD
December&nbsp;27, 2016 BSD</p>
<hr>
</body>
</html>