Bug 226 - cpio old portable ascii (-oc) format wrong due to long long dev_t
cpio old portable ascii (-oc) format wrong due to long long dev_t
Product: Red Hat Linux
Classification: Retired
Component: cpio (Show other bugs)
All Linux
high Severity high
: ---
: ---
Assigned To: bero
: 2336 (view as bug list)
Depends On:
  Show dependency treegraph
Reported: 1998-11-29 17:48 EST by sra
Modified: 2008-05-01 11:37 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 1998-12-05 20:53:01 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description sra 1998-11-29 17:48:43 EST
During testing of our software distribution product, I
noticed that cpio was producing archives that were
unreadable by it or other cpio programs when the -oc option
was used and when files had large inode numbers. Upon
investigation, I determined that the printf used to create
the ascii header is not properly dealing with two parameters
wich are declared as type dev_t. Since dev_t is now declared
as type "long long" the stack to the variable arguments code
is not being interpreted correctly. I fixed it for our use
by casting the dev and rdev parameters to int. I am not sure
if that is correct in the general case. My patch is below.

--- cpio-2.4.2.orig/copyout.c   Wed Jan 10 10:10:45 1996
+++ cpio-2.4.2/copyout.c        Thu Nov 19 16:08:36 1998
@@ -113,10 +113,10 @@

       sprintf (ascii_header,

-              file_hdr->c_magic & 0xFFFF, dev & 0xFFFF,
+              file_hdr->c_magic & 0xFFFF, (int) (dev &
               file_hdr->c_ino & 0xFFFF, file_hdr->c_mode &
               file_hdr->c_uid & 0xFFFF, file_hdr->c_gid &
-              file_hdr->c_nlink & 0xFFFF, rdev & 0xFFFF,
+              file_hdr->c_nlink & 0xFFFF, (int) (rdev &
               file_hdr->c_mtime, file_hdr->c_namesize &
       tape_buffered_write (ascii_header, out_des, 76L);
Comment 1 Preston Brown 1998-11-30 13:43:59 EST
jeff I think this relates to the other cpio stuff...
Comment 2 Jeff Johnson 1998-12-05 20:53:59 EST
Fixed in cpio-2.4.2-11. This problem is closely related to bug #80
and provides an alternative fix for the failure of

	find /any/dir | cpio -o -Hodc | cpio -itv -H odc
Comment 3 Jeff Johnson 1999-04-23 11:15:59 EDT
*** Bug 2336 has been marked as a duplicate of this bug. ***

Forwarded message follows from Chris Green.




Some extremely detailed work by Randy [Herber] in
determining why a Linux backup using cpio failed has found a
bug in the cpio package for any rpm below patchlevel 11
(which we have determined fixes the bug). The rpm which
comes with FRH521 [i.e., Red Hat 5.2] is at patchlevel 9,
which also has the bug.

Basically, if one uses

cpio -Hodc -o

(the most portable way to output information via cpio), then
the header information before each cpio item has the
namesize and filesize attributes missing -- effectively a
showstopper to having the backup read back in any usable



Chris Green. HEP, Purdue University. CDF SVXII project.
Based at Fermilab. MAIL greenc@fnal.gov; PHONE (630)

Note You need to log in before you can comment on or make changes to this bug.