Bug 89661 - Sizes reported wrong for RPMS
Summary: Sizes reported wrong for RPMS
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Paul Nasrat
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 171491
TreeView+ depends on / blocked
 
Reported: 2003-04-25 17:35 UTC by Andrew Schretter
Modified: 2007-11-30 22:10 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2006-01-06 16:34:47 UTC
Type: ---
Embargoed:


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

Description Andrew Schretter 2003-04-25 17:35:43 UTC
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.

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

Version-Release number of selected component (if applicable):
rpm-build-4.2-0.69

How reproducible:
Always

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
files.

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 15:42:40 UTC
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 19:30:24 UTC
Created attachment 117239 [details]
Proposed patch

Untested but this should not add %excludes to RPMTAG_SIZE

Comment 3 Jeff Johnson 2006-01-06 16:34:47 UTC
Patch added in rpm-4.4.4.


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