ruda/rpm2cpio

rpm2cpio broken? [requires unzstd installed]

saltedcoffii opened this issue · 2 comments

When running this command:

$ python3.9 rpm2cpio.py xclip-0.13-10.fc33.x86_64.rpm  | cpio -it

I got this output:

Traceback (most recent call last):
  File "/usr/local/build/rpm2cpio/rpm2cpio-2017/./rpm2cpio.py", line 96, in <module>
    rpm2cpio(fin)
  File "/usr/local/build/rpm2cpio/rpm2cpio-2017/./rpm2cpio.py", line 88, in rpm2cpio
    data = decompress(data[pos:])
  File "/usr/local/build/rpm2cpio/rpm2cpio-2017/./rpm2cpio.py", line 48, in gzip_decompress
    gzstream = StringIO(data)
TypeError: initial_value must be str or None, not bytes
cpio: premature end of archive

After running

$ python2.7 rpm2cpio.py xclip-0.13-10.fc33.x86_64.rpm  | cpio -it

I got:

cpio: premature end of archive

Here's the rpm file I was using:
https://download-ib01.fedoraproject.org/pub/fedora/linux/releases/33/Everything/x86_64/os/Packages/x/xclip-0.13-10.fc33.x86_64.rpm

ruda commented

Looks like a bug:

$ python3 rpm2cpio.py xclip-0.13-10.fc33.x86_64.rpm 
Error: xclip-0.13-10.fc33.x86_64.rpm [Errno 2] No such file or directory: 'unzstd'

The payload in the RPM was compressed with zstd so you'll need to install unzstd command line to uncompress it.

There isn't any zstd module in Python standard library, so this is an external requirement.

ruda commented

Fedora switching RPMs to zstd compression, «Binary RPMs are currently compressed with xz level 2. Switching to zstd would increase decompression speed significantly.»