FS#12712 - [rpmextract] 1.0-2 won't extract rpm files anymore

Attached to Project: Arch Linux
Opened by Lee Jackson (ProfessorTomoe) - Thursday, 08 January 2009, 15:13 GMT
Last edited by Jan de Groot (JGC) - Saturday, 06 June 2009, 21:18 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Tobias Powalowski (tpowa)
Architecture All
Severity Medium
Priority Normal
Reported Version None
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

The change made in Revision 23362 of rpm2cpio breaks normal rpm extraction. Extraction errors out with the following:

"gzip: stdin: not in gzip format"

I discovered this when trying a rebuild of the bin32-wine-suse package in AUR. Downgrading to 1.0-1 fixes the issue.

Steps to reproduce:
1. Install rpmextract 1.0-2
2. Download the bin32-wine-suse PKGBUILD from AUR
3. Run makepkg - error occurs here under 1.0-2, but not with 1.0-1
This task depends upon

Closed by  Jan de Groot (JGC)
Saturday, 06 June 2009, 21:18 GMT
Reason for closing:  Fixed
Additional comments about closing:  libarchive supports lzma/xz now, file-roller has been patched to use bsdtar for rpm extracting.
Comment by Lee Jackson (ProfessorTomoe) - Thursday, 08 January 2009, 15:35 GMT
Another user of the bin32-wine-suse package has reported the same error in the comments on AUR.
Comment by Jan de Groot (JGC) - Thursday, 08 January 2009, 19:06 GMT
Fun. I had a locked up file-roller yesterday because somehow the SRPMs I opened were all compressed CPIO archives. I piped the output through gunzip to make sure the output wasn't compressed anymore, but it seems there's also uncompressed rpms available.

The solution for your bug is to open rpm2cpio and remove the "|gunzip" part from it. To fix this issue completely, we should write out the stream to a temporary file, find out if it's compressed and then gunzip it.
Comment by Lee Jackson (ProfessorTomoe) - Friday, 09 January 2009, 11:57 GMT
>>The solution for your bug is to open rpm2cpio and remove the "|gunzip" part from it.

That's essentially what downgrading to 1.0-1 does - the rpm2cpio files are identical otherwise.

>>To fix this issue completely, we should write out the stream to a temporary file, find out if it's compressed and then gunzip it.

While you're at it, there are some newer RPM files that won't rpmextract fails on because they're compressed with LZMA. Try this file as an example:

http://download.opensuse.org/repositories/Emulators:/Wine/openSUSE_11.1/i586/wine-1.1.12-2.1.i586.rpm

The weird part is that LZMA won't decompress the above file, but 7-Zip will unpack it to wine-1.1.12-2.1.i586.cpio.lzma. LZMA will then recognize and decompress it. Of course, none of this works with rpmextract since it's not written to work with 7-Zip or LZMA.

Any chance of a fix for this, please?

Comment by Attila (attila) - Friday, 09 January 2009, 19:25 GMT
@ProfessorTomoe Opensuse use lzma for rpm (not the src.rpm) since 11.0 (see http://en.opensuse.org/LZMA). You can use this in your PKGBUILD if you want:

rpm2cpio wine-*.i586.rpm | lzma -d | cpio -idmuv || return 1
Comment by Lee Jackson (ProfessorTomoe) - Saturday, 10 January 2009, 07:08 GMT
@Attila - Thanks! It'd be nice if this were in the wiki or some other place, for future reference.
Comment by Attila (attila) - Saturday, 10 January 2009, 08:17 GMT
@ProfessorTomoe Because i use opensuse on my server i take a copy of the rpmextract package and include this shell scripts inside of it:

$ cat /usr/bin/rpmextract.sh
#!/bin/sh
# Extract RPM's with gunzip and cpio
if [ "$1" = "" -o ! -e "$1" ]; then
echo "no package supplied" 1>&2
exit 1
fi
rpm2cpio $1 | gunzip | cpio -idmuv

$ cat /usr/bin/rpmbsdtarextract.sh
#!/bin/sh
# Archlinux Way with bsdtar
if [ "$1" = "" -o ! -e "$1" ]; then
echo "no package supplied" 1>&2
exit 1
fi
rpm2cpio $1 | bsdtar -xf -

$ cat /usr/bin/rpmlzmaextract.sh
#!/bin/sh
# Extract RPM's with lzma and cpio
if [ "$1" = "" -o ! -e "$1" ]; then
echo "no package supplied" 1>&2
exit 1
fi
rpm2cpio $1 | lzma -d | cpio -idmuv

Personally i found this better than searching the info in a wiki or somewhere else but this be only my 2c. Perhaps in the future bsdtar can handle such cases better and this would be the best solution.
Comment by Jan de Groot (JGC) - Monday, 12 January 2009, 22:39 GMT
Fun, file-roller is super-easy to modify, and bsdtar can give listings that are compatible to what file-roller expects to see from cpio. I modified file-roller to use bsdtar instead of cpio for these operations, and now file-roller can extract whatever RPM file bsdtar is able to extract.
I'll see what I can do with other file formats, as this gives nice possibilities: every file that can be handled by bsdtar will be handled by bsdtar, which means users don't need extra tools like unzip.

It's up to the maintainer of libarchive to include lzma support. For core, we don't need it, but for possibilities like this, it's a welcome feature.

Loading...