Bug 226 - cpio old portable ascii (-oc) format wrong due to long long dev_t
Summary: cpio old portable ascii (-oc) format wrong due to long long dev_t
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: cpio
Version: 5.2
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: bero
QA Contact:
URL:
Whiteboard:
: 2336 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 1998-11-29 22:48 UTC by sra
Modified: 2008-05-01 15:37 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 1998-12-06 01:53:01 UTC
Embargoed:


Attachments (Terms of Use)

Description sra 1998-11-29 22:48:43 UTC
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,

"%06o%06o%06lo%06lo%06lo%06lo%06lo%06o%011lo%06lo%011lo",
-              file_hdr->c_magic & 0xFFFF, dev & 0xFFFF,
+              file_hdr->c_magic & 0xFFFF, (int) (dev &
0xFFFF),
               file_hdr->c_ino & 0xFFFF, file_hdr->c_mode &
0xFFFF,
               file_hdr->c_uid & 0xFFFF, file_hdr->c_gid &
0xFFFF,
-              file_hdr->c_nlink & 0xFFFF, rdev & 0xFFFF,
+              file_hdr->c_nlink & 0xFFFF, (int) (rdev &
0xFFFF),
               file_hdr->c_mtime, file_hdr->c_namesize &
0xFFFF,
               file_hdr->c_filesize);
       tape_buffered_write (ascii_header, out_des, 76L);

Comment 1 Preston Brown 1998-11-30 18:43:59 UTC
jeff I think this relates to the other cpio stuff...

Comment 2 Jeff Johnson 1998-12-06 01:53:59 UTC
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 15:15:59 UTC
*** Bug 2336 has been marked as a duplicate of this bug. ***

Forwarded message follows from Chris Green.

Dan

******************

Hi,

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
fashion.

<snip>

Thanks,
Chris.

--
Chris Green. HEP, Purdue University. CDF SVXII project.
Based at Fermilab. MAIL greenc; PHONE (630)
840-2308


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