Bug 89661 - Sizes reported wrong for RPMS
Sizes reported wrong for RPMS
Product: Fedora
Classification: Fedora
Component: rpm (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Paul Nasrat
Depends On:
Blocks: 171491
  Show dependency treegraph
Reported: 2003-04-25 13:35 EDT by Andrew Schretter
Modified: 2007-11-30 17:10 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-01-06 11:34:47 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Proposed patch (540 bytes, patch)
2005-07-28 15:30 EDT, Paul Nasrat
no flags Details | Diff

  None (edit)
Description Andrew Schretter 2003-04-25 13:35:43 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (compatible;MSIE 5.5; Windows 98)

Description of problem:
I know its a nit-picky little thing, but RPMs built on RedHat 9 (I 
haven't checked older versions yet) report incorrect sizes depending 
on how files are packaged in the %files section of the spec.

In particular, file sizes are added to the Size variable in these 
cases when it shouldn't be :

* A file is listed twice in the same %files section, usually because
  a wildcard caught it once then it is listed explicity (the file
  size is added twice in this case).  It is reported by RPM as being 
  there twice, just not handled properly.

* A file is excluded via %exclude, its size is still added, although 
  the file is not

And finally, file sizes are NOT added to the Size variable for 
symbolic links...  

I can see how the first two are "well write your spec files properly 
you idiot and it will work fine", and I agree, I've fixed those, but 
the latter looks like it should be fixed, not a big deal, but for 
accuracy's sake.
The following script will take an RPM as an argument and report
on the sum of the sizes listed in the file list and the size listed
in the Size variable in the RPM and put a * beside the result if they 
don't match.

realsize=`rpm -qlvp $file | awk '{s+=$5} END {print s}'`;
reportedsize=`rpm -qp --queryformat "%{size}" $file`; 
if [ "$realsize" != "$reportedsize" ]; then 
   printf "* "
   printf "  "
printf "%10s %10s %s\n" $realsize $reportedsize $file;
exit 0

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

How reproducible:

Steps to Reproduce:
1.Add an %exclude to a SPEC file and build it
2.Include links in the %files section of a SPEC file
3.List a file twice in a SPEC file

Actual Results:  In each case, the size reported by rpm -qi on the RPM was
different from the actual size of adding up the included

Expected Results:  The size of the RPM should be exactly the sum of the sizes
of the included files.

Additional info:
Comment 1 Rex Dieter 2003-05-05 11:42:40 EDT
I can confirm that when using %exclude that the size is calculated incorrectly.  As a matter of 
fact, I have reason to believe that when something is %exclude'd (at least in some cases), it's 
size is counted *twice*. 
In my case, I have a package that contains 
%doc %{_docdir}/* 
%exclude %{_docdir}/foo 
Where %{_docdir}/foo is approximately 75-80MB in size.  The package's size is then reported 
to be approximately ~150MB too big. 
Comment 2 Paul Nasrat 2005-07-28 15:30:24 EDT
Created attachment 117239 [details]
Proposed patch

Untested but this should not add %excludes to RPMTAG_SIZE
Comment 3 Jeff Johnson 2006-01-06 11:34:47 EST
Patch added in rpm-4.4.4.

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