Bug 790396

Summary: rpm2cpio returns failure exit code on large files even though it ran successfully
Product: [Fedora] Fedora Reporter: Martin Milata <mmilata>
Component: rpmAssignee: Panu Matilainen <pmatilai>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 16CC: abrt-devel-list, ffesti, jnovy, kklic, pahan, pmatilai
Target Milestone: ---Keywords: Upstream
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-11-19 11:08:03 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch fixing the bug none

Description Martin Milata 2012-02-14 12:31:30 UTC
Created attachment 561896 [details]
Patch fixing the bug

Description of problem:
Running rpm2cpio on rpm that contains cpio archive larger than ~2G unpacks the archive correctly, but returns code 1 (without any message on stderr).

Version-Release number of selected component (if applicable):
4.9.1.2-5.fc16

How reproducible:
Always (on my machine).

Steps to Reproduce:
1. Download http://kojipkgs.fedoraproject.org/packages/paraview/3.12.0/5.fc17/x86_64/paraview-debuginfo-3.12.0-5.fc17.x86_64.rpm
2. Run rpm2cpio paraview-debuginfo-3.12.0-5.fc17.x86_64.rpm >/dev/null
3. Run echo $?
  
Actual results:
1

Expected results:
0

Additional info:
The bug is due to an integer overflow in rpmio.c. Attached is a patch against current git (7a9a5505667c681044bacb21c9b84ac66c062fe7) that hopefully fixes the problem.

Comment 1 Panu Matilainen 2012-02-16 06:47:17 UTC
Yup, the ufdCopy() incorrect return type is known (but many times forgotten) problem. ssize_t is not enough for it either, off_t would be more like it. Unfortuntely ufdCopy() is part of librpmio public API so changing the return type can't really be done in a stable release, short of grabbing an internal copy of it into rpm2cpio (which actually is the only caller within rpm itself) for the time being. Thanks for the report and patch anyway, having an open bug helps to avoid forgetting about it yet again :)

Comment 2 Panu Matilainen 2012-03-14 09:24:55 UTC
Fixed upstream now for what will be rpm >= 4.10 where the slight API change is still possible, for older versions this will need a slightly different approach.

Comment 3 Karel Klíč 2012-09-18 11:26:00 UTC
*** Bug 744712 has been marked as a duplicate of this bug. ***

Comment 4 Panu Matilainen 2012-11-19 11:08:03 UTC
This in fixed in Fedora >= 18. As noted in comment #1, the API problem can't be fixed in rpm 4.9.x and doesn't seem worth the trouble working around...