bug-cpio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

cpio 2.13: cpio -o --format=ustar broken on BSD UFS


From: Christian Weisgerber
Subject: cpio 2.13: cpio -o --format=ustar broken on BSD UFS
Date: Thu, 14 Nov 2019 13:55:59 +0100
User-agent: Mutt/1.12.2 (2019-09-21)

cpio 2.13 is broken when creating ustar archives from files on a
BSD UFS filesystem.

$ rm foo
$ echo hello world >foo
$ echo foo | cpio -o --format=ustar >/dev/null
cpio: foo: value devminor 6881288 out of allowed range 0..2097151
2 blocks

Here's what happens:

(1) stat() on UFS returns something in st_rdev even for non-device
files.  (Specifically, the st_rdev field is overlaid with the disk
address of the first direct block and this value is blindly returned.
This behavior has been there since 1982.)

(2) cpio, when writing ustar archives, always fills in the devmajor
and devminor fields, regardless of file type.

(3) Earlier versions of cpio would silently truncate values that
exceeded he 21-bit range of these header fields, but 2.13 now checks
in to_oct_or_error().

I think (2) is a bug.

The degree to which this problems is reproducible may depend on the
filesystem layout and on the size and exact encoding of major/minor
in dev_t:
* On FreeBSD, the basic inout.at regression test immediately failed.
* On OpenBSD, I can reproduce the problem after searching for some
  files where st_rdev > 536870911.
* I don't run NetBSD, but minor numbers there are limited to 20
  bits, so the problem presumably doesn't show there.

-- 
Christian "naddy" Weisgerber                          address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]