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 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
<!-- lifted from man+troff by doclifter -->
<refentry>
<!-- Copyright (c) 2001\-2003 The Open Group, All Rights Reserved -->
<refentryinfo><date>2003</date></refentryinfo>
<refmeta>
<refentrytitle>PAX</refentrytitle>
<manvolnum>P</manvolnum>
<refmiscinfo class='date'>2003</refmiscinfo>
<refmiscinfo class='source'>IEEE/The Open Group</refmiscinfo>
<refmiscinfo class='manual'>POSIX Programmer's Manual</refmiscinfo>
</refmeta>
<refnamediv>
<refname>pax</refname>
<refpurpose>portable archive interchange</refpurpose>
</refnamediv>
<!-- body begins here -->
<refsynopsisdiv id='synopsis'>
<cmdsynopsis>
<command>pax</command> <arg choice='opt'>-cdnv </arg>
<group choice='opt'><arg choice='plain'>-H </arg><arg choice='plain'>-L </arg></group>
<arg choice='opt'>-f <replaceable>archive</replaceable></arg>
<arg choice='opt' rep='repeat'>-s <replaceable>replstr</replaceable></arg>
<arg choice='opt' rep='repeat'><replaceable>pattern</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>pax</command> <arg choice='plain'>-r </arg>
<arg choice='opt'>-cdiknuv </arg>
<group choice='opt'><arg choice='plain'>-H </arg><arg choice='plain'>-L </arg></group>
<arg choice='opt'>-f <replaceable>archive</replaceable></arg>
<arg choice='opt' rep='repeat'>-o <replaceable>options</replaceable></arg>
<arg choice='opt' rep='repeat'>-p <replaceable>string</replaceable></arg>
<sbr/>
<arg choice='opt' rep='repeat'>-s <replaceable>replstr</replaceable></arg>
<arg choice='opt' rep='repeat'><replaceable>pattern</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>pax</command> <arg choice='plain'>-w </arg>
<arg choice='opt'>-dituvX </arg>
<group choice='opt'><arg choice='plain'>-H </arg><arg choice='plain'>-L </arg></group>
<arg choice='opt'>-b <replaceable>blksize</replaceable></arg>
<arg choice='opt'>-a </arg>
<arg choice='opt'>-f <replaceable>archive</replaceable></arg>
<arg choice='opt' rep='repeat'>-o <replaceable>options</replaceable></arg>
<sbr/>
<arg choice='opt' rep='repeat'>-s <replaceable>replstr</replaceable></arg>
<arg choice='opt'>-x <replaceable>format</replaceable></arg>
<arg choice='opt' rep='repeat'><replaceable>file</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>pax</command> <arg choice='plain'>-r </arg>
<arg choice='plain'>-w </arg>
<arg choice='opt'>-diklntuvX </arg>
<group choice='opt'><arg choice='plain'>-H </arg><arg choice='plain'>-L </arg></group>
<arg choice='opt' rep='repeat'>-p <replaceable>string</replaceable></arg>
<arg choice='opt' rep='repeat'>-s <replaceable>replstr</replaceable></arg>
<sbr/>
<arg choice='opt' rep='repeat'><replaceable>file</replaceable></arg>
<arg choice='plain'><replaceable>directory</replaceable></arg>
<sbr/>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1 id='description'><title>DESCRIPTION</title>
<para>The <command>pax</command> utility shall read, write, and write lists of the members
of archive files and copy directory hierarchies. A
variety of archive formats shall be supported; see the <emphasis role='strong' remap='B'>-x</emphasis> <emphasis remap='I'>format</emphasis>
option.</para>
<para>The action to be taken depends on the presence of the <emphasis role='strong' remap='B'>-r</emphasis> and
<emphasis role='strong' remap='B'>-w</emphasis> options. The four combinations of <emphasis role='strong' remap='B'>-r</emphasis> and
<emphasis role='strong' remap='B'>-w</emphasis> are referred to as the four modes of operation: <emphasis role='strong' remap='B'>list</emphasis>,
<emphasis role='strong' remap='B'>read</emphasis>, <emphasis role='strong' remap='B'>write</emphasis>, and <emphasis role='strong' remap='B'>copy</emphasis> modes,
corresponding respectively to the four forms shown in the SYNOPSIS
section.</para>
<variablelist remap='TP'>
<varlistentry>
<term><emphasis role='strong' remap='B'>list</emphasis></term>
<listitem>
<para>In <emphasis role='strong' remap='B'>list</emphasis> mode (when neither <emphasis role='strong' remap='B'>-r</emphasis> nor <emphasis role='strong' remap='B'>-w</emphasis> are specified),
<command>pax</command> shall write the names of the members of
the archive file read from the standard input, with pathnames matching
the specified patterns, to standard output. If a named file
is of type directory, the file hierarchy rooted at that file shall
be listed as well.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>read</emphasis></term>
<listitem>
<para>In <emphasis role='strong' remap='B'>read</emphasis> mode (when <emphasis role='strong' remap='B'>-r</emphasis> is specified, but <emphasis role='strong' remap='B'>-w</emphasis> is not),
<command>pax</command> shall extract the members of the archive
file read from the standard input, with pathnames matching the specified
patterns. If an extracted file is of type directory, the
file hierarchy rooted at that file shall be extracted as well. The
extracted files shall be created performing pathname resolution
with the directory in which <command>pax</command> was invoked as the current working
directory.</para>
</listitem>
</varlistentry>
</variablelist>
<para>If an attempt is made to extract a directory when the directory already
exists, this shall not be considered an error. If an
attempt is made to extract a FIFO when the FIFO already exists, this
shall not be considered an error.</para>
<para>The ownership, access, and modification times, and file mode of the
restored files are discussed under the <emphasis role='strong' remap='B'>-p</emphasis> option.</para>
<variablelist remap='TP'>
<varlistentry>
<term><emphasis role='strong' remap='B'>write</emphasis></term>
<listitem>
<para>In <emphasis role='strong' remap='B'>write</emphasis> mode (when <emphasis role='strong' remap='B'>-w</emphasis> is specified, but <emphasis role='strong' remap='B'>-r</emphasis> is not),
<command>pax</command> shall write the contents of the
<emphasis remap='I'>file</emphasis> operands to the standard output in an archive format. If
no <emphasis remap='I'>file</emphasis> operands are specified, a list of files to
copy, one per line, shall be read from the standard input. A file
of type directory shall include all of the files in the file
hierarchy rooted at the file.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>copy</emphasis></term>
<listitem>
<para>In <emphasis role='strong' remap='B'>copy</emphasis> mode (when both <emphasis role='strong' remap='B'>-r</emphasis> and <emphasis role='strong' remap='B'>-w</emphasis> are specified),
<command>pax</command> shall copy the <emphasis remap='I'>file</emphasis> operands to the
destination directory.</para>
</listitem>
</varlistentry>
</variablelist>
<para>If no <emphasis remap='I'>file</emphasis> operands are specified, a list of files to copy,
one per line, shall be read from the standard input. A file
of type directory shall include all of the files in the file hierarchy
rooted at the file.</para>
<para>The effect of the <emphasis role='strong' remap='B'>copy</emphasis> shall be as if the copied files were
written to an archive file and then subsequently extracted,
except that there may be hard links between the original and the copied
files. If the destination directory is a subdirectory of
one of the files to be copied, the results are unspecified. If the
destination directory is a file of a type not defined by the
System Interfaces volume of IEEE Std 1003.1-2001, the results are
implementation-defined; otherwise, it shall be an error
for the file named by the <emphasis remap='I'>directory</emphasis> operand not to exist, not
be writable by the user, or not be a file of type
directory.</para>
<para>In <emphasis role='strong' remap='B'>read</emphasis> or <emphasis role='strong' remap='B'>copy</emphasis> modes, if intermediate directories are
necessary to extract an archive member, <command>pax</command> shall
perform actions equivalent to the <emphasis remap='I'>mkdir</emphasis>() function defined in
the System Interfaces
volume of IEEE Std 1003.1-2001, called with the following arguments:</para>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>The intermediate directory used as the <emphasis remap='I'>path</emphasis> argument</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>The value of the bitwise-inclusive OR of S_IRWXU, S_IRWXG, and S_IRWXO
as the <emphasis remap='I'>mode</emphasis> argument</para>
</listitem>
</varlistentry>
</variablelist>
<para>If any specified <emphasis remap='I'>pattern</emphasis> or <emphasis remap='I'>file</emphasis> operands are not matched
by at least one file or archive member, <command>pax</command> shall
write a diagnostic message to standard error for each one that did
not match and exit with a non-zero exit status.</para>
<para>The archive formats described in the EXTENDED DESCRIPTION section
shall be automatically detected on input. The default output
archive format shall be implementation-defined.</para>
<para>A single archive can span multiple files. The <command>pax</command> utility shall
determine, in an implementation-defined manner, what file
to read or write as the next file.</para>
<para>If the selected archive format supports the specification of linked
files, it shall be an error if these files cannot be linked
when the archive is extracted. For archive formats that do not store
file contents with each name that causes a hard link, if the
file that contains the data is not extracted during this <command>pax</command>
session, either the data shall be restored from the original
file, or a diagnostic message shall be displayed with the name of
a file that can be used to extract the data. In traversing
directories, <command>pax</command> shall detect infinite loops; that is, entering
a previously visited directory that is an ancestor of the
last file visited. When it detects an infinite loop, <command>pax</command> shall
write a diagnostic message to standard error and shall
terminate.</para>
</refsect1>
<refsect1 id='options'><title>OPTIONS</title>
<para>The <command>pax</command> utility shall conform to the Base Definitions volume
of IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines,
except that the order of presentation of the
<emphasis role='strong' remap='B'>-o</emphasis>, <emphasis role='strong' remap='B'>-p</emphasis>, and <emphasis role='strong' remap='B'>-s</emphasis> options is significant.</para>
<para>The following options shall be supported:</para>
<variablelist remap='TP'>
<varlistentry>
<term><emphasis role='strong' remap='B'>-r</emphasis></term>
<listitem>
<para>Read an archive file from standard input.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>-w</emphasis></term>
<listitem>
<para>Write files to the standard output in the specified archive format.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>-a</emphasis></term>
<listitem>
<para>Append files to the end of the archive. It is implementation-defined
which devices on the system support appending. Additional
file formats unspecified by this volume of IEEE Std 1003.1-2001
may impose restrictions on appending.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>-b </emphasis> <emphasis remap='I'>blocksize</emphasis></term>
<listitem>
<para>Block the output at a positive decimal integer number of bytes per
write to the archive file. Devices and archive formats may
impose restrictions on blocking. Blocking shall be automatically determined
on input. Conforming applications shall not specify a
<emphasis remap='I'>blocksize</emphasis> value larger than 32256. Default blocking when creating
archives depends on the archive format. (See the <emphasis role='strong' remap='B'>-x</emphasis>
option below.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>-c</emphasis></term>
<listitem>
<para>Match all file or archive members except those specified by the <emphasis remap='I'>pattern</emphasis>
or <emphasis remap='I'>file</emphasis> operands.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>-d</emphasis></term>
<listitem>
<para>Cause files of type directory being copied or archived or archive
members of type directory being extracted or listed to match
only the file or archive member itself and not the file hierarchy
rooted at the file.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>-f </emphasis> <emphasis remap='I'>archive</emphasis></term>
<listitem>
<para>Specify the pathname of the input or output archive, overriding the
default standard input (in <emphasis role='strong' remap='B'>list</emphasis> or <emphasis role='strong' remap='B'>read</emphasis>
modes) or standard output ( <emphasis role='strong' remap='B'>write</emphasis> mode).</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>-H</emphasis></term>
<listitem>
<para>If a symbolic link referencing a file of type directory is specified
on the command line, <command>pax</command> shall archive the file
hierarchy rooted in the file referenced by the link, using the name
of the link as the root of the file hierarchy. Otherwise, if a
symbolic link referencing a file of any other file type which <command>pax</command>
can normally archive is specified on the command line,
then <command>pax</command> shall archive the file referenced by the link, using
the name of the link. The default behavior shall be to archive
the symbolic link itself.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>-i</emphasis></term>
<listitem>
<para>Interactively rename files or archive members. For each archive member
matching a <emphasis remap='I'>pattern</emphasis> operand or file matching a
<emphasis remap='I'>file</emphasis> operand, a prompt shall be written to the file <emphasis role='strong' remap='B'>/dev/tty</emphasis>.
The prompt shall contain the name of the file or
archive member, but the format is otherwise unspecified. A line shall
then be read from <emphasis role='strong' remap='B'>/dev/tty</emphasis>. If this line is blank, the
file or archive member shall be skipped. If this line consists of
a single period, the file or archive member shall be processed
with no modification to its name. Otherwise, its name shall be replaced
with the contents of the line. The <command>pax</command> utility shall
immediately exit with a non-zero exit status if end-of-file is encountered
when reading a response or if <emphasis role='strong' remap='B'>/dev/tty</emphasis> cannot be
opened for reading and writing.</para>
</listitem>
</varlistentry>
</variablelist>
<para>The results of extracting a hard link to a file that has been renamed
during extraction are unspecified.</para>
<variablelist remap='TP'>
<varlistentry>
<term><emphasis role='strong' remap='B'>-k</emphasis></term>
<listitem>
<para>Prevent the overwriting of existing files.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>-l</emphasis></term>
<listitem>
<para>(The letter ell.) In <emphasis role='strong' remap='B'>copy</emphasis> mode, hard links shall be made between
the source and destination file hierarchies whenever
possible. If specified in conjunction with <emphasis role='strong' remap='B'>-H</emphasis> or <emphasis role='strong' remap='B'>-L</emphasis>, when
a symbolic link is encountered, the hard link created in
the destination file hierarchy shall be to the file referenced by
the symbolic link. If specified when neither <emphasis role='strong' remap='B'>-H</emphasis> nor
<emphasis role='strong' remap='B'>-L</emphasis> is specified, when a symbolic link is encountered, the implementation
shall create a hard link to the symbolic link in
the source file hierarchy or copy the symbolic link to the destination.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>-L</emphasis></term>
<listitem>
<para>If a symbolic link referencing a file of type directory is specified
on the command line or encountered during the traversal of
a file hierarchy, <command>pax</command> shall archive the file hierarchy rooted
in the file referenced by the link, using the name of the link
as the root of the file hierarchy. Otherwise, if a symbolic link referencing
a file of any other file type which <command>pax</command> can
normally archive is specified on the command line or encountered during
the traversal of a file hierarchy, <command>pax</command> shall archive
the file referenced by the link, using the name of the link. The default
behavior shall be to archive the symbolic link
itself.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>-n</emphasis></term>
<listitem>
<para>Select the first archive member that matches each <emphasis remap='I'>pattern</emphasis> operand.
No more than one archive member shall be matched for
each pattern (although members of type directory shall still match
the file hierarchy rooted at that file).</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>-o </emphasis> <emphasis remap='I'>options</emphasis></term>
<listitem>
<para>Provide information to the implementation to modify the algorithm
for extracting or writing files. The value of <emphasis remap='I'>options</emphasis>
shall consist of one or more comma-separated keywords of the form:</para>
<literallayout remap='.nf'>
<emphasis remap='I'>keyword</emphasis><emphasis role='strong' remap='B'>[[</emphasis><emphasis role='strong' remap='B'>:</emphasis><emphasis role='strong' remap='B'>]</emphasis><emphasis role='strong' remap='B'>=</emphasis><emphasis remap='I'>value</emphasis><emphasis role='strong' remap='B'>][</emphasis><emphasis role='strong' remap='B'>,</emphasis><emphasis remap='I'>keyword</emphasis><emphasis role='strong' remap='B'>[[</emphasis><emphasis role='strong' remap='B'>:</emphasis><emphasis role='strong' remap='B'>]</emphasis><emphasis role='strong' remap='B'>=</emphasis><emphasis remap='I'>value</emphasis><emphasis role='strong' remap='B'>]</emphasis><emphasis role='strong' remap='B'>, ...</emphasis><emphasis role='strong' remap='B'>]</emphasis>
</literallayout> <!-- .fi -->
</listitem>
</varlistentry>
</variablelist>
<para>Some keywords apply only to certain file formats, as indicated with
each description. Use of keywords that are inapplicable to
the file format being processed produces undefined results.</para>
<para>Keywords in the <emphasis remap='I'>options</emphasis> argument shall be a string that would
be a valid portable filename as described in the Base
Definitions volume of IEEE Std 1003.1-2001, Section 3.276, Portable
Filename Character Set.</para>
<variablelist remap='TP'>
<varlistentry>
<term><emphasis role='strong' remap='B'>Note:</emphasis></term>
<listitem>
<blockquote remap='RS'>
<para>Keywords are not expected to be filenames, merely to follow the same
character composition rules as portable filenames.
</para></blockquote> <!-- remap='RE' -->
</listitem>
</varlistentry>
</variablelist>
<para>Keywords can be preceded with white space. The <emphasis remap='I'>value</emphasis> field shall
consist of zero or more characters; within <emphasis remap='I'>value</emphasis>,
the application shall precede any literal comma with a backslash,
which shall be ignored, but preserves the comma as part of
<emphasis remap='I'>value</emphasis>. A comma as the final character, or a comma followed solely
by white space as the final characters, in <emphasis remap='I'>options</emphasis>
shall be ignored. Multiple <emphasis role='strong' remap='B'>-o</emphasis> options can be specified; if keywords
given to these multiple <emphasis role='strong' remap='B'>-o</emphasis> options conflict, the
keywords and values appearing later in command line sequence shall
take precedence and the earlier shall be silently ignored. The
following keyword values of <emphasis remap='I'>options</emphasis> shall be supported for the
file formats as indicated:</para>
<variablelist remap='TP'>
<varlistentry>
<term><emphasis role='strong' remap='B'>delete</emphasis>=<emphasis remap='I'>pattern</emphasis></term>
<listitem>
<blockquote remap='RS'>
<para>(Applicable only to the <emphasis role='strong' remap='B'>-x</emphasis> <emphasis role='strong' remap='B'>pax</emphasis> format.) When used in <emphasis role='strong' remap='B'>write</emphasis>
or <emphasis role='strong' remap='B'>copy</emphasis> mode, <command>pax</command> shall omit from
extended header records that it produces any keywords matching the
string pattern. When used in <emphasis role='strong' remap='B'>read</emphasis> or <emphasis role='strong' remap='B'>list</emphasis> mode,
<command>pax</command> shall ignore any keywords matching the string pattern in
the extended header records. In both cases, matching shall be
performed using the pattern matching notation described in <emphasis remap='I'>Patterns
Matching a Single
Character</emphasis> and <emphasis remap='I'>Patterns Matching Multiple Characters</emphasis> . For
example:</para>
<literallayout remap='.nf'>
<emphasis role='strong' remap='B'>-o</emphasis> <emphasis role='strong' remap='B'>delete</emphasis><emphasis role='strong' remap='B'>=</emphasis><emphasis remap='I'>security</emphasis><emphasis role='strong' remap='B'>.*
</emphasis>
</literallayout> <!-- .fi -->
<para>would suppress security-related information. See pax Extended Header
for extended header record
keyword usage.
</para></blockquote> <!-- remap='RE' -->
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>exthdr.name</emphasis>=<emphasis remap='I'>string</emphasis></term>
<listitem>
<blockquote remap='RS'>
<para>(Applicable only to the <emphasis role='strong' remap='B'>-x</emphasis> <emphasis role='strong' remap='B'>pax</emphasis> format.) This keyword allows
user control over the name that is written into the
<emphasis role='strong' remap='B'>ustar</emphasis> header blocks for the extended header produced under the
circumstances described in pax
Header Block . The name shall be the contents of <emphasis remap='I'>string</emphasis>, after
the following character substitutions have been made:</para>
<informaltable pgwide='0' frame='none'>
<tgroup cols='6' align='center'>
<colspec colname='c1'/>
<colspec colname='c2'/>
<colspec colname='c3'/>
<colspec colname='c4'/>
<colspec colname='c5'/>
<colspec colname='c6'/>
<tbody>
<row>
<entry align='center'><emphasis role='strong' remap='B'></emphasis><emphasis remap='I'>string</emphasis><emphasis role='strong' remap='P->B'></emphasis></entry>
<entry align='right'><!-- na -->
<para><emphasis role='strong' remap='B'> </emphasis>
<!-- ad --></para></entry>
</row>
<row>
<entry align='center'><emphasis role='strong' remap='B'>Includes:</emphasis></entry>
<entry align='right'><!-- na -->
<emphasis role='strong' remap='B'>Replaced By:</emphasis>
<!-- ad --></entry>
</row>
<row>
<entry align='center'>%d</entry>
<entry align='right'><!-- na -->
The directory name of the file, equivalent to the result of the <emphasis remap='I'>dirname</emphasis> utility on the translated pathname.
<!-- ad --></entry>
</row>
<row>
<entry align='center'>%f</entry>
<entry align='right'><!-- na -->
The filename of the file, equivalent to the result of the <emphasis remap='I'>basename</emphasis> utility on the translated pathname.
<!-- ad --></entry>
</row>
<row>
<entry align='center'>%p</entry>
<entry align='right'><!-- na -->
The process ID of the <command>pax</command> process.
<!-- ad --></entry>
</row>
<row>
<entry align='center'>%%</entry>
<entry align='right'><!-- na -->
A <emphasis role='strong' remap='B'>'%'</emphasis> character.
<!-- ad --></entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>Any other <emphasis role='strong' remap='B'>'%'</emphasis> characters in <emphasis remap='I'>string</emphasis> produce undefined results.</para>
<para>If no <emphasis role='strong' remap='B'>-o</emphasis> <emphasis role='strong' remap='B'>exthdr.name=</emphasis> <emphasis remap='I'>string</emphasis> is specified, <command>pax</command>
shall use the following default value:</para>
<literallayout remap='.nf'>
<emphasis role='strong' remap='B'>%d/PaxHeaders.%p/%f
</emphasis>
</literallayout> <!-- .fi -->
</blockquote> <!-- remap='RE' -->
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>globexthdr.name</emphasis>=<emphasis remap='I'>string</emphasis></term>
<listitem>
<blockquote remap='RS'>
<para>(Applicable only to the <emphasis role='strong' remap='B'>-x</emphasis> <emphasis role='strong' remap='B'>pax</emphasis> format.) When used in <emphasis role='strong' remap='B'>write</emphasis>
or <emphasis role='strong' remap='B'>copy</emphasis> mode with the appropriate options,
<command>pax</command> shall create global extended header records with <emphasis role='strong' remap='B'>ustar</emphasis>
header blocks that will be treated as regular files by
previous versions of <command>pax</command>. This keyword allows user control over
the name that is written into the <emphasis role='strong' remap='B'>ustar</emphasis> header blocks
for global extended header records. The name shall be the contents
of string, after the following character substitutions have been
made:</para>
<informaltable pgwide='0' frame='none'>
<tgroup cols='6' align='center'>
<colspec colname='c1'/>
<colspec colname='c2'/>
<colspec colname='c3'/>
<colspec colname='c4'/>
<colspec colname='c5'/>
<colspec colname='c6'/>
<tbody>
<row>
<entry align='center'><emphasis role='strong' remap='B'></emphasis><emphasis remap='I'>string</emphasis><emphasis role='strong' remap='P->B'></emphasis></entry>
<entry align='right'><!-- na -->
<para><emphasis role='strong' remap='B'> </emphasis>
<!-- ad --></para></entry>
</row>
<row>
<entry align='center'><emphasis role='strong' remap='B'>Includes:</emphasis></entry>
<entry align='right'><!-- na -->
<emphasis role='strong' remap='B'>Replaced By:</emphasis>
<!-- ad --></entry>
</row>
<row>
<entry align='center'>%n</entry>
<entry align='right'><!-- na -->
An integer that represents the sequence number of the global extended header record in the archive, starting at 1.
<!-- ad --></entry>
</row>
<row>
<entry align='center'>%p</entry>
<entry align='right'><!-- na -->
The process ID of the <command>pax</command> process.
<!-- ad --></entry>
</row>
<row>
<entry align='center'>%%</entry>
<entry align='right'><!-- na -->
A <emphasis role='strong' remap='B'>'%'</emphasis> character.
<!-- ad --></entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>Any other <emphasis role='strong' remap='B'>'%'</emphasis> characters in <emphasis remap='I'>string</emphasis> produce undefined results.</para>
<para>If no <emphasis role='strong' remap='B'>-o</emphasis> <emphasis role='strong' remap='B'>globexthdr.name=</emphasis> <emphasis remap='I'>string</emphasis> is specified, <command>pax</command>
shall use the following default value:</para>
<literallayout remap='.nf'>
<emphasis role='strong' remap='B'>$TMPDIR/GlobalHead.%p.%n
</emphasis>
</literallayout> <!-- .fi -->
<para>where $ <envar>TMPDIR</envar> represents the value of the <envar>TMPDIR</envar> environment
variable. If <envar>TMPDIR</envar> is not set, <command>pax</command>
shall use <emphasis role='strong' remap='B'>/tmp</emphasis>.
</para></blockquote> <!-- remap='RE' -->
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>invalid</emphasis>=<emphasis remap='I'>action</emphasis></term>
<listitem>
<blockquote remap='RS'>
<para>(Applicable only to the <emphasis role='strong' remap='B'>-x</emphasis> <emphasis role='strong' remap='B'>pax</emphasis> format.) This keyword allows
user control over the action <command>pax</command> takes upon
encountering values in an extended header record that, in <emphasis role='strong' remap='B'>read</emphasis>
or <emphasis role='strong' remap='B'>copy</emphasis> mode, are invalid in the destination hierarchy
or, in <emphasis role='strong' remap='B'>list</emphasis> mode, cannot be written in the codeset and current
locale of the implementation. The following are invalid
values that shall be recognized by <command>pax</command>:</para>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>In <emphasis role='strong' remap='B'>read</emphasis> or <emphasis role='strong' remap='B'>copy</emphasis> mode, a filename or link name that contains
character encodings invalid in the destination
hierarchy. (For example, the name may contain embedded NULs.)</para>
</listitem>
</varlistentry>
</variablelist>
</blockquote>
</listitem>
</varlistentry>
</variablelist>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>In <emphasis role='strong' remap='B'>read</emphasis> or <emphasis role='strong' remap='B'>copy</emphasis> mode, a filename or link name that is
longer than the maximum allowed in the destination hierarchy
(for either a pathname component or the entire pathname).</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>In <emphasis role='strong' remap='B'>list</emphasis> mode, any character string value (filename, link name,
user name, and so on) that cannot be written in the
codeset and current locale of the implementation.</para>
</listitem>
</varlistentry>
</variablelist>
<para>The following mutually-exclusive values of the <emphasis remap='I'>action</emphasis> argument
are supported:</para>
<variablelist remap='TP'>
<varlistentry>
<term><emphasis role='strong' remap='B'>bypass</emphasis></term>
<listitem>
<blockquote remap='RS'>
<para>In <emphasis role='strong' remap='B'>read</emphasis> or <emphasis role='strong' remap='B'>copy</emphasis> mode, <command>pax</command> shall bypass the file,
causing no change to the destination hierarchy. In
<emphasis role='strong' remap='B'>list</emphasis> mode, <command>pax</command> shall write all requested valid values
for the file, but its method for writing invalid values is
unspecified.
</para></blockquote> <!-- remap='RE' -->
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>rename</emphasis></term>
<listitem>
<blockquote remap='RS'>
<para>In <emphasis role='strong' remap='B'>read</emphasis> or <emphasis role='strong' remap='B'>copy</emphasis> mode, <command>pax</command> shall act as if the <emphasis role='strong' remap='B'>-i</emphasis>
option were in effect for each file with invalid
filename or link name values, allowing the user to provide a replacement
name interactively. In <emphasis role='strong' remap='B'>list</emphasis> mode, <command>pax</command> shall
behave identically to the <emphasis role='strong' remap='B'>bypass</emphasis> action.
</para></blockquote> <!-- remap='RE' -->
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>UTF-8</emphasis></term>
<listitem>
<blockquote remap='RS'>
<para>When used in <emphasis role='strong' remap='B'>read</emphasis>, <emphasis role='strong' remap='B'>copy</emphasis>, or <emphasis role='strong' remap='B'>list</emphasis> mode and a filename,
link name, owner name, or any other field in an
extended header record cannot be translated from the <emphasis role='strong' remap='B'>pax</emphasis> UTF-8
codeset format to the codeset and current locale of the
implementation, <command>pax</command> shall use the actual UTF-8 encoding for
the name.
</para></blockquote> <!-- remap='RE' -->
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>write</emphasis></term>
<listitem>
<blockquote remap='RS'>
<para>In <emphasis role='strong' remap='B'>read</emphasis> or <emphasis role='strong' remap='B'>copy</emphasis> mode, <command>pax</command> shall write the file,
translating or truncating the name, regardless of whether
this may overwrite an existing file with a valid name. In <emphasis role='strong' remap='B'>list</emphasis>
mode, <command>pax</command> shall behave identically to the
<emphasis role='strong' remap='B'>bypass</emphasis> action.
</para></blockquote> <!-- remap='RE' -->
</listitem>
</varlistentry>
</variablelist>
<para>If no <emphasis role='strong' remap='B'>-o</emphasis> <emphasis role='strong' remap='B'>invalid=</emphasis> option is specified, <command>pax</command> shall
act as if <emphasis role='strong' remap='B'>-o</emphasis> <emphasis role='strong' remap='B'>invalid=</emphasis> <emphasis role='strong' remap='B'>bypass</emphasis> were
specified. Any overwriting of existing files that may be allowed by
the <emphasis role='strong' remap='B'>-o</emphasis> <emphasis role='strong' remap='B'>invalid=</emphasis> actions shall be subject to
permission ( <emphasis role='strong' remap='B'>-p</emphasis>) and modification time ( <emphasis role='strong' remap='B'>-u</emphasis>) restrictions,
and shall be suppressed if the <emphasis role='strong' remap='B'>-k</emphasis> option is also
specified.</para>
<variablelist remap='TP'>
<varlistentry>
<term><emphasis role='strong' remap='B'>linkdata</emphasis></term>
<listitem>
<blockquote remap='RS'>
<para>(Applicable only to the <emphasis role='strong' remap='B'>-x</emphasis> <emphasis role='strong' remap='B'>pax</emphasis> format.) In <emphasis role='strong' remap='B'>write</emphasis>
mode, <command>pax</command> shall write the contents of a file to the
archive even when that file is merely a hard link to a file whose
contents have already been written to the archive.
</para></blockquote> <!-- remap='RE' -->
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>listopt</emphasis>=<emphasis remap='I'>format</emphasis></term>
<listitem>
<blockquote remap='RS'>
<para>This keyword specifies the output format of the table of contents
produced when the <emphasis role='strong' remap='B'>-v</emphasis> option is specified in <emphasis role='strong' remap='B'>list</emphasis>
mode. See List Mode Format Specifications . To avoid ambiguity, the
<emphasis role='strong' remap='B'>listopt=</emphasis> <emphasis remap='I'>format</emphasis>
shall be the only or final <emphasis role='strong' remap='B'>keyword=</emphasis> <emphasis remap='I'>value</emphasis> pair in a <emphasis role='strong' remap='B'>-o</emphasis>
option-argument; all characters in the remainder of the
option-argument shall be considered part of the format string. When
multiple <emphasis role='strong' remap='B'>-o</emphasis> <emphasis role='strong' remap='B'>listopt=</emphasis> <emphasis remap='I'>format</emphasis> options are
specified, the format strings shall be considered a single, concatenated
string, evaluated in command line order.
</para></blockquote> <!-- remap='RE' -->
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>times</emphasis></term>
<listitem>
<blockquote remap='RS'>
<para>(Applicable only to the <emphasis role='strong' remap='B'>-x</emphasis> <command>pax</command> format.) When used in <emphasis role='strong' remap='B'>write</emphasis>
or <emphasis role='strong' remap='B'>copy</emphasis> mode, <command>pax</command> shall include
<emphasis role='strong' remap='B'>atime</emphasis>, <emphasis role='strong' remap='B'>ctime</emphasis>, and <emphasis role='strong' remap='B'>mtime</emphasis> extended header records
for each file. See pax Extended
Header File Times .
</para></blockquote> <!-- remap='RE' -->
</listitem>
</varlistentry>
</variablelist>
<para>In addition to these keywords, if the <emphasis role='strong' remap='B'>-x</emphasis> <command>pax</command> format is
specified, any of the keywords and values defined in pax Extended
Header , including implementation extensions, can be used in <emphasis role='strong' remap='B'>-o</emphasis>
option-arguments,
in either of two modes:</para>
<variablelist remap='TP'>
<varlistentry>
<term><emphasis role='strong' remap='B'>keyword</emphasis>=<emphasis remap='I'>value</emphasis></term>
<listitem>
<blockquote remap='RS'>
<para>When used in <emphasis role='strong' remap='B'>write</emphasis> or <emphasis role='strong' remap='B'>copy</emphasis> mode, these keyword/value pairs
shall be included at the beginning of the archive as
<emphasis role='strong' remap='B'>typeflag</emphasis> <emphasis role='strong' remap='B'>g</emphasis> global extended header records. When used in
<emphasis role='strong' remap='B'>read</emphasis> or <emphasis role='strong' remap='B'>list</emphasis> mode, these keyword/value pairs
shall act as if they had been at the beginning of the archive as <emphasis role='strong' remap='B'>typeflag</emphasis>
<emphasis role='strong' remap='B'>g</emphasis> global extended header records.
</para></blockquote> <!-- remap='RE' -->
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>keyword</emphasis>:=<emphasis remap='I'>value</emphasis></term>
<listitem>
<blockquote remap='RS'>
<para>When used in <emphasis role='strong' remap='B'>write</emphasis> or <emphasis role='strong' remap='B'>copy</emphasis> mode, these keyword/value pairs
shall be included as records at the beginning of a
<emphasis role='strong' remap='B'>typeflag</emphasis> <emphasis role='strong' remap='B'>x</emphasis> extended header for each file. (This shall
be equivalent to the equal-sign form except that it creates no
<emphasis role='strong' remap='B'>typeflag</emphasis> <emphasis role='strong' remap='B'>g</emphasis> global extended header records.) When used
in <emphasis role='strong' remap='B'>read</emphasis> or <emphasis role='strong' remap='B'>list</emphasis> mode, these keyword/value pairs
shall act as if they were included as records at the end of each extended
header; thus, they shall override any global or
file-specific extended header record keywords of the same names. For
example, in the command:</para>
<literallayout remap='.nf'>
<emphasis role='strong' remap='B'>pax -r -o "
gname:=mygroup,
" <archive
</emphasis>
</literallayout> <!-- .fi -->
<para>the group name will be forced to a new value for all files read from
the archive.
</para></blockquote> <!-- remap='RE' -->
</listitem>
</varlistentry>
</variablelist>
<para>The precedence of <emphasis role='strong' remap='B'>-o</emphasis> keywords over various fields in the archive
is described in pax Extended
Header Keyword Precedence .</para>
<variablelist remap='TP'>
<varlistentry>
<term><emphasis role='strong' remap='B'>-p </emphasis> <emphasis remap='I'>string</emphasis></term>
<listitem>
<para>Specify one or more file characteristic options (privileges). The
<emphasis remap='I'>string</emphasis> option-argument shall be a string specifying
file characteristics to be retained or discarded on extraction. The
string shall consist of the specification characters <emphasis role='strong' remap='B'>a</emphasis>
, <emphasis role='strong' remap='B'>e</emphasis> , <emphasis role='strong' remap='B'>m</emphasis> , <emphasis role='strong' remap='B'>o</emphasis> , and <emphasis role='strong' remap='B'>p</emphasis> . Other implementation-defined
characters can be included. Multiple
characteristics can be concatenated within the same string and multiple
<emphasis role='strong' remap='B'>-p</emphasis> options can be specified. The meaning of the
specification characters are as follows:</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>a</emphasis></term>
<listitem>
<blockquote remap='RS'>
<para>Do not preserve file access times.
</para></blockquote> <!-- remap='RE' -->
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>e</emphasis></term>
<listitem>
<blockquote remap='RS'>
<para>Preserve the user ID, group ID, file mode bits (see the Base Definitions
volume of IEEE Std 1003.1-2001, Section 3.168, File Mode Bits),
access time, modification time, and any other
implementation-defined file characteristics.
</para></blockquote> <!-- remap='RE' -->
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>m</emphasis></term>
<listitem>
<blockquote remap='RS'>
<para>Do not preserve file modification times.
</para></blockquote> <!-- remap='RE' -->
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>o</emphasis></term>
<listitem>
<blockquote remap='RS'>
<para>Preserve the user ID and group ID.
</para></blockquote> <!-- remap='RE' -->
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>p</emphasis></term>
<listitem>
<blockquote remap='RS'>
<para>Preserve the file mode bits. Other implementation-defined file mode
attributes may be preserved.
</para></blockquote> <!-- remap='RE' -->
</listitem>
</varlistentry>
</variablelist>
<para>In the preceding list, "preserve" indicates that an attribute stored
in the archive shall be given to the extracted file,
subject to the permissions of the invoking process. The access and
modification times of the file shall be preserved unless
otherwise specified with the <emphasis role='strong' remap='B'>-p</emphasis> option or not stored in the
archive. All attributes that are not preserved shall be
determined as part of the normal file creation action (see <emphasis remap='I'>File
Read, Write, and
Creation</emphasis> ).</para>
<para>If neither the <emphasis role='strong' remap='B'>e</emphasis> nor the <emphasis role='strong' remap='B'>o</emphasis> specification character is
specified, or the user ID and group ID are not preserved
for any reason, <command>pax</command> shall not set the S_ISUID and S_ISGID bits
of the file mode.</para>
<para>If the preservation of any of these items fails for any reason, <command>pax</command>
shall write a diagnostic message to standard error.
Failure to preserve these items shall affect the final exit status,
but shall not cause the extracted file to be deleted.</para>
<para>If file characteristic letters in any of the <emphasis remap='I'>string</emphasis> option-arguments
are duplicated or conflict with each other, the ones
given last shall take precedence. For example, if <emphasis role='strong' remap='B'>-p</emphasis> <emphasis role='strong' remap='B'>eme</emphasis>
is specified, file modification times are preserved.</para>
<variablelist remap='TP'>
<varlistentry>
<term><emphasis role='strong' remap='B'>-s </emphasis> <emphasis remap='I'>replstr</emphasis></term>
<listitem>
<para>Modify file or archive member names named by <emphasis remap='I'>pattern</emphasis> or <emphasis remap='I'>file</emphasis>
operands according to the substitution expression
<emphasis remap='I'>replstr</emphasis>, using the syntax of the <emphasis remap='I'>ed</emphasis> utility. The concepts
of "address" and
"line" are meaningless in the context of the <command>pax</command> utility, and
shall not be supplied. The format shall be:</para>
<literallayout remap='.nf'>
<emphasis role='strong' remap='B'>-s /</emphasis><emphasis remap='I'>old</emphasis><emphasis role='strong' remap='B'>/</emphasis><emphasis remap='I'>new</emphasis><emphasis role='strong' remap='B'>/</emphasis><emphasis role='strong' remap='B'>[</emphasis><emphasis role='strong' remap='B'>gp</emphasis><emphasis role='strong' remap='B'>]</emphasis>
</literallayout> <!-- .fi -->
</listitem>
</varlistentry>
</variablelist>
<para>where as in <emphasis remap='I'>ed</emphasis>, <emphasis remap='I'>old</emphasis> is a basic regular expression and
<emphasis remap='I'>new</emphasis> can contain an
ampersand, <emphasis role='strong' remap='B'>'\n'</emphasis> (where <emphasis remap='I'>n</emphasis> is a digit) backreferences,
or subexpression matching. The <emphasis remap='I'>old</emphasis> string shall also be
permitted to contain <newline>s.</para>
<para>Any non-null character can be used as a delimiter ( <emphasis role='strong' remap='B'>'/'</emphasis> shown
here). Multiple <emphasis role='strong' remap='B'>-s</emphasis> expressions can be specified;
the expressions shall be applied in the order specified, terminating
with the first successful substitution. The optional trailing
<emphasis role='strong' remap='B'>'g'</emphasis> is as defined in the <emphasis remap='I'>ed</emphasis> utility. The optional trailing
<emphasis role='strong' remap='B'>'p'</emphasis> shall
cause successful substitutions to be written to standard error. File
or archive member names that substitute to the empty string
shall be ignored when reading and writing archives.</para>
<variablelist remap='TP'>
<varlistentry>
<term><emphasis role='strong' remap='B'>-t</emphasis></term>
<listitem>
<para>When reading files from the file system, and if the user has the permissions
required by <emphasis remap='I'>utime</emphasis>() to do so, set the access time of each file
read to the access time that it had before
being read by <command>pax</command>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>-u</emphasis></term>
<listitem>
<para>Ignore files that are older (having a less recent file modification
time) than a pre-existing file or archive member with the
same name. In <emphasis role='strong' remap='B'>read</emphasis> mode, an archive member with the same name
as a file in the file system shall be extracted if the archive
member is newer than the file. In <emphasis role='strong' remap='B'>write</emphasis> mode, an archive file
member with the same name as a file in the file system shall
be superseded if the file is newer than the archive member. If <emphasis role='strong' remap='B'>-a</emphasis>
is also specified, this is accomplished by appending to
the archive; otherwise, it is unspecified whether this is accomplished
by actual replacement in the archive or by appending to the
archive. In <emphasis role='strong' remap='B'>copy</emphasis> mode, the file in the destination hierarchy
shall be replaced by the file in the source hierarchy or by a
link to the file in the source hierarchy if the file in the source
hierarchy is newer.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>-v</emphasis></term>
<listitem>
<para>In <emphasis role='strong' remap='B'>list</emphasis> mode, produce a verbose table of contents (see the STDOUT
section). Otherwise, write archive member pathnames to
standard error (see the STDERR section).</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>-x </emphasis> <emphasis remap='I'>format</emphasis></term>
<listitem>
<para>Specify the output archive format. The <command>pax</command> utility shall support
the following formats:</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>cpio</emphasis></term>
<listitem>
<blockquote remap='RS'>
<para>The <emphasis role='strong' remap='B'>cpio</emphasis> interchange format; see the EXTENDED DESCRIPTION section.
The default <emphasis remap='I'>blocksize</emphasis> for this format for
character special archive files shall be 5120. Implementations shall
support all <emphasis remap='I'>blocksize</emphasis> values less than or equal to
32256 that are multiples of 512.
</para></blockquote> <!-- remap='RE' -->
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>pax</emphasis></term>
<listitem>
<blockquote remap='RS'>
<para>The <emphasis role='strong' remap='B'>pax</emphasis> interchange format; see the EXTENDED DESCRIPTION section.
The default <emphasis remap='I'>blocksize</emphasis> for this format for
character special archive files shall be 5120. Implementations shall
support all <emphasis remap='I'>blocksize</emphasis> values less than or equal to
32256 that are multiples of 512.
</para></blockquote> <!-- remap='RE' -->
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>ustar</emphasis></term>
<listitem>
<blockquote remap='RS'>
<para>The <emphasis role='strong' remap='B'>tar</emphasis> interchange format; see the EXTENDED DESCRIPTION section.
The default <emphasis remap='I'>blocksize</emphasis> for this format for
character special archive files shall be 10240. Implementations shall
support all <emphasis remap='I'>blocksize</emphasis> values less than or equal to
32256 that are multiples of 512.
</para></blockquote> <!-- remap='RE' -->
</listitem>
</varlistentry>
</variablelist>
<para>Implementation-defined formats shall specify a default block size
as well as any other block sizes supported for character
special archive files.</para>
<para>Any attempt to append to an archive file in a format different from
the existing archive format shall cause <command>pax</command> to exit
immediately with a non-zero exit status.</para>
<para>In <emphasis role='strong' remap='B'>copy</emphasis> mode, if no <emphasis role='strong' remap='B'>-x</emphasis> format is specified, <command>pax</command>
shall behave as if <emphasis role='strong' remap='B'>-x</emphasis> <command>pax</command> were specified.</para>
<variablelist remap='TP'>
<varlistentry>
<term><emphasis role='strong' remap='B'>-X</emphasis></term>
<listitem>
<para>When traversing the file hierarchy specified by a pathname, <command>pax</command>
shall not descend into directories that have a different
device ID ( <emphasis remap='I'>st_dev</emphasis>; see the System Interfaces volume of IEEE Std 1003.1-2001,
<emphasis remap='I'>stat</emphasis>()).</para>
</listitem>
</varlistentry>
</variablelist>
<para>The options that operate on the names of files or archive members
( <emphasis role='strong' remap='B'>-c</emphasis>, <emphasis role='strong' remap='B'>-i</emphasis>, <emphasis role='strong' remap='B'>-n</emphasis>, <emphasis role='strong' remap='B'>-s</emphasis>, <emphasis role='strong' remap='B'>-u</emphasis>, and
<emphasis role='strong' remap='B'>-v</emphasis>) shall interact as follows. In <emphasis role='strong' remap='B'>read</emphasis> mode, the archive
members shall be selected based on the user-specified
<emphasis remap='I'>pattern</emphasis> operands as modified by the <emphasis role='strong' remap='B'>-c</emphasis>, <emphasis role='strong' remap='B'>-n</emphasis>, and
<emphasis role='strong' remap='B'>-u</emphasis> options. Then, any <emphasis role='strong' remap='B'>-s</emphasis> and <emphasis role='strong' remap='B'>-i</emphasis> options
shall modify, in that order, the names of the selected files. The
<emphasis role='strong' remap='B'>-v</emphasis> option shall write names resulting from these
modifications.</para>
<para>In <emphasis role='strong' remap='B'>write</emphasis> mode, the files shall be selected based on the user-specified
pathnames as modified by the <emphasis role='strong' remap='B'>-n</emphasis> and
<emphasis role='strong' remap='B'>-u</emphasis> options. Then, any <emphasis role='strong' remap='B'>-s</emphasis> and <emphasis role='strong' remap='B'>-i</emphasis> options shall modify,
in that order, the names of these selected files. The
<emphasis role='strong' remap='B'>-v</emphasis> option shall write names resulting from these modifications.</para>
<para>If both the <emphasis role='strong' remap='B'>-u</emphasis> and <emphasis role='strong' remap='B'>-n</emphasis> options are specified, <command>pax</command>
shall not consider a file selected unless it is newer than
the file to which it is compared.</para>
<refsect2 id='list_mode_format_specifications'><title>List Mode Format Specifications</title>
<para>In <emphasis role='strong' remap='B'>list</emphasis> mode with the <emphasis role='strong' remap='B'>-o</emphasis> <emphasis role='strong' remap='B'>listopt=</emphasis> <emphasis remap='I'>format</emphasis> option,
the <emphasis remap='I'>format</emphasis> argument shall be applied for
each selected file. The <command>pax</command> utility shall append a <newline>
to the <emphasis role='strong' remap='B'>listopt</emphasis> output for each selected file. The
<emphasis remap='I'>format</emphasis> argument shall be used as the <emphasis remap='I'>format</emphasis> string described
in the Base Definitions volume of
IEEE Std 1003.1-2001, Chapter 5, File Format Notation, with the
exceptions 1.
through 5. defined in the EXTENDED DESCRIPTION section of <emphasis remap='I'>printf</emphasis>,
plus the following
exceptions:</para>
<variablelist remap='TP'>
<varlistentry>
<term>6.</term>
<listitem>
<para>The sequence ( <emphasis remap='I'>keyword</emphasis>) can occur before a format conversion
specifier. The conversion argument is defined by the value
of <emphasis remap='I'>keyword</emphasis>. The implementation shall support the following keywords:</para>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>Any of the Field Name entries in ustar Header Block and Octet-Oriented
cpio
Archive Entry . The implementation may support the <emphasis remap='I'>cpio</emphasis> keywords
without the leading <emphasis role='strong' remap='B'>c_</emphasis> in addition to the form
required by Values for cpio c_mode Field .</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
</variablelist>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>Any keyword defined for the extended header in pax Extended Header
.</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>Any keyword provided as an implementation-defined extension within
the extended header defined in pax Extended Header .</para>
</listitem>
</varlistentry>
</variablelist>
<para>For example, the sequence <emphasis role='strong' remap='B'>"%(charset)s"</emphasis> is the string value
of the name of the character set in the extended
header.</para>
<para>The result of the keyword conversion argument shall be the value from
the applicable header field or extended header, without
any trailing NULs.</para>
<para>All keyword values used as conversion arguments shall be translated
from the UTF-8 encoding to the character set appropriate for
the local file system, user database, and so on, as applicable.</para>
<variablelist remap='TP'>
<varlistentry>
<term>7.</term>
<listitem>
<para>An additional conversion specifier character, <emphasis role='strong' remap='B'>T</emphasis> , shall be used
to specify time formats. The <emphasis role='strong' remap='B'>T</emphasis> conversion
specifier character can be preceded by the sequence ( <emphasis remap='I'>keyword=</emphasis>
<emphasis remap='I'>subformat</emphasis>), where <emphasis remap='I'>subformat</emphasis> is a date format as
defined by <emphasis remap='I'>date</emphasis> operands. The default <emphasis remap='I'>keyword</emphasis> shall be
<emphasis role='strong' remap='B'>mtime</emphasis> and the
default subformat shall be:</para>
<literallayout remap='.nf'>
<emphasis role='strong' remap='B'>%b %e %H:%M %Y
</emphasis>
</literallayout> <!-- .fi -->
</listitem>
</varlistentry>
<varlistentry>
<term>8.</term>
<listitem>
<para>An additional conversion specifier character, <emphasis role='strong' remap='B'>M</emphasis> , shall be used
to specify the file mode string as defined in <emphasis remap='I'>ls</emphasis> Standard Output.
If ( <emphasis remap='I'>keyword</emphasis>) is omitted, the <emphasis role='strong' remap='B'>mode</emphasis> keyword shall be used.
For
example, <emphasis role='strong' remap='B'>%.1M</emphasis> writes the single character corresponding to the
<<emphasis remap='I'>entry type</emphasis>> field of the <emphasis remap='I'>ls</emphasis> <emphasis role='strong' remap='B'>-l</emphasis> command.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>9.</term>
<listitem>
<para>An additional conversion specifier character, <emphasis role='strong' remap='B'>D</emphasis> , shall be used
to specify the device for block or special files, if
applicable, in an implementation-defined format. If not applicable,
and ( <emphasis remap='I'>keyword</emphasis>) is specified, then this conversion shall
be equivalent to <emphasis role='strong' remap='B'>%(</emphasis><emphasis remap='I'>keyword</emphasis><emphasis role='strong' remap='B'>)u</emphasis>. If not applicable,
and ( <emphasis remap='I'>keyword</emphasis>) is omitted, then this conversion
shall be equivalent to <space>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>10.</term>
<listitem>
<para>An additional conversion specifier character, <emphasis role='strong' remap='B'>F</emphasis> , shall be used
to specify a pathname. The <emphasis role='strong' remap='B'>F</emphasis> conversion
character can be preceded by a sequence of comma-separated keywords:</para>
<literallayout remap='.nf'>
<emphasis role='strong' remap='B'>(</emphasis><emphasis remap='I'>keyword</emphasis><emphasis role='strong' remap='B'>[</emphasis><emphasis role='strong' remap='B'>,</emphasis><emphasis remap='I'>keyword</emphasis><emphasis role='strong' remap='B'>]</emphasis> <emphasis role='strong' remap='B'>... )
</emphasis>
</literallayout> <!-- .fi -->
</listitem>
</varlistentry>
</variablelist>
<para>The values for all the keywords that are non-null shall be concatenated
together, each separated by a <emphasis role='strong' remap='B'>'/'</emphasis> . The default
shall be ( <emphasis role='strong' remap='B'>path</emphasis>) if the keyword <emphasis role='strong' remap='B'>path</emphasis> is defined; otherwise,
the default shall be ( <emphasis role='strong' remap='B'>prefix</emphasis>, <emphasis role='strong' remap='B'>name</emphasis>).</para>
<variablelist remap='TP'>
<varlistentry>
<term>11.</term>
<listitem>
<para>An additional conversion specifier character, <emphasis role='strong' remap='B'>L</emphasis> , shall be used
to specify a symbolic line expansion. If the current
file is a symbolic link, then <emphasis role='strong' remap='B'>%L</emphasis> shall expand to:</para>
<literallayout remap='.nf'>
<emphasis role='strong' remap='B'>"%s -> %s", <</emphasis><emphasis remap='I'>value of keyword</emphasis><emphasis role='strong' remap='B'>>, <</emphasis><emphasis remap='I'>contents of link</emphasis><emphasis role='strong' remap='B'>>
</emphasis>
</literallayout> <!-- .fi -->
</listitem>
</varlistentry>
</variablelist>
<para>Otherwise, the <emphasis role='strong' remap='B'>%L</emphasis> conversion specification shall be the equivalent
of <emphasis role='strong' remap='B'>%F</emphasis> .</para>
</refsect2>
</refsect1>
<refsect1 id='operands'><title>OPERANDS</title>
<para>The following operands shall be supported:</para>
<variablelist remap='TP'>
<varlistentry>
<term><emphasis remap='I'>directory</emphasis></term>
<listitem>
<para>The destination directory pathname for <emphasis role='strong' remap='B'>copy</emphasis> mode.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>file</emphasis></term>
<listitem>
<para>A pathname of a file to be copied or archived.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>pattern</emphasis></term>
<listitem>
<para>A pattern matching one or more pathnames of archive members. A pattern
must be given in the name-generating notation of the
pattern matching notation in <emphasis remap='I'>Pattern Matching Notation</emphasis> , including
the filename
expansion rules in <emphasis remap='I'>Patterns Used for Filename Expansion</emphasis> . The
default, if no
<emphasis remap='I'>pattern</emphasis> is specified, is to select all members in the archive.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id='stdin'><title>STDIN</title>
<para>In <emphasis role='strong' remap='B'>write</emphasis> mode, the standard input shall be used only if no <emphasis remap='I'>file</emphasis>
operands are specified. It shall be a text file
containing a list of pathnames, one per line, without leading or trailing
<blank>s.</para>
<para>In <emphasis role='strong' remap='B'>list</emphasis> and <emphasis role='strong' remap='B'>read</emphasis> modes, if <emphasis role='strong' remap='B'>-f</emphasis> is not specified,
the standard input shall be an archive file.</para>
<para>Otherwise, the standard input shall not be used.</para>
</refsect1>
<refsect1 id='input_files'><title>INPUT FILES</title>
<para>The input file named by the <emphasis remap='I'>archive</emphasis> option-argument, or standard
input when the archive is read from there, shall be a
file formatted according to one of the specifications in the EXTENDED
DESCRIPTION section or some other implementation-defined
format.</para>
<para>The file <emphasis role='strong' remap='B'>/dev/tty</emphasis> shall be used to write prompts and read responses.</para>
</refsect1>
<refsect1 id='environment_variables'><title>ENVIRONMENT VARIABLES</title>
<para>The following environment variables shall affect the execution of
<command>pax</command>:</para>
<variablelist remap='TP'>
<varlistentry>
<term><envar>LANG</envar></term>
<listitem>
<para>Provide a default value for the internationalization variables that
are unset or null. (See the Base Definitions volume of
IEEE Std 1003.1-2001, Section 8.2, Internationalization Variables
for
the precedence of internationalization variables used to determine
the values of locale categories.)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><envar>LC_ALL</envar></term>
<listitem>
<para>If set to a non-empty string value, override the values of all the
other internationalization variables.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>LC_COLLATE</emphasis></term>
<listitem>
<para>Determine the locale for the behavior of ranges, equivalence classes,
and multi-character collating elements used in the pattern
matching expressions for the <emphasis remap='I'>pattern</emphasis> operand, the basic regular
expression for the <emphasis role='strong' remap='B'>-s</emphasis> option, and the extended
regular expression defined for the <emphasis role='strong' remap='B'>yesexpr</emphasis> locale keyword in
the <envar>LC_MESSAGES</envar> category.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>LC_CTYPE</emphasis></term>
<listitem>
<para>Determine the locale for the interpretation of sequences of bytes
of text data as characters (for example, single-byte as
opposed to multi-byte characters in arguments and input files), the
behavior of character classes used in the extended regular
expression defined for the <emphasis role='strong' remap='B'>yesexpr</emphasis> locale keyword in the <envar>LC_MESSAGES</envar>
category, and pattern matching.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><envar>LC_MESSAGES</envar></term>
<listitem>
<para>Determine the locale for the processing of affirmative responses that
should be used to affect the format and contents of
diagnostic messages written to standard error.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>LC_TIME</emphasis></term>
<listitem>
<para>Determine the format and contents of date and time strings when the
<emphasis role='strong' remap='B'>-v</emphasis> option is specified.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><envar>NLSPATH</envar></term>
<listitem>
<para>Determine the location of message catalogs for the processing of <emphasis remap='I'>LC_MESSAGES
.</emphasis></para>
</listitem>
</varlistentry>
<varlistentry>
<term><envar>TMPDIR</envar></term>
<listitem>
<para>Determine the pathname that provides part of the default global extended
header record file, as described for the <emphasis role='strong' remap='B'>-o</emphasis>
<emphasis role='strong' remap='B'>globexthdr=</emphasis> keyword in the OPTIONS section.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><envar>TZ</envar></term>
<listitem>
<para>Determine the timezone used to calculate date and time strings when
the <emphasis role='strong' remap='B'>-v</emphasis> option is specified. If <envar>TZ</envar> is unset or
null, an unspecified default timezone shall be used.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id='asynchronous_events'><title>ASYNCHRONOUS EVENTS</title>
<para>Default.</para>
</refsect1>
<refsect1 id='stdout'><title>STDOUT</title>
<para>In <emphasis role='strong' remap='B'>write</emphasis> mode, if <emphasis role='strong' remap='B'>-f</emphasis> is not specified, the standard output
shall be the archive formatted according to one of the
specifications in the EXTENDED DESCRIPTION section, or some other
implementation-defined format (see <emphasis role='strong' remap='B'>-x</emphasis> <emphasis remap='I'>format</emphasis>).</para>
<para>In <emphasis role='strong' remap='B'>list</emphasis> mode, when the <emphasis role='strong' remap='B'>-o</emphasis> <emphasis role='strong' remap='B'>listopt</emphasis>= <emphasis remap='I'>format</emphasis>
has been specified, the selected archive members shall be
written to standard output using the format described under List Mode
Format Specifications . In
<emphasis role='strong' remap='B'>list</emphasis> mode without the <emphasis role='strong' remap='B'>-o</emphasis> <emphasis role='strong' remap='B'>listopt</emphasis>= <emphasis remap='I'>format</emphasis> option,
the table of contents of the selected archive members
shall be written to standard output using the following format:</para>
<literallayout remap='.nf'>
<emphasis role='strong' remap='B'>"%s\n", <</emphasis><emphasis remap='I'>pathname</emphasis><emphasis role='strong' remap='B'>>
</emphasis>
</literallayout> <!-- .fi -->
<para>If the <emphasis role='strong' remap='B'>-v</emphasis> option is specified in <emphasis role='strong' remap='B'>list</emphasis> mode, the table
of contents of the selected archive members shall be written
to standard output using the following formats.</para>
<para>For pathnames representing hard links to previous members of the archive:</para>
<literallayout remap='.nf'>
<emphasis role='strong' remap='B'>"%s == %s\n", <</emphasis><emphasis remap='I'>ls</emphasis> <emphasis role='strong' remap='B'>-l</emphasis> <emphasis remap='I'>listing</emphasis><emphasis role='strong' remap='B'>>, <</emphasis><emphasis remap='I'>linkname</emphasis><emphasis role='strong' remap='B'>>
</emphasis>
</literallayout> <!-- .fi -->
<para>For all other pathnames:</para>
<literallayout remap='.nf'>
<emphasis role='strong' remap='B'>"%s\n", <</emphasis><emphasis remap='I'>ls</emphasis> <emphasis role='strong' remap='B'>-l</emphasis> <emphasis remap='I'>listing</emphasis><emphasis role='strong' remap='B'>>
</emphasis>
</literallayout> <!-- .fi -->
<para>where <<emphasis remap='I'>ls </emphasis> -l <emphasis remap='I'>listing</emphasis>> shall be the format specified
by the <emphasis remap='I'>ls</emphasis> utility with the <emphasis role='strong' remap='B'>-l</emphasis> option. When writing pathnames
in this format, it is unspecified
what is written for fields for which the underlying archive format
does not have the correct information, although the correct
number of <blank>-separated fields shall be written.</para>
<para>In <emphasis role='strong' remap='B'>list</emphasis> mode, standard output shall not be buffered more than
a line at a time.</para>
</refsect1>
<refsect1 id='stderr'><title>STDERR</title>
<para>If <emphasis role='strong' remap='B'>-v</emphasis> is specified in <emphasis role='strong' remap='B'>read</emphasis>, <emphasis role='strong' remap='B'>write</emphasis>, or <emphasis role='strong' remap='B'>copy</emphasis>
modes, <command>pax</command> shall write the pathnames it processes
to the standard error output using the following format:</para>
<literallayout remap='.nf'>
<emphasis role='strong' remap='B'>"%s\n", <</emphasis><emphasis remap='I'>pathname</emphasis><emphasis role='strong' remap='B'>>
</emphasis>
</literallayout> <!-- .fi -->
<para>These pathnames shall be written as soon as processing is begun on
the file or archive member, and shall be flushed to standard
error. The trailing <newline>, which shall not be buffered, is written
when the file has been read or written.</para>
<para>If the <emphasis role='strong' remap='B'>-s</emphasis> option is specified, and the replacement string has
a trailing <emphasis role='strong' remap='B'>'p'</emphasis> , substitutions shall be written to
standard error in the following format:</para>
<literallayout remap='.nf'>
<emphasis role='strong' remap='B'>"%s >> %s\n", <</emphasis><emphasis remap='I'>original pathname</emphasis><emphasis role='strong' remap='B'>>, <</emphasis><emphasis remap='I'>new pathname</emphasis><emphasis role='strong' remap='B'>>
</emphasis>
</literallayout> <!-- .fi -->
<para>In all operating modes of <command>pax</command>, optional messages of unspecified
format concerning the input archive format and volume
number, the number of files, blocks, volumes, and media parts as well
as other diagnostic messages may be written to standard
error.</para>
<para>In all formats, for both standard output and standard error, it is
unspecified how non-printable characters in pathnames or link
names are written.</para>
<para>When <command>pax</command> is in <emphasis role='strong' remap='B'>read</emphasis> mode or <emphasis role='strong' remap='B'>list</emphasis> mode, using the
<emphasis role='strong' remap='B'>-x</emphasis> <emphasis role='strong' remap='B'>pax</emphasis> archive format, and a filename, link
name, owner name, or any other field in an extended header record
cannot be translated from the <emphasis role='strong' remap='B'>pax</emphasis> UTF-8 codeset format to
the codeset and current locale of the implementation, <command>pax</command> shall
write a diagnostic message to standard error, shall process
the file as described for the <emphasis role='strong' remap='B'>-o</emphasis> <emphasis role='strong' remap='B'>invalid=</emphasis> option, and
then shall process the next file in the archive.</para>
</refsect1>
<refsect1 id='output_files'><title>OUTPUT FILES</title>
<para>In <emphasis role='strong' remap='B'>read</emphasis> mode, the extracted output files shall be of the archived
file type. In <emphasis role='strong' remap='B'>copy</emphasis> mode, the copied output files
shall be the type of the file being copied. In either mode, existing
files in the destination hierarchy shall be overwritten only
when all permission ( <emphasis role='strong' remap='B'>-p</emphasis>), modification time ( <emphasis role='strong' remap='B'>-u</emphasis>), and
invalid-value ( <emphasis role='strong' remap='B'>-o</emphasis> <emphasis role='strong' remap='B'>invalid</emphasis>=) tests allow
it.</para>
<para>In <emphasis role='strong' remap='B'>write</emphasis> mode, the output file named by the <emphasis role='strong' remap='B'>-f</emphasis> option-argument
shall be a file formatted according to one of the
specifications in the EXTENDED DESCRIPTION section, or some other
implementation-defined format.</para>
</refsect1>
<refsect1 id='extended_description'><title>EXTENDED DESCRIPTION</title>
<refsect2 id='pax_interchange_format'><title>pax Interchange Format</title>
<para>A <command>pax</command> archive tape or file produced in the <emphasis role='strong' remap='B'>-x</emphasis> <emphasis role='strong' remap='B'>pax</emphasis>
format shall contain a series of blocks. The physical
layout of the archive shall be identical to the <emphasis role='strong' remap='B'>ustar</emphasis> format
described in ustar Interchange
Format . Each file archived shall be represented by the following
sequence:</para>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>An optional header block with extended header records. This header
block is of the form described in pax Header Block , with a <emphasis remap='I'>typeflag</emphasis>
value of <emphasis role='strong' remap='B'>x</emphasis> or <emphasis role='strong' remap='B'>g</emphasis>. The extended header records,
described in pax Extended Header , shall be included as the data for
this header block.</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>A header block that describes the file. Any fields in the preceding
optional extended header shall override the associated
fields in this header block for this file.</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>Zero or more blocks that contain the contents of the file.</para>
</listitem>
</varlistentry>
</variablelist>
<para>At the end of the archive file there shall be two 512-byte blocks
filled with binary zeros, interpreted as an end-of-archive
indicator.</para>
<para>A schematic of an example archive with global extended header records
and two actual files is shown in pax
Format Archive Example . In the example, the second file in the archive
has no extended header preceding it, presumably because
it has no need for extended attributes.</para>
<literallayout remap='RS'>
<synopsis>
</synopsis>
</literallayout> <!-- remap='RE' -->
<itemizedlist remap='TP'>
<listitem><para><emphasis role='strong' remap='B'>Figure: pax Format Archive Example</emphasis></para></listitem>
</itemizedlist>
</refsect2>
<refsect2 id='pax_header_block'><title>pax Header Block</title>
<para>The <emphasis role='strong' remap='B'>pax</emphasis> header block shall be identical to the <emphasis role='strong' remap='B'>ustar</emphasis> header
block described in ustar
Interchange Format , except that two additional <emphasis remap='I'>typeflag</emphasis> values
are defined:</para>
<variablelist remap='TP'>
<varlistentry>
<term><emphasis role='strong' remap='B'>x</emphasis></term>
<listitem>
<para>Represents extended header records for the following file in the archive
(which shall have its own <emphasis role='strong' remap='B'>ustar</emphasis> header block).
The format of these extended header records shall be as described
in pax Extended Header .</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>g</emphasis></term>
<listitem>
<para>Represents global extended header records for the following files
in the archive. The format of these extended header records
shall be as described in pax Extended Header . Each value shall affect
all subsequent files that do
not override that value in their own extended header record and until
another global extended header record is reached that
provides another value for the same field. The <emphasis remap='I'>typeflag</emphasis> <emphasis role='strong' remap='B'>g</emphasis>
global headers should not be used with interchange media
that could suffer partial data loss in transporting the archive.</para>
</listitem>
</varlistentry>
</variablelist>
<para>For both of these types, the <emphasis remap='I'>size</emphasis> field shall be the size of
the extended header records in octets. The other fields in
the header block are not meaningful to this version of the <command>pax</command>
utility. However, if this archive is read by a <command>pax</command>
utility conforming to the ISO POSIX-2:1993 standard, the header block
fields are used to create a regular file that contains
the extended header records as data. Therefore, header block field
values should be selected to provide reasonable file access to
this regular file.</para>
<para>A further difference from the <emphasis role='strong' remap='B'>ustar</emphasis> header block is that data
blocks for files of <emphasis remap='I'>typeflag</emphasis> 1 (the digit one) (hard
link) may be included, which means that the size field may be greater
than zero. Archives created by <command>pax</command> <emphasis role='strong' remap='B'>-o</emphasis>
<emphasis role='strong' remap='B'>linkdata</emphasis> shall include these data blocks with the hard links.</para>
</refsect2>
<refsect2 id='pax_extended_header'><title>pax Extended Header</title>
<para>A <emphasis role='strong' remap='B'>pax</emphasis> extended header contains values that are inappropriate
for the <emphasis role='strong' remap='B'>ustar</emphasis> header block because of limitations in
that format: fields requiring a character encoding other than that
described in the ISO/IEC 646:1991 standard, fields
representing file attributes not described in the <emphasis role='strong' remap='B'>ustar</emphasis> header,
and fields whose format or length do not fit the
requirements of the <emphasis role='strong' remap='B'>ustar</emphasis> header. The values in an extended
header add attributes to the following file (or files; see the
description of the <emphasis remap='I'>typeflag</emphasis> <emphasis role='strong' remap='B'>g</emphasis> header block) or override
values in the following header block(s), as indicated in the
following list of keywords.</para>
<para>An extended header shall consist of one or more records, each constructed
as follows:</para>
<literallayout remap='.nf'>
<emphasis role='strong' remap='B'>"%d %s=%s\n", <</emphasis><emphasis remap='I'>length</emphasis><emphasis role='strong' remap='B'>>, <</emphasis><emphasis remap='I'>keyword</emphasis><emphasis role='strong' remap='B'>>, <</emphasis><emphasis remap='I'>value</emphasis><emphasis role='strong' remap='B'>>
</emphasis>
</literallayout> <!-- .fi -->
<para>The extended header records shall be encoded according to the ISO/IEC 10646-1:2000
standard (UTF-8). The
<<emphasis remap='I'>length</emphasis>> field, <blank>, equals sign, and <newline> shown shall
be limited to the portable character set,
as encoded in UTF-8. The <<emphasis remap='I'>keyword</emphasis>> and <<emphasis remap='I'>value</emphasis>> fields
can be any UTF-8 characters. The
<<emphasis remap='I'>length</emphasis>> field shall be the decimal length of the extended header
record in octets, including the trailing
<newline>.</para>
<para>The <<emphasis remap='I'>keyword</emphasis>> field shall be one of the entries from the following
list or a keyword provided as an implementation
extension. Keywords consisting entirely of lowercase letters, digits,
and periods are reserved for future standardization. A
keyword shall not include an equals sign. (In the following list,
the notations "file(s)" or "block(s)" is used to acknowledge
that a keyword affects the following single file after a <emphasis remap='I'>typeflag</emphasis>
<emphasis role='strong' remap='B'>x</emphasis> extended header, but possibly multiple files
after <emphasis remap='I'>typeflag</emphasis> <emphasis role='strong' remap='B'>g</emphasis>. Any requirements in the list for <command>pax</command>
to include a record when in <emphasis role='strong' remap='B'>write</emphasis> or <emphasis role='strong' remap='B'>copy</emphasis>
mode shall apply only when such a record has not already been provided
through the use of the <emphasis role='strong' remap='B'>-o</emphasis> option. When used in
<emphasis role='strong' remap='B'>copy</emphasis> mode, <command>pax</command> shall behave as if an archive had been
created with applicable extended header records and then
extracted.)</para>
<variablelist remap='TP'>
<varlistentry>
<term><emphasis role='strong' remap='B'>atime</emphasis></term>
<listitem>
<para>The file access time for the following file(s), equivalent to the
value of the <emphasis remap='I'>st_atime</emphasis> member of the <emphasis role='strong' remap='B'>stat</emphasis>
structure for a file, as described by the <emphasis remap='I'>stat</emphasis>() function. The
access time shall be
restored if the process has the appropriate privilege required to
do so. The format of the <<emphasis remap='I'>value</emphasis>> shall be as
described in pax Extended Header File Times .</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>charset</emphasis></term>
<listitem>
<para>The name of the character set used to encode the data in the following
file(s). The entries in the following table are defined
to refer to known standards; additional names may be agreed on between
the originator and recipient.</para>
<informaltable pgwide='0' frame='none'>
<tgroup cols='6' align='center'>
<colspec colname='c1'/>
<colspec colname='c2'/>
<colspec colname='c3'/>
<colspec colname='c4'/>
<colspec colname='c5'/>
<colspec colname='c6'/>
<tbody>
<row>
<entry align='center'><emphasis role='strong' remap='B'><value></emphasis></entry>
<entry align='right'><emphasis role='strong' remap='B'>Formal Standard</emphasis></entry>
</row>
<row>
<entry align='center'>ISO-IR 646 1990</entry>
<entry align='right'>ISO/IEC 646:1990</entry>
</row>
<row>
<entry align='center'>ISO-IR 8859 1 1998</entry>
<entry align='right'>ISO/IEC 8859-1:1998</entry>
</row>
<row>
<entry align='center'>ISO-IR 8859 2 1999</entry>
<entry align='right'>ISO/IEC 8859-2:1999</entry>
</row>
<row>
<entry align='center'>ISO-IR 8859 3 1999</entry>
<entry align='right'>ISO/IEC 8859-3:1999</entry>
</row>
<row>
<entry align='center'>ISO-IR 8859 4 1998</entry>
<entry align='right'>ISO/IEC 8859-4:1998</entry>
</row>
<row>
<entry align='center'>ISO-IR 8859 5 1999</entry>
<entry align='right'>ISO/IEC 8859-5:1999</entry>
</row>
<row>
<entry align='center'>ISO-IR 8859 6 1999</entry>
<entry align='right'>ISO/IEC 8859-6:1999</entry>
</row>
<row>
<entry align='center'>ISO-IR 8859 7 1987</entry>
<entry align='right'>ISO/IEC 8859-7:1987</entry>
</row>
<row>
<entry align='center'>ISO-IR 8859 8 1999</entry>
<entry align='right'>ISO/IEC 8859-8:1999</entry>
</row>
<row>
<entry align='center'>ISO-IR 8859 9 1999</entry>
<entry align='right'>ISO/IEC 8859-9:1999</entry>
</row>
<row>
<entry align='center'>ISO-IR 8859 10 1998</entry>
<entry align='right'>ISO/IEC 8859-10:1998</entry>
</row>
<row>
<entry align='center'>ISO-IR 8859 13 1998</entry>
<entry align='right'>ISO/IEC 8859-13:1998</entry>
</row>
<row>
<entry align='center'>ISO-IR 8859 14 1998</entry>
<entry align='right'>ISO/IEC 8859-14:1998</entry>
</row>
<row>
<entry align='center'>ISO-IR 8859 15 1999</entry>
<entry align='right'>ISO/IEC 8859-15:1999</entry>
</row>
<row>
<entry align='center'>ISO-IR 10646 2000</entry>
<entry align='right'>ISO/IEC 10646:2000</entry>
</row>
<row>
<entry align='center'>ISO-IR 10646 2000 UTF-8</entry>
<entry align='right'>ISO/IEC 10646, UTF-8 encoding</entry>
</row>
<row>
<entry align='center'>BINARY</entry>
<entry align='right'>None.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</listitem>
</varlistentry>
</variablelist>
<para>The encoding is included in an extended header for information only;
when <command>pax</command> is used as described in
IEEE Std 1003.1-2001, it shall not translate the file data into
any other encoding. The <emphasis role='strong' remap='B'>BINARY</emphasis> entry indicates
unencoded binary data.</para>
<para>When used in <emphasis role='strong' remap='B'>write</emphasis> or <emphasis role='strong' remap='B'>copy</emphasis> mode, it is implementation-defined
whether <command>pax</command> includes a <emphasis role='strong' remap='B'>charset</emphasis>
extended header record for a file.</para>
<variablelist remap='TP'>
<varlistentry>
<term><emphasis role='strong' remap='B'>comment</emphasis></term>
<listitem>
<para>A series of characters used as a comment. All characters in the <<emphasis remap='I'>value</emphasis>>
field shall be ignored by <command>pax</command>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>ctime</emphasis></term>
<listitem>
<para>The file creation time for the following file(s), equivalent to the
value of the <emphasis remap='I'>st_ctime</emphasis> member of the <emphasis role='strong' remap='B'>stat</emphasis>
structure for a file, as described by the <emphasis remap='I'>stat</emphasis>() function. The
creation time shall be
restored if the process has the appropriate privilege required to
do so. The format of the <<emphasis remap='I'>value</emphasis>> shall be as
described in pax Extended Header File Times .</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>gid</emphasis></term>
<listitem>
<para>The group ID of the group that owns the file, expressed as a decimal
number using digits from the ISO/IEC 646:1991
standard. This record shall override the <emphasis remap='I'>gid</emphasis> field in the following
header block(s). When used in <emphasis role='strong' remap='B'>write</emphasis> or
<emphasis role='strong' remap='B'>copy</emphasis> mode, <command>pax</command> shall include a <emphasis remap='I'>gid</emphasis> extended header
record for each file whose group ID is greater than 2097151
(octal 7777777).</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>gname</emphasis></term>
<listitem>
<para>The group of the file(s), formatted as a group name in the group database.
This record shall override the <emphasis remap='I'>gid</emphasis> and
<emphasis remap='I'>gname</emphasis> fields in the following header block(s), and any <emphasis remap='I'>gid</emphasis>
extended header record. When used in <emphasis role='strong' remap='B'>read</emphasis>,
<emphasis role='strong' remap='B'>copy</emphasis>, or <emphasis role='strong' remap='B'>list</emphasis> mode, <command>pax</command> shall translate the name
from the UTF-8 encoding in the header record to the character
set appropriate for the group database on the receiving system. If
any of the UTF-8 characters cannot be translated, and if the
<emphasis role='strong' remap='B'>-o</emphasis> <emphasis role='strong' remap='B'>invalid=</emphasis> UTF-8 option is not specified, the results
are implementation-defined. When used in <emphasis role='strong' remap='B'>write</emphasis> or
<emphasis role='strong' remap='B'>copy</emphasis> mode, <command>pax</command> shall include a <emphasis role='strong' remap='B'>gname</emphasis> extended header
record for each file whose group name cannot be
represented entirely with the letters and digits of the portable character
set.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>linkpath</emphasis></term>
<listitem>
<para>The pathname of a link being created to another file, of any type,
previously archived. This record shall override the
<emphasis remap='I'>linkname</emphasis> field in the following <emphasis role='strong' remap='B'>ustar</emphasis> header block(s).
The following <emphasis role='strong' remap='B'>ustar</emphasis> header block shall determine the
type of link created. If <emphasis remap='I'>typeflag</emphasis> of the following header block
is 1, it shall be a hard link. If <emphasis remap='I'>typeflag</emphasis> is 2, it
shall be a symbolic link and the <emphasis role='strong' remap='B'>linkpath</emphasis> value shall be the
contents of the symbolic link. The <command>pax</command> utility shall
translate the name of the link (contents of the symbolic link) from
the UTF-8 encoding to the character set appropriate for the
local file system. When used in <emphasis role='strong' remap='B'>write</emphasis> or <emphasis role='strong' remap='B'>copy</emphasis> mode, <command>pax</command>
shall include a <emphasis role='strong' remap='B'>linkpath</emphasis> extended header record
for each link whose pathname cannot be represented entirely with the
members of the portable character set other than NUL.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>mtime</emphasis></term>
<listitem>
<para>The file modification time of the following file(s), equivalent to
the value of the <emphasis remap='I'>st_mtime</emphasis> member of the <emphasis role='strong' remap='B'>stat</emphasis>
structure for a file, as described in the <emphasis remap='I'>stat</emphasis>() function. This
record shall override
the <emphasis remap='I'>mtime</emphasis> field in the following header block(s). The modification
time shall be restored if the process has the appropriate
privilege required to do so. The format of the <<emphasis remap='I'>value</emphasis>> shall
be as described in pax
Extended Header File Times .</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>path</emphasis></term>
<listitem>
<para>The pathname of the following file(s). This record shall override
the <emphasis remap='I'>name</emphasis> and <emphasis remap='I'>prefix</emphasis> fields in the following
header block(s). The <command>pax</command> utility shall translate the pathname
of the file from the UTF-8 encoding to the character set
appropriate for the local file system.</para>
</listitem>
</varlistentry>
</variablelist>
<para>When used in <emphasis role='strong' remap='B'>write</emphasis> or <emphasis role='strong' remap='B'>copy</emphasis> mode, <command>pax</command> shall include
a <emphasis remap='I'>path</emphasis> extended header record for each file whose
pathname cannot be represented entirely with the members of the portable
character set other than NUL.</para>
<variablelist remap='TP'>
<varlistentry>
<term><emphasis role='strong' remap='B'>realtime.</emphasis><emphasis remap='I'>any</emphasis></term>
<listitem>
<para>The keywords prefixed by "realtime." are reserved for future standardization.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>security.</emphasis><emphasis remap='I'>any</emphasis></term>
<listitem>
<para>The keywords prefixed by "security." are reserved for future standardization.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>size</emphasis></term>
<listitem>
<para>The size of the file in octets, expressed as a decimal number using
digits from the ISO/IEC 646:1991 standard. This record
shall override the <emphasis remap='I'>size</emphasis> field in the following header block(s).
When used in <emphasis role='strong' remap='B'>write</emphasis> or <emphasis role='strong' remap='B'>copy</emphasis> mode, <command>pax</command>
shall include a <emphasis remap='I'>size</emphasis> extended header record for each file with
a size value greater than 8589934591 (octal
77777777777).</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>uid</emphasis></term>
<listitem>
<para>The user ID of the file owner, expressed as a decimal number using
digits from the ISO/IEC 646:1991 standard. This record
shall override the <emphasis remap='I'>uid</emphasis> field in the following header block(s).
When used in <emphasis role='strong' remap='B'>write</emphasis> or <emphasis role='strong' remap='B'>copy</emphasis> mode, <command>pax</command>
shall include a <emphasis remap='I'>uid</emphasis> extended header record for each file whose
owner ID is greater than 2097151 (octal 7777777).</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>uname</emphasis></term>
<listitem>
<para>The owner of the following file(s), formatted as a user name in the
user database. This record shall override the <emphasis remap='I'>uid</emphasis>
and <emphasis remap='I'>uname</emphasis> fields in the following header block(s), and any <emphasis remap='I'>uid</emphasis>
extended header record. When used in <emphasis role='strong' remap='B'>read</emphasis>,
<emphasis role='strong' remap='B'>copy</emphasis>, or <emphasis role='strong' remap='B'>list</emphasis> mode, <command>pax</command> shall translate the name
from the UTF-8 encoding in the header record to the character
set appropriate for the user database on the receiving system. If
any of the UTF-8 characters cannot be translated, and if the
<emphasis role='strong' remap='B'>-o</emphasis> <emphasis role='strong' remap='B'>invalid=</emphasis> UTF-8 option is not specified, the results
are implementation-defined. When used in <emphasis role='strong' remap='B'>write</emphasis> or
<emphasis role='strong' remap='B'>copy</emphasis> mode, <command>pax</command> shall include a <emphasis role='strong' remap='B'>uname</emphasis> extended header
record for each file whose user name cannot be
represented entirely with the letters and digits of the portable character
set.</para>
</listitem>
</varlistentry>
</variablelist>
<para>If the <<emphasis remap='I'>value</emphasis>> field is zero length, it shall delete any header
block field, previously entered extended header
value, or global extended header value of the same name.</para>
<para>If a keyword in an extended header record (or in a <emphasis role='strong' remap='B'>-o</emphasis> option-argument)
overrides or deletes a corresponding field in the
<emphasis role='strong' remap='B'>ustar</emphasis> header block, <command>pax</command> shall ignore the contents of that
header block field.</para>
<para>Unlike the <emphasis role='strong' remap='B'>ustar</emphasis> header block fields, NULs shall not delimit
<<emphasis remap='I'>value</emphasis>>s; all characters within the
<<emphasis remap='I'>value</emphasis>> field shall be considered data for the field. None of
the length limitations of the <emphasis role='strong' remap='B'>ustar</emphasis> header block
fields in ustar Header Block shall apply to the extended header records.</para>
</refsect2>
<refsect2 id='pax_extended_header_keyword_precedence'><title>pax Extended Header Keyword Precedence</title>
<para>This section describes the precedence in which the various header
records and fields and command line options are selected to
apply to a file in the archive. When <command>pax</command> is used in <emphasis role='strong' remap='B'>read</emphasis>
or <emphasis role='strong' remap='B'>list</emphasis> modes, it shall determine a file attribute in
the following sequence:</para>
<variablelist remap='IP'>
<varlistentry>
<term> 1.</term>
<listitem>
<para>If <emphasis role='strong' remap='B'>-o</emphasis> <emphasis role='strong' remap='B'>delete=</emphasis> <emphasis remap='I'>keyword-prefix</emphasis> is used, the affected
attributes shall be determined from step 7., if
applicable, or ignored otherwise.</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist remap='IP'>
<varlistentry>
<term> 2.</term>
<listitem>
<para>If <emphasis role='strong' remap='B'>-o</emphasis> <emphasis remap='I'>keyword</emphasis>:= is used, the affected attributes shall
be ignored.</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist remap='IP'>
<varlistentry>
<term> 3.</term>
<listitem>
<para>If <emphasis role='strong' remap='B'>-o</emphasis> <emphasis remap='I'>keyword</emphasis> <emphasis role='strong' remap='B'>:=</emphasis> <emphasis remap='I'>value</emphasis> is used, the affected
attribute shall be assigned the value.</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist remap='IP'>
<varlistentry>
<term> 4.</term>
<listitem>
<para>If there is a <emphasis remap='I'>typeflag</emphasis> <emphasis role='strong' remap='B'>x</emphasis> extended header record, the affected
attribute shall be assigned the
<<emphasis remap='I'>value</emphasis>>. When extended header records conflict, the last one
given in the header shall take precedence.</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist remap='IP'>
<varlistentry>
<term> 5.</term>
<listitem>
<para>If <emphasis role='strong' remap='B'>-o</emphasis> <emphasis remap='I'>keyword</emphasis> <emphasis role='strong' remap='B'>=</emphasis> <emphasis remap='I'>value</emphasis> is used, the affected
attribute shall be assigned the value.</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist remap='IP'>
<varlistentry>
<term> 6.</term>
<listitem>
<para>If there is a <emphasis remap='I'>typeflag</emphasis> <emphasis role='strong' remap='B'>g</emphasis> global extended header record,
the affected attribute shall be assigned the
<<emphasis remap='I'>value</emphasis>>. When global extended header records conflict, the last
one given in the global header shall take
precedence.</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist remap='IP'>
<varlistentry>
<term> 7.</term>
<listitem>
<para>Otherwise, the attribute shall be determined from the <emphasis role='strong' remap='B'>ustar</emphasis>
header block.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>
<refsect2 id='pax_extended_header_file_times'><title>pax Extended Header File Times</title>
<para>The <command>pax</command> utility shall write an <emphasis role='strong' remap='B'>mtime</emphasis> record for each file
in <emphasis role='strong' remap='B'>write</emphasis> or <emphasis role='strong' remap='B'>copy</emphasis> modes if the file's
modification time cannot be represented exactly in the <emphasis role='strong' remap='B'>ustar</emphasis>
header logical record described in ustar Interchange Format . This
can occur if the time is out of <emphasis role='strong' remap='B'>ustar</emphasis> range, or if the file
system
of the underlying implementation supports non-integer time granularities
and the time is not an integer. All of these time records
shall be formatted as a decimal representation of the time in seconds
since the Epoch. If a period ( <emphasis role='strong' remap='B'>'.'</emphasis> ) decimal point
character is present, the digits to the right of the point shall represent
the units of a subsecond timing granularity, where the
first digit is tenths of a second and each subsequent digit is a tenth
of the previous digit. In <emphasis role='strong' remap='B'>read</emphasis> or <emphasis role='strong' remap='B'>copy</emphasis> mode,
the <command>pax</command> utility shall truncate the time of a file to the greatest
value that is not greater than the input header file time.
In <emphasis role='strong' remap='B'>write</emphasis> or <emphasis role='strong' remap='B'>copy</emphasis> mode, the <command>pax</command> utility shall output
a time exactly if it can be represented exactly as a
decimal number, and otherwise shall generate only enough digits so
that the same time shall be recovered if the file is extracted
on a system whose underlying implementation supports the same time
granularity.</para>
</refsect2>
<refsect2 id='ustar_interchange_format'><title>ustar Interchange Format</title>
<para>A <emphasis role='strong' remap='B'>ustar</emphasis> archive tape or file shall contain a series of logical
records. Each logical record shall be a fixed-size logical
record of 512 octets (see below). Although this format may be thought
of as being stored on 9-track industry-standard 12.7 mm (0.5
in) magnetic tape, other types of transportable media are not excluded.
Each file archived shall be represented by a header logical
record that describes the file, followed by zero or more logical records
that give the contents of the file. At the end of the
archive file there shall be two 512-octet logical records filled with
binary zeros, interpreted as an end-of-archive indicator.</para>
<para>The logical records may be grouped for physical I/O operations, as
described under the <emphasis role='strong' remap='B'>-b</emphasis> <emphasis remap='I'>blocksize</emphasis> and <emphasis role='strong' remap='B'>-x</emphasis>
<emphasis role='strong' remap='B'>ustar</emphasis> options. Each group of logical records may be written
with a single operation equivalent to the <emphasis remap='I'>write</emphasis>() function.
On magnetic tape, the result of this write shall be a single tape
physical
block. The last physical block shall always be the full size, so logical
records after the two zero logical records may contain
undefined data.</para>
<para>The header logical record shall be structured as shown in the following
table. All lengths and offsets are in decimal.</para>
<!-- br -->
<blockquote remap='RS'>
<para></para>
<table pgwide='0' frame='none'>
<title>Table: ustar Header Block</title>
<tgroup cols='7' align='center'>
<colspec colname='c1'/>
<colspec colname='c2'/>
<colspec colname='c3'/>
<colspec colname='c4'/>
<colspec colname='c5'/>
<colspec colname='c6'/>
<colspec colname='c7'/>
<tbody>
<row>
<entry align='center'><emphasis role='strong' remap='B'>Field Name</emphasis></entry>
<entry align='right'><emphasis role='strong' remap='B'>Octet Offset</emphasis></entry>
<entry align='right' namest='c3' nameend='c4'><emphasis role='strong' remap='B'>Length (in Octets)</emphasis></entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>name</emphasis></entry>
<entry align='right'>0</entry>
<entry align='right' namest='c3' nameend='c4'>100</entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>mode</emphasis></entry>
<entry align='right'>100</entry>
<entry align='right' namest='c3' nameend='c4'>8</entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>uid</emphasis></entry>
<entry align='right'>108</entry>
<entry align='right' namest='c3' nameend='c4'>8</entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>gid</emphasis></entry>
<entry align='right'>116</entry>
<entry align='right' namest='c3' nameend='c4'>8</entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>size</emphasis></entry>
<entry align='right'>124</entry>
<entry align='right' namest='c3' nameend='c4'>12</entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>mtime</emphasis></entry>
<entry align='right'>136</entry>
<entry align='right' namest='c3' nameend='c4'>12</entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>chksum</emphasis></entry>
<entry align='right'>148</entry>
<entry align='right' namest='c3' nameend='c4'>8</entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>typeflag</emphasis></entry>
<entry align='right'>156</entry>
<entry align='right' namest='c3' nameend='c4'>1</entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>linkname</emphasis></entry>
<entry align='right'>157</entry>
<entry align='right' namest='c3' nameend='c4'>100</entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>magic</emphasis></entry>
<entry align='right'>257</entry>
<entry align='right' namest='c3' nameend='c4'>6</entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>version</emphasis></entry>
<entry align='right'>263</entry>
<entry align='right' namest='c3' nameend='c4'>2</entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>uname</emphasis></entry>
<entry align='right'>265</entry>
<entry align='right' namest='c3' nameend='c4'>32</entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>gname</emphasis></entry>
<entry align='right'>297</entry>
<entry align='right' namest='c3' nameend='c4'>32</entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>devmajor</emphasis></entry>
<entry align='right'>329</entry>
<entry align='right' namest='c3' nameend='c4'>8</entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>devminor</emphasis></entry>
<entry align='right'>337</entry>
<entry align='right' namest='c3' nameend='c4'>8</entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>prefix</emphasis></entry>
<entry align='right'>345</entry>
<entry align='right' namest='c3' nameend='c4'>155</entry>
</row>
</tbody>
</tgroup>
</table>
</blockquote> <!-- remap='RE' -->
<para>All characters in the header logical record shall be represented in
the coded character set of the ISO/IEC 646:1991
standard. For maximum portability between implementations, names should
be selected from characters represented by the portable
filename character set as octets with the most significant bit zero.
If an implementation supports the use of characters outside of
slash and the portable filename character set in names for files,
users, and groups, one or more implementation-defined encodings
of these characters shall be provided for interchange purposes.</para>
<para>However, the <command>pax</command> utility shall never create filenames on the
local system that cannot be accessed via the procedures
described in IEEE Std 1003.1-2001. If a filename is found on the
medium that would create an invalid filename, it is
implementation-defined whether the data from the file is stored on
the file hierarchy and under what name it is stored. The
<command>pax</command> utility may choose to ignore these files as long as it produces
an error indicating that the file is being ignored.</para>
<para>Each field within the header logical record is contiguous; that is,
there is no padding used. Each character on the archive
medium shall be stored contiguously.</para>
<para>The fields <emphasis remap='I'>magic</emphasis>, <emphasis remap='I'>uname</emphasis>, and <emphasis remap='I'>gname</emphasis> are character
strings each terminated by a NUL character. The fields
<emphasis remap='I'>name</emphasis>, <emphasis remap='I'>linkname</emphasis>, and <emphasis remap='I'>prefix</emphasis> are NUL-terminated character
strings except when all characters in the array
contain non-NUL characters including the last character. The <emphasis remap='I'>version</emphasis>
field is two octets containing the characters
<emphasis role='strong' remap='B'>"00"</emphasis> (zero-zero). The <emphasis remap='I'>typeflag</emphasis> contains a single character.
All other fields are leading zero-filled octal numbers
using digits from the ISO/IEC 646:1991 standard IRV. Each numeric
field is terminated by one or more <space> or NUL
characters.</para>
<para>The <emphasis remap='I'>name</emphasis> and the <emphasis remap='I'>prefix</emphasis> fields shall produce the pathname
of the file. A new pathname shall be formed, if
<emphasis remap='I'>prefix</emphasis> is not an empty string (its first character is not NUL),
by concatenating <emphasis remap='I'>prefix</emphasis> (up to the first NUL
character), a slash character, and <emphasis remap='I'>name</emphasis>; otherwise, <emphasis remap='I'>name</emphasis>
is used alone. In either case, <emphasis remap='I'>name</emphasis> is terminated at
the first NUL character. If <emphasis remap='I'>prefix</emphasis> begins with a NUL character,
it shall be ignored. In this manner, pathnames of at most
256 characters can be supported. If a pathname does not fit in the
space provided, <command>pax</command> shall notify the user of the error,
and shall not store any part of the file-header or data-on the medium.</para>
<para>The <emphasis remap='I'>linkname</emphasis> field, described below, shall not use the <emphasis remap='I'>prefix</emphasis>
to produce a pathname. As such, a <emphasis remap='I'>linkname</emphasis> is
limited to 100 characters. If the name does not fit in the space provided,
<command>pax</command> shall notify the user of the error, and shall
not attempt to store the link on the medium.</para>
<para>The <emphasis remap='I'>mode</emphasis> field provides 12 bits encoded in the ISO/IEC 646:1991
standard octal digit representation. The encoded
bits shall represent the following values:</para>
<!-- br -->
<blockquote remap='RS'>
<para></para>
<table pgwide='0' frame='none'>
<title>Table: ustar <emphasis remap='I'>mode</emphasis> Field</title>
<tgroup cols='7' align='center'>
<colspec colname='c1'/>
<colspec colname='c2'/>
<colspec colname='c3'/>
<colspec colname='c4'/>
<colspec colname='c5'/>
<colspec colname='c6'/>
<colspec colname='c7'/>
<tbody>
<row>
<entry align='center'><emphasis role='strong' remap='B'>Bit Value</emphasis></entry>
<entry align='right'><emphasis role='strong' remap='B'>IEEE Std 1003.1-2001 Bit</emphasis></entry>
<entry align='right' namest='c3' nameend='c4'><!-- na -->
<para><emphasis role='strong' remap='B'>Description</emphasis>
<!-- ad --></para></entry>
</row>
<row>
<entry align='center'>04000</entry>
<entry align='right'>S_ISUID</entry>
<entry align='right' namest='c3' nameend='c4'><!-- na -->
Set UID on execution.
<!-- ad --></entry>
</row>
<row>
<entry align='center'>02000</entry>
<entry align='right'>S_ISGID</entry>
<entry align='right' namest='c3' nameend='c4'><!-- na -->
Set GID on execution.
<!-- ad --></entry>
</row>
<row>
<entry align='center'>01000</entry>
<entry align='right'><reserved></entry>
<entry align='right' namest='c3' nameend='c4'><!-- na -->
Reserved for future standardization.
<!-- ad --></entry>
</row>
<row>
<entry align='center'>00400</entry>
<entry align='right'>S_IRUSR</entry>
<entry align='right' namest='c3' nameend='c4'><!-- na -->
Read permission for file owner class.
<!-- ad --></entry>
</row>
<row>
<entry align='center'>00200</entry>
<entry align='right'>S_IWUSR</entry>
<entry align='right' namest='c3' nameend='c4'><!-- na -->
Write permission for file owner class.
<!-- ad --></entry>
</row>
<row>
<entry align='center'>00100</entry>
<entry align='right'>S_IXUSR</entry>
<entry align='right' namest='c3' nameend='c4'><!-- na -->
Execute/search permission for file owner class.
<!-- ad --></entry>
</row>
<row>
<entry align='center'>00040</entry>
<entry align='right'>S_IRGRP</entry>
<entry align='right' namest='c3' nameend='c4'><!-- na -->
Read permission for file group class.
<!-- ad --></entry>
</row>
<row>
<entry align='center'>00020</entry>
<entry align='right'>S_IWGRP</entry>
<entry align='right' namest='c3' nameend='c4'><!-- na -->
Write permission for file group class.
<!-- ad --></entry>
</row>
<row>
<entry align='center'>00010</entry>
<entry align='right'>S_IXGRP</entry>
<entry align='right' namest='c3' nameend='c4'><!-- na -->
Execute/search permission for file group class.
<!-- ad --></entry>
</row>
<row>
<entry align='center'>00004</entry>
<entry align='right'>S_IROTH</entry>
<entry align='right' namest='c3' nameend='c4'><!-- na -->
Read permission for file other class.
<!-- ad --></entry>
</row>
<row>
<entry align='center'>00002</entry>
<entry align='right'>S_IWOTH</entry>
<entry align='right' namest='c3' nameend='c4'><!-- na -->
Write permission for file other class.
<!-- ad --></entry>
</row>
<row>
<entry align='center'>00001</entry>
<entry align='right'>S_IXOTH</entry>
<entry align='right' namest='c3' nameend='c4'><!-- na -->
Execute/search permission for file other class.
<!-- ad --></entry>
</row>
</tbody>
</tgroup>
</table>
</blockquote> <!-- remap='RE' -->
<para>When appropriate privilege is required to set one of these mode bits,
and the user restoring the files from the archive does not
have the appropriate privilege, the mode bits for which the user does
not have appropriate privilege shall be ignored. Some of the
mode bits in the archive format are not mentioned elsewhere in this
volume of IEEE Std 1003.1-2001. If the implementation
does not support those bits, they may be ignored.</para>
<para>The <emphasis remap='I'>uid</emphasis> and <emphasis remap='I'>gid</emphasis> fields are the user and group ID of the
owner and group of the file, respectively.</para>
<para>The <emphasis remap='I'>size</emphasis> field is the size of the file in octets. If the <emphasis remap='I'>typeflag</emphasis>
field is set to specify a file to be of type 1
(a link) or 2 (a symbolic link), the <emphasis remap='I'>size</emphasis> field shall be specified
as zero. If the <emphasis remap='I'>typeflag</emphasis> field is set to specify a
file of type 5 (directory), the <emphasis remap='I'>size</emphasis> field shall be interpreted
as described under the definition of that record type. No
data logical records are stored for types 1, 2, or 5. If the <emphasis remap='I'>typeflag</emphasis>
field is set to 3 (character special file), 4 (block
special file), or 6 (FIFO), the meaning of the <emphasis remap='I'>size</emphasis> field is
unspecified by this volume of IEEE Std 1003.1-2001,
and no data logical records shall be stored on the medium. Additionally,
for type 6, the <emphasis remap='I'>size</emphasis> field shall be ignored when
reading. If the <emphasis remap='I'>typeflag</emphasis> field is set to any other value, the
number of logical records written following the header shall
be ( <emphasis remap='I'>size</emphasis>+511)/512, ignoring any fraction in the result of the
division.</para>
<para>The <emphasis remap='I'>mtime</emphasis> field shall be the modification time of the file at
the time it was archived. It is the ISO/IEC 646:1991
standard representation of the octal value of the modification time
obtained from the <emphasis remap='I'>stat</emphasis>() function.</para>
<para>The <emphasis remap='I'>chksum</emphasis> field shall be the ISO/IEC 646:1991 standard IRV
representation of the octal value of the simple sum of
all octets in the header logical record. Each octet in the header
shall be treated as an unsigned value. These values shall be
added to an unsigned integer, initialized to zero, the precision of
which is not less than 17 bits. When calculating the checksum,
the <emphasis remap='I'>chksum</emphasis> field is treated as if it were all spaces.</para>
<para>The <emphasis remap='I'>typeflag</emphasis> field specifies the type of file archived. If a
particular implementation does not recognize the type, or
the user does not have appropriate privilege to create that type,
the file shall be extracted as if it were a regular file if the
file type is defined to have a meaning for the <emphasis remap='I'>size</emphasis> field that
could cause data logical records to be written on the medium
(see the previous description for <emphasis remap='I'>size</emphasis>). If conversion to a
regular file occurs, the <command>pax</command> utility shall produce an
error indicating that the conversion took place. All of the <emphasis remap='I'>typeflag</emphasis>
fields shall be coded in the ISO/IEC 646:1991
standard IRV:</para>
<variablelist remap='TP'>
<varlistentry>
<term><emphasis role='strong' remap='B'>0</emphasis></term>
<listitem>
<para>Represents a regular file. For backwards-compatibility, a <emphasis remap='I'>typeflag</emphasis>
value of binary zero ( <emphasis role='strong' remap='B'>'\0'</emphasis> ) should be
recognized as meaning a regular file when extracting files from the
archive. Archives written with this version of the archive file
format create regular files with a <emphasis remap='I'>typeflag</emphasis> value of the ISO/IEC 646:1991
standard IRV <emphasis role='strong' remap='B'>'0'</emphasis> .</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>1</emphasis></term>
<listitem>
<para>Represents a file linked to another file, of any type, previously
archived. Such files are identified by each file having the
same device and file serial number. The linked-to name is specified
in the <emphasis remap='I'>linkname</emphasis> field with a NUL-character terminator if
it is less than 100 octets in length.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>2</emphasis></term>
<listitem>
<para>Represents a symbolic link. The contents of the symbolic link shall
be stored in the <emphasis remap='I'>linkname</emphasis> field.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>3,4</emphasis></term>
<listitem>
<para>Represent character special files and block special files respectively.
In this case the <emphasis remap='I'>devmajor</emphasis> and <emphasis remap='I'>devminor</emphasis>
fields shall contain information defining the device, the format of
which is unspecified by this volume of
IEEE Std 1003.1-2001. Implementations may map the device specifications
to their own local specification or may ignore
the entry.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>5</emphasis></term>
<listitem>
<para>Specifies a directory or subdirectory. On systems where disk allocation
is performed on a directory basis, the <emphasis remap='I'>size</emphasis>
field shall contain the maximum number of octets (which may be rounded
to the nearest disk block allocation unit) that the
directory may hold. A <emphasis remap='I'>size</emphasis> field of zero indicates no such limiting.
Systems that do not support limiting in this manner
should ignore the <emphasis remap='I'>size</emphasis> field.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>6</emphasis></term>
<listitem>
<para>Specifies a FIFO special file. Note that the archiving of a FIFO file
archives the existence of this file and not its
contents.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>7</emphasis></term>
<listitem>
<para>Reserved to represent a file to which an implementation has associated
some high-performance attribute. Implementations without
such extensions should treat this file as a regular file (type 0).</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>A-Z</emphasis></term>
<listitem>
<para>The letters <emphasis role='strong' remap='B'>'A'</emphasis> to <emphasis role='strong' remap='B'>'Z'</emphasis> , inclusive, are reserved for custom
implementations. All other values are reserved
for future versions of IEEE Std 1003.1-2001.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Attempts to archive a socket using <emphasis role='strong' remap='B'>ustar</emphasis> interchange format
shall produce a diagnostic message. Handling of other file
types is implementation-defined.</para>
<para>The <emphasis remap='I'>magic</emphasis> field is the specification that this archive was output
in this archive format. If this field contains
<emphasis role='strong' remap='B'>ustar</emphasis> (the five characters from the ISO/IEC 646:1991 standard
IRV shown followed by NUL), the <emphasis remap='I'>uname</emphasis> and
<emphasis remap='I'>gname</emphasis> fields shall contain the ISO/IEC 646:1991 standard IRV
representation of the owner and group of the file,
respectively (truncated to fit, if necessary). When the file is restored
by a privileged, protection-preserving version of the
utility, the user and group databases shall be scanned for these names.
If found, the user and group IDs contained within these
files shall be used rather than the values contained within the <emphasis remap='I'>uid</emphasis>
and <emphasis remap='I'>gid</emphasis> fields.</para>
</refsect2>
<refsect2 id='cpio_interchange_format'><title>cpio Interchange Format</title>
<para>The octet-oriented <emphasis role='strong' remap='B'>cpio</emphasis> archive format shall be a series of
entries, each comprising a header that describes the file,
the name of the file, and then the contents of the file.</para>
<para>An archive may be recorded as a series of fixed-size blocks of octets.
This blocking shall be used only to make physical I/O
more efficient. The last group of blocks shall always be at the full
size.</para>
<para>For the octet-oriented <emphasis role='strong' remap='B'>cpio</emphasis> archive format, the individual entry
information shall be in the order indicated and
described by the following table; see also the <emphasis remap='I'><cpio.h></emphasis> header.</para>
<!-- br -->
<blockquote remap='RS'>
<para></para>
<table pgwide='0' frame='none'>
<title>Table: Octet-Oriented cpio Archive Entry</title>
<tgroup cols='7' align='center'>
<colspec colname='c1'/>
<colspec colname='c2'/>
<colspec colname='c3'/>
<colspec colname='c4'/>
<colspec colname='c5'/>
<colspec colname='c6'/>
<colspec colname='c7'/>
<tbody>
<row>
<entry align='center'><emphasis role='strong' remap='B'>Header Field Name</emphasis></entry>
<entry align='right'><emphasis role='strong' remap='B'>Length (in Octets)</emphasis></entry>
<entry align='right' namest='c3' nameend='c4'><emphasis role='strong' remap='B'>Interpreted as</emphasis></entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>c_magic</emphasis></entry>
<entry align='right'>6</entry>
<entry align='right' namest='c3' nameend='c4'>Octal number</entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>c_dev</emphasis></entry>
<entry align='right'>6</entry>
<entry align='right' namest='c3' nameend='c4'>Octal number</entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>c_ino</emphasis></entry>
<entry align='right'>6</entry>
<entry align='right' namest='c3' nameend='c4'>Octal number</entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>c_mode</emphasis></entry>
<entry align='right'>6</entry>
<entry align='right' namest='c3' nameend='c4'>Octal number</entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>c_uid</emphasis></entry>
<entry align='right'>6</entry>
<entry align='right' namest='c3' nameend='c4'>Octal number</entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>c_gid</emphasis></entry>
<entry align='right'>6</entry>
<entry align='right' namest='c3' nameend='c4'>Octal number</entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>c_nlink</emphasis></entry>
<entry align='right'>6</entry>
<entry align='right' namest='c3' nameend='c4'>Octal number</entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>c_rdev</emphasis></entry>
<entry align='right'>6</entry>
<entry align='right' namest='c3' nameend='c4'>Octal number</entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>c_mtime</emphasis></entry>
<entry align='right'>11</entry>
<entry align='right' namest='c3' nameend='c4'>Octal number</entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>c_namesize</emphasis></entry>
<entry align='right'>6</entry>
<entry align='right' namest='c3' nameend='c4'>Octal number</entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>c_filesize</emphasis></entry>
<entry align='right'>11</entry>
<entry align='right' namest='c3' nameend='c4'>Octal number</entry>
</row>
<row>
<entry align='center'><emphasis role='strong' remap='B'>Filename Field Name</emphasis></entry>
<entry align='right'><emphasis role='strong' remap='B'>Length</emphasis></entry>
<entry align='right' namest='c3' nameend='c4'><emphasis role='strong' remap='B'>Interpreted as</emphasis></entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>c_name</emphasis></entry>
<entry align='right'><emphasis remap='I'>c_namesize</emphasis></entry>
<entry align='right' namest='c3' nameend='c4'>Pathname string</entry>
</row>
<row>
<entry align='center'><emphasis role='strong' remap='B'>File Data Field Name</emphasis></entry>
<entry align='right'><emphasis role='strong' remap='B'>Length</emphasis></entry>
<entry align='right' namest='c3' nameend='c4'><emphasis role='strong' remap='B'>Interpreted as</emphasis></entry>
</row>
<row>
<entry align='center'><emphasis remap='I'>c_filedata</emphasis></entry>
<entry align='right'><emphasis remap='I'>c_filesize</emphasis></entry>
<entry align='right' namest='c3' nameend='c4'>Data</entry>
</row>
</tbody>
</tgroup>
</table>
</blockquote> <!-- remap='RE' -->
</refsect2>
<refsect2 id='cpio_header'><title>cpio Header</title>
<para>For each file in the archive, a header as defined previously shall
be written. The information in the header fields is written
as streams of the ISO/IEC 646:1991 standard characters interpreted
as octal numbers. The octal numbers shall be extended to
the necessary length by appending the ISO/IEC 646:1991 standard IRV
zeros at the most-significant-digit end of the number; the
result is written to the most-significant digit of the stream of octets
first. The fields shall be interpreted as follows:</para>
<variablelist remap='TP'>
<varlistentry>
<term><emphasis remap='I'>c_magic</emphasis></term>
<listitem>
<para>Identify the archive as being a transportable archive by containing
the identifying value <emphasis role='strong' remap='B'>"070707"</emphasis> .</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>c_dev</emphasis>, <emphasis remap='I'>c_ino</emphasis></term>
<listitem>
<para>Contains values that uniquely identify the file within the archive
(that is, no files contain the same pair of <emphasis remap='I'>c_dev</emphasis> and
<emphasis remap='I'>c_ino</emphasis> values unless they are links to the same file). The values
shall be determined in an unspecified manner.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>c_mode</emphasis></term>
<listitem>
<para>Contains the file type and access permissions as defined in the following
table.</para>
<!-- br -->
<blockquote remap='RS'>
<para></para>
<table pgwide='0' frame='none'>
<title>Table: Values for cpio c_mode Field</title>
<tgroup cols='7' align='center'>
<colspec colname='c1'/>
<colspec colname='c2'/>
<colspec colname='c3'/>
<colspec colname='c4'/>
<colspec colname='c5'/>
<colspec colname='c6'/>
<colspec colname='c7'/>
<tbody>
<row>
<entry align='center'><emphasis role='strong' remap='B'>File Permissions Name</emphasis></entry>
<entry align='right'><emphasis role='strong' remap='B'>Value</emphasis></entry>
<entry align='right' namest='c3' nameend='c4'><emphasis role='strong' remap='B'>Indicates</emphasis></entry>
</row>
<row>
<entry align='center'>C_IRUSR</entry>
<entry align='right'>000400</entry>
<entry align='right' namest='c3' nameend='c4'>Read by owner</entry>
</row>
<row>
<entry align='center'>C_IWUSR</entry>
<entry align='right'>000200</entry>
<entry align='right' namest='c3' nameend='c4'>Write by owner</entry>
</row>
<row>
<entry align='center'>C_IXUSR</entry>
<entry align='right'>000100</entry>
<entry align='right' namest='c3' nameend='c4'>Execute by owner</entry>
</row>
<row>
<entry align='center'>C_IRGRP</entry>
<entry align='right'>000040</entry>
<entry align='right' namest='c3' nameend='c4'>Read by group</entry>
</row>
<row>
<entry align='center'>C_IWGRP</entry>
<entry align='right'>000020</entry>
<entry align='right' namest='c3' nameend='c4'>Write by group</entry>
</row>
<row>
<entry align='center'>C_IXGRP</entry>
<entry align='right'>000010</entry>
<entry align='right' namest='c3' nameend='c4'>Execute by group</entry>
</row>
<row>
<entry align='center'>C_IROTH</entry>
<entry align='right'>000004</entry>
<entry align='right' namest='c3' nameend='c4'>Read by others</entry>
</row>
<row>
<entry align='center'>C_IWOTH</entry>
<entry align='right'>000002</entry>
<entry align='right' namest='c3' nameend='c4'>Write by others</entry>
</row>
<row>
<entry align='center'>C_IXOTH</entry>
<entry align='right'>000001</entry>
<entry align='right' namest='c3' nameend='c4'>Execute by others</entry>
</row>
<row>
<entry align='center'>C_ISUID</entry>
<entry align='right'>004000</entry>
<entry align='right' namest='c3' nameend='c4'>Set <emphasis remap='I'>uid</emphasis></entry>
</row>
<row>
<entry align='center'>C_ISGID</entry>
<entry align='right'>002000</entry>
<entry align='right' namest='c3' nameend='c4'>Set <emphasis remap='I'>gid</emphasis></entry>
</row>
<row>
<entry align='center'>C_ISVTX</entry>
<entry align='right'>001000</entry>
<entry align='right' namest='c3' nameend='c4'>Reserved</entry>
</row>
<row>
<entry align='center'><emphasis role='strong' remap='B'>File Type Name</emphasis></entry>
<entry align='right'><emphasis role='strong' remap='B'>Value</emphasis></entry>
<entry align='right' namest='c3' nameend='c4'><emphasis role='strong' remap='B'>Indicates</emphasis></entry>
</row>
<row>
<entry align='center'>C_ISDIR</entry>
<entry align='right'>040000</entry>
<entry align='right' namest='c3' nameend='c4'>Directory</entry>
</row>
<row>
<entry align='center'>C_ISFIFO</entry>
<entry align='right'>010000</entry>
<entry align='right' namest='c3' nameend='c4'>FIFO</entry>
</row>
<row>
<entry align='center'>C_ISREG</entry>
<entry align='right'>0100000</entry>
<entry align='right' namest='c3' nameend='c4'>Regular file</entry>
</row>
<row>
<entry align='center'>C_ISLNK</entry>
<entry align='right'>0120000</entry>
<entry align='right' namest='c3' nameend='c4'>Symbolic link</entry>
</row>
<row>
<entry align='center'>C_ISBLK</entry>
<entry align='right'>060000</entry>
<entry align='right' namest='c3' nameend='c4'>Block special file</entry>
</row>
<row>
<entry align='center'>C_ISCHR</entry>
<entry align='right'>020000</entry>
<entry align='right' namest='c3' nameend='c4'>Character special file</entry>
</row>
<row>
<entry align='center'>C_ISSOCK</entry>
<entry align='right'>0140000</entry>
<entry align='right' namest='c3' nameend='c4'>Socket</entry>
</row>
<row>
<entry align='center'>C_ISCTG</entry>
<entry align='right'>0110000</entry>
<entry align='right' namest='c3' nameend='c4'>Reserved</entry>
</row>
</tbody>
</tgroup>
</table>
</blockquote> <!-- remap='RE' -->
</listitem>
</varlistentry>
</variablelist>
<para>Directories, FIFOs, symbolic links, and regular files shall be supported
on a system conforming to this volume of
IEEE Std 1003.1-2001; additional values defined previously are reserved
for compatibility with existing systems.
Additional file types may be supported; however, such files should
not be written to archives intended to be transported to other
systems.</para>
<variablelist remap='TP'>
<varlistentry>
<term><emphasis remap='I'>c_uid</emphasis></term>
<listitem>
<para>Contains the user ID of the owner.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>c_gid</emphasis></term>
<listitem>
<para>Contains the group ID of the group.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>c_nlink</emphasis></term>
<listitem>
<para>Contains the number of links referencing the file at the time the
archive was created.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>c_rdev</emphasis></term>
<listitem>
<para>Contains implementation-defined information for character or block
special files.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>c_mtime</emphasis></term>
<listitem>
<para>Contains the latest time of modification of the file at the time the
archive was created.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>c_namesize</emphasis></term>
<listitem>
<para>Contains the length of the pathname, including the terminating NUL
character.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap='I'>c_filesize</emphasis></term>
<listitem>
<para>Contains the length of the file in octets. This shall be the length
of the data section following the header structure.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>
<refsect2 id='cpio_filename'><title>cpio Filename</title>
<para>The <emphasis remap='I'>c_name</emphasis> field shall contain the pathname of the file. The
length of this field in octets is the value of
<emphasis remap='I'>c_namesize</emphasis>.</para>
<para>If a filename is found on the medium that would create an invalid
pathname, it is implementation-defined whether the data from
the file is stored on the file hierarchy and under what name it is
stored.</para>
<para>All characters shall be represented in the ISO/IEC 646:1991 standard
IRV. For maximum portability between implementations,
names should be selected from characters represented by the portable
filename character set as octets with the most significant bit
zero. If an implementation supports the use of characters outside
the portable filename character set in names for files, users,
and groups, one or more implementation-defined encodings of these
characters shall be provided for interchange purposes. However,
the <command>pax</command> utility shall never create filenames on the local system
that cannot be accessed via the procedures described
previously in this volume of IEEE Std 1003.1-2001. If a filename
is found on the medium that would create an invalid
filename, it is implementation-defined whether the data from the file
is stored on the local file system and under what name it is
stored. The <command>pax</command> utility may choose to ignore these files as
long as it produces an error indicating that the file is being
ignored.</para>
</refsect2>
<refsect2 id='cpio_file_data'><title>cpio File Data</title>
<para>Following <emphasis remap='I'>c_name</emphasis>, there shall be <emphasis remap='I'>c_filesize</emphasis> octets of
data. Interpretation of such data occurs in a manner
dependent on the file. If <emphasis remap='I'>c_filesize</emphasis> is zero, no data shall
be contained in <emphasis remap='I'>c_filedata</emphasis>.</para>
<para>When restoring from an archive:</para>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>If the user does not have the appropriate privilege to create a file
of the specified type, <command>pax</command> shall ignore the entry
and write an error message to standard error.</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>Only regular files have data to be restored. Presuming a regular file
meets any selection criteria that might be imposed on the
format-reading utility by the user, such data shall be restored.</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>If a user does not have appropriate privilege to set a particular
mode flag, the flag shall be ignored. Some of the mode flags
in the archive format are not mentioned elsewhere in this volume of
IEEE Std 1003.1-2001. If the implementation does not
support those flags, they may be ignored.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>
<refsect2 id='cpio_special_entries'><title>cpio Special Entries</title>
<para>FIFO special files, directories, and the trailer shall be recorded
with <emphasis remap='I'>c_filesize</emphasis> equal to zero. For other special
files, <emphasis remap='I'>c_filesize</emphasis> is unspecified by this volume of IEEE Std 1003.1-2001.
The header for the next file entry in the
archive shall be written directly after the last octet of the file
entry preceding it. A header denoting the filename
<emphasis role='strong' remap='B'>TRAILER!!!</emphasis> shall indicate the end of the archive; the contents
of octets in the last block of the archive following such a
header are undefined.</para>
</refsect2>
</refsect1>
<refsect1 id='exit_status'><title>EXIT STATUS</title>
<para>The following exit values shall be returned:</para>
<variablelist remap='TP'>
<varlistentry>
<term> 0</term>
<listitem>
<para>All files were processed successfully.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>>0</term>
<listitem>
<para>An error occurred.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id='consequences_of_errors'><title>CONSEQUENCES OF ERRORS</title>
<para>If <command>pax</command> cannot create a file or a link when reading an archive
or cannot find a file when writing an archive, or cannot
preserve the user ID, group ID, or file mode when the <emphasis role='strong' remap='B'>-p</emphasis> option
is specified, a diagnostic message shall be written to
standard error and a non-zero exit status shall be returned, but processing
shall continue. In the case where <command>pax</command> cannot
create a link to a file, <command>pax</command> shall not, by default, create a
second copy of the file.</para>
<para>If the extraction of a file from an archive is prematurely terminated
by a signal or error, <command>pax</command> may have only partially
extracted the file or (if the <emphasis role='strong' remap='B'>-n</emphasis> option was not specified) may
have extracted a file of the same name as that specified by
the user, but which is not the file the user wanted. Additionally,
the file modes of extracted directories may have additional bits
from the S_IRWXU mask set as well as incorrect modification and access
times.</para>
<para><emphasis remap='I'>The following sections are informative.</emphasis></para>
</refsect1>
<refsect1 id='application_usage'><title>APPLICATION USAGE</title>
<para>The <emphasis role='strong' remap='B'>-p</emphasis> (privileges) option was invented to reconcile differences
between historical <emphasis remap='I'>tar</emphasis> and <emphasis remap='I'>cpio</emphasis>
implementations. In particular, the two utilities use <emphasis role='strong' remap='B'>-m</emphasis> in
diametrically opposed ways. The <emphasis role='strong' remap='B'>-p</emphasis> option also provides a
consistent means of extending the ways in which future file attributes
can be addressed, such as for enhanced security systems or
high-performance files. Although it may seem complex, there are really
two modes that are most commonly used:</para>
<variablelist remap='TP'>
<varlistentry>
<term><emphasis role='strong' remap='B'>-p e</emphasis></term>
<listitem>
<para>``Preserve everything". This would be used by the historical superuser,
someone with all the appropriate privileges, to
preserve all aspects of the files as they are recorded in the archive.
The <emphasis role='strong' remap='B'>e</emphasis> flag is the sum of <emphasis role='strong' remap='B'>o</emphasis> and <emphasis role='strong' remap='B'>p</emphasis>, and
other implementation-defined attributes.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role='strong' remap='B'>-p p</emphasis></term>
<listitem>
<para>``Preserve" the file mode bits. This would be used by the user with
regular privileges who wished to preserve aspects of the
file other than the ownership. The file times are preserved by default,
but two other flags are offered to disable these and use
the time of extraction.</para>
</listitem>
</varlistentry>
</variablelist>
<para>The one pathname per line format of standard input precludes pathnames
containing <newline>s. Although such pathnames
violate the portable filename guidelines, they may exist and their
presence may inhibit usage of <command>pax</command> within shell scripts.
This problem is inherited from historical archive programs. The problem
can be avoided by listing filename arguments on the command
line instead of on standard input.</para>
<para>It is almost certain that appropriate privileges are required for
<command>pax</command> to accomplish parts of this volume of
IEEE Std 1003.1-2001. Specifically, creating files of type block
special or character special, restoring file access
times unless the files are owned by the user (the <emphasis role='strong' remap='B'>-t</emphasis> option),
or preserving file owner, group, and mode (the <emphasis role='strong' remap='B'>-p</emphasis>
option) all probably require appropriate privileges.</para>
<para>In <emphasis role='strong' remap='B'>read</emphasis> mode, implementations are permitted to overwrite files
when the archive has multiple members with the same name.
This may fail if permissions on the first version of the file do not
permit it to be overwritten.</para>
<para>The <emphasis role='strong' remap='B'>cpio</emphasis> and <emphasis role='strong' remap='B'>ustar</emphasis> formats can only support files up to
8589934592 bytes (8 * 2^30) in size.</para>
</refsect1>
<refsect1 id='examples'><title>EXAMPLES</title>
<para>The following command:</para>
<literallayout remap='.nf'>
<emphasis role='strong' remap='B'>pax -w -f /dev/rmt/1m .
</emphasis>
</literallayout> <!-- .fi -->
<para>copies the contents of the current directory to tape drive 1, medium
density (assuming historical System V device naming
procedures-the historical BSD device name would be <emphasis role='strong' remap='B'>/dev/rmt9</emphasis>).</para>
<para>The following commands:</para>
<literallayout remap='.nf'>
<emphasis role='strong' remap='B'>mkdir</emphasis> <emphasis remap='I'>newdir</emphasis><emphasis role='strong' remap='B'>pax -rw</emphasis> <emphasis remap='I'>olddir newdir</emphasis>
</literallayout> <!-- .fi -->
<para>copy the <emphasis remap='I'>olddir</emphasis> directory hierarchy to <emphasis remap='I'>newdir</emphasis>.</para>
<literallayout remap='.nf'>
<emphasis role='strong' remap='B'>pax -r -s ',^//*usr//*,,' -f a.pax
</emphasis>
</literallayout> <!-- .fi -->
<para>reads the archive <emphasis role='strong' remap='B'>a.pax</emphasis>, with all files rooted in <emphasis role='strong' remap='B'>/usr</emphasis>
in the archive extracted relative to the current
directory.</para>
<para>Using the option:</para>
<literallayout remap='.nf'>
<emphasis role='strong' remap='B'>-o listopt="%M %(atime)T %(size)D %(name)s"
</emphasis>
</literallayout> <!-- .fi -->
<para>overrides the default output description in Standard Output and instead
writes:</para>
<literallayout remap='.nf'>
<emphasis role='strong' remap='B'>-rw-rw--- Jan 12 15:53 1492 /usr/foo/bar
</emphasis>
</literallayout> <!-- .fi -->
<para>Using the options:</para>
<literallayout remap='.nf'>
<emphasis role='strong' remap='B'>-o listopt='%L\t%(size)D\n%.7' \
-o listopt='(name)s\n%(ctime)T\n%T'
</emphasis>
</literallayout> <!-- .fi -->
<para>overrides the default output description in Standard Output and instead
writes:</para>
<literallayout remap='.nf'>
<emphasis role='strong' remap='B'>/usr/foo/bar -> /tmp 1492
/usr/fo
Jan 12 1991
Jan 31 15:53
</emphasis>
</literallayout> <!-- .fi -->
</refsect1>
<refsect1 id='rationale'><title>RATIONALE</title>
<para>The <command>pax</command> utility was new for the ISO POSIX-2:1993 standard.
It represents a peaceful compromise between advocates of
the historical <emphasis remap='I'>tar</emphasis> and <emphasis remap='I'>cpio</emphasis> utilities.</para>
<para>A fundamental difference between <emphasis remap='I'>cpio</emphasis> and <emphasis remap='I'>tar</emphasis> was in the
way directories were treated. The <emphasis remap='I'>cpio</emphasis> utility did
not treat directories differently from other files, and to select
a directory and its contents required that each file in the
hierarchy be explicitly specified. For <emphasis remap='I'>tar</emphasis>, a directory matched
every file in the file hierarchy it rooted.</para>
<para>The <command>pax</command> utility offers both interfaces; by default, directories
map into the file hierarchy they root. The <emphasis role='strong' remap='B'>-d</emphasis>
option causes <command>pax</command> to skip any file not explicitly referenced,
as <emphasis remap='I'>cpio</emphasis> historically did. The <emphasis remap='I'>tar</emphasis> <emphasis role='strong' remap='B'>-</emphasis>
<emphasis remap='I'>style</emphasis> behavior was chosen as the default because it was believed
that this was the more common usage and because <emphasis remap='I'>tar</emphasis>
is the more commonly available interface, as it was historically provided
on both System V and BSD implementations.</para>
<para>The data interchange format specification in this volume of IEEE Std 1003.1-2001
requires that processes with
"appropriate privileges" shall always restore the ownership and permissions
of extracted files exactly as archived. If viewed
from the historic equivalence between superuser and "appropriate privileges",
there are two problems with this requirement.
First, users running as superusers may unknowingly set dangerous permissions
on extracted files. Second, it is needlessly limiting,
in that superusers cannot extract files and own them as superuser
unless the archive was created by the superuser. (It should be
noted that restoration of ownerships and permissions for the superuser,
by default, is historical practice in <emphasis remap='I'>cpio</emphasis>, but not
in <emphasis remap='I'>tar</emphasis>.) In order to avoid these two problems, the <command>pax</command>
specification has an additional "privilege" mechanism, the
<emphasis role='strong' remap='B'>-p</emphasis> option. Only a <command>pax</command> invocation with the privileges needed,
and which has the <emphasis role='strong' remap='B'>-p</emphasis> option set using the
<emphasis role='strong' remap='B'>e</emphasis> specification character, has the "appropriate privilege" to
restore full ownership and permission information.</para>
<para>Note also that this volume of IEEE Std 1003.1-2001 requires that
the file ownership and access permissions shall be
set, on extraction, in the same fashion as the <emphasis remap='I'>creat</emphasis>() function
when provided with the
mode stored in the archive. This means that the file creation mask
of the user is applied to the file permissions.</para>
<para>Users should note that directories may be created by <command>pax</command> while
extracting files with permissions that are different from
those that existed at the time the archive was created. When extracting
sensitive information into a directory hierarchy that no
longer exists, users are encouraged to set their file creation mask
appropriately to protect these files during extraction.</para>
<para>The table of contents output is written to standard output to facilitate
pipeline processing.</para>
<para>An early proposal had hard links displaying for all pathnames. This
was removed because it complicates the output of the case
where <emphasis role='strong' remap='B'>-v</emphasis> is not specified and does not match historical <emphasis remap='I'>cpio</emphasis>
usage. The hard-link information is available in the
<emphasis role='strong' remap='B'>-v</emphasis> display.</para>
<para>The description of the <emphasis role='strong' remap='B'>-l</emphasis> option allows implementations to make
hard links to symbolic links.
IEEE Std 1003.1-2001 does not specify any way to create a hard link
to a symbolic link, but many implementations provide
this capability as an extension. If there are hard links to symbolic
links when an archive is created, the implementation is
required to archive the hard link in the archive (unless <emphasis role='strong' remap='B'>-H</emphasis>
or <emphasis role='strong' remap='B'>-L</emphasis> is specified). When in <emphasis role='strong' remap='B'>read</emphasis> mode and in
<emphasis role='strong' remap='B'>copy</emphasis> mode, implementations supporting hard links to symbolic
links should use them when appropriate.</para>
<para>The archive formats inherited from the POSIX.1-1990 standard have
certain restrictions that have been brought along from
historical usage. For example, there are restrictions on the length
of pathnames stored in the archive. When <command>pax</command> is used in
<emphasis role='strong' remap='B'>copy</emphasis>( <emphasis role='strong' remap='B'>-rw</emphasis>) mode (copying directory hierarchies), the ability
to use extensions from the <emphasis role='strong' remap='B'>-x</emphasis> <emphasis role='strong' remap='B'>pax</emphasis> format
overcomes these restrictions.</para>
<para>The default <emphasis remap='I'>blocksize</emphasis> value of 5120 bytes for <emphasis remap='I'>cpio</emphasis> was
selected because it is one of the standard block-size
values for <emphasis remap='I'>cpio</emphasis>, set when the <emphasis role='strong' remap='B'>-B</emphasis> option is specified.
(The other default block-size value for <emphasis remap='I'>cpio</emphasis> is 512
bytes, and this was considered to be too small.) The default block
value of 10240 bytes for <emphasis remap='I'>tar</emphasis> was selected because that is
the standard block-size value for BSD <emphasis remap='I'>tar</emphasis>. The maximum block
size of 32256 bytes (2**15-512 bytes)
is the largest multiple of 512 bytes that fits into a signed 16-bit
tape controller transfer register. There are known limitations
in some historical systems that would prevent larger blocks from being
accepted. Historical values were chosen to improve
compatibility with historical scripts using <emphasis remap='I'>dd</emphasis> or similar utilities
to manipulate
archives. Also, default block sizes for any file type other than character
special file has been deleted from this volume of
IEEE Std 1003.1-2001 as unimportant and not likely to affect the
structure of the resulting archive.</para>
<para>Implementations are permitted to modify the block-size value based
on the archive format or the device to which the archive is
being written. This is to provide implementations with the opportunity
to take advantage of special types of devices, and it should
not be used without a great deal of consideration as it almost certainly
decreases archive portability.</para>
<para>The intended use of the <emphasis role='strong' remap='B'>-n</emphasis> option was to permit extraction of
one or more files from the archive without processing the
entire archive. This was viewed by the standard developers as offering
significant performance advantages over historical
implementations. The <emphasis role='strong' remap='B'>-n</emphasis> option in early proposals had three
effects; the first was to cause special characters in patterns
to not be treated specially. The second was to cause only the first
file that matched a pattern to be extracted. The third was to
cause <command>pax</command> to write a diagnostic message to standard error when
no file was found matching a specified pattern. Only the
second behavior is retained by this volume of IEEE Std 1003.1-2001,
for many reasons. First, it is in general not
acceptable for a single option to have multiple effects. Second, the
ability to make pattern matching characters act as normal
characters is useful for parts of <command>pax</command> other than file extraction.
Third, a finer degree of control over the special
characters is useful because users may wish to normalize only a single
special character in a single filename. Fourth, given a more
general escape mechanism, the previous behavior of the <emphasis role='strong' remap='B'>-n</emphasis> option
can be easily obtained using the <emphasis role='strong' remap='B'>-s</emphasis> option or a <emphasis remap='I'>sed</emphasis> script.
Finally, writing a diagnostic message when a pattern specified by
the user is
unmatched by any file is useful behavior in all cases.</para>
<para>In this version, the <emphasis role='strong' remap='B'>-n</emphasis> was removed from the <emphasis role='strong' remap='B'>copy</emphasis> mode
synopsis of <command>pax</command>; it is inapplicable because there
are no pattern operands specified in this mode.</para>
<para>There is another method than <command>pax</command> for copying subtrees in IEEE Std 1003.1-2001
described as part of the <emphasis remap='I'>cp</emphasis> utility. Both methods are historical
practice: <emphasis remap='I'>cp</emphasis>
provides a simpler, more intuitive interface, while <command>pax</command> offers
a finer granularity of control. Each provides additional
functionality to the other; in particular, <command>pax</command> maintains the
hard-link structure of the hierarchy while <emphasis remap='I'>cp</emphasis> does not. It is
the intention of the standard developers that the results be similar
(using
appropriate option combinations in both utilities). The results are
not required to be identical; there seemed insufficient gain to
applications to balance the difficulty of implementations having to
guarantee that the results would be exactly identical.</para>
<para>A single archive may span more than one file. It is suggested that
implementations provide informative messages to the user on
standard error whenever the archive file is changed.</para>
<para>The <emphasis role='strong' remap='B'>-d</emphasis> option (do not create intermediate directories not listed
in the archive) found in early proposals was originally
provided as a complement to the historic <emphasis role='strong' remap='B'>-d</emphasis> option of <emphasis remap='I'>cpio</emphasis>.
It has been deleted.</para>
<para>The <emphasis role='strong' remap='B'>-s</emphasis> option in early proposals specified a subset of the substitution
command from the <emphasis remap='I'>ed</emphasis> utility. As there was no reason for only
a subset to be supported, the <emphasis role='strong' remap='B'>-s</emphasis> option is now
compatible with the current <emphasis remap='I'>ed</emphasis> specification. Since the delimiter
can be any non-null
character, the following usage with single spaces is valid:</para>
<literallayout remap='.nf'>
<emphasis role='strong' remap='B'>pax -s " foo bar " ...
</emphasis>
</literallayout> <!-- .fi -->
<para>The <emphasis role='strong' remap='B'>-t</emphasis> description is worded so as to note that this may cause
the access time update caused by some other activity
(which occurs while the file is being read) to be overwritten.</para>
<para>The default behavior of <command>pax</command> with regard to file modification
times is the same as historical implementations of
<emphasis remap='I'>tar</emphasis>. It is not the historical behavior of <emphasis remap='I'>cpio</emphasis>.</para>
<para>Because the <emphasis role='strong' remap='B'>-i</emphasis> option uses <emphasis role='strong' remap='B'>/dev/tty</emphasis>, utilities without
a controlling terminal are not able to use this option.</para>
<para>The <emphasis role='strong' remap='B'>-y</emphasis> option, found in early proposals, has been deleted because
a line containing a single period for the <emphasis role='strong' remap='B'>-i</emphasis>
option has equivalent functionality. The special lines for the <emphasis role='strong' remap='B'>-i</emphasis>
option (a single period and the empty line) are historical
practice in <emphasis remap='I'>cpio</emphasis>.</para>
<para>In early drafts, a <emphasis role='strong' remap='B'>-e</emphasis> <emphasis remap='I'>charmap</emphasis> option was included to increase
portability of files between systems using different
coded character sets. This option was omitted because it was apparent
that consensus could not be formed for it. In this version,
the use of UTF-8 should be an adequate substitute.</para>
<para>The <emphasis role='strong' remap='B'>-k</emphasis> option was added to address international concerns about
the dangers involved in the character set transformations
of <emphasis role='strong' remap='B'>-e</emphasis> (if the target character set were different from the source,
the filenames might be transformed into names matching
existing files) and also was made more general to protect files transferred
between file systems with different {NAME_MAX} values
(truncating a filename on a smaller system might also inadvertently
overwrite existing files). As stated, it prevents any
overwriting, even if the target file is older than the source. This
version adds more granularity of options to solve this problem
by introducing the <emphasis role='strong' remap='B'>-o</emphasis> <emphasis role='strong' remap='B'>invalid=</emphasis> option-specifically the
UTF-8 action. (Note that an existing file that is named with a
UTF-8 encoding is still subject to overwriting in this case. The <emphasis role='strong' remap='B'>-k</emphasis>
option closes that loophole.)</para>
<para>Some of the file characteristics referenced in this volume of IEEE Std 1003.1-2001
might not be supported by some
archive formats. For example, neither the <emphasis role='strong' remap='B'>tar</emphasis> nor <emphasis role='strong' remap='B'>cpio</emphasis>
formats contain the file access time. For this reason, the
<emphasis role='strong' remap='B'>e</emphasis> specification character has been provided, intended to cause
all file characteristics specified in the archive to be
retained.</para>
<para>It is required that extracted directories, by default, have their
access and modification times and permissions set to the
values specified in the archive. This has obvious problems in that
the directories are almost certainly modified after being
extracted and that directory permissions may not permit file creation.
One possible solution is to create directories with the mode
specified in the archive, as modified by the <emphasis remap='I'>umask</emphasis> of the user,
with sufficient
permissions to allow file creation. After all files have been extracted,
<command>pax</command> would then reset the access and modification
times and permissions as necessary.</para>
<para>The list-mode formatting description borrows heavily from the one
defined by the <emphasis remap='I'>printf</emphasis> utility. However, since there is no separate
operand list to get conversion arguments,
the format was extended to allow specifying the name of the conversion
argument as part of the conversion specification.</para>
<para>The <emphasis role='strong' remap='B'>T</emphasis> conversion specifier allows time fields to be displayed
in any of the date formats. Unlike the <emphasis remap='I'>ls</emphasis> utility, <command>pax</command>
does not adjust the format when the date is less than six months in
the
past. This makes parsing the output more predictable.</para>
<para>The <emphasis role='strong' remap='B'>D</emphasis> conversion specifier handles the ability to display the
major/minor or file size, as with <emphasis remap='I'>ls</emphasis>, by using <emphasis role='strong' remap='B'>%-8(</emphasis><emphasis remap='I'>size</emphasis><emphasis role='strong' remap='B'>)D</emphasis>.</para>
<para>The <emphasis role='strong' remap='B'>L</emphasis> conversion specifier handles the <emphasis remap='I'>ls</emphasis> display for
symbolic links.</para>
<para>Conversion specifiers were added to generate existing known types
used for <emphasis remap='I'>ls</emphasis>.</para>
<refsect2 id='pax_interchange_format2'><title>pax Interchange Format</title>
<para>The new POSIX data interchange format was developed primarily to satisfy
international concerns that the <emphasis role='strong' remap='B'>ustar</emphasis> and
<emphasis role='strong' remap='B'>cpio</emphasis> formats did not provide for file, user, and group names
encoded in characters outside a subset of the
ISO/IEC 646:1991 standard. The standard developers realized that
this new POSIX data interchange format should be very
extensible because there were other requirements they foresaw in the
near future:</para>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>Support international character encodings and locale information</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>Support security information (ACLs, and so on)</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>Support future file types, such as realtime or contiguous files</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>Include data areas for implementation use</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>Support systems with words larger than 32 bits and timers with subsecond
granularity</para>
</listitem>
</varlistentry>
</variablelist>
<para>The following were not goals for this format because these are better
handled by separate utilities or are inappropriate for a
portable format:</para>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>Encryption</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>Compression</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>Data translation between locales and codesets</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para><emphasis remap='I'>inode</emphasis> storage</para>
</listitem>
</varlistentry>
</variablelist>
<para>The format chosen to support the goals is an extension of the <emphasis role='strong' remap='B'>ustar</emphasis>
format. Of the two formats previously available, only
the <emphasis role='strong' remap='B'>ustar</emphasis> format was selected for extensions because:</para>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>It was easier to extend in an upwards-compatible way. It offered version
flags and header block type fields with room for future
standardization. The <emphasis role='strong' remap='B'>cpio</emphasis> format, while possessing a more flexible
file naming methodology, could not be extended without
breaking some theoretical implementation or using a dummy filename
that could be a legitimate filename.</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>Industry experience since the original " <emphasis remap='I'>tar</emphasis> wars" fought in
developing the ISO POSIX-1 standard has clearly been
in favor of the <emphasis role='strong' remap='B'>ustar</emphasis> format, which is generally the default
output format selected for <command>pax</command> implementations on new
systems.</para>
</listitem>
</varlistentry>
</variablelist>
<para>The new format was designed with one additional goal in mind: reasonable
behavior when an older <emphasis remap='I'>tar</emphasis> or <command>pax</command> utility
happened to read an archive. Since the POSIX.1-1990 standard mandated
that a "format-reading utility" had to treat unrecognized
<emphasis remap='I'>typeflag</emphasis> values as regular files, this allowed the format to
include all the extended information in a pseudo-regular file
that preceded each real file. An option is given that allows the archive
creator to set up reasonable names for these files on the
older systems. Also, the normative text suggests that reasonable file
access values be used for this <emphasis role='strong' remap='B'>ustar</emphasis> header block.
Making these header files inaccessible for convenient reading and
deleting would not be reasonable. File permissions of 600 or 700
are suggested.</para>
<para>The <emphasis role='strong' remap='B'>ustar</emphasis> <emphasis remap='I'>typeflag</emphasis> field was used to accommodate the additional
functionality of the new format rather than magic
or version because the POSIX.1-1990 standard (and, by reference, the
previous version of <command>pax</command>), mandated the behavior of the
format-reading utility when it encountered an unknown <emphasis remap='I'>typeflag</emphasis>,
but was silent about the other two fields.</para>
<para>Early proposals of the first revision to IEEE Std 1003.1-2001 contained
a proposed archive format that was based on
compatibility with the standard for tape files (ISO 1001, similar
to the format used historically on many mainframes and
minicomputers). This format was overly complex and required considerable
overhead in volume and header records. Furthermore, the
standard developers felt that it would not be acceptable to the community
of POSIX developers, so it was later changed to be a
format more closely related to historical practice on POSIX systems.</para>
<para>The prefix and name split of pathnames in <emphasis role='strong' remap='B'>ustar</emphasis> was replaced
by the single path extended header record for
simplicity.</para>
<para>The concept of a global extended header ( <emphasis remap='I'>typeflag</emphasis> <emphasis role='strong' remap='B'>g</emphasis>)
was controversial. If this were applied to an archive being
recorded on magnetic tape, a few unreadable blocks at the beginning
of the tape could be a serious problem; a utility attempting to
extract as many files as possible from a damaged archive could lose
a large percentage of file header information in this case.
However, if the archive were on a reliable medium, such as a CD-ROM,
the global extended header offers considerable potential size
reductions by eliminating redundant information. Thus, the text warns
against using the global method for unreliable media and
provides a method for implanting global information in the extended
header for each file, rather than in the <emphasis remap='I'>typeflag</emphasis>
<emphasis role='strong' remap='B'>g</emphasis> records.</para>
<para>No facility for data translation or filtering on a per-file basis
is included because the standard developers could not invent
an interface that would allow this in an efficient manner. If a filter,
such as encryption or compression, is to be applied to all
the files, it is more efficient to apply the filter to the entire
archive as a single file. The standard developers considered
interfaces that would invoke a shell script for each file going into
or out of the archive, but the system overhead in this
approach was considered to be too high.</para>
<para>One such approach would be to have <emphasis role='strong' remap='B'>filter=</emphasis> records that give
a pathname for an executable. When the program is invoked,
the file and archive would be open for standard input/output and all
the header fields would be available as environment variables
or command-line arguments. The standard developers did discuss such
schemes, but they were omitted from
IEEE Std 1003.1-2001 due to concerns about excessive overhead. Also,
the program itself would need to be in the archive
if it were to be used portably.</para>
<para>There is currently no portable means of identifying the character
set(s) used for a file in the file system. Therefore,
<command>pax</command> has not been given a mechanism to generate charset records
automatically. The only portable means of doing this is for
the user to write the archive using the <emphasis role='strong' remap='B'>-o</emphasis> <emphasis role='strong' remap='B'>charset=</emphasis> <emphasis remap='I'>string</emphasis>
command line option. This assumes that all of the
files in the archive use the same encoding. The "implementation-defined"
text is included to allow for a system that can identify
the encodings used for each of its files.</para>
<para>The table of standards that accompanies the charset record description
is acknowledged to be very limited. Only a limited number
of character set standards is reasonable for maximal interchange.
Any character set is, of course, possible by prior agreement. It
was suggested that EBCDIC be listed, but it was omitted because it
is not defined by a formal standard. Formal standards, and then
only those with reasonably large followings, can be included here,
simply as a matter of practicality. The <<emphasis remap='I'>value</emphasis>>s
represent names of officially registered character sets in the format
required by the ISO 2375:1985 standard.</para>
<para>The normal comma or <blank>-separated list rules are not followed
in the case of keyword options to allow ease of argument
parsing for <emphasis remap='I'>getopts</emphasis>.</para>
<para>Further information on character encodings is in pax Archive Character
Set Encoding/Decoding
.</para>
<para>The standard developers have reserved keyword name space for vendor
extensions. It is suggested that the format to be used
is:</para>
<literallayout remap='.nf'>
<emphasis remap='I'>VENDOR.keyword</emphasis>
</literallayout> <!-- .fi -->
<para>where <emphasis remap='I'>VENDOR</emphasis> is the name of the vendor or organization in all
uppercase letters. It is further suggested that the keyword
following the period be named differently than any of the standard
keywords so that it could be used for future standardization, if
appropriate, by omitting the <emphasis remap='I'>VENDOR</emphasis> prefix.</para>
<para>The <<emphasis remap='I'>length</emphasis>> field in the extended header record was included
to make it simpler to step through the records, even
if a record contains an unknown format (to a particular <command>pax</command>)
with complex interactions of special characters. It also
provides a minor integrity checkpoint within the records to aid a
program attempting to recover files from a damaged archive.</para>
<para>There are no extended header versions of the <emphasis remap='I'>devmajor</emphasis> and <emphasis remap='I'>devminor</emphasis>
fields because the unspecified format
<emphasis role='strong' remap='B'>ustar</emphasis> header field should be sufficient. If they are not, vendor-specific
extended keywords (such as <emphasis remap='I'>VENDOR.devmajor</emphasis>)
should be used.</para>
<para>Device and <emphasis remap='I'>i</emphasis>-number labeling of files was not adopted from <emphasis remap='I'>cpio</emphasis>;
files are interchanged strictly on a symbolic
name basis, as in <emphasis role='strong' remap='B'>ustar</emphasis>.</para>
<para>Just as with the <emphasis role='strong' remap='B'>ustar</emphasis> format descriptions, the new format makes
no special arrangements for multi-volume archives. Each
of the <command>pax</command> archive types is assumed to be inside a single POSIX
file and splitting that file over multiple volumes
(diskettes, tape cartridges, and so on), processing their labels,
and mounting each in the proper sequence are considered to be
implementation details that cannot be described portably.</para>
<para>The <emphasis role='strong' remap='B'>pax</emphasis> format is intended for interchange, not only for backup
on a single (family of) systems. It is not as densely
packed as might be possible for backup:</para>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>It contains information as coded characters that could be coded in
binary.</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>It identifies extended records with name fields that could be omitted
in favor of a fixed-field layout.</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>It translates names into a portable character set and identifies locale-related
information, both of which are probably
unnecessary for backup.</para>
</listitem>
</varlistentry>
</variablelist>
<para>The requirements on restoring from an archive are slightly different
from the historical wording, allowing for non-monolithic
privilege to bring forward as much as possible. In particular, attributes
such as "high performance file" might be broadly but
not universally granted while set-user-ID or <emphasis remap='I'>chown</emphasis>() might be
much more restricted.
There is no implication in IEEE Std 1003.1-2001 that the security
information be honored after it is restored to the file
hierarchy, in spite of what might be improperly inferred by the silence
on that topic. That is a topic for another standard.</para>
<para>Links are recorded in the fashion described here because a link can
be to any file type. It is desirable in general to be able
to restore part of an archive selectively and restore all of those
files completely. If the data is not associated with each link,
it is not possible to do this. However, the data associated with a
file can be large, and when selective restoration is not needed,
this can be a significant burden. The archive is structured so that
files that have no associated data can always be restored by
the name of any link name of any link, and the user may choose whether
data is recorded with each instance of a file that contains
data. The format permits mixing of both types of links in a single
archive; this can be done for special needs, and <command>pax</command> is
expected to interpret such archives on input properly, despite the
fact that there is no <command>pax</command> option that would force this
mixed case on output. (When <emphasis role='strong' remap='B'>-o</emphasis> <emphasis role='strong' remap='B'>linkdata</emphasis> is used, the output
must contain the duplicate data, but the implementation
is free to include it or omit it when <emphasis role='strong' remap='B'>-o</emphasis> <emphasis role='strong' remap='B'>linkdata</emphasis> is not
used.)</para>
<para>The time values are included as extended header records for those
implementations needing more than the eleven octal digits
allowed by the <emphasis role='strong' remap='B'>ustar</emphasis> format. Portable file timestamps cannot
be negative. If <command>pax</command> encounters a file with a negative
timestamp in <emphasis role='strong' remap='B'>copy</emphasis> or <emphasis role='strong' remap='B'>write</emphasis> mode, it can reject the file,
substitute a non-negative timestamp, or generate a
non-portable timestamp with a leading <emphasis role='strong' remap='B'>'-'</emphasis> . Even though some
implementations can support finer file-time granularities
than seconds, the normative text requires support only for seconds
since the Epoch because the ISO POSIX-1 standard states
them that way. The <emphasis role='strong' remap='B'>ustar</emphasis> format includes only <emphasis remap='I'>mtime</emphasis>; the
new format adds <emphasis remap='I'>atime</emphasis> and <emphasis remap='I'>ctime</emphasis> for symmetry.
The <emphasis remap='I'>atime</emphasis> access time restored to the file system will be affected
by the <emphasis role='strong' remap='B'>-p</emphasis> <emphasis role='strong' remap='B'>a</emphasis> and <emphasis role='strong' remap='B'>-p</emphasis> <emphasis role='strong' remap='B'>e</emphasis> options.
The <emphasis remap='I'>ctime</emphasis> creation time (actually <emphasis remap='I'>inode</emphasis> modification time)
is described with "appropriate privilege" so that it can
be ignored when writing to the file system. POSIX does not provide
a portable means to change file creation time. Nothing is
intended to prevent a non-portable implementation of <command>pax</command> from
restoring the value.</para>
<para>The <emphasis remap='I'>gid</emphasis>, <emphasis remap='I'>size</emphasis>, and <emphasis remap='I'>uid</emphasis> extended header records were
included to allow expansion beyond the sizes specified
in the regular <emphasis remap='I'>tar</emphasis> header. New file system architectures are
emerging that will exhaust the 12-digit size field. There are
probably not many systems requiring more than 8 digits for user and
group IDs, but the extended header values were included for
completeness, allowing overrides for all of the decimal values in
the <emphasis remap='I'>tar</emphasis> header.</para>
<para>The standard developers intended to describe the effective results
of <command>pax</command> with regard to file ownerships and permissions;
implementations are not restricted in timing or sequencing the restoration
of such, provided the results are as specified.</para>
<para>Much of the text describing the extended headers refers to use in
" <emphasis role='strong' remap='B'>write</emphasis> or <emphasis role='strong' remap='B'>copy</emphasis> modes". The <emphasis role='strong' remap='B'>copy</emphasis> mode
references are due to the normative text: "The effect of the copy
shall be as if the copied files were written to an archive file
and then subsequently extracted ...". There is certainly no way to
test whether <command>pax</command> is actually generating the extended
headers in <emphasis role='strong' remap='B'>copy</emphasis> mode, but the effects must be as if it had.</para>
</refsect2>
<refsect2 id='pax_archive_character_set_encodingdecodi'><title>pax Archive Character Set Encoding/Decoding</title>
<para>There is a need to exchange archives of files between systems of different
native codesets. Filenames, group names, and user
names must be preserved to the fullest extent possible when an archive
is read on the receiving platform. Translation of the
contents of files is not within the scope of the <command>pax</command> utility.</para>
<para>There will also be the need to represent characters that are not available
on the receiving platform. These unsupported
characters cannot be automatically folded to the local set of characters
due to the chance of collisions. This could result in
overwriting previous extracted files from the archive or pre-existing
files on the system.</para>
<para>For these reasons, the codeset used to represent characters within
the extended header records of the <command>pax</command> archive must be
sufficiently rich to handle all commonly used character sets. The
fields requiring translation include, at a minimum, filenames,
user names, group names, and link pathnames. Implementations may wish
to have localized extended keywords that use non-portable
characters.</para>
<para>The standard developers considered the following options:</para>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>The archive creator specifies the well-defined name of the source
codeset. The receiver must then recognize the codeset name and
perform the appropriate translations to the destination codeset.</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>The archive creator includes within the archive the character mapping
table for the source codeset used to encode extended
header records. The receiver must then read the character mapping
table and perform the appropriate translations to the destination
codeset.</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist remap='IP'>
<varlistentry>
<term> *</term>
<listitem>
<para>The archive creator translates the extended header records in the
source codeset into a canonical form. The receiver must then
perform the appropriate translations to the destination codeset.</para>
</listitem>
</varlistentry>
</variablelist>
<para>The approach that incorporates the name of the source codeset poses
the problem of codeset name registration, and makes the
archive useless to <command>pax</command> archive decoders that do not recognize
that codeset.</para>
<para>Because parts of an archive may be corrupted, the standard developers
felt that including the character map of the source
codeset was too fragile. The loss of this one key component could
result in making the entire archive useless. (The difference
between this and the global extended header decision was that the
latter has a workaround-duplicating extended header records on
unreliable media-but this would be too burdensome for large character
set maps.)</para>
<para>Both of the above approaches also put an undue burden on the <command>pax</command>
archive receiver to handle the cross-product of all
source and destination codesets.</para>
<para>To simplify the translation from the source codeset to the canonical
form and from the canonical form to the destination
codeset, the standard developers decided that the internal representation
should be a stateless encoding. A stateless encoding is
one where each codepoint has the same meaning, without regard to the
decoder being in a specific state. An example of a stateful
encoding would be the Japanese Shift-JIS; an example of a stateless
encoding would be the ISO/IEC 646:1991 standard
(equivalent to 7-bit ASCII).</para>
<para>For these reasons, the standard developers decided to adopt a canonical
format for the representation of file information
strings. The obvious, well-endorsed candidate is the ISO/IEC 10646-1:2000
standard (based in part on Unicode), which can be
used to represent the characters of virtually all standardized character
sets. The standard developers initially agreed upon using
UCS2 (16-bit Unicode) as the internal representation. This repertoire
of characters provides a sufficiently rich set to represent
all commonly-used codesets.</para>
<para>However, the standard developers found that the 16-bit Unicode representation
had some problems. It forced the issue of
standardizing byte ordering. The 2-byte length of each character made
the extended header records twice as long for the case of
strings coded entirely from historical 7-bit ASCII. For these reasons,
the standard developers chose the UTF-8 defined in the
ISO/IEC 10646-1:2000 standard. This multi-byte representation encodes
UCS2 or UCS4 characters reliably and deterministically,
eliminating the need for a canonical byte ordering. In addition, NUL
octets and other characters possibly confusing to POSIX file
systems do not appear, except to represent themselves. It was realized
that certain national codesets take up more space after the
encoding, due to their placement within the UCS range; it was felt
that the usefulness of the encoding of the names outweighs the
disadvantage of size increase for file, user, and group names.</para>
<para>The encoding of UTF-8 is as follows:</para>
<literallayout remap='.nf'>
<emphasis role='strong' remap='B'>UCS4 Hex Encoding UTF-8 Binary Encoding
00000000-0000007F 0xxxxxxx
00000080-000007FF 110xxxxx 10xxxxxx
00000800-0000FFFF 1110xxxx 10xxxxxx 10xxxxxx
00010000-001FFFFF 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
00200000-03FFFFFF 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
04000000-7FFFFFFF 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
</emphasis>
</literallayout> <!-- .fi -->
<para>where each <emphasis role='strong' remap='B'>'x'</emphasis> represents a bit value from the character being
translated.</para>
</refsect2>
<refsect2 id='ustar_interchange_format2'><title>ustar Interchange Format</title>
<para>The description of the <emphasis role='strong' remap='B'>ustar</emphasis> format reflects numerous enhancements
over pre-1988 versions of the historical <emphasis remap='I'>tar</emphasis>
utility. The goal of these changes was not only to provide the functional
enhancements desired, but also to retain compatibility
between new and old versions. This compatibility has been retained.
Archives written using the old archive format are compatible
with the new format.</para>
<para>Implementors should be aware that the previous file format did not
include a mechanism to archive directory type files. For this
reason, the convention of using a filename ending with slash was adopted
to specify a directory on the archive.</para>
<para>The total size of the <emphasis remap='I'>name</emphasis> and <emphasis remap='I'>prefix</emphasis> fields have been
set to meet the minimum requirements for {PATH_MAX}. If a
pathname will fit within the <emphasis remap='I'>name</emphasis> field, it is recommended that
the pathname be stored there without the use of the
<emphasis remap='I'>prefix</emphasis> field. Although the name field is known to be too small
to contain {PATH_MAX} characters, the value was not changed
in this version of the archive file format to retain backwards-compatibility,
and instead the prefix was introduced. Also, because
of the earlier version of the format, there is no way to remove the
restriction on the <emphasis remap='I'>linkname</emphasis> field being limited in size
to just that of the <emphasis remap='I'>name</emphasis> field.</para>
<para>The <emphasis remap='I'>size</emphasis> field is required to be meaningful in all implementation
extensions, although it could be zero. This is required
so that the data blocks can always be properly counted.</para>
<para>It is suggested that if device special files need to be represented
that cannot be represented in the standard format, that one
of the extension types ( <emphasis role='strong' remap='B'>A</emphasis>- <emphasis role='strong' remap='B'>Z</emphasis>) be used, and that the additional
information for the special file be represented as
data and be reflected in the <emphasis remap='I'>size</emphasis> field.</para>
<para>Attempting to restore a special file type, where it is converted to
ordinary data and conflicts with an existing filename, need
not be specially detected by the utility. If run as an ordinary user,
<command>pax</command> should not be able to overwrite the entries in,
for example, <emphasis role='strong' remap='B'>/dev</emphasis> in any case (whether the file is converted
to another type or not). If run as a privileged user, it should
be able to do so, and it would be considered a bug if it did not.
The same is true of ordinary data files and similarly named
special files; it is impossible to anticipate the needs of the user
(who could really intend to overwrite the file), so the
behavior should be predictable (and thus regular) and rely on the
protection system as required.</para>
<para>The value 7 in the <emphasis remap='I'>typeflag</emphasis> field is intended to define how
contiguous files can be stored in a <emphasis role='strong' remap='B'>ustar</emphasis> archive.
IEEE Std 1003.1-2001 does not require the contiguous file extension,
but does define a standard way of archiving such
files so that all conforming systems can interpret these file types
in a meaningful and consistent manner. On a system that does
not support extended file types, the <command>pax</command> utility should do the
best it can with the file and go on to the next.</para>
<para>The file protection modes are those conventionally used by the <emphasis remap='I'>ls</emphasis>
utility. This is
extended beyond the usage in the ISO POSIX-2 standard to support
the "shared text" or "sticky" bit. It is intended that
the conformance document should not document anything beyond the existence
of and support of such a mode. Further extensions are
expected to these bits, particularly with overloading the set-user-ID
and set-group-ID flags.</para>
</refsect2>
<refsect2 id='cpio_interchange_format2'><title>cpio Interchange Format</title>
<para>The reference to appropriate privilege in the <emphasis role='strong' remap='B'>cpio</emphasis> format refers
to an error on standard output; the <emphasis role='strong' remap='B'>ustar</emphasis> format
does not make comparable statements.</para>
<para>The model for this format was the historical System V <emphasis remap='I'>cpio</emphasis> <emphasis role='strong' remap='B'>-c</emphasis>
data interchange format. This model documents the
portable version of the <emphasis role='strong' remap='B'>cpio</emphasis> format and not the binary version.
It has the flexibility to transfer data of any type
described within IEEE Std 1003.1-2001, yet is extensible to transfer
data types specific to extensions beyond
IEEE Std 1003.1-2001 (for example, contiguous files). Because it
describes existing practice, there is no question of
maintaining upwards-compatibility.</para>
</refsect2>
<refsect2 id='cpio_header2'><title>cpio Header</title>
<para>There has been some concern that the size of the <emphasis remap='I'>c_ino</emphasis> field
of the header is too small to handle those systems that have
very large <emphasis remap='I'>inode</emphasis> numbers. However, the <emphasis remap='I'>c_ino</emphasis> field in
the header is used strictly as a hard-link resolution mechanism
for archives. It is not necessarily the same value as the <emphasis remap='I'>inode</emphasis>
number of the file in the location from which that file is
extracted.</para>
<para>The name <emphasis remap='I'>c_magic</emphasis> is based on historical usage.</para>
</refsect2>
<refsect2 id='cpio_filename2'><title>cpio Filename</title>
<para>For most historical implementations of the <emphasis remap='I'>cpio</emphasis> utility, {PATH_MAX}
octets can be used to describe the pathname without
the addition of any other header fields (the NUL character would be
included in this count). {PATH_MAX} is the minimum value for
pathname size, documented as 256 bytes. However, an implementation
may use <emphasis remap='I'>c_namesize</emphasis> to determine the exact length of the
pathname. With the current description of the <emphasis remap='I'><cpio.h></emphasis> header,
this pathname
size can be as large as a number that is described in six octal digits.</para>
<para>Two values are documented under the <emphasis remap='I'>c_mode</emphasis> field values to provide
for extensibility for known file types:</para>
<variablelist remap='TP'>
<varlistentry>
<term><emphasis role='strong' remap='B'>0110 000</emphasis></term>
<listitem>
<para>Reserved for contiguous files. The implementation may treat the rest
of the information for this archive like a regular file.
If this file type is undefined, the implementation may create the
file as a regular file.</para>
</listitem>
</varlistentry>
</variablelist>
<para>This provides for extensibility of the <emphasis role='strong' remap='B'>cpio</emphasis> format while allowing
for the ability to read old archives. Files of an
unknown type may be read as "regular files" on some implementations.
On a system that does not support extended file types, the
<command>pax</command> utility should do the best it can with the file and go on
to the next.</para>
</refsect2>
</refsect1>
<refsect1 id='future_directions'><title>FUTURE DIRECTIONS</title>
<para>None.</para>
</refsect1>
<refsect1 id='see_also'><title>SEE ALSO</title>
<para><emphasis remap='I'>Shell Command Language</emphasis> , <emphasis remap='I'>cp</emphasis> , <emphasis remap='I'>ed</emphasis> , <emphasis remap='I'>getopts</emphasis>
, <emphasis remap='I'>ls</emphasis> , <emphasis remap='I'>printf</emphasis>() , the Base Definitions volume of IEEE Std 1003.1-2001,
<emphasis remap='I'><cpio.h></emphasis>, the System Interfaces volume of IEEE Std 1003.1-2001,
<emphasis remap='I'>chown</emphasis>(), <emphasis remap='I'>creat</emphasis>(), <emphasis remap='I'>mkdir</emphasis>(), <emphasis remap='I'>mkfifo</emphasis>(), <emphasis remap='I'>stat</emphasis>(),
<emphasis remap='I'>utime</emphasis>(), <emphasis remap='I'>write</emphasis>()</para>
</refsect1>
<refsect1 id='copyright'><title>COPYRIGHT</title>
<para>Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the
event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
<ulink url='http://www.opengroup.org/unix/online.html'>http://www.opengroup.org/unix/online.html</ulink> .</para>
</refsect1>
</refentry>
|