Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 297252 - cpio archives with option -H newc are bad and breaks genkernel
Summary: cpio archives with option -H newc are bad and breaks genkernel
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: AMD64 Linux
: High major
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-17 05:32 UTC by John Klug
Modified: 2009-12-17 07:18 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
bad cpio file with option -H newc (busynewc.cpio,1.13 MB, application/octet-stream)
2009-12-17 05:42 UTC, John Klug
Details

Note You need to log in before you can comment on or make changes to this bug.
Description John Klug 2009-12-17 05:32:18 UTC
genkernel uses -H newc, which is broken in cpio.

I have cpio app-arch/cpio-2.9-r2,
sys-libs/glibc-2.9_p20081201-r2, and 
sys-kernel/genkernel-3.4.10.904 (0)


What is happening is that some files in the archive seem to be zero bytes in length, and the boot fails loading the initramfs stuff.

Here is an example:
(chroot) livecd initramfs-busybox-temp # cpio -ivt </tmp/busy.cpio
drwxr-xr-x   4 root     root            0 Dec 16 22:43 .
drwxr-xr-x   2 root     root            0 Dec 16 22:43 bin
drwxr-xr-x   3 root     root            0 Dec 16 22:43 usr
drwxr-xr-x   3 root     root            0 Dec 16 22:43 usr/share
drwxr-xr-x   2 root     root            0 Dec 16 22:43 usr/share/udhcpc
-rwxr-xr-x   1 root     root          790 Dec 16 22:43 usr/share/udhcpc/default.script
-rwxr-xr-x   9 root     root            0 Nov  5 08:38 bin/cat
-rwxr-xr-x   9 root     root            0 Nov  5 08:38 bin/cut
-rwxr-xr-x   9 root     root            0 Nov  5 08:38 bin/echo
-rwxr-xr-x   9 root     root            0 Nov  5 08:38 bin/uname
-rwxr-xr-x   9 root     root            0 Nov  5 08:38 bin/mount
-rwxr-xr-x   9 root     root            0 Nov  5 08:38 bin/sh
-rwxr-xr-x   9 root     root            0 Nov  5 08:38 bin/ash
-rwxr-xr-x   9 root     root            0 Nov  5 08:38 bin/[
-rwxr-xr-x   9 root     root            0 Nov  5 08:38 bin/busybox
6 blocks
(chroot) livecd initramfs-busybox-temp # find . | cpio  -o -F /tmp/busy.cpio
20786 blocks
(chroot) livecd initramfs-busybox-temp # cpio -ivt </tmp/busy.cpio
drwxr-xr-x   4 root     root            0 Dec 16 22:43 .
drwxr-xr-x   2 root     root            0 Dec 16 22:43 bin
-rwxr-xr-x   9 root     root      1182336 Nov  5 08:38 bin/busybox
-rwxr-xr-x   9 root     root      1182336 Nov  5 08:38 bin/[
-rwxr-xr-x   9 root     root      1182336 Nov  5 08:38 bin/ash
-rwxr-xr-x   9 root     root      1182336 Nov  5 08:38 bin/sh
-rwxr-xr-x   9 root     root      1182336 Nov  5 08:38 bin/mount
-rwxr-xr-x   9 root     root      1182336 Nov  5 08:38 bin/uname
-rwxr-xr-x   9 root     root      1182336 Nov  5 08:38 bin/echo
-rwxr-xr-x   9 root     root      1182336 Nov  5 08:38 bin/cut
-rwxr-xr-x   9 root     root      1182336 Nov  5 08:38 bin/cat
drwxr-xr-x   3 root     root            0 Dec 16 22:43 usr
drwxr-xr-x   3 root     root            0 Dec 16 22:43 usr/share
drwxr-xr-x   2 root     root            0 Dec 16 22:43 usr/share/udhcpc
-rwxr-xr-x   1 root     root          790 Dec 16 22:43 usr/share/udhcpc/default.script
20786 blocks
(chroot) livecd initramfs-busybox-temp # 



Reproducible: Always

Steps to Reproduce:
1.Have a bunch of files hard linked together
2.Use cpio -Hnewc
3.

Actual Results:  
Files are empty

Expected Results:  
(chroot) livecd newctest # cpio -ivt <../busy.cpio
drwxr-xr-x   4 root     root            0 Dec 16 22:43 .
drwxr-xr-x   2 root     root            0 Dec 16 22:43 bin
-rwxr-xr-x   9 root     root      1182336 Nov  5 08:38 bin/busybox
-rwxr-xr-x   9 root     root      1182336 Nov  5 08:38 bin/[
-rwxr-xr-x   9 root     root      1182336 Nov  5 08:38 bin/ash
-rwxr-xr-x   9 root     root      1182336 Nov  5 08:38 bin/sh
-rwxr-xr-x   9 root     root      1182336 Nov  5 08:38 bin/mount
-rwxr-xr-x   9 root     root      1182336 Nov  5 08:38 bin/uname
-rwxr-xr-x   9 root     root      1182336 Nov  5 08:38 bin/echo
-rwxr-xr-x   9 root     root      1182336 Nov  5 08:38 bin/cut
-rwxr-xr-x   9 root     root      1182336 Nov  5 08:38 bin/cat
drwxr-xr-x   3 root     root            0 Dec 16 22:43 usr
drwxr-xr-x   3 root     root            0 Dec 16 22:43 usr/share
drwxr-xr-x   2 root     root            0 Dec 16 22:43 usr/share/udhcpc
-rwxr-xr-x   1 root     root          790 Dec 16 22:43 usr/share/udhcpc/default.script


I will upload a cpio archive created correctly without -Hnewc, and incorrectly with -Hnewc.
Comment 1 John Klug 2009-12-17 05:42:17 UTC
Created attachment 213263 [details]
bad cpio file with option -H newc

created via:
$ find . | cpio -Hnewc -oF busynewc.cpio

Has zero length files.
Comment 2 John Klug 2009-12-17 06:13:29 UTC
$ find . | cpio -oF busyvanilla.zip

Sorry about the file name, but this is actually a vanilla cpio archive with the default header type.  This can be used to test cpio -H newc for errors.

<http://www.snapdrive.net/files/472996/busyvanilla.zip>
Comment 3 John Klug 2009-12-17 07:18:09 UTC
After looking at this, I am not exactly sure what was wrong.  I re-emerged genkernel.  I did not re-emerge cpio.

The initramfs did indeed create a zero length busybox, with all linked together to zero length.

However, it is not happening anymore on my system, and the cpio archives I created list out as having zero length, but the files themselves are OK.