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);
jeff I think this relates to the other cpio stuff...
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
*** 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