Bug 528693 - ** ERROR **: file cpio.c: line 283 (cpio_read_bin_head): assertion failed: (u.buf.c_magic == 070707) aborting... Aborted
Summary: ** ERROR **: file cpio.c: line 283 (cpio_read_bin_head): assertion failed: (u...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: mc
Version: 5.4
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Denys Vlasenko
QA Contact: BaseOS QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-10-13 12:02 UTC by Michal Nowak
Modified: 2013-03-18 12:46 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-03-18 12:46:04 UTC
Target Upstream Version:


Attachments (Terms of Use)
Proposed fix (725 bytes, patch)
2009-10-15 14:15 UTC, Denys Vlasenko
no flags Details | Diff
Patch to add xz decompression support (3.18 KB, patch)
2010-04-28 10:28 UTC, Denys Vlasenko
no flags Details | Diff

Description Michal Nowak 2009-10-13 12:02:29 UTC
Description of problem:

mc fails with 

"""
** ERROR **: file cpio.c: line 283 (cpio_read_bin_head): assertion failed: (u.buf.c_magic == 070707)
aborting...
Aborted
"""

when trying to see what's inside rpm's cpio archive.

Version-Release number of selected component (if applicable):

mc-4.6.1a-35.el5.s390x

How reproducible:

always

Steps to Reproduce:
1. (do on stable system) mc /mnt/redhat/brewroot/packages/kernel/2.6.31/0.174.rc7.git2.fc12/data/signed/f21541eb/s390x/
2. move pointer to kernel-debuginfo-2.6.31-0.174.rc7.git2.fc12.s390x.rpm
3. press Enter
4. move to CONTENTS.cpio, press Enter
5. after a 1-2 s you get the assertion.
  
Actual results:

assertion

Expected results:

Perhaps the rpm header is changed from EL5 times, because it works quite fine for older rpms.

Comment 1 Denys Vlasenko 2009-10-14 15:26:26 UTC
Reproduced with mc-4.6.1a-35.el5.x86_64 (i.e. different arch)

Comment 2 Denys Vlasenko 2009-10-14 16:17:16 UTC
Reproduced with mc-4.6.1a-35.el5.i386 (32-bit arch). It's not a struct alignment issue.

Comment 3 Denys Vlasenko 2009-10-14 16:35:03 UTC
Bingo. It's the new(er) compression algorithm in rpm's. "hexdump -vC CONTENTS.cpio" shows:

00000000  fd 37 7a 58 5a 00 00 0a  e1 fb 0c a1 02 00 21 01  |.7zXZ.........!.|
00000010  18 00 00 00 47 58 3a 43  e7 85 8a f0 00 5d 00 18  |....GX:C.....]..|
00000020  0d dd 04 63 83 21 5f 0f  54 31 c5 95 a2 fa 85 f8  |...c.!_.T1......|
00000030  79 3b c8 e6 9d a0 ee 9f  3e 59 ab dc e2 19 9e 3f  |y;......>Y.....?|
...

This is clearly a compressed file. RHEL5 has neither lzma nor xz (de)compression programs to deal with it...

Comment 6 Denys Vlasenko 2009-10-15 14:04:11 UTC
mc just does not have corresponding support. I checked mc-4.6.1a-35 and mc-4.6.2-10 and I did not find any code to handle XZ archives. Therefore it simply misinterprets compressed .cpio as uncompressed.

Upstream code has such code:

    /* XZ compression magic */
    if (magic[0] == 0xFD
        && magic[1] == 0x37 && magic[2] == 0x7A && magic[3] == 0x58) {
        if (mc_read (fd, (char *) magic + 4, 2) == 2) {
            if (magic[4] == 0x5A && magic[5] == 0x00) {
                return COMPRESSION_XZ;
            }
        }
    }
...
static const struct edit_filters {
    const char *read, *write, *extension;
} all_filters[] = {
    { "xz -cd %s 2>&1",     "xz > %s",     ".xz" },
    { "lzma -cd %s 2>&1",   "lzma > %s",   ".lzma" },
    { "bzip2 -cd %s 2>&1",  "bzip2 > %s",  ".bz2" },
    { "gzip -cd %s 2>&1",   "gzip > %s",   ".gz"  },
    { "gzip -cd %s 2>&1",   "gzip > %s",   ".Z"   }
};

Comment 7 Denys Vlasenko 2009-10-15 14:15:13 UTC
Created attachment 364917 [details]
Proposed fix

This fix at least will make mc to not abort, but just inform the user that cpio file seems to be corrupted.

Comment 8 Radek Bíba 2009-10-20 13:40:15 UTC
How about we rather enhance mc to understand xz in a future RHEL 5 minor update?

Comment 9 Denys Vlasenko 2009-10-20 16:19:32 UTC
xz support and "do not crash horribly on a bad .cpio file" bug are unrelated problems. This patch fixes the second problem. Let's decide whether we want this fix. Meanwhile I'll look into adding xz support.

Comment 10 Denys Vlasenko 2010-04-27 19:24:29 UTC
It's not an mc bug!
mc just uses rpm2cpio, and on RHEL5.5 rpm2cpio does not unpack .cpio, it extracts it still XZ-packed:

# rpm2cpio kernel-debuginfo-2.6.33.2-68.fc13.i686.rpm >z.cpio
# hexdump -C z.cpio | head
00000000  fd 37 7a 58 5a 00 00 0a  e1 fb 0c a1 02 00 21 01  |.7zXZ.........!.|
00000010  0e 00 00 00 04 50 48 36  e7 cb b5 f0 00 5d 00 18  |.....PH6.....]..|
00000020  0d dd 04 62 32 88 43 6d  31 bd 26 74 38 9a 03 54  |...b2.Cm1.&t8..T|
00000030  68 41 ce be ca 1c 3e 04  9c c7 81 04 7f de b3 da  |hA....>.........|
00000040  47 36 23 44 d3 05 df 28  18 16 cc aa d7 3a 56 c3  |G6#D...(.....:V.|
00000050  60 e7 bb 00 99 24 45 01  ed 3c b4 34 79 23 94 77  |`....$E..<.4y#.w|
00000060  d2 08 c4 01 37 33 08 0c  f1 1c 95 6d 37 5a 76 a1  |....73.....m7Zv.|
00000070  04 cd e7 dc 30 6a 8a 21  0c 14 e4 ca a8 a0 01 c1  |....0j.!........|
00000080  b3 55 ac 7c f4 4a 7f de  c7 3f 1e ff 81 91 21 ef  |.U.|.J...?....!.|
00000090  ff 91 18 03 45 1c 5f 46  f4 33 dc 31 c4 27 e5 43  |....E._F.3.1.'.C|

On F12, for example, extracted .cpio is not packed.

Comment 11 Denys Vlasenko 2010-04-28 10:28:05 UTC
Even though it is not an mc bug, adding xz decompression support still makes it possible to handle xz-compressed .rpm's.

Comment 12 Denys Vlasenko 2010-04-28 10:28:38 UTC
Created attachment 409756 [details]
Patch to add xz decompression support

Comment 14 RHEL Program Management 2010-08-09 18:29:12 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 15 Alok Kataria 2010-10-04 20:54:30 UTC
Hi,
Is there a workaround or a fixed rpm2cpio available for RHEL 5.x somewhere ?

Thanks.

Comment 16 Kirill Kolyshkin 2010-10-13 10:54:28 UTC
Alok, see bug #602423, there is a shell script rpm2cpio.sh which can be used instead of rpm2cpio. The problem with it is it relies on file utility to detect xz compression which doesn't work with file from rhel5.5, so you have to apply the patch from me.

Comment 18 RHEL Program Management 2011-01-11 20:46:00 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 19 RHEL Program Management 2011-01-11 23:06:08 UTC
This request was erroneously denied for the current release of
Red Hat Enterprise Linux.  The error has been fixed and this
request has been re-proposed for the current release.

Comment 20 RHEL Program Management 2011-05-31 13:30:26 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 22 Denys Vlasenko 2013-03-18 12:46:04 UTC
I don't think this issue is critical enough to be fixed in RHEL5.


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