Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I download alot of srpms to rummage through, I used to go through a long winded approach,

root@server$ curl rpm -o file.rpm
root@server$ rpm2cpio file.rpm | cpio -id

but that leaves behind an ugly file.rpm so I tried a single pipeline

root@server$ curl rpm | rpm2cpio - | cpio -id

According to the curl manpage curl outputs to stdout by default and the rpm2cpio man page says that if the only argument is '-' that it will read from stdin.

However I keep getting errors:

error: rpm2cpio: headerRead failed: hdr blob(23176): BAD, read returned 2696
error reading header from package
cpio: premature end of archive
  0 5468k    0 13257    0     0  21912      0  0:04:15 --:--:--  0:04:15 29791
curl: (23) Failed writing body (379 != 1348)

if I try catting the downloaded file into the pipeline instead of using curl it works.

Now I am aware there are a number of ways around this, and when I can be bothered I'll probably script this. I was just curious as to why rpm doesn't like the rpm outputted by curl.

Any Ideas?

share|improve this question
up vote 0 down vote accepted

Turns out that both curl and wget send a bunch of other stuff to stdout as well as the file being retrieved, hence the errors when rpm2cpio is called on the stream.

Explicitly using the flag -o - removes that extra stuff and it works fine now.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.