Red Hat Bugzilla – Bug 171649
cpio: checksum error on 64-bit machines
Last modified: 2007-11-30 17:07:21 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915
Description of problem:
[ The above pseudo-headers are for the Debian email bug reporting system. ]
Vanilla cpio 2.6 sometimes writes bad crcs in the cpio header on 64-bit machines. It seems to
show up only on some large files. The symptom is that the crc stored in the file appears to
be shifted by one nibble, and fails the crc check on copy-out.
For example using the Openoffice 2.0 release from openoffice.org mirrors, eg
$ uname -a Linux centos 2.6.9-11.ELsmp #1 SMP Wed Jun 8 16:59:12 CDT 2005 x86_64 x86_64 x86_64 GNU/Linux
$ cpio --version cpio (GNU cpio) 2.6
$ echo OOo_2.0.0_LinuxIntel_install.tar.gz |cpio -o --format=crc >test.cpio
$ cpio -i --only-verify-crc <test.cpio
cpio: OOo_2.0.0_LinuxIntel_install.tar.gz: checksum error (0x32bf3b47, should be 0x332bf3b4)
Doing the same thing on a 32-bit i386 machine running the same software works properly.
The only differences in the output file are in the c_maj, m_min, and c_chksum fields of
the cpio header. All the other fields and the file data are the same and correct.
The cpio-2.5 that comes with the current Redhat EL (cpio-2.5-8.RHEL4) exhibits the
The bug was reported to Redhat by Michael J. Donahue in 1998 in cpio 2.4.2 on Redhat 4.1
but apparently never addressed.
It was rediscovered by Tom Vier in 2001 2.4.2 on Debian and fixed by the debian folks:
Looking at their patches for 2.4.2 at
the fix was in function write_out_header():
@@ -60,7 +61,7 @@
file_hdr->c_gid, file_hdr->c_nlink, file_hdr->c_mtime,
file_hdr->c_filesize, file_hdr->c_dev_maj, file_hdr->c_dev_min,
file_hdr->c_rdev_maj, file_hdr->c_rdev_min, file_hdr->c_namesize,
+ file_hdr->c_chksum & 0xffffffff);
tape_buffered_write (ascii_header, out_des, 110L);
/* Write file name to output. */
I applied that same change to the vanilla 2.6 copyout.c and it fixes the problem.
Patch is attached.
Note 1: The current Redhat ships cpio 2.5 with this defect.
Note 2: Debian carried the patch over to their patches for cpio 2.5 but seems to have
dropped it from their patches for 2.6. So I'd guess that their 2.6 has the same problem
too, though I haven't tried it.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. echo OOo_2.0.0_LinuxIntel_install.tar.gz |cpio -o --format=crc >test.cpio
2. cpio -i --only-verify-crc <test.cpio
Actual Results: cpio: OOo_2.0.0_LinuxIntel_install.tar.gz: checksum error (0x32bf3b47, should be 0x332bf3b4)
Expected Results: 207906 blocks
Created attachment 120316 [details]
Patch for vanilla cpio 2.6
Your patch did not help me. Problem still persists.
cpio: OOo_2.0.0_LinuxIntel_install.tar.gz: checksum error (0x332bf3b47, should
if (crc != file_hdr.c_chksum)
crc is unsigned long and file_hdr.c_chksum is truncated by your patch.
Created attachment 120403 [details]
my patch fixing this bug
Peter, you're right. My patch was incomplete. Thanks.
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.