head 1.9; access; symbols libarchive-3-8-11:1.1.1.12 libarchive-3-8-10:1.1.1.12 pkgsrc-2026Q3:1.8.0.16 pkgsrc-2026Q3-base:1.8 libarchive-3-8-9:1.1.1.11 libarchive-3-8-8:1.1.1.11 pkgsrc-2026Q2:1.8.0.14 pkgsrc-2026Q2-base:1.8 libarchive-3-8-7:1.1.1.11 libarchive-3-8-6:1.1.1.11 pkgsrc-2026Q1:1.8.0.12 pkgsrc-2026Q1-base:1.8 libarchive-3-8-5:1.1.1.11 libarchive-3-8-4:1.1.1.11 pkgsrc-2025Q4:1.8.0.10 pkgsrc-2025Q4-base:1.8 libarchive-3-8-3:1.1.1.11 libarchive-3-8-2:1.1.1.11 pkgsrc-2025Q3:1.8.0.8 pkgsrc-2025Q3-base:1.8 libarchive-3-8-1:1.1.1.11 pkgsrc-2025Q2:1.8.0.6 pkgsrc-2025Q2-base:1.8 libarchive-3-8-0:1.1.1.11 libarchive-3-7-9:1.1.1.11 pkgsrc-2025Q1:1.8.0.4 pkgsrc-2025Q1-base:1.8 pkgsrc-2024Q4:1.8.0.2 pkgsrc-2024Q4-base:1.8 libarchive-3-7-7:1.1.1.11 pkgsrc-2024Q3:1.7.0.6 pkgsrc-2024Q3-base:1.7 libarchive-3-7-5:1.1.1.10 pkgsrc-2024Q2:1.7.0.4 pkgsrc-2024Q2-base:1.7 libarchive-3-7-4:1.1.1.10 libarchive-3-7-3:1.1.1.10 pkgsrc-2024Q1:1.7.0.2 pkgsrc-2024Q1-base:1.7 libarchive-3-7-2:1.1.1.10 pkgsrc-2023Q4:1.6.0.30 pkgsrc-2023Q4-base:1.6 pkgsrc-2023Q3:1.6.0.28 pkgsrc-2023Q3-base:1.6 pkgsrc-2023Q2:1.6.0.26 pkgsrc-2023Q2-base:1.6 pkgsrc-2023Q1:1.6.0.24 pkgsrc-2023Q1-base:1.6 pkgsrc-2022Q4:1.6.0.22 pkgsrc-2022Q4-base:1.6 pkgsrc-2022Q3:1.6.0.20 pkgsrc-2022Q3-base:1.6 pkgsrc-2022Q2:1.6.0.18 pkgsrc-2022Q2-base:1.6 pkgsrc-2022Q1:1.6.0.16 pkgsrc-2022Q1-base:1.6 pkgsrc-2021Q4:1.6.0.14 pkgsrc-2021Q4-base:1.6 pkgsrc-2021Q3:1.6.0.12 pkgsrc-2021Q3-base:1.6 pkgsrc-2021Q2:1.6.0.10 pkgsrc-2021Q2-base:1.6 pkgsrc-2021Q1:1.6.0.8 pkgsrc-2021Q1-base:1.6 pkgsrc-2020Q4:1.6.0.6 pkgsrc-2020Q4-base:1.6 pkgsrc-2020Q3:1.6.0.4 pkgsrc-2020Q3-base:1.6 pkgsrc-2020Q2:1.6.0.2 pkgsrc-2020Q2-base:1.6 pkgsrc-2020Q1:1.5.0.4 pkgsrc-2020Q1-base:1.5 pkgsrc-2019Q4:1.5.0.6 pkgsrc-2019Q4-base:1.5 pkgsrc-2019Q3:1.5.0.2 pkgsrc-2019Q3-base:1.5 libarchive-3-4-0:1.1.1.9 libarchive-3-3-3:1.1.1.8 pkgsrc-2019Q2:1.4.0.18 pkgsrc-2019Q2-base:1.4 pkgsrc-2019Q1:1.4.0.16 pkgsrc-2019Q1-base:1.4 pkgsrc-2018Q4:1.4.0.14 pkgsrc-2018Q4-base:1.4 pkgsrc-2018Q3:1.4.0.12 pkgsrc-2018Q3-base:1.4 pkgsrc-2018Q2:1.4.0.10 pkgsrc-2018Q2-base:1.4 pkgsrc-2018Q1:1.4.0.8 pkgsrc-2018Q1-base:1.4 pkgsrc-2017Q4:1.4.0.6 pkgsrc-2017Q4-base:1.4 pkgsrc-2017Q3:1.4.0.4 pkgsrc-2017Q3-base:1.4 libarchive-3-3-2:1.1.1.8 pkgsrc-2017Q2:1.3.0.4 pkgsrc-2017Q2-base:1.3 pkgsrc-2017Q1:1.3.0.2 pkgsrc-2017Q1-base:1.3 libarchive-3-3-1:1.1.1.7 pkgsrc-2016Q4:1.2.0.16 pkgsrc-2016Q4-base:1.2 pkgsrc-2016Q3:1.2.0.14 pkgsrc-2016Q3-base:1.2 pkgsrc-2016Q2:1.2.0.12 pkgsrc-2016Q2-base:1.2 libarchive-3-2-1:1.1.1.6 pkgsrc-2016Q1:1.2.0.10 pkgsrc-2016Q1-base:1.2 pkgsrc-2015Q4:1.2.0.8 pkgsrc-2015Q4-base:1.2 pkgsrc-2015Q3:1.2.0.6 pkgsrc-2015Q3-base:1.2 pkgsrc-2015Q2:1.2.0.4 pkgsrc-2015Q2-base:1.2 pkgsrc-2015Q1:1.2.0.2 pkgsrc-2015Q1-base:1.2 pkgsrc-2014Q4:1.1.1.5.0.36 pkgsrc-2014Q4-base:1.1.1.5 pkgsrc-2014Q3:1.1.1.5.0.34 pkgsrc-2014Q3-base:1.1.1.5 pkgsrc-2014Q2:1.1.1.5.0.32 pkgsrc-2014Q2-base:1.1.1.5 pkgsrc-2014Q1:1.1.1.5.0.30 pkgsrc-2014Q1-base:1.1.1.5 pkgsrc-2013Q4:1.1.1.5.0.28 pkgsrc-2013Q4-base:1.1.1.5 pkgsrc-2013Q3:1.1.1.5.0.26 pkgsrc-2013Q3-base:1.1.1.5 pkgsrc-2013Q2:1.1.1.5.0.24 pkgsrc-2013Q2-base:1.1.1.5 pkgsrc-2013Q1:1.1.1.5.0.22 pkgsrc-2013Q1-base:1.1.1.5 pkgsrc-2012Q4:1.1.1.5.0.20 pkgsrc-2012Q4-base:1.1.1.5 pkgsrc-2012Q3:1.1.1.5.0.18 pkgsrc-2012Q3-base:1.1.1.5 pkgsrc-2012Q2:1.1.1.5.0.16 pkgsrc-2012Q2-base:1.1.1.5 pkgsrc-2012Q1:1.1.1.5.0.14 pkgsrc-2012Q1-base:1.1.1.5 pkgsrc-2011Q4:1.1.1.5.0.12 pkgsrc-2011Q4-base:1.1.1.5 pkgsrc-2011Q3:1.1.1.5.0.10 pkgsrc-2011Q3-base:1.1.1.5 pkgsrc-2011Q2:1.1.1.5.0.8 pkgsrc-2011Q2-base:1.1.1.5 pkgsrc-2011Q1:1.1.1.5.0.6 pkgsrc-2011Q1-base:1.1.1.5 pkgsrc-2010Q4:1.1.1.5.0.4 pkgsrc-2010Q4-base:1.1.1.5 pkgsrc-2010Q3:1.1.1.5.0.2 pkgsrc-2010Q3-base:1.1.1.5 libarchive-2-8-4:1.1.1.5 pkgsrc-2010Q2:1.1.1.4.0.4 pkgsrc-2010Q2-base:1.1.1.4 pkgsrc-2010Q1:1.1.1.4.0.2 pkgsrc-2010Q1-base:1.1.1.4 libarchive-2-8-3:1.1.1.4 libarchive-2-8-2:1.1.1.3 libarchive-2-8-0:1.1.1.2 pkgsrc-2009Q4:1.1.1.1.0.22 pkgsrc-2009Q4-base:1.1.1.1 pkgsrc-2009Q3:1.1.1.1.0.20 pkgsrc-2009Q3-base:1.1.1.1 pkgsrc-2009Q2:1.1.1.1.0.18 pkgsrc-2009Q2-base:1.1.1.1 pkgsrc-2009Q1:1.1.1.1.0.16 pkgsrc-2009Q1-base:1.1.1.1 pkgsrc-2008Q4:1.1.1.1.0.14 pkgsrc-2008Q4-base:1.1.1.1 pkgsrc-2008Q3:1.1.1.1.0.12 pkgsrc-2008Q3-base:1.1.1.1 cube-native-xorg:1.1.1.1.0.10 cube-native-xorg-base:1.1.1.1 pkgsrc-2008Q2:1.1.1.1.0.8 pkgsrc-2008Q2-base:1.1.1.1 cwrapper:1.1.1.1.0.6 pkgsrc-2008Q1:1.1.1.1.0.4 pkgsrc-2008Q1-base:1.1.1.1 pkgsrc-2007Q4:1.1.1.1.0.2 pkgsrc-2007Q4-base:1.1.1.1 libarchive-2-4-0:1.1.1.1 KIENTZLE:1.1.1; locks; strict; comment @# @; 1.9 date 2026.10.19.12.05.17; author adam; state Exp; branches; next 1.8; commitid R3KJfVxz3NuPb50H; 1.8 date 2024.10.19.05.39.58; author adam; state Exp; branches; next 1.7; commitid fYRSlpIWMYluweuF; 1.7 date 2024.01.18.18.00.16; author adam; state Exp; branches; next 1.6; commitid hNXpsHx3SuHqsXUE; 1.6 date 2020.05.26.09.16.41; author nia; state Exp; branches; next 1.5; commitid nNhsdZACz3PjmJ9C; 1.5 date 2019.09.22.09.55.08; author joerg; state Exp; branches; next 1.4; commitid FdPvRjF4OzwBwZDB; 1.4 date 2017.08.01.22.26.23; author joerg; state Exp; branches; next 1.3; commitid 32clTfkmVE8bPy1A; 1.3 date 2017.02.25.21.11.19; author joerg; state Exp; branches; next 1.2; commitid rW8QfCWrsCO1snHz; 1.2 date 2015.01.17.12.44.49; author adam; state Exp; branches; next 1.1; commitid yy7e1hLrfmA2pn6y; 1.1 date 2007.11.30.21.25.33; author joerg; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2007.11.30.21.25.33; author joerg; state Exp; branches; next 1.1.1.2; 1.1.1.2 date 2010.02.20.03.50.03; author joerg; state Exp; branches; next 1.1.1.3; 1.1.1.3 date 2010.03.14.17.57.21; author joerg; state Exp; branches; next 1.1.1.4; 1.1.1.4 date 2010.03.16.17.07.34; author joerg; state Exp; branches; next 1.1.1.5; 1.1.1.5 date 2010.07.09.11.53.32; author joerg; state Exp; branches; next 1.1.1.6; 1.1.1.6 date 2016.06.20.17.12.02; author joerg; state Exp; branches; next 1.1.1.7; commitid rRgm3BqbmbI8aebz; 1.1.1.7 date 2017.02.25.20.54.13; author joerg; state Exp; branches; next 1.1.1.8; commitid ReqPI0ibLYjdmnHz; 1.1.1.8 date 2017.08.01.22.21.12; author joerg; state Exp; branches; next 1.1.1.9; commitid XQwPAFJku336Ny1A; 1.1.1.9 date 2019.09.22.09.51.33; author joerg; state Exp; branches; next 1.1.1.10; commitid 5kDbfPbiV3INvZDB; 1.1.1.10 date 2024.01.18.17.37.46; author adam; state Exp; branches; next 1.1.1.11; commitid zDULEPUODGjTkXUE; 1.1.1.11 date 2024.10.19.05.27.34; author adam; state Exp; branches; next 1.1.1.12; commitid v1iXM4j1Na52seuF; 1.1.1.12 date 2026.10.19.11.50.40; author adam; state Exp; branches; next ; commitid eS0MvMrTxXQX650H; desc @@ 1.9 log @libarchive: updated to 3.8.10 3.8.10 New features: 7z: add Delta, RISCV, ARMTHUMB and IA64 filters for non-lzma archives libarchive: support digest with nettle 4 and mbedtls 3 tar: add --mode option Security and Bug Fixes see ChangeLog @ text @4mCPIO24m(5) File Formats Manual 4mCPIO24m(5) 1mNAME0m cpio — format of cpio archive files 1mDESCRIPTION0m The 1mcpio 22marchive format collects any number of files, directories, and other file system objects (symbolic links, device nodes, etc.) into a single stream of bytes. 1mGeneral Format0m Each file system object in a 1mcpio 22marchive comprises a header record with basic numeric metadata followed by the full pathname of the entry and the file data. The header record stores a series of integer values that generally follow the fields in 4mstruct24m 4mstat24m. (See 4mstat24m(2) for de‐ tails.) The variants differ primarily in how they store those integers (binary, octal, or hexadecimal). The header is followed by the path‐ name of the entry (the length of the pathname is stored in the header) and any file data. The end of the archive is indicated by a special record with the pathname “TRAILER!!!”. 1mPWB format0m The PWB binary 1mcpio 22mformat is the original format, when cpio was intro‐ duced as part of the Programmer's Work Bench system, a variant of 6th Edition UNIX. It stores numbers as 2-byte and 4-byte binary values. Each entry begins with a header in the following format: struct header_pwb_cpio { short h_magic; short h_dev; short h_ino; short h_mode; short h_uid; short h_gid; short h_nlink; short h_majmin; long h_mtime; short h_namesize; long h_filesize; }; The 4mshort24m fields here are 16-bit integer values, while the 4mlong24m fields are 32 bit integers. Since PWB UNIX, like the 6th Edition UNIX it was based on, only ran on PDP-11 computers, they are in PDP-endian format, which has little-endian shorts, and big-endian longs. That is, the long integer whose hexadecimal representation is 0x12345678 would be stored in four successive bytes as 0x34, 0x12, 0x78, 0x56. The fields are as follows: 4mh_magic0m The integer value octal 070707. 4mh_dev24m, 4mh_ino0m The device and inode numbers from the disk. These are used by programs that read 1mcpio 22marchives to determine when two entries refer to the same file. Programs that synthesize 1mcpio 22marchives should be careful to set these to distinct values for each en‐ try. 4mh_mode24m The mode specifies both the regular permissions and the file type, and it also holds a couple of bits that are irrelevant to the cpio format, because the field is actually a raw copy of the mode field in the inode representing the file. These are the IALLOC flag, which shows that the inode entry is in use, and the ILARG flag, which shows that the file it represents is large enough to have indirect block pointers in the inode. The mode is decoded as follows: 0100000 IALLOC flag - irrelevant to cpio. 0060000 This masks the file type bits. 0040000 File type value for directories. 0020000 File type value for character special devices. 0060000 File type value for block special devices. 0010000 ILARG flag - irrelevant to cpio. 0004000 SUID bit. 0002000 SGID bit. 0001000 Sticky bit. 0000777 The lower 9 bits specify read/write/execute permis‐ sions for world, group, and user following standard POSIX conventions. 4mh_uid24m, 4mh_gid0m The numeric user id and group id of the owner. 4mh_nlink0m The number of links to this file. Directories always have a value of at least two here. Note that hardlinked files include file data with every copy in the archive. 4mh_majmin0m For block special and character special entries, this field contains the associated device number, with the major number in the high byte, and the minor number in the low byte. For all other entry types, it should be set to zero by writers and ig‐ nored by readers. 4mh_mtime0m Modification time of the file, indicated as the number of sec‐ onds since the start of the epoch, 00:00:00 UTC January 1, 1970. 4mh_namesize0m The number of bytes in the pathname that follows the header. This count includes the trailing NUL byte. 4mh_filesize0m The size of the file. Note that this archive format is limited to 16 megabyte file sizes, because PWB UNIX, like 6th Edition, only used an unsigned 24 bit integer for the file size inter‐ nally. The pathname immediately follows the fixed header. If 1mh_namesize 22mis odd, an additional NUL byte is added after the pathname. The file data is then appended, again with an additional NUL appended if needed to get the next header at an even offset. Hardlinked files are not given special treatment; the full file con‐ tents are included with each copy of the file. 1mNew Binary Format0m The new binary 1mcpio 22mformat showed up when cpio was adopted into late 7th Edition UNIX. It is exactly like the PWB binary format, described above, except for three changes: First, UNIX now ran on more than one hardware type, so the endianness of 16 bit integers must be determined by observing the magic number at the start of the header. The 32 bit integers are still always stored with the most significant word first, though, so each of those two, in the struct shown above, was stored as an array of two 16 bit integers, in the traditional order. Those 16 bit integers, like all the others in the struct, were accessed using a macro that byte swapped them if necessary. Next, 7th Edition had more file types to store, and the IALLOC and ILARG flag bits were re-purposed to accommodate these. The revised use of the various bits is as follows: 0170000 This masks the file type bits. 0140000 File type value for sockets. 0120000 File type value for symbolic links. For symbolic links, the link body is stored as file data. 0100000 File type value for regular files. 0060000 File type value for block special devices. 0040000 File type value for directories. 0020000 File type value for character special devices. 0010000 File type value for named pipes or FIFOs. 0004000 SUID bit. 0002000 SGID bit. 0001000 Sticky bit. 0000777 The lower 9 bits specify read/write/execute permissions for world, group, and user following standard POSIX conventions. Finally, the file size field now represents a signed 32 bit integer in the underlying file system, so the maximum file size has increased to 2 gigabytes. Note that there is no obvious way to tell which of the two binary for‐ mats an archive uses, other than to see which one makes more sense. The typical error scenario is that a PWB format archive unpacked as if it were in the new format will create named sockets instead of directo‐ ries, and then fail to unpack files that should go in those directo‐ ries. Running 4mbsdcpio24m 4m-itv24m on an unknown archive will make it obvious which it is: if it's PWB format, directories will be listed with an 's' instead of a 'd' as the first character of the mode string, and the larger files will have a '?' in that position. 1mPortable ASCII Format0m Version 2 of the Single UNIX Specification (“SUSv2”) standardized an ASCII variant that is portable across all platforms. It is commonly known as the “old character” format or as the “odc” format. It stores the same numeric fields as the old binary format, but represents them as 6-character or 11-character octal values. struct cpio_odc_header { char c_magic[6]; char c_dev[6]; char c_ino[6]; char c_mode[6]; char c_uid[6]; char c_gid[6]; char c_nlink[6]; char c_rdev[6]; char c_mtime[11]; char c_namesize[6]; char c_filesize[11]; }; The fields are identical to those in the new binary format. The name and file body follow the fixed header. Unlike the binary formats, there is no additional padding after the pathname or file contents. If the files being archived are themselves entirely ASCII, then the re‐ sulting archive will be entirely ASCII, except for the NUL byte that terminates the name field. 1mNew ASCII Format0m The "new" ASCII format uses 8-byte hexadecimal fields for all numbers and separates device numbers into separate fields for major and minor numbers. struct cpio_newc_header { char c_magic[6]; char c_ino[8]; char c_mode[8]; char c_uid[8]; char c_gid[8]; char c_nlink[8]; char c_mtime[8]; char c_filesize[8]; char c_devmajor[8]; char c_devminor[8]; char c_rdevmajor[8]; char c_rdevminor[8]; char c_namesize[8]; char c_check[8]; }; Except as specified below, the fields here match those specified for the new binary format above. 4mmagic24m The string “070701”. 4mcheck24m This field is always set to zero by writers and ignored by readers. See the next section for more details. The pathname is followed by NUL bytes so that the total size of the fixed header plus pathname is a multiple of four. Likewise, the file data is padded to a multiple of four bytes. Note that this format sup‐ ports only 4 gigabyte files (unlike the older ASCII format, which sup‐ ports 8 gigabyte files). In this format, hardlinked files are handled by setting the filesize to zero for each entry except the first one that appears in the archive. 1mNew CRC Format0m The CRC format is identical to the new ASCII format described in the previous section except that the magic field is set to “070702” and the 4mcheck24m field is set to the sum of all bytes in the file data. This sum is computed treating all bytes as unsigned values and using unsigned arithmetic. Only the least-significant 32 bits of the sum are stored. 1mHP variants0m The 1mcpio 22mimplementation distributed with HPUX used XXXX but stored de‐ vice numbers differently XXX. 1mOther Extensions and Variants0m Sun Solaris uses additional file types to store extended file data, in‐ cluding ACLs and extended attributes, as special entries in cpio archives. XXX Others? XXX 1mSEE ALSO0m 4mcpio24m(1), 4mtar24m(5) 1mSTANDARDS0m The 1mcpio 22mutility is no longer a part of POSIX or the Single Unix Stan‐ dard. It last appeared in Version 2 of the Single UNIX Specification (“SUSv2”). It has been supplanted in subsequent standards by 4mpax24m(1). The portable ASCII format is currently part of the specification for the 4mpax24m(1) utility. 1mHISTORY0m The original cpio utility was written by Dick Haight while working in AT&T's Unix Support Group. It appeared in 1977 as part of PWB/UNIX 1.0, the “Programmer's Work Bench” derived from Version 6 AT&T UNIX that was used internally at AT&T. Both the new binary and old charac‐ ter formats were in use by 1980, according to the System III source re‐ leased by SCO under their “Ancient Unix” license. The character format was adopted as part of IEEE Std 1003.1-1988 (“POSIX.1”). XXX when did "newc" appear? Who invented it? When did HP come out with their vari‐ ant? When did Sun introduce ACLs and extended attributes? XXX 1mBUGS0m The “CRC” format is mis-named, as it uses a simple checksum and not a cyclic redundancy check. The binary formats are limited to 16 bits for user id, group id, de‐ vice, and inode numbers. They are limited to 16 megabyte and 2 giga‐ byte file sizes for the older and newer variants, respectively. The old ASCII format is limited to 18 bits for the user id, group id, device, and inode numbers. It is limited to 8 gigabyte file sizes. The new ASCII format is limited to 4 gigabyte file sizes. None of the cpio formats store user or group names, which are essential when moving files between systems with dissimilar user or group number‐ ing. Especially when writing older cpio variants, it may be necessary to map actual device/inode values to synthesized values that fit the available fields. With very large filesystems, this may be necessary even for the newer formats. Debian December 23, 2011 4mCPIO24m(5) @ 1.8 log @libarchive: updated to 3.7.7 Libarchive 3.7.7 is a bugfix and security release Security fixes: gzip: prevent a hang when processing a malformed gzip inside a gzip tar: don't crash on truncated tar archives tar: fix two leaks in tar header parsing Important bugfixes: 7-zip: read/write symlink paths as UTF-8 cpio: exit with an error code if an entry could not be extracted rar5: report encrypted entries tar: fix truncation of entry pathnames in specific archives windows: fix ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS Libarchive 3.7.6 is a bugfix and security release. This release fixes a tar regression introduced in libarchive 3.7.5 Important bugfixes. tar: clean up linkpath between entries tar: fix memory leaks when processing symlinks or parsing pax headers iso: be more cautious about parsing ISO-9660 timestamps @ text @d66 2 a67 2 large enough to have indirect blocks pointers in the inode. The mode is decoded as follows: d78 2 a79 2 0000777 The lower 9 bits specify read/write/execute permis‐ sions for world, group, and user following standard d86 1 a86 1 The number of links to this file. Directories always have a d91 1 a91 1 For block special and character special entries, this field d93 2 a94 2 the high byte, and the minor number in the low byte. For all other entry types, it should be set to zero by writers and ig‐ d98 2 a99 2 Modification time of the file, indicated as the number of sec‐ onds since the start of the epoch, 00:00:00 UTC January 1, d103 1 a103 1 The number of bytes in the pathname that follows the header. d108 2 a109 2 to 16 megabyte file sizes, because PWB UNIX, like 6th Edition, only used an unsigned 24 bit integer for the file size inter‐ d112 1 a112 1 The pathname immediately follows the fixed header. If 1mh_namesize 22mis d114 1 a114 1 is then appended, again with an additional NUL appended if needed to d117 1 a117 1 Hardlinked files are not given special treatment; the full file con‐ d121 2 a122 2 The new binary 1mcpio 22mformat showed up when cpio was adopted into late 7th Edition UNIX. It is exactly like the PWB binary format, described d125 7 a131 7 First, UNIX now ran on more than one hardware type, so the endianness of 16 bit integers must be determined by observing the magic number at the start of the header. The 32 bit integers are still always stored with the most significant word first, though, so each of those two, in the struct shown above, was stored as an array of two 16 bit integers, in the traditional order. Those 16 bit integers, like all the others in the struct, were accessed using a macro that byte swapped them if d134 1 a134 1 Next, 7th Edition had more file types to store, and the IALLOC and d140 1 a140 1 0120000 File type value for symbolic links. For symbolic links, the d150 1 a150 1 0000777 The lower 9 bits specify read/write/execute permissions for d153 1 a153 1 Finally, the file size field now represents a signed 32 bit integer in d157 3 a159 3 Note that there is no obvious way to tell which of the two binary for‐ mats an archive uses, other than to see which one makes more sense. The typical error scenario is that a PWB format archive unpacked as if d161 2 a162 2 ries, and then fail to unpack files that should go in those directo‐ ries. Running 4mbsdcpio24m 4m-itv24m on an unknown archive will make it obvious d164 1 a164 1 instead of a 'd' as the first character of the mode string, and the d168 4 a171 4 Version 2 of the Single UNIX Specification (“SUSv2”) standardized an ASCII variant that is portable across all platforms. It is commonly known as the “old character” format or as the “odc” format. It stores the same numeric fields as the old binary format, but represents them d188 2 a189 2 The fields are identical to those in the new binary format. The name and file body follow the fixed header. Unlike the binary formats, d191 2 a192 2 the files being archived are themselves entirely ASCII, then the re‐ sulting archive will be entirely ASCII, except for the NUL byte that d196 2 a197 2 The "new" ASCII format uses 8-byte hexadecimal fields for all numbers and separates device numbers into separate fields for major and minor d217 1 a217 1 Except as specified below, the fields here match those specified for d222 1 a222 1 4mcheck24m This field is always set to zero by writers and ignored by d225 2 a226 2 The pathname is followed by NUL bytes so that the total size of the fixed header plus pathname is a multiple of four. Likewise, the file d228 1 a228 1 ports only 4 gigabyte files (unlike the older ASCII format, which sup‐ d235 1 a235 1 The CRC format is identical to the new ASCII format described in the d237 2 a238 2 4mcheck24m field is set to the sum of all bytes in the file data. This sum is computed treating all bytes as unsigned values and using unsigned d242 1 a242 1 The 1mcpio 22mimplementation distributed with HPUX used XXXX but stored de‐ d247 1 a247 1 cluding ACLs and extended attributes, as special entries in cpio d256 4 a259 4 The 1mcpio 22mutility is no longer a part of POSIX or the Single Unix Stan‐ dard. It last appeared in Version 2 of the Single UNIX Specification (“SUSv2”). It has been supplanted in subsequent standards by 4mpax24m(1). The portable ASCII format is currently part of the specification for d263 4 a266 4 The original cpio utility was written by Dick Haight while working in AT&T's Unix Support Group. It appeared in 1977 as part of PWB/UNIX 1.0, the “Programmer's Work Bench” derived from Version 6 AT&T UNIX that was used internally at AT&T. Both the new binary and old charac‐ d269 1 a269 1 was adopted as part of IEEE Std 1003.1-1988 (“POSIX.1”). XXX when did d274 1 a274 1 The “CRC” format is mis-named, as it uses a simple checksum and not a d277 2 a278 2 The binary formats are limited to 16 bits for user id, group id, de‐ vice, and inode numbers. They are limited to 16 megabyte and 2 giga‐ d281 1 a281 1 The old ASCII format is limited to 18 bits for the user id, group id, d292 1 a292 1 fields. With very large filesystems, this may be necessary even for @ 1.7 log @libarchive: updated to 3.7.2 Libarchive 3.7.2 is a security, bugfix and feature release. Security fixes: Multiple vulnerabilities have been fixed in the PAX writer (1b4e0d0) Important bugfixes: bsdunzip(1) now correctly handles arguments following an -x after the zipfile New features: bsdunzip(1) now supports the "--version" flag 7-zip reader now translates Windows permissions into UNIX permissions uudecode filter in raw mode now supports file name and file mode zstd filter now supports the "long" write option Libarchive 3.7.1 is a security, feature and bugfix release. Security fixes: SEGV and stack buffer overflow in verbose mode of cpio Feature updates: bsdunzip updated to match latest upstream code Important bugfixes: miscellaneous functional bugfixes build fixes on multiple platforms Libarchive 3.7.0 is a feature and bugfix release. New features: bsdunzip: new tool ported from FreeBSD drop-in replacement for Info-ZIP unzip, not yet ported for Windows 7zip reader: support for Zstandard compression 7zip reader: support for ARM64 filter zstd filter: support for multi-frame zstd archives Other notable bugfixes and improvements: pax: fix year 2038 problem on platforms with 64-bit time_t Windows: Universal Windows Platform (UWP) fixes and improvements Windows: bcrypt usage fixes and improvements Windows: time function usage fixes and improvements @ text @d1 1 a1 1 CPIO(5) BSD File Formats Manual CPIO(5) d3 2 a4 2 NAME cpio — format of cpio archive files d6 288 a293 285 DESCRIPTION The cpio archive format collects any number of files, directories, and other file system objects (symbolic links, device nodes, etc.) into a single stream of bytes. General Format Each file system object in a cpio archive comprises a header record with basic numeric metadata followed by the full pathname of the entry and the file data. The header record stores a series of integer values that gen‐ erally follow the fields in struct stat. (See stat(2) for details.) The variants differ primarily in how they store those integers (binary, oc‐ tal, or hexadecimal). The header is followed by the pathname of the en‐ try (the length of the pathname is stored in the header) and any file data. The end of the archive is indicated by a special record with the pathname “TRAILER!!!”. PWB format The PWB binary cpio format is the original format, when cpio was intro‐ duced as part of the Programmer's Work Bench system, a variant of 6th Edition UNIX. It stores numbers as 2-byte and 4-byte binary values. Each entry begins with a header in the following format: struct header_pwb_cpio { short h_magic; short h_dev; short h_ino; short h_mode; short h_uid; short h_gid; short h_nlink; short h_majmin; long h_mtime; short h_namesize; long h_filesize; }; The short fields here are 16-bit integer values, while the long fields are 32 bit integers. Since PWB UNIX, like the 6th Edition UNIX it was based on, only ran on PDP-11 computers, they are in PDP-endian format, which has little-endian shorts, and big-endian longs. That is, the long integer whose hexadecimal representation is 0x12345678 would be stored in four successive bytes as 0x34, 0x12, 0x78, 0x56. The fields are as fol‐ lows: h_magic The integer value octal 070707. h_dev, h_ino The device and inode numbers from the disk. These are used by programs that read cpio archives to determine when two entries refer to the same file. Programs that synthesize cpio archives should be careful to set these to distinct values for each entry. h_mode The mode specifies both the regular permissions and the file type, and it also holds a couple of bits that are irrelevant to the cpio format, because the field is actually a raw copy of the mode field in the inode representing the file. These are the IALLOC flag, which shows that the inode entry is in use, and the ILARG flag, which shows that the file it represents is large enough to have indirect blocks pointers in the inode. The mode is decoded as follows: 0100000 IALLOC flag - irrelevant to cpio. 0060000 This masks the file type bits. 0040000 File type value for directories. 0020000 File type value for character special devices. 0060000 File type value for block special devices. 0010000 ILARG flag - irrelevant to cpio. 0004000 SUID bit. 0002000 SGID bit. 0001000 Sticky bit. 0000777 The lower 9 bits specify read/write/execute permissions for world, group, and user following standard POSIX con‐ ventions. h_uid, h_gid The numeric user id and group id of the owner. h_nlink The number of links to this file. Directories always have a value of at least two here. Note that hardlinked files include file data with every copy in the archive. h_majmin For block special and character special entries, this field con‐ tains the associated device number, with the major number in the high byte, and the minor number in the low byte. For all other entry types, it should be set to zero by writers and ignored by readers. h_mtime Modification time of the file, indicated as the number of seconds since the start of the epoch, 00:00:00 UTC January 1, 1970. h_namesize The number of bytes in the pathname that follows the header. This count includes the trailing NUL byte. h_filesize The size of the file. Note that this archive format is limited to 16 megabyte file sizes, because PWB UNIX, like 6th Edition, only used an unsigned 24 bit integer for the file size inter‐ nally. The pathname immediately follows the fixed header. If h_namesize is odd, an additional NUL byte is added after the pathname. The file data is then appended, again with an additional NUL appended if needed to get the next header at an even offset. Hardlinked files are not given special treatment; the full file contents are included with each copy of the file. New Binary Format The new binary cpio format showed up when cpio was adopted into late 7th Edition UNIX. It is exactly like the PWB binary format, described above, except for three changes: First, UNIX now ran on more than one hardware type, so the endianness of 16 bit integers must be determined by observing the magic number at the start of the header. The 32 bit integers are still always stored with the most significant word first, though, so each of those two, in the struct shown above, was stored as an array of two 16 bit integers, in the traditional order. Those 16 bit integers, like all the others in the struct, were accessed using a macro that byte swapped them if necessary. Next, 7th Edition had more file types to store, and the IALLOC and ILARG flag bits were re-purposed to accommodate these. The revised use of the various bits is as follows: 0170000 This masks the file type bits. 0140000 File type value for sockets. 0120000 File type value for symbolic links. For symbolic links, the link body is stored as file data. 0100000 File type value for regular files. 0060000 File type value for block special devices. 0040000 File type value for directories. 0020000 File type value for character special devices. 0010000 File type value for named pipes or FIFOs. 0004000 SUID bit. 0002000 SGID bit. 0001000 Sticky bit. 0000777 The lower 9 bits specify read/write/execute permissions for world, group, and user following standard POSIX conventions. Finally, the file size field now represents a signed 32 bit integer in the underlying file system, so the maximum file size has increased to 2 gigabytes. Note that there is no obvious way to tell which of the two binary formats an archive uses, other than to see which one makes more sense. The typi‐ cal error scenario is that a PWB format archive unpacked as if it were in the new format will create named sockets instead of directories, and then fail to unpack files that should go in those directories. Running bsdcpio -itv on an unknown archive will make it obvious which it is: if it's PWB format, directories will be listed with an 's' instead of a 'd' as the first character of the mode string, and the larger files will have a '?' in that position. Portable ASCII Format Version 2 of the Single UNIX Specification (“SUSv2”) standardized an ASCII variant that is portable across all platforms. It is commonly known as the “old character” format or as the “odc” format. It stores the same numeric fields as the old binary format, but represents them as 6-character or 11-character octal values. struct cpio_odc_header { char c_magic[6]; char c_dev[6]; char c_ino[6]; char c_mode[6]; char c_uid[6]; char c_gid[6]; char c_nlink[6]; char c_rdev[6]; char c_mtime[11]; char c_namesize[6]; char c_filesize[11]; }; The fields are identical to those in the new binary format. The name and file body follow the fixed header. Unlike the binary formats, there is no additional padding after the pathname or file contents. If the files being archived are themselves entirely ASCII, then the resulting archive will be entirely ASCII, except for the NUL byte that terminates the name field. New ASCII Format The "new" ASCII format uses 8-byte hexadecimal fields for all numbers and separates device numbers into separate fields for major and minor num‐ bers. struct cpio_newc_header { char c_magic[6]; char c_ino[8]; char c_mode[8]; char c_uid[8]; char c_gid[8]; char c_nlink[8]; char c_mtime[8]; char c_filesize[8]; char c_devmajor[8]; char c_devminor[8]; char c_rdevmajor[8]; char c_rdevminor[8]; char c_namesize[8]; char c_check[8]; }; Except as specified below, the fields here match those specified for the new binary format above. magic The string “070701”. check This field is always set to zero by writers and ignored by read‐ ers. See the next section for more details. The pathname is followed by NUL bytes so that the total size of the fixed header plus pathname is a multiple of four. Likewise, the file data is padded to a multiple of four bytes. Note that this format supports only 4 gigabyte files (unlike the older ASCII format, which supports 8 giga‐ byte files). In this format, hardlinked files are handled by setting the filesize to zero for each entry except the first one that appears in the archive. New CRC Format The CRC format is identical to the new ASCII format described in the pre‐ vious section except that the magic field is set to “070702” and the check field is set to the sum of all bytes in the file data. This sum is computed treating all bytes as unsigned values and using unsigned arith‐ metic. Only the least-significant 32 bits of the sum are stored. HP variants The cpio implementation distributed with HPUX used XXXX but stored device numbers differently XXX. Other Extensions and Variants Sun Solaris uses additional file types to store extended file data, in‐ cluding ACLs and extended attributes, as special entries in cpio ar‐ chives. XXX Others? XXX SEE ALSO cpio(1), tar(5) STANDARDS The cpio utility is no longer a part of POSIX or the Single Unix Stan‐ dard. It last appeared in Version 2 of the Single UNIX Specification (“SUSv2”). It has been supplanted in subsequent standards by pax(1). The portable ASCII format is currently part of the specification for the pax(1) utility. HISTORY The original cpio utility was written by Dick Haight while working in AT&T's Unix Support Group. It appeared in 1977 as part of PWB/UNIX 1.0, the “Programmer's Work Bench” derived from Version 6 AT&T UNIX that was used internally at AT&T. Both the new binary and old character formats were in use by 1980, according to the System III source released by SCO under their “Ancient Unix” license. The character format was adopted as part of IEEE Std 1003.1-1988 (“POSIX.1”). XXX when did "newc" appear? Who invented it? When did HP come out with their variant? When did Sun introduce ACLs and extended attributes? XXX BUGS The “CRC” format is mis-named, as it uses a simple checksum and not a cyclic redundancy check. The binary formats are limited to 16 bits for user id, group id, device, and inode numbers. They are limited to 16 megabyte and 2 gigabyte file sizes for the older and newer variants, respectively. The old ASCII format is limited to 18 bits for the user id, group id, de‐ vice, and inode numbers. It is limited to 8 gigabyte file sizes. The new ASCII format is limited to 4 gigabyte file sizes. None of the cpio formats store user or group names, which are essential when moving files between systems with dissimilar user or group number‐ ing. Especially when writing older cpio variants, it may be necessary to map actual device/inode values to synthesized values that fit the available fields. With very large filesystems, this may be necessary even for the newer formats. d295 1 a295 1 BSD December 23, 2011 BSD @ 1.6 log @libarchive: Update to 3.4.3 Libarchive 3.4.3 is a feature and bugfix release. New features: support for pzstd compressed files (#1357) support for RHT.security.selinux tar extended attribute (#1348) Important bugfixes: various zstd fixes and improvements (#1342 #1352 #1359) child process handling fixes (#1372) Libarchive 3.4.2 is a feature and security release. New features: support for atomic file extraction (bsdtar -x --safe-writes) (#1289) support for mbed TLS (PolarSSL) (#1301) Important bugfixes: security fixes in RAR5 reader (#1280 #1326) compression buffer fix in XAR writer (#1317) fix uname and gname longer than 32 characters in PAX writer (#1319) fix segfault when archiving hard links in ISO9660 and XAR writers (#1325) fix support for extracting 7z archive entries with Delta filter (#987) Libarchive 3.4.1 is a feature and security release. New features: Unicode filename support for reading lha/lzh archives New pax write option "xattrhdr" Important bugfixes: security fixes in wide string processing (#1276 #1298) security fixes in RAR5 reader (#1212 #1217 #1296) security fixes and optimizations to write filter logic (#351) security fix related to use of readlink(2) (1dae5a5) sparse file handling fixes (#1218 #1260) Thanks to all contributors and bug reporters. Special thanks to Christos Zoulas (@@zoulasc) from NetBSD for the atomic file extraction feature. @ text @d1 1 a1 1 CPIO(5) BSD File Formats Manual CPIO(5) d4 1 a4 1 cpio -- format of cpio archive files d14 1 a14 1 file data. The header record stores a series of integer values that gen- d16 3 a18 3 variants differ primarily in how they store those integers (binary, octal, or hexadecimal). The header is followed by the pathname of the entry (the length of the pathname is stored in the header) and any file d20 1 a20 1 pathname ``TRAILER!!!''. d23 17 a39 18 XXX Any documentation of the original PWB/UNIX 1.0 format? XXX Old Binary Format The old binary cpio format stores numbers as 2-byte and 4-byte binary values. Each entry begins with a header in the following format: struct header_old_cpio { unsigned short c_magic; unsigned short c_dev; unsigned short c_ino; unsigned short c_mode; unsigned short c_uid; unsigned short c_gid; unsigned short c_nlink; unsigned short c_rdev; unsigned short c_mtime[2]; unsigned short c_namesize; unsigned short c_filesize[2]; d42 7 a48 2 The unsigned short fields here are 16-bit integer values; the unsigned int fields are 32-bit integer values. The fields are as follows d50 2 a51 3 magic The integer value octal 070707. This value can be used to deter- mine whether this archive is written with little-endian or big- endian integers. d53 1 a53 1 dev, ino d59 11 a69 8 mode The mode specifies both the regular permissions and the file type. It consists of several bit fields as follows: 0170000 This masks the file type bits. 0140000 File type value for sockets. 0120000 File type value for symbolic links. For symbolic links, the link body is stored as file data. 0100000 File type value for regular files. 0060000 File type value for block special devices. d72 2 a73 1 0010000 File type value for named pipes or FIFOs. d76 1 a76 2 0001000 Sticky bit. On some systems, this modifies the behavior of executables and/or directories. d78 1 a78 1 for world, group, and user following standard POSIX con- d81 1 a81 1 uid, gid d84 2 a85 1 nlink The number of links to this file. Directories always have a d89 10 a98 9 rdev For block special and character special entries, this field con- tains the associated device number. For all other entry types, it should be set to zero by writers and ignored by readers. mtime Modification time of the file, indicated as the number of seconds since the start of the epoch, 00:00:00 UTC January 1, 1970. The four-byte integer is stored with the most-significant 16 bits first followed by the least-significant 16 bits. Each of the two 16 bit values are stored in machine-native byte order. d100 1 a100 1 namesize d104 1 a104 1 filesize d106 8 a113 6 to four gigabyte file sizes. See mtime above for a description of the storage of four-byte integers. The pathname immediately follows the fixed header. If the namesize is odd, an additional NUL byte is added after the pathname. The file data is then appended, padded with NUL bytes to an even length. d118 46 d165 1 a165 1 Version 2 of the Single UNIX Specification (``SUSv2'') standardized an d167 3 a169 3 known as the ``old character'' format or as the ``odc'' format. It stores the same numeric fields as the old binary format, but represents them as 6-character or 11-character octal values. d172 11 a182 11 char c_magic[6]; char c_dev[6]; char c_ino[6]; char c_mode[6]; char c_uid[6]; char c_gid[6]; char c_nlink[6]; char c_rdev[6]; char c_mtime[11]; char c_namesize[6]; char c_filesize[11]; d185 6 a190 6 The fields are identical to those in the old binary format. The name and file body follow the fixed header. Unlike the old binary format, there is no additional padding after the pathname or file contents. If the files being archived are themselves entirely ASCII, then the resulting archive will be entirely ASCII, except for the NUL byte that terminates the name field. d194 1 a194 1 separates device numbers into separate fields for major and minor num- d198 14 a211 14 char c_magic[6]; char c_ino[8]; char c_mode[8]; char c_uid[8]; char c_gid[8]; char c_nlink[8]; char c_mtime[8]; char c_filesize[8]; char c_devmajor[8]; char c_devminor[8]; char c_rdevmajor[8]; char c_rdevminor[8]; char c_namesize[8]; char c_check[8]; d215 1 a215 1 old binary format above. d217 1 a217 1 magic The string ``070701''. d219 1 a219 1 check This field is always set to zero by writers and ignored by read- d225 1 a225 1 4 gigabyte files (unlike the older ASCII format, which supports 8 giga- d232 2 a233 2 The CRC format is identical to the new ASCII format described in the pre- vious section except that the magic field is set to ``070702'' and the d235 1 a235 1 computed treating all bytes as unsigned values and using unsigned arith- d243 2 a244 2 Sun Solaris uses additional file types to store extended file data, including ACLs and extended attributes, as special entries in cpio ar- d253 1 a253 1 The cpio utility is no longer a part of POSIX or the Single Unix Stan- d255 1 a255 1 (``SUSv2''). It has been supplanted in subsequent standards by pax(1). d261 3 a263 3 AT&T's Unix Support Group. It appeared in 1977 as part of PWB/UNIX 1.0, the ``Programmer's Work Bench'' derived from Version 6 AT&T UNIX that was used internally at AT&T. Both the old binary and old character formats d265 4 a268 4 under their ``Ancient Unix'' license. The character format was adopted as part of IEEE Std 1003.1-1988 (``POSIX.1''). XXX when did "newc" appear? Who invented it? When did HP come out with their variant? When did Sun introduce ACLs and extended attributes? XXX d271 1 a271 1 The ``CRC'' format is mis-named, as it uses a simple checksum and not a d274 3 a276 2 The old binary format is limited to 16 bits for user id, group id, device, and inode numbers. It is limited to 4 gigabyte file sizes. d278 2 a279 2 The old ASCII format is limited to 18 bits for the user id, group id, device, and inode numbers. It is limited to 8 gigabyte file sizes. d284 1 a284 1 when moving files between systems with dissimilar user or group number- @ 1.5 log @Update for libarchive-3.4.0: - improvements for Android APK and JAR archives - better support for non-recursive list and extract - tar --exclude-vcs support - fixes for file attributes and flags handling - zipx support - rar 5.0 reader @ text @d4 1 a4 1 cpio — format of cpio archive files d14 1 a14 1 file data. The header record stores a series of integer values that gen‐ d16 3 a18 3 variants differ primarily in how they store those integers (binary, oc‐ tal, or hexadecimal). The header is followed by the pathname of the en‐ try (the length of the pathname is stored in the header) and any file d20 1 a20 1 pathname “TRAILER!!!”. d46 1 a46 1 magic The integer value octal 070707. This value can be used to deter‐ d72 1 a72 1 for world, group, and user following standard POSIX con‐ d82 1 a82 1 rdev For block special and character special entries, this field con‐ d109 1 a109 1 Version 2 of the Single UNIX Specification (“SUSv2”) standardized an d111 3 a113 3 known as the “old character” format or as the “odc” format. It stores the same numeric fields as the old binary format, but represents them as 6-character or 11-character octal values. d138 1 a138 1 separates device numbers into separate fields for major and minor num‐ d161 1 a161 1 magic The string “070701”. d163 1 a163 1 check This field is always set to zero by writers and ignored by read‐ d169 1 a169 1 4 gigabyte files (unlike the older ASCII format, which supports 8 giga‐ d173 1 a173 1 zero for each entry except the last one that appears in the archive. d176 2 a177 2 The CRC format is identical to the new ASCII format described in the pre‐ vious section except that the magic field is set to “070702” and the d179 1 a179 1 computed treating all bytes as unsigned values and using unsigned arith‐ d187 2 a188 2 Sun Solaris uses additional file types to store extended file data, in‐ cluding ACLs and extended attributes, as special entries in cpio ar‐ d197 1 a197 1 The cpio utility is no longer a part of POSIX or the Single Unix Stan‐ d199 1 a199 1 (“SUSv2”). It has been supplanted in subsequent standards by pax(1). d206 1 a206 1 the “Programmer's Work Bench” derived from Version 6 AT&T UNIX that was d209 4 a212 4 under their “Ancient Unix” license. The character format was adopted as part of IEEE Std 1003.1-1988 (“POSIX.1”). XXX when did "newc" appear? Who invented it? When did HP come out with their variant? When did Sun introduce ACLs and extended attributes? XXX d215 1 a215 1 The “CRC” format is mis-named, as it uses a simple checksum and not a d218 2 a219 2 The old binary format is limited to 16 bits for user id, group id, de‐ vice, and inode numbers. It is limited to 4 gigabyte file sizes. d221 2 a222 2 The old ASCII format is limited to 18 bits for the user id, group id, de‐ vice, and inode numbers. It is limited to 8 gigabyte file sizes. d227 1 a227 1 when moving files between systems with dissimilar user or group number‐ @ 1.4 log @Merge for libarchive-3.3.2. @ text @d16 3 a18 3 variants differ primarily in how they store those integers (binary, octal, or hexadecimal). The header is followed by the pathname of the entry (the length of the pathname is stored in the header) and any file d187 2 a188 2 Sun Solaris uses additional file types to store extended file data, including ACLs and extended attributes, as special entries in cpio ar‐ d218 2 a219 2 The old binary format is limited to 16 bits for user id, group id, device, and inode numbers. It is limited to 4 gigabyte file sizes. d221 2 a222 2 The old ASCII format is limited to 18 bits for the user id, group id, device, and inode numbers. It is limited to 8 gigabyte file sizes. @ 1.3 log @Merge libarchive-3.3.1. @ text @d3 2 a4 2 1mNAME0m 1mcpio 22m— format of cpio archive files d6 2 a7 2 1mDESCRIPTION0m The 1mcpio 22marchive format collects any number of files, directories, and d11 2 a12 2 1mGeneral Format0m Each file system object in a 1mcpio 22marchive comprises a header record with d15 1 a15 1 erally follow the fields in 4mstruct24m 4mstat24m. (See stat(2) for details.) The d22 1 a22 1 1mPWB format0m d25 2 a26 2 1mOld Binary Format0m The old binary 1mcpio 22mformat stores numbers as 2-byte and 4-byte binary d43 2 a44 2 The 4munsigned24m 4mshort24m fields here are 16-bit integer values; the 4munsigned0m 4mint24m fields are 32-bit integer values. The fields are as follows d46 1 a46 1 4mmagic24m The integer value octal 070707. This value can be used to deter‐ d50 1 a50 1 4mdev24m, 4mino0m d52 2 a53 2 programs that read 1mcpio 22marchives to determine when two entries refer to the same file. Programs that synthesize 1mcpio 22marchives d56 1 a56 1 4mmode24m The mode specifies both the regular permissions and the file d75 1 a75 1 4muid24m, 4mgid0m d78 1 a78 1 4mnlink24m The number of links to this file. Directories always have a d82 1 a82 1 4mrdev24m For block special and character special entries, this field con‐ d86 1 a86 1 4mmtime24m Modification time of the file, indicated as the number of seconds d92 1 a92 1 4mnamesize0m d96 1 a96 1 4mfilesize0m d98 1 a98 1 to four gigabyte file sizes. See 4mmtime24m above for a description d101 1 a101 1 The pathname immediately follows the fixed header. If the 1mnamesize 22mis d108 1 a108 1 1mPortable ASCII Format0m d136 1 a136 1 1mNew ASCII Format0m d161 1 a161 1 4mmagic24m The string “070701”. d163 1 a163 1 4mcheck24m This field is always set to zero by writers and ignored by read‐ d175 1 a175 1 1mNew CRC Format0m d178 1 a178 1 4mcheck24m field is set to the sum of all bytes in the file data. This sum is d182 2 a183 2 1mHP variants0m The 1mcpio 22mimplementation distributed with HPUX used XXXX but stored device d186 1 a186 1 1mOther Extensions and Variants0m d193 1 a193 1 1mSEE ALSO0m d196 2 a197 2 1mSTANDARDS0m The 1mcpio 22mutility is no longer a part of POSIX or the Single Unix Stan‐ d203 1 a203 1 1mHISTORY0m d214 1 a214 1 1mBUGS0m @ 1.2 log @Changes 3.1.2: This is a maintenance update to fix issues with the new RAR seeking feature. This new release also contains fixes for build failures when building libarchive using Visual Studio 2012 and MinGW. @ text @d3 2 a4 2 NAME cpio — format of cpio archive files d6 2 a7 2 DESCRIPTION The cpio archive format collects any number of files, directories, and d11 2 a12 2 General Format Each file system object in a cpio archive comprises a header record with d15 1 a15 1 erally follow the fields in struct stat. (See stat(2) for details.) The d22 1 a22 1 PWB format d25 2 a26 2 Old Binary Format The old binary cpio format stores numbers as 2-byte and 4-byte binary d43 2 a44 2 The unsigned short fields here are 16-bit integer values; the unsigned int fields are 32-bit integer values. The fields are as follows d46 1 a46 1 magic The integer value octal 070707. This value can be used to deter‐ d50 1 a50 1 dev, ino d52 2 a53 2 programs that read cpio archives to determine when two entries refer to the same file. Programs that synthesize cpio archives d56 1 a56 1 mode The mode specifies both the regular permissions and the file d75 1 a75 1 uid, gid d78 1 a78 1 nlink The number of links to this file. Directories always have a d82 1 a82 1 rdev For block special and character special entries, this field con‐ d86 1 a86 1 mtime Modification time of the file, indicated as the number of seconds d92 1 a92 1 namesize d96 1 a96 1 filesize d98 1 a98 1 to four gigabyte file sizes. See mtime above for a description d101 1 a101 1 The pathname immediately follows the fixed header. If the namesize is d108 1 a108 1 Portable ASCII Format d136 1 a136 1 New ASCII Format d161 1 a161 1 magic The string “070701”. d163 1 a163 1 check This field is always set to zero by writers and ignored by read‐ d175 1 a175 1 New CRC Format d178 1 a178 1 check field is set to the sum of all bytes in the file data. This sum is d182 2 a183 2 HP variants The cpio implementation distributed with HPUX used XXXX but stored device d186 1 a186 1 Other Extensions and Variants d193 1 a193 1 SEE ALSO d196 2 a197 2 STANDARDS The cpio utility is no longer a part of POSIX or the Single Unix Stan‐ d203 1 a203 1 HISTORY d214 1 a214 1 BUGS @ 1.1 log @Initial revision @ text @d1 1 a1 1 CPIO(5) FreeBSD File Formats Manual CPIO(5) d4 1 a4 1 cpio -- format of cpio archive files d14 1 a14 1 file data. The header record stores a series of integer values that gen- d20 1 a20 1 pathname ``TRAILER!!!''. d46 1 a46 1 magic The integer value octal 070707. This value can be used to deter- d72 1 a72 1 for world, group, and user following standard POSIX con- d82 1 a82 1 rdev For block special and character special entries, this field con- d94 1 a94 1 This count includes the trailing NULL byte. d102 2 a103 2 odd, an additional NULL byte is added after the pathname. The file data is then appended, padded with NULL bytes to an even length. d109 1 a109 1 Version 2 of the Single UNIX Specification (``SUSv2'') standardized an d111 3 a113 3 known as the ``old character'' format or as the ``odc'' format. It stores the same numeric fields as the old binary format, but represents them as 6-character or 11-character octal values. d133 1 a133 1 archive will be entirely ASCII, except for the NULL byte that terminates d138 1 a138 1 separates device numbers into separate fields for major and minor num- d161 1 a161 1 magic The string ``070701''. d163 1 a163 1 check This field is always set to zero by writers and ignored by read- d166 5 a170 5 The pathname is followed by NULL bytes so that the total size of the fixed header plus pathname is a multiple of four. Likewise, the file data is padded to a multiple of four bytes. Note that this format sup- ports only 4 gigabyte files (unlike the older ASCII format, which sup- ports 8 gigabyte files). d176 2 a177 2 The CRC format is identical to the new ASCII format described in the pre- vious section except that the magic field is set to ``070702'' and the d179 1 a179 1 computed treating all bytes as unsigned values and using unsigned arith- d188 1 a188 1 including ACLs and extended attributes, as special entries in cpio ar- d193 21 d215 1 a215 1 The ``CRC'' format is mis-named, as it uses a simple checksum and not a d227 1 a227 1 when moving files between systems with dissimilar user or group number- d235 1 a235 22 SEE ALSO cpio(1), tar(5) STANDARDS The cpio utility is no longer a part of POSIX or the Single Unix Stan- dard. It last appeared in Version 2 of the Single UNIX Specification (``SUSv2''). It has been supplanted in subsequent standards by pax(1). The portable ASCII format is currently part of the specification for the pax(1) utility. HISTORY The original cpio utility was written by Dick Haight while working in AT&T's Unix Support Group. It appeared in 1977 as part of PWB/UNIX 1.0, the ``Programmer's Work Bench'' derived from Version 6 AT&T UNIX that was used internally at AT&T. Both the old binary and old character formats were in use by 1980, according to the System III source released by SCO under their ``Ancient Unix'' license. The character format was adopted as part of IEEE Std 1003.1-1988 (``POSIX.1''). XXX when did "newc" appear? Who invented it? When did HP come out with their variant? When did Sun introduce ACLs and extended attributes? XXX FreeBSD 6.0 October 5, 2007 FreeBSD 6.0 @ 1.1.1.1 log @Import libarchive-2.4.0 @ text @@ 1.1.1.2 log @Import libarchive 2.8.0: - Infrastructure: - Allow command line tools as fallback for missing compression libraries. If compiled without gzip for example, gunzip will be used automatically. - Improved support for a number of platforms like high-resolution timestamps and Extended Attributes on various Unix systems - New convience interface for creating archives based on disk content, complement of the archive_write_disk interface. - Frontends: - bsdcpio ready for public consumption - hand-written date parser replaces the yacc code - Filter system: - Simplified read filter chains - Option support for filters - LZMA, XZ, uudecode handled - Format support: - Write support for mtree files based on file system or archive content - Basic read support for Joliet - Write support for zip files - Write support for shar archives, both text-only and binary-safe @ text @d94 1 a94 1 This count includes the trailing NUL byte. d102 2 a103 2 odd, an additional NUL byte is added after the pathname. The file data is then appended, padded with NUL bytes to an even length. d133 1 a133 1 archive will be entirely ASCII, except for the NUL byte that terminates d166 5 a170 5 The pathname is followed by NUL bytes so that the total size of the fixed header plus pathname is a multiple of four. Likewise, the file data is padded to a multiple of four bytes. Note that this format supports only 4 gigabyte files (unlike the older ASCII format, which supports 8 giga- byte files). d235 1 a235 1 FreeBSD 8.0 October 5, 2007 FreeBSD 8.0 @ 1.1.1.3 log @libarchive-2.8.2: - Fix NULL deference for short self-extracting zip archives - Don't dereference symlinks on Linux when reading ACLs - Better detection of SHA2 support for old OpenSSL versions - Fix parsing of input files for bsdtar -T - Do not leak setup_xattr into the global namespace - Fix build when an older libarchive is already installed - Use O_BINARY opening files in bsdtar - Include missing archive_crc32.h - Correctly include iconv.h required by libxml2 @ text @d1 1 a1 1 CPIO(5) NetBSD File Formats Manual CPIO(5) d14 1 a14 1 file data. The header record stores a series of integer values that gen- d101 1 a101 1 The pathname immediately follows the fixed header. If the namesize is d116 11 a126 11 char c_magic[6]; char c_dev[6]; char c_ino[6]; char c_mode[6]; char c_uid[6]; char c_gid[6]; char c_nlink[6]; char c_rdev[6]; char c_mtime[11]; char c_namesize[6]; char c_filesize[11]; d130 1 a130 1 file body follow the fixed header. Unlike the old binary format, there d142 14 a155 14 char c_magic[6]; char c_ino[8]; char c_mode[8]; char c_uid[8]; char c_gid[8]; char c_nlink[8]; char c_mtime[8]; char c_filesize[8]; char c_devmajor[8]; char c_devminor[8]; char c_rdevmajor[8]; char c_rdevminor[8]; char c_namesize[8]; char c_check[8]; d198 1 a198 1 device, and inode numbers. It is limited to 4 gigabyte file sizes. d201 1 a201 1 device, and inode numbers. It is limited to 8 gigabyte file sizes. d226 1 a226 1 AT&T's Unix Support Group. It appeared in 1977 as part of PWB/UNIX 1.0, d235 1 a235 1 NetBSD 5.0 October 5, 2007 NetBSD 5.0 @ 1.1.1.4 log @libarchive-2.8.3: Build fix for Linux @ text @d1 1 a1 1 CPIO(5) FreeBSD File Formats Manual CPIO(5) d14 1 a14 1 file data. The header record stores a series of integer values that gen- d101 1 a101 1 The pathname immediately follows the fixed header. If the namesize is d116 11 a126 11 char c_magic[6]; char c_dev[6]; char c_ino[6]; char c_mode[6]; char c_uid[6]; char c_gid[6]; char c_nlink[6]; char c_rdev[6]; char c_mtime[11]; char c_namesize[6]; char c_filesize[11]; d130 1 a130 1 file body follow the fixed header. Unlike the old binary format, there d142 14 a155 14 char c_magic[6]; char c_ino[8]; char c_mode[8]; char c_uid[8]; char c_gid[8]; char c_nlink[8]; char c_mtime[8]; char c_filesize[8]; char c_devmajor[8]; char c_devminor[8]; char c_rdevmajor[8]; char c_rdevminor[8]; char c_namesize[8]; char c_check[8]; d198 1 a198 1 device, and inode numbers. It is limited to 4 gigabyte file sizes. d201 1 a201 1 device, and inode numbers. It is limited to 8 gigabyte file sizes. d226 1 a226 1 AT&T's Unix Support Group. It appeared in 1977 as part of PWB/UNIX 1.0, d235 1 a235 1 FreeBSD 9.0 October 5, 2007 FreeBSD 9.0 @ 1.1.1.5 log @Import libarchive-2.8.4: - Improved reliability of hash function detection - Fix issues on ancient FreeBSD, QNX, ancient NetBSD and Minix @ text @d1 1 a1 1 CPIO(5) NetBSD File Formats Manual CPIO(5) d14 1 a14 1 file data. The header record stores a series of integer values that gen- d101 1 a101 1 The pathname immediately follows the fixed header. If the namesize is d116 11 a126 11 char c_magic[6]; char c_dev[6]; char c_ino[6]; char c_mode[6]; char c_uid[6]; char c_gid[6]; char c_nlink[6]; char c_rdev[6]; char c_mtime[11]; char c_namesize[6]; char c_filesize[11]; d130 1 a130 1 file body follow the fixed header. Unlike the old binary format, there d142 14 a155 14 char c_magic[6]; char c_ino[8]; char c_mode[8]; char c_uid[8]; char c_gid[8]; char c_nlink[8]; char c_mtime[8]; char c_filesize[8]; char c_devmajor[8]; char c_devminor[8]; char c_rdevmajor[8]; char c_rdevminor[8]; char c_namesize[8]; char c_check[8]; d198 1 a198 1 device, and inode numbers. It is limited to 4 gigabyte file sizes. d201 1 a201 1 device, and inode numbers. It is limited to 8 gigabyte file sizes. d226 1 a226 1 AT&T's Unix Support Group. It appeared in 1977 as part of PWB/UNIX 1.0, d235 1 a235 1 NetBSD 5.0 October 5, 2007 NetBSD 5.0 @ 1.1.1.6 log @Import libarchive-3.2.1: - security fixes and other bugfixes - support for multhreading in xz 5.2+ @ text @d1 1 a1 1 CPIO(5) BSD File Formats Manual CPIO(5) d4 1 a4 1 cpio — format of cpio archive files d14 1 a14 1 file data. The header record stores a series of integer values that gen‐ d20 1 a20 1 pathname “TRAILER!!!”. d46 1 a46 1 magic The integer value octal 070707. This value can be used to deter‐ d72 1 a72 1 for world, group, and user following standard POSIX con‐ d82 1 a82 1 rdev For block special and character special entries, this field con‐ d101 1 a101 1 The pathname immediately follows the fixed header. If the namesize is d109 1 a109 1 Version 2 of the Single UNIX Specification (“SUSv2”) standardized an d111 3 a113 3 known as the “old character” format or as the “odc” format. It stores the same numeric fields as the old binary format, but represents them as 6-character or 11-character octal values. d116 11 a126 11 char c_magic[6]; char c_dev[6]; char c_ino[6]; char c_mode[6]; char c_uid[6]; char c_gid[6]; char c_nlink[6]; char c_rdev[6]; char c_mtime[11]; char c_namesize[6]; char c_filesize[11]; d130 1 a130 1 file body follow the fixed header. Unlike the old binary format, there d138 1 a138 1 separates device numbers into separate fields for major and minor num‐ d142 14 a155 14 char c_magic[6]; char c_ino[8]; char c_mode[8]; char c_uid[8]; char c_gid[8]; char c_nlink[8]; char c_mtime[8]; char c_filesize[8]; char c_devmajor[8]; char c_devminor[8]; char c_rdevmajor[8]; char c_rdevminor[8]; char c_namesize[8]; char c_check[8]; d161 1 a161 1 magic The string “070701”. d163 1 a163 1 check This field is always set to zero by writers and ignored by read‐ d169 1 a169 1 4 gigabyte files (unlike the older ASCII format, which supports 8 giga‐ d176 2 a177 2 The CRC format is identical to the new ASCII format described in the pre‐ vious section except that the magic field is set to “070702” and the d179 1 a179 1 computed treating all bytes as unsigned values and using unsigned arith‐ d188 1 a188 1 including ACLs and extended attributes, as special entries in cpio ar‐ a192 21 SEE ALSO cpio(1), tar(5) STANDARDS The cpio utility is no longer a part of POSIX or the Single Unix Stan‐ dard. It last appeared in Version 2 of the Single UNIX Specification (“SUSv2”). It has been supplanted in subsequent standards by pax(1). The portable ASCII format is currently part of the specification for the pax(1) utility. HISTORY The original cpio utility was written by Dick Haight while working in AT&T's Unix Support Group. It appeared in 1977 as part of PWB/UNIX 1.0, the “Programmer's Work Bench” derived from Version 6 AT&T UNIX that was used internally at AT&T. Both the old binary and old character formats were in use by 1980, according to the System III source released by SCO under their “Ancient Unix” license. The character format was adopted as part of IEEE Std 1003.1-1988 (“POSIX.1”). XXX when did "newc" appear? Who invented it? When did HP come out with their variant? When did Sun introduce ACLs and extended attributes? XXX d194 1 a194 1 The “CRC” format is mis-named, as it uses a simple checksum and not a d198 1 a198 1 device, and inode numbers. It is limited to 4 gigabyte file sizes. d201 1 a201 1 device, and inode numbers. It is limited to 8 gigabyte file sizes. d206 1 a206 1 when moving files between systems with dissimilar user or group number‐ d214 22 a235 1 BSD December 23, 2011 BSD @ 1.1.1.7 log @Import libarchive-3.3.1. @ text @d3 2 a4 2 1mNAME0m 1mcpio 22m— format of cpio archive files d6 2 a7 2 1mDESCRIPTION0m The 1mcpio 22marchive format collects any number of files, directories, and d11 2 a12 2 1mGeneral Format0m Each file system object in a 1mcpio 22marchive comprises a header record with d15 1 a15 1 erally follow the fields in 4mstruct24m 4mstat24m. (See stat(2) for details.) The d22 1 a22 1 1mPWB format0m d25 2 a26 2 1mOld Binary Format0m The old binary 1mcpio 22mformat stores numbers as 2-byte and 4-byte binary d43 2 a44 2 The 4munsigned24m 4mshort24m fields here are 16-bit integer values; the 4munsigned0m 4mint24m fields are 32-bit integer values. The fields are as follows d46 1 a46 1 4mmagic24m The integer value octal 070707. This value can be used to deter‐ d50 1 a50 1 4mdev24m, 4mino0m d52 2 a53 2 programs that read 1mcpio 22marchives to determine when two entries refer to the same file. Programs that synthesize 1mcpio 22marchives d56 1 a56 1 4mmode24m The mode specifies both the regular permissions and the file d75 1 a75 1 4muid24m, 4mgid0m d78 1 a78 1 4mnlink24m The number of links to this file. Directories always have a d82 1 a82 1 4mrdev24m For block special and character special entries, this field con‐ d86 1 a86 1 4mmtime24m Modification time of the file, indicated as the number of seconds d92 1 a92 1 4mnamesize0m d96 1 a96 1 4mfilesize0m d98 1 a98 1 to four gigabyte file sizes. See 4mmtime24m above for a description d101 1 a101 1 The pathname immediately follows the fixed header. If the 1mnamesize 22mis d108 1 a108 1 1mPortable ASCII Format0m d136 1 a136 1 1mNew ASCII Format0m d161 1 a161 1 4mmagic24m The string “070701”. d163 1 a163 1 4mcheck24m This field is always set to zero by writers and ignored by read‐ d175 1 a175 1 1mNew CRC Format0m d178 1 a178 1 4mcheck24m field is set to the sum of all bytes in the file data. This sum is d182 2 a183 2 1mHP variants0m The 1mcpio 22mimplementation distributed with HPUX used XXXX but stored device d186 1 a186 1 1mOther Extensions and Variants0m d193 1 a193 1 1mSEE ALSO0m d196 2 a197 2 1mSTANDARDS0m The 1mcpio 22mutility is no longer a part of POSIX or the Single Unix Stan‐ d203 1 a203 1 1mHISTORY0m d214 1 a214 1 1mBUGS0m @ 1.1.1.8 log @Import libarchive-3.3.2 + 9de5f3 + f9dacbf: - Support NFS4 ACLs on Linux - Bugfixes @ text @d3 2 a4 2 NAME cpio — format of cpio archive files d6 2 a7 2 DESCRIPTION The cpio archive format collects any number of files, directories, and d11 2 a12 2 General Format Each file system object in a cpio archive comprises a header record with d15 1 a15 1 erally follow the fields in struct stat. (See stat(2) for details.) The d22 1 a22 1 PWB format d25 2 a26 2 Old Binary Format The old binary cpio format stores numbers as 2-byte and 4-byte binary d43 2 a44 2 The unsigned short fields here are 16-bit integer values; the unsigned int fields are 32-bit integer values. The fields are as follows d46 1 a46 1 magic The integer value octal 070707. This value can be used to deter‐ d50 1 a50 1 dev, ino d52 2 a53 2 programs that read cpio archives to determine when two entries refer to the same file. Programs that synthesize cpio archives d56 1 a56 1 mode The mode specifies both the regular permissions and the file d75 1 a75 1 uid, gid d78 1 a78 1 nlink The number of links to this file. Directories always have a d82 1 a82 1 rdev For block special and character special entries, this field con‐ d86 1 a86 1 mtime Modification time of the file, indicated as the number of seconds d92 1 a92 1 namesize d96 1 a96 1 filesize d98 1 a98 1 to four gigabyte file sizes. See mtime above for a description d101 1 a101 1 The pathname immediately follows the fixed header. If the namesize is d108 1 a108 1 Portable ASCII Format d136 1 a136 1 New ASCII Format d161 1 a161 1 magic The string “070701”. d163 1 a163 1 check This field is always set to zero by writers and ignored by read‐ d175 1 a175 1 New CRC Format d178 1 a178 1 check field is set to the sum of all bytes in the file data. This sum is d182 2 a183 2 HP variants The cpio implementation distributed with HPUX used XXXX but stored device d186 1 a186 1 Other Extensions and Variants d193 1 a193 1 SEE ALSO d196 2 a197 2 STANDARDS The cpio utility is no longer a part of POSIX or the Single Unix Stan‐ d203 1 a203 1 HISTORY d214 1 a214 1 BUGS @ 1.1.1.9 log @Import libarchive 3.4.0 @ text @d16 3 a18 3 variants differ primarily in how they store those integers (binary, oc‐ tal, or hexadecimal). The header is followed by the pathname of the en‐ try (the length of the pathname is stored in the header) and any file d187 2 a188 2 Sun Solaris uses additional file types to store extended file data, in‐ cluding ACLs and extended attributes, as special entries in cpio ar‐ d218 2 a219 2 The old binary format is limited to 16 bits for user id, group id, de‐ vice, and inode numbers. It is limited to 4 gigabyte file sizes. d221 2 a222 2 The old ASCII format is limited to 18 bits for the user id, group id, de‐ vice, and inode numbers. It is limited to 8 gigabyte file sizes. @ 1.1.1.10 log @Import libarchive 3.7.2 @ text @d1 1 a1 1 CPIO(5) BSD File Formats Manual CPIO(5) d14 1 a14 1 file data. The header record stores a series of integer values that gen‐ d23 18 a40 17 The PWB binary cpio format is the original format, when cpio was intro‐ duced as part of the Programmer's Work Bench system, a variant of 6th Edition UNIX. It stores numbers as 2-byte and 4-byte binary values. Each entry begins with a header in the following format: struct header_pwb_cpio { short h_magic; short h_dev; short h_ino; short h_mode; short h_uid; short h_gid; short h_nlink; short h_majmin; long h_mtime; short h_namesize; long h_filesize; d43 2 a44 7 The short fields here are 16-bit integer values, while the long fields are 32 bit integers. Since PWB UNIX, like the 6th Edition UNIX it was based on, only ran on PDP-11 computers, they are in PDP-endian format, which has little-endian shorts, and big-endian longs. That is, the long integer whose hexadecimal representation is 0x12345678 would be stored in four successive bytes as 0x34, 0x12, 0x78, 0x56. The fields are as fol‐ lows: d46 3 a48 2 h_magic The integer value octal 070707. d50 1 a50 1 h_dev, h_ino d56 8 a63 11 h_mode The mode specifies both the regular permissions and the file type, and it also holds a couple of bits that are irrelevant to the cpio format, because the field is actually a raw copy of the mode field in the inode representing the file. These are the IALLOC flag, which shows that the inode entry is in use, and the ILARG flag, which shows that the file it represents is large enough to have indirect blocks pointers in the inode. The mode is decoded as follows: 0100000 IALLOC flag - irrelevant to cpio. 0060000 This masks the file type bits. d66 1 a66 2 0060000 File type value for block special devices. 0010000 ILARG flag - irrelevant to cpio. d69 2 a70 1 0001000 Sticky bit. d75 1 a75 1 h_uid, h_gid d78 1 a78 2 h_nlink The number of links to this file. Directories always have a d82 9 a90 10 h_majmin For block special and character special entries, this field con‐ tains the associated device number, with the major number in the high byte, and the minor number in the low byte. For all other entry types, it should be set to zero by writers and ignored by readers. h_mtime Modification time of the file, indicated as the number of seconds since the start of the epoch, 00:00:00 UTC January 1, 1970. d92 1 a92 1 h_namesize d96 1 a96 1 h_filesize d98 6 a103 8 to 16 megabyte file sizes, because PWB UNIX, like 6th Edition, only used an unsigned 24 bit integer for the file size inter‐ nally. The pathname immediately follows the fixed header. If h_namesize is odd, an additional NUL byte is added after the pathname. The file data is then appended, again with an additional NUL appended if needed to get the next header at an even offset. a107 46 New Binary Format The new binary cpio format showed up when cpio was adopted into late 7th Edition UNIX. It is exactly like the PWB binary format, described above, except for three changes: First, UNIX now ran on more than one hardware type, so the endianness of 16 bit integers must be determined by observing the magic number at the start of the header. The 32 bit integers are still always stored with the most significant word first, though, so each of those two, in the struct shown above, was stored as an array of two 16 bit integers, in the traditional order. Those 16 bit integers, like all the others in the struct, were accessed using a macro that byte swapped them if necessary. Next, 7th Edition had more file types to store, and the IALLOC and ILARG flag bits were re-purposed to accommodate these. The revised use of the various bits is as follows: 0170000 This masks the file type bits. 0140000 File type value for sockets. 0120000 File type value for symbolic links. For symbolic links, the link body is stored as file data. 0100000 File type value for regular files. 0060000 File type value for block special devices. 0040000 File type value for directories. 0020000 File type value for character special devices. 0010000 File type value for named pipes or FIFOs. 0004000 SUID bit. 0002000 SGID bit. 0001000 Sticky bit. 0000777 The lower 9 bits specify read/write/execute permissions for world, group, and user following standard POSIX conventions. Finally, the file size field now represents a signed 32 bit integer in the underlying file system, so the maximum file size has increased to 2 gigabytes. Note that there is no obvious way to tell which of the two binary formats an archive uses, other than to see which one makes more sense. The typi‐ cal error scenario is that a PWB format archive unpacked as if it were in the new format will create named sockets instead of directories, and then fail to unpack files that should go in those directories. Running bsdcpio -itv on an unknown archive will make it obvious which it is: if it's PWB format, directories will be listed with an 's' instead of a 'd' as the first character of the mode string, and the larger files will have a '?' in that position. d116 11 a126 11 char c_magic[6]; char c_dev[6]; char c_ino[6]; char c_mode[6]; char c_uid[6]; char c_gid[6]; char c_nlink[6]; char c_rdev[6]; char c_mtime[11]; char c_namesize[6]; char c_filesize[11]; d129 6 a134 6 The fields are identical to those in the new binary format. The name and file body follow the fixed header. Unlike the binary formats, there is no additional padding after the pathname or file contents. If the files being archived are themselves entirely ASCII, then the resulting archive will be entirely ASCII, except for the NUL byte that terminates the name field. d142 14 a155 14 char c_magic[6]; char c_ino[8]; char c_mode[8]; char c_uid[8]; char c_gid[8]; char c_nlink[8]; char c_mtime[8]; char c_filesize[8]; char c_devmajor[8]; char c_devminor[8]; char c_rdevmajor[8]; char c_rdevminor[8]; char c_namesize[8]; char c_check[8]; d159 1 a159 1 new binary format above. d173 1 a173 1 zero for each entry except the first one that appears in the archive. d199 1 a199 1 (“SUSv2”). It has been supplanted in subsequent standards by pax(1). d205 1 a205 1 AT&T's Unix Support Group. It appeared in 1977 as part of PWB/UNIX 1.0, d207 1 a207 1 used internally at AT&T. Both the new binary and old character formats d211 1 a211 1 Who invented it? When did HP come out with their variant? When did Sun d218 2 a219 3 The binary formats are limited to 16 bits for user id, group id, device, and inode numbers. They are limited to 16 megabyte and 2 gigabyte file sizes for the older and newer variants, respectively. @ 1.1.1.11 log @libarchove: import version 3.7.7 @ text @d1 1 a1 1 4mCPIO24m(5) File Formats Manual 4mCPIO24m(5) d3 2 a4 2 1mNAME0m cpio — format of cpio archive files d6 285 a290 288 1mDESCRIPTION0m The 1mcpio 22marchive format collects any number of files, directories, and other file system objects (symbolic links, device nodes, etc.) into a single stream of bytes. 1mGeneral Format0m Each file system object in a 1mcpio 22marchive comprises a header record with basic numeric metadata followed by the full pathname of the entry and the file data. The header record stores a series of integer values that generally follow the fields in 4mstruct24m 4mstat24m. (See 4mstat24m(2) for de‐ tails.) The variants differ primarily in how they store those integers (binary, octal, or hexadecimal). The header is followed by the path‐ name of the entry (the length of the pathname is stored in the header) and any file data. The end of the archive is indicated by a special record with the pathname “TRAILER!!!”. 1mPWB format0m The PWB binary 1mcpio 22mformat is the original format, when cpio was intro‐ duced as part of the Programmer's Work Bench system, a variant of 6th Edition UNIX. It stores numbers as 2-byte and 4-byte binary values. Each entry begins with a header in the following format: struct header_pwb_cpio { short h_magic; short h_dev; short h_ino; short h_mode; short h_uid; short h_gid; short h_nlink; short h_majmin; long h_mtime; short h_namesize; long h_filesize; }; The 4mshort24m fields here are 16-bit integer values, while the 4mlong24m fields are 32 bit integers. Since PWB UNIX, like the 6th Edition UNIX it was based on, only ran on PDP-11 computers, they are in PDP-endian format, which has little-endian shorts, and big-endian longs. That is, the long integer whose hexadecimal representation is 0x12345678 would be stored in four successive bytes as 0x34, 0x12, 0x78, 0x56. The fields are as follows: 4mh_magic0m The integer value octal 070707. 4mh_dev24m, 4mh_ino0m The device and inode numbers from the disk. These are used by programs that read 1mcpio 22marchives to determine when two entries refer to the same file. Programs that synthesize 1mcpio 22marchives should be careful to set these to distinct values for each en‐ try. 4mh_mode24m The mode specifies both the regular permissions and the file type, and it also holds a couple of bits that are irrelevant to the cpio format, because the field is actually a raw copy of the mode field in the inode representing the file. These are the IALLOC flag, which shows that the inode entry is in use, and the ILARG flag, which shows that the file it represents is large enough to have indirect blocks pointers in the inode. The mode is decoded as follows: 0100000 IALLOC flag - irrelevant to cpio. 0060000 This masks the file type bits. 0040000 File type value for directories. 0020000 File type value for character special devices. 0060000 File type value for block special devices. 0010000 ILARG flag - irrelevant to cpio. 0004000 SUID bit. 0002000 SGID bit. 0001000 Sticky bit. 0000777 The lower 9 bits specify read/write/execute permis‐ sions for world, group, and user following standard POSIX conventions. 4mh_uid24m, 4mh_gid0m The numeric user id and group id of the owner. 4mh_nlink0m The number of links to this file. Directories always have a value of at least two here. Note that hardlinked files include file data with every copy in the archive. 4mh_majmin0m For block special and character special entries, this field contains the associated device number, with the major number in the high byte, and the minor number in the low byte. For all other entry types, it should be set to zero by writers and ig‐ nored by readers. 4mh_mtime0m Modification time of the file, indicated as the number of sec‐ onds since the start of the epoch, 00:00:00 UTC January 1, 1970. 4mh_namesize0m The number of bytes in the pathname that follows the header. This count includes the trailing NUL byte. 4mh_filesize0m The size of the file. Note that this archive format is limited to 16 megabyte file sizes, because PWB UNIX, like 6th Edition, only used an unsigned 24 bit integer for the file size inter‐ nally. The pathname immediately follows the fixed header. If 1mh_namesize 22mis odd, an additional NUL byte is added after the pathname. The file data is then appended, again with an additional NUL appended if needed to get the next header at an even offset. Hardlinked files are not given special treatment; the full file con‐ tents are included with each copy of the file. 1mNew Binary Format0m The new binary 1mcpio 22mformat showed up when cpio was adopted into late 7th Edition UNIX. It is exactly like the PWB binary format, described above, except for three changes: First, UNIX now ran on more than one hardware type, so the endianness of 16 bit integers must be determined by observing the magic number at the start of the header. The 32 bit integers are still always stored with the most significant word first, though, so each of those two, in the struct shown above, was stored as an array of two 16 bit integers, in the traditional order. Those 16 bit integers, like all the others in the struct, were accessed using a macro that byte swapped them if necessary. Next, 7th Edition had more file types to store, and the IALLOC and ILARG flag bits were re-purposed to accommodate these. The revised use of the various bits is as follows: 0170000 This masks the file type bits. 0140000 File type value for sockets. 0120000 File type value for symbolic links. For symbolic links, the link body is stored as file data. 0100000 File type value for regular files. 0060000 File type value for block special devices. 0040000 File type value for directories. 0020000 File type value for character special devices. 0010000 File type value for named pipes or FIFOs. 0004000 SUID bit. 0002000 SGID bit. 0001000 Sticky bit. 0000777 The lower 9 bits specify read/write/execute permissions for world, group, and user following standard POSIX conventions. Finally, the file size field now represents a signed 32 bit integer in the underlying file system, so the maximum file size has increased to 2 gigabytes. Note that there is no obvious way to tell which of the two binary for‐ mats an archive uses, other than to see which one makes more sense. The typical error scenario is that a PWB format archive unpacked as if it were in the new format will create named sockets instead of directo‐ ries, and then fail to unpack files that should go in those directo‐ ries. Running 4mbsdcpio24m 4m-itv24m on an unknown archive will make it obvious which it is: if it's PWB format, directories will be listed with an 's' instead of a 'd' as the first character of the mode string, and the larger files will have a '?' in that position. 1mPortable ASCII Format0m Version 2 of the Single UNIX Specification (“SUSv2”) standardized an ASCII variant that is portable across all platforms. It is commonly known as the “old character” format or as the “odc” format. It stores the same numeric fields as the old binary format, but represents them as 6-character or 11-character octal values. struct cpio_odc_header { char c_magic[6]; char c_dev[6]; char c_ino[6]; char c_mode[6]; char c_uid[6]; char c_gid[6]; char c_nlink[6]; char c_rdev[6]; char c_mtime[11]; char c_namesize[6]; char c_filesize[11]; }; The fields are identical to those in the new binary format. The name and file body follow the fixed header. Unlike the binary formats, there is no additional padding after the pathname or file contents. If the files being archived are themselves entirely ASCII, then the re‐ sulting archive will be entirely ASCII, except for the NUL byte that terminates the name field. 1mNew ASCII Format0m The "new" ASCII format uses 8-byte hexadecimal fields for all numbers and separates device numbers into separate fields for major and minor numbers. struct cpio_newc_header { char c_magic[6]; char c_ino[8]; char c_mode[8]; char c_uid[8]; char c_gid[8]; char c_nlink[8]; char c_mtime[8]; char c_filesize[8]; char c_devmajor[8]; char c_devminor[8]; char c_rdevmajor[8]; char c_rdevminor[8]; char c_namesize[8]; char c_check[8]; }; Except as specified below, the fields here match those specified for the new binary format above. 4mmagic24m The string “070701”. 4mcheck24m This field is always set to zero by writers and ignored by readers. See the next section for more details. The pathname is followed by NUL bytes so that the total size of the fixed header plus pathname is a multiple of four. Likewise, the file data is padded to a multiple of four bytes. Note that this format sup‐ ports only 4 gigabyte files (unlike the older ASCII format, which sup‐ ports 8 gigabyte files). In this format, hardlinked files are handled by setting the filesize to zero for each entry except the first one that appears in the archive. 1mNew CRC Format0m The CRC format is identical to the new ASCII format described in the previous section except that the magic field is set to “070702” and the 4mcheck24m field is set to the sum of all bytes in the file data. This sum is computed treating all bytes as unsigned values and using unsigned arithmetic. Only the least-significant 32 bits of the sum are stored. 1mHP variants0m The 1mcpio 22mimplementation distributed with HPUX used XXXX but stored de‐ vice numbers differently XXX. 1mOther Extensions and Variants0m Sun Solaris uses additional file types to store extended file data, in‐ cluding ACLs and extended attributes, as special entries in cpio archives. XXX Others? XXX 1mSEE ALSO0m 4mcpio24m(1), 4mtar24m(5) 1mSTANDARDS0m The 1mcpio 22mutility is no longer a part of POSIX or the Single Unix Stan‐ dard. It last appeared in Version 2 of the Single UNIX Specification (“SUSv2”). It has been supplanted in subsequent standards by 4mpax24m(1). The portable ASCII format is currently part of the specification for the 4mpax24m(1) utility. 1mHISTORY0m The original cpio utility was written by Dick Haight while working in AT&T's Unix Support Group. It appeared in 1977 as part of PWB/UNIX 1.0, the “Programmer's Work Bench” derived from Version 6 AT&T UNIX that was used internally at AT&T. Both the new binary and old charac‐ ter formats were in use by 1980, according to the System III source re‐ leased by SCO under their “Ancient Unix” license. The character format was adopted as part of IEEE Std 1003.1-1988 (“POSIX.1”). XXX when did "newc" appear? Who invented it? When did HP come out with their vari‐ ant? When did Sun introduce ACLs and extended attributes? XXX 1mBUGS0m The “CRC” format is mis-named, as it uses a simple checksum and not a cyclic redundancy check. The binary formats are limited to 16 bits for user id, group id, de‐ vice, and inode numbers. They are limited to 16 megabyte and 2 giga‐ byte file sizes for the older and newer variants, respectively. The old ASCII format is limited to 18 bits for the user id, group id, device, and inode numbers. It is limited to 8 gigabyte file sizes. The new ASCII format is limited to 4 gigabyte file sizes. None of the cpio formats store user or group names, which are essential when moving files between systems with dissimilar user or group number‐ ing. Especially when writing older cpio variants, it may be necessary to map actual device/inode values to synthesized values that fit the available fields. With very large filesystems, this may be necessary even for the newer formats. d292 1 a292 1 Debian December 23, 2011 4mCPIO24m(5) @ 1.1.1.12 log @libarchive: import version 3.8.10 @ text @d66 2 a67 2 large enough to have indirect block pointers in the inode. The mode is decoded as follows: d78 2 a79 2 0000777 The lower 9 bits specify read/write/execute permis‐ sions for world, group, and user following standard d86 1 a86 1 The number of links to this file. Directories always have a d91 1 a91 1 For block special and character special entries, this field d93 2 a94 2 the high byte, and the minor number in the low byte. For all other entry types, it should be set to zero by writers and ig‐ d98 2 a99 2 Modification time of the file, indicated as the number of sec‐ onds since the start of the epoch, 00:00:00 UTC January 1, d103 1 a103 1 The number of bytes in the pathname that follows the header. d108 2 a109 2 to 16 megabyte file sizes, because PWB UNIX, like 6th Edition, only used an unsigned 24 bit integer for the file size inter‐ d112 1 a112 1 The pathname immediately follows the fixed header. If 1mh_namesize 22mis d114 1 a114 1 is then appended, again with an additional NUL appended if needed to d117 1 a117 1 Hardlinked files are not given special treatment; the full file con‐ d121 2 a122 2 The new binary 1mcpio 22mformat showed up when cpio was adopted into late 7th Edition UNIX. It is exactly like the PWB binary format, described d125 7 a131 7 First, UNIX now ran on more than one hardware type, so the endianness of 16 bit integers must be determined by observing the magic number at the start of the header. The 32 bit integers are still always stored with the most significant word first, though, so each of those two, in the struct shown above, was stored as an array of two 16 bit integers, in the traditional order. Those 16 bit integers, like all the others in the struct, were accessed using a macro that byte swapped them if d134 1 a134 1 Next, 7th Edition had more file types to store, and the IALLOC and d140 1 a140 1 0120000 File type value for symbolic links. For symbolic links, the d150 1 a150 1 0000777 The lower 9 bits specify read/write/execute permissions for d153 1 a153 1 Finally, the file size field now represents a signed 32 bit integer in d157 3 a159 3 Note that there is no obvious way to tell which of the two binary for‐ mats an archive uses, other than to see which one makes more sense. The typical error scenario is that a PWB format archive unpacked as if d161 2 a162 2 ries, and then fail to unpack files that should go in those directo‐ ries. Running 4mbsdcpio24m 4m-itv24m on an unknown archive will make it obvious d164 1 a164 1 instead of a 'd' as the first character of the mode string, and the d168 4 a171 4 Version 2 of the Single UNIX Specification (“SUSv2”) standardized an ASCII variant that is portable across all platforms. It is commonly known as the “old character” format or as the “odc” format. It stores the same numeric fields as the old binary format, but represents them d188 2 a189 2 The fields are identical to those in the new binary format. The name and file body follow the fixed header. Unlike the binary formats, d191 2 a192 2 the files being archived are themselves entirely ASCII, then the re‐ sulting archive will be entirely ASCII, except for the NUL byte that d196 2 a197 2 The "new" ASCII format uses 8-byte hexadecimal fields for all numbers and separates device numbers into separate fields for major and minor d217 1 a217 1 Except as specified below, the fields here match those specified for d222 1 a222 1 4mcheck24m This field is always set to zero by writers and ignored by d225 2 a226 2 The pathname is followed by NUL bytes so that the total size of the fixed header plus pathname is a multiple of four. Likewise, the file d228 1 a228 1 ports only 4 gigabyte files (unlike the older ASCII format, which sup‐ d235 1 a235 1 The CRC format is identical to the new ASCII format described in the d237 2 a238 2 4mcheck24m field is set to the sum of all bytes in the file data. This sum is computed treating all bytes as unsigned values and using unsigned d242 1 a242 1 The 1mcpio 22mimplementation distributed with HPUX used XXXX but stored de‐ d247 1 a247 1 cluding ACLs and extended attributes, as special entries in cpio d256 4 a259 4 The 1mcpio 22mutility is no longer a part of POSIX or the Single Unix Stan‐ dard. It last appeared in Version 2 of the Single UNIX Specification (“SUSv2”). It has been supplanted in subsequent standards by 4mpax24m(1). The portable ASCII format is currently part of the specification for d263 4 a266 4 The original cpio utility was written by Dick Haight while working in AT&T's Unix Support Group. It appeared in 1977 as part of PWB/UNIX 1.0, the “Programmer's Work Bench” derived from Version 6 AT&T UNIX that was used internally at AT&T. Both the new binary and old charac‐ d269 1 a269 1 was adopted as part of IEEE Std 1003.1-1988 (“POSIX.1”). XXX when did d274 1 a274 1 The “CRC” format is mis-named, as it uses a simple checksum and not a d277 2 a278 2 The binary formats are limited to 16 bits for user id, group id, de‐ vice, and inode numbers. They are limited to 16 megabyte and 2 giga‐ d281 1 a281 1 The old ASCII format is limited to 18 bits for the user id, group id, d292 1 a292 1 fields. With very large filesystems, this may be necessary even for @