head 1.6;
access;
symbols
libarchive-3-8-10:1.1.1.4
pkgsrc-2026Q3:1.5.0.22
pkgsrc-2026Q3-base:1.5
libarchive-3-8-9:1.1.1.3
libarchive-3-8-8:1.1.1.3
pkgsrc-2026Q2:1.5.0.20
pkgsrc-2026Q2-base:1.5
libarchive-3-8-7:1.1.1.3
libarchive-3-8-6:1.1.1.3
pkgsrc-2026Q1:1.5.0.18
pkgsrc-2026Q1-base:1.5
libarchive-3-8-5:1.1.1.3
libarchive-3-8-4:1.1.1.3
pkgsrc-2025Q4:1.5.0.16
pkgsrc-2025Q4-base:1.5
libarchive-3-8-3:1.1.1.3
libarchive-3-8-2:1.1.1.3
pkgsrc-2025Q3:1.5.0.14
pkgsrc-2025Q3-base:1.5
libarchive-3-8-1:1.1.1.3
pkgsrc-2025Q2:1.5.0.12
pkgsrc-2025Q2-base:1.5
libarchive-3-8-0:1.1.1.3
libarchive-3-7-9:1.1.1.3
pkgsrc-2025Q1:1.5.0.10
pkgsrc-2025Q1-base:1.5
pkgsrc-2024Q4:1.5.0.8
pkgsrc-2024Q4-base:1.5
libarchive-3-7-7:1.1.1.3
pkgsrc-2024Q3:1.5.0.6
pkgsrc-2024Q3-base:1.5
libarchive-3-7-5:1.1.1.3
pkgsrc-2024Q2:1.5.0.4
pkgsrc-2024Q2-base:1.5
libarchive-3-7-4:1.1.1.3
libarchive-3-7-3:1.1.1.3
pkgsrc-2024Q1:1.5.0.2
pkgsrc-2024Q1-base:1.5
libarchive-3-7-2:1.1.1.3
pkgsrc-2023Q4:1.4.0.30
pkgsrc-2023Q4-base:1.4
pkgsrc-2023Q3:1.4.0.28
pkgsrc-2023Q3-base:1.4
pkgsrc-2023Q2:1.4.0.26
pkgsrc-2023Q2-base:1.4
pkgsrc-2023Q1:1.4.0.24
pkgsrc-2023Q1-base:1.4
pkgsrc-2022Q4:1.4.0.22
pkgsrc-2022Q4-base:1.4
pkgsrc-2022Q3:1.4.0.20
pkgsrc-2022Q3-base:1.4
pkgsrc-2022Q2:1.4.0.18
pkgsrc-2022Q2-base:1.4
pkgsrc-2022Q1:1.4.0.16
pkgsrc-2022Q1-base:1.4
pkgsrc-2021Q4:1.4.0.14
pkgsrc-2021Q4-base:1.4
pkgsrc-2021Q3:1.4.0.12
pkgsrc-2021Q3-base:1.4
pkgsrc-2021Q2:1.4.0.10
pkgsrc-2021Q2-base:1.4
pkgsrc-2021Q1:1.4.0.8
pkgsrc-2021Q1-base:1.4
pkgsrc-2020Q4:1.4.0.6
pkgsrc-2020Q4-base:1.4
pkgsrc-2020Q3:1.4.0.4
pkgsrc-2020Q3-base:1.4
pkgsrc-2020Q2:1.4.0.2
pkgsrc-2020Q2-base:1.4
pkgsrc-2020Q1:1.3.0.12
pkgsrc-2020Q1-base:1.3
pkgsrc-2019Q4:1.3.0.34
pkgsrc-2019Q4-base:1.3
pkgsrc-2019Q3:1.3.0.30
pkgsrc-2019Q3-base:1.3
libarchive-3-4-0:1.1.1.2
libarchive-3-3-3:1.1.1.2
pkgsrc-2019Q2:1.3.0.28
pkgsrc-2019Q2-base:1.3
pkgsrc-2019Q1:1.3.0.26
pkgsrc-2019Q1-base:1.3
pkgsrc-2018Q4:1.3.0.24
pkgsrc-2018Q4-base:1.3
pkgsrc-2018Q3:1.3.0.22
pkgsrc-2018Q3-base:1.3
pkgsrc-2018Q2:1.3.0.20
pkgsrc-2018Q2-base:1.3
pkgsrc-2018Q1:1.3.0.18
pkgsrc-2018Q1-base:1.3
pkgsrc-2017Q4:1.3.0.16
pkgsrc-2017Q4-base:1.3
pkgsrc-2017Q3:1.3.0.14
pkgsrc-2017Q3-base:1.3
libarchive-3-3-2:1.1.1.2
pkgsrc-2017Q2:1.3.0.10
pkgsrc-2017Q2-base:1.3
pkgsrc-2017Q1:1.3.0.8
pkgsrc-2017Q1-base:1.3
libarchive-3-3-1:1.1.1.2
pkgsrc-2016Q4:1.3.0.6
pkgsrc-2016Q4-base:1.3
pkgsrc-2016Q3:1.3.0.4
pkgsrc-2016Q3-base:1.3
pkgsrc-2016Q2:1.3.0.2
pkgsrc-2016Q2-base:1.3
libarchive-3-2-1:1.1.1.2
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.1.0.40
pkgsrc-2014Q4-base:1.1.1.1
pkgsrc-2014Q3:1.1.1.1.0.38
pkgsrc-2014Q3-base:1.1.1.1
pkgsrc-2014Q2:1.1.1.1.0.36
pkgsrc-2014Q2-base:1.1.1.1
pkgsrc-2014Q1:1.1.1.1.0.34
pkgsrc-2014Q1-base:1.1.1.1
pkgsrc-2013Q4:1.1.1.1.0.32
pkgsrc-2013Q4-base:1.1.1.1
pkgsrc-2013Q3:1.1.1.1.0.30
pkgsrc-2013Q3-base:1.1.1.1
pkgsrc-2013Q2:1.1.1.1.0.28
pkgsrc-2013Q2-base:1.1.1.1
pkgsrc-2013Q1:1.1.1.1.0.26
pkgsrc-2013Q1-base:1.1.1.1
pkgsrc-2012Q4:1.1.1.1.0.24
pkgsrc-2012Q4-base:1.1.1.1
pkgsrc-2012Q3:1.1.1.1.0.22
pkgsrc-2012Q3-base:1.1.1.1
pkgsrc-2012Q2:1.1.1.1.0.20
pkgsrc-2012Q2-base:1.1.1.1
pkgsrc-2012Q1:1.1.1.1.0.18
pkgsrc-2012Q1-base:1.1.1.1
pkgsrc-2011Q4:1.1.1.1.0.16
pkgsrc-2011Q4-base:1.1.1.1
pkgsrc-2011Q3:1.1.1.1.0.14
pkgsrc-2011Q3-base:1.1.1.1
pkgsrc-2011Q2:1.1.1.1.0.12
pkgsrc-2011Q2-base:1.1.1.1
pkgsrc-2011Q1:1.1.1.1.0.10
pkgsrc-2011Q1-base:1.1.1.1
pkgsrc-2010Q4:1.1.1.1.0.8
pkgsrc-2010Q4-base:1.1.1.1
pkgsrc-2010Q3:1.1.1.1.0.6
pkgsrc-2010Q3-base:1.1.1.1
libarchive-2-8-4:1.1.1.1
pkgsrc-2010Q2:1.1.1.1.0.4
pkgsrc-2010Q2-base:1.1.1.1
pkgsrc-2010Q1:1.1.1.1.0.2
pkgsrc-2010Q1-base:1.1.1.1
libarchive-2-8-3:1.1.1.1
libarchive-2-8-2:1.1.1.1
libarchive-2-8-0:1.1.1.1
KIENTZLE:1.1.1;
locks; strict;
comment @# @;
1.6
date 2026.10.19.12.05.18; author adam; state Exp;
branches;
next 1.5;
commitid R3KJfVxz3NuPb50H;
1.5
date 2024.01.18.18.00.17; author adam; state Exp;
branches;
next 1.4;
commitid hNXpsHx3SuHqsXUE;
1.4
date 2020.05.26.09.16.41; author nia; state Exp;
branches;
next 1.3;
commitid nNhsdZACz3PjmJ9C;
1.3
date 2016.06.20.17.24.57; author joerg; state Exp;
branches;
next 1.2;
commitid ArUvympBjfBseebz;
1.2
date 2015.01.17.12.44.49; author adam; state Exp;
branches;
next 1.1;
commitid yy7e1hLrfmA2pn6y;
1.1
date 2010.02.20.03.49.48; author joerg; state Exp;
branches
1.1.1.1;
next ;
1.1.1.1
date 2010.02.20.03.49.48; author joerg; state Exp;
branches;
next 1.1.1.2;
1.1.1.2
date 2016.06.20.17.12.05; author joerg; state Exp;
branches;
next 1.1.1.3;
commitid rRgm3BqbmbI8aebz;
1.1.1.3
date 2024.01.18.17.37.45; author adam; state Exp;
branches;
next 1.1.1.4;
commitid zDULEPUODGjTkXUE;
1.1.1.4
date 2026.10.19.11.50.39; author adam; state Exp;
branches;
next ;
commitid eS0MvMrTxXQX650H;
desc
@@
1.6
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
@CPIO(5) manual page
== NAME ==
'''cpio'''
- format of cpio archive files
== 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 generally
follow the fields in
''struct'' stat.
(See
[[stat(2)|http://www.freebsd.org/cgi/man.cgi?query=stat&sektion=2]]
for details.)
The 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 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 introduced 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:
```text
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 follows:
- ''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 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 permissions
for world, group, and user following standard POSIX conventions.
- ''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 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 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 internally.
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 typical 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.
```text
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 numbers.
```text
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 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 supports only 4 gigabyte files (unlike the
older ASCII format, which supports 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.
=== New CRC Format===
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
''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 arithmetic.
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, including ACLs and extended attributes, as special
entries in cpio archives.
XXX Others? XXX
== SEE ALSO ==
[[ManPageBsdcpio1]],
[[ManPageTar5]]
== STANDARDS ==
The
'''cpio'''
utility is no longer a part of POSIX or the Single Unix Standard.
It last appeared in
Version 2 of the Single UNIX Specification (``SUSv2'').
It has been supplanted in subsequent standards by
[[pax(1)|http://www.freebsd.org/cgi/man.cgi?query=pax&sektion=1]].
The portable ASCII format is currently part of the specification for the
[[pax(1)|http://www.freebsd.org/cgi/man.cgi?query=pax&sektion=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
At v6
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, 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 numbering.
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.
@
1.5
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
@d82 1
a82 1
file it represents is large enough to have indirect blocks pointers in
@
1.4
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
@d31 1
a31 3
XXX Any documentation of the original PWB/UNIX 1.0 format? XXX
=== Old Binary Format===
The old binary
d33 3
a35 1
format stores numbers as 2-byte and 4-byte binary values.
d37 1
d39 12
a50 12
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];
d55 10
a64 5
''unsigned'' short
fields here are 16-bit integer values; the
''unsigned'' int
fields are 32-bit integer values.
The fields are as follows
d66 1
a66 1
''magic''
d68 1
a68 3
This value can be used to determine whether this archive is
written with little-endian or big-endian integers.
''dev'', ''ino''
d76 10
a85 3
''mode''
The mode specifies both the regular permissions and the file type.
It consists of several bit fields as follows:
d87 3
a89 1
0170000
a90 9
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.
d95 2
d98 1
a98 1
File type value for named pipes or FIFOs.
a104 1
On some systems, this modifies the behavior of executables and/or directories.
d109 1
a109 1
''uid'', ''gid''
d111 1
a111 1
''nlink''
d115 1
a115 1
''rdev''
d117 2
a118 1
this field contains the associated device number.
d121 1
a121 1
''mtime''
d125 1
a125 4
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.
''namesize''
d128 4
a131 7
''filesize''
The size of the file.
Note that this archive format is limited to
four gigabyte file sizes.
See
''mtime''
above for a description of the storage of four-byte integers.
d135 2
a136 2
If the
'''namesize'''
d138 2
a139 2
The file data is then appended, padded with NUL
bytes to an even length.
d144 64
d219 1
d236 1
a236 1
The fields are identical to those in the old binary format.
d238 1
a238 1
Unlike the old binary format, there is no additional padding
d247 1
d268 1
a268 1
for the old binary format above.
d331 1
a331 1
Both the old binary and old character formats were in use
d345 3
a347 3
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.
@
1.3
log
@Update for libarchive 3.2.1.
@
text
@d219 1
a219 1
filesize to zero for each entry except the last one that
@
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
@d20 1
a20 1
'''stat'''(2)
d244 2
a245 2
'''cpio'''(1),
'''tar'''(5)
d253 1
a253 1
'''pax'''(1).
d255 1
a255 1
'''pax'''(1)
@
1.1
log
@Initial revision
@
text
@d1 37
a37 37
#summary CPIO 5 manual page
== NAME ==
*cpio*
- format of cpio archive files
== 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 generally
follow the fields in
_struct_ stat.
(See
*stat*(2)
for details.)
The 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 data.
The end of the archive is indicated by a special record with
the pathname
"TRAILER!!!".
=== PWB format===
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:
{{{
d51 1
a51 1
}}}
d53 103
a155 103
The
_unsigned_ short
fields here are 16-bit integer values; the
_unsigned_ int
fields are 32-bit integer values.
The fields are as follows
- _magic_
-
The integer value octal 070707.
This value can be used to determine whether this archive is
written with little-endian or big-endian integers.
- _dev_, _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.
- _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.
- 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.
On some systems, this modifies the behavior of executables and/or directories.
- 0000777
-
The lower 9 bits specify read/write/execute permissions
for world, group, and user following standard POSIX conventions.
- _uid_, _gid_
-
The numeric user id and group id of the owner.
- _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.
- _rdev_
-
For block special and character special entries,
this field contains 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.
- _namesize_
-
The number of bytes in the pathname that follows the header.
This count includes the trailing NUL byte.
- _filesize_
-
The size of the file.
Note that this archive format is limited 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.
Hardlinked files are not given special treatment;
the full file contents are included with each copy of the
file.
=== 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.
{{{
d169 1
a169 1
}}}
d171 12
a182 12
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.
=== 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 numbers.
{{{
d199 1
a199 1
}}}
d201 97
a297 97
Except as specified below, the fields here match those specified
for the old binary format above.
- _magic_
-
The string
"070701".
- _check_
-
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 supports only 4 gigabyte files (unlike the
older ASCII format, which supports 8 gigabyte files).
In this format, hardlinked files are handled by setting the
filesize to zero for each entry except the last one that
appears in the archive.
=== New CRC Format===
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
_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 arithmetic.
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, including ACLs and extended attributes, as special
entries in cpio archives.
XXX Others? XXX
== BUGS ==
The
"CRC"
format is mis-named, as it uses a simple checksum and
not a cyclic redundancy check.
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.
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 numbering.
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.
== SEE ALSO ==
*cpio*(1),
*tar*(5)
== STANDARDS ==
The
*cpio*
utility is no longer a part of POSIX or the Single Unix Standard.
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
At v6
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
@
1.1.1.1
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
@@
1.1.1.2
log
@Import libarchive-3.2.1:
- security fixes and other bugfixes
- support for multhreading in xz 5.2+
@
text
@d1 37
a37 37
CPIO(5) manual page
== NAME ==
'''cpio'''
- format of cpio archive files
== 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 generally
follow the fields in
''struct'' stat.
(See
[[stat(2)|http://www.freebsd.org/cgi/man.cgi?query=stat&sektion=2]]
for details.)
The 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 data.
The end of the archive is indicated by a special record with
the pathname
"TRAILER!!!".
=== PWB format===
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:
```text
d51 1
a51 1
```
d53 103
a155 103
The
''unsigned'' short
fields here are 16-bit integer values; the
''unsigned'' int
fields are 32-bit integer values.
The fields are as follows
- ''magic''
-
The integer value octal 070707.
This value can be used to determine whether this archive is
written with little-endian or big-endian integers.
- ''dev'', ''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.
- ''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.
- 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.
On some systems, this modifies the behavior of executables and/or directories.
- 0000777
-
The lower 9 bits specify read/write/execute permissions
for world, group, and user following standard POSIX conventions.
- ''uid'', ''gid''
-
The numeric user id and group id of the owner.
- ''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.
- ''rdev''
-
For block special and character special entries,
this field contains 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.
- ''namesize''
-
The number of bytes in the pathname that follows the header.
This count includes the trailing NUL byte.
- ''filesize''
-
The size of the file.
Note that this archive format is limited 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.
Hardlinked files are not given special treatment;
the full file contents are included with each copy of the
file.
=== 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.
```text
d169 1
a169 1
```
d171 12
a182 12
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.
=== 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 numbers.
```text
d199 1
a199 1
```
d201 97
a297 97
Except as specified below, the fields here match those specified
for the old binary format above.
- ''magic''
-
The string
"070701".
- ''check''
-
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 supports only 4 gigabyte files (unlike the
older ASCII format, which supports 8 gigabyte files).
In this format, hardlinked files are handled by setting the
filesize to zero for each entry except the last one that
appears in the archive.
=== New CRC Format===
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
''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 arithmetic.
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, including ACLs and extended attributes, as special
entries in cpio archives.
XXX Others? XXX
== SEE ALSO ==
[[ManPageBsdcpio1]],
[[ManPageTar5]]
== STANDARDS ==
The
'''cpio'''
utility is no longer a part of POSIX or the Single Unix Standard.
It last appeared in
Version 2 of the Single UNIX Specification (``SUSv2'').
It has been supplanted in subsequent standards by
[[pax(1)|http://www.freebsd.org/cgi/man.cgi?query=pax&sektion=1]].
The portable ASCII format is currently part of the specification for the
[[pax(1)|http://www.freebsd.org/cgi/man.cgi?query=pax&sektion=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
At v6
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
== BUGS ==
The
"CRC"
format is mis-named, as it uses a simple checksum and
not a cyclic redundancy check.
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.
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 numbering.
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.
@
1.1.1.3
log
@Import libarchive 3.7.2
@
text
@d31 3
a33 1
The PWB binary
d35 1
a35 3
format is the original format, when cpio was introduced 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.
a36 1
d38 12
a49 12
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;
d54 5
a58 10
''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 follows:
d60 1
a60 1
''h_magic''
d62 3
a64 1
''h_dev'', ''h_ino''
d72 3
a74 10
''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:
d76 9
a84 2
0100000
IALLOC flag - irrelevant to cpio.
d86 1
a86 1
This masks the file type bits.
a90 2
0060000
File type value for block special devices.
d92 1
a92 1
ILARG flag - irrelevant to cpio.
d99 1
d104 1
a104 1
''h_uid'', ''h_gid''
d106 1
a106 1
''h_nlink''
d110 1
a110 1
''h_majmin''
d112 1
a112 2
this field contains the associated device number, with the major
number in the high byte, and the minor number in the low byte.
d115 1
a115 1
''h_mtime''
d119 4
a122 1
''h_namesize''
d125 7
a131 4
''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 internally.
d135 2
a136 2
If
'''h_namesize'''
d138 2
a139 2
The file data is then appended, again with an additional NUL
appended if needed to get the next header at an even offset.
a143 64
=== 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 typical 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.
a154 1
d171 1
a171 1
The fields are identical to those in the new binary format.
d173 1
a173 1
Unlike the binary formats, there is no additional padding
a181 1
d202 1
a202 1
for the new binary format above.
d219 1
a219 1
filesize to zero for each entry except the first one that
d265 1
a265 1
Both the new binary and old character formats were in use
d279 3
a281 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.4
log
@libarchive: import version 3.8.10
@
text
@d82 1
a82 1
file it represents is large enough to have indirect block pointers in
@