Red Hat Bugzilla – Bug 60309
rpm -V doesn't check number of hard links
Last modified: 2008-05-01 11:38:01 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.8+) Gecko/20020208
Description of problem:
If files in a rpm that ought to be hardlinks are accidentally
copied to separate files, rpm -V ought to report this.
In a directory tree like /usr/lib/locale this can cost as
much as 80Mb. (Hard links are evil).
Version-Release number of selected component (if applicable): all
Steps to Reproduce:
1.cd /bin; rm zcat; cp gzip zcat
2.rpm -V gzip
Actual Results: No errors
Expected Results: It would be nice if rpm could warn about the
numer of hard links for gzip, gunzip and zcat that are wrong.
An rpm header does not carry the number of
hard links as an explicit tag value. That
means nlinks has to be computed. Since
both the build side and the install side
of rpm permit "partial hard link sets"
(i.e. only some of the hard links are
actually installed), this becomes a
large and intensive calculation.
Not worth the effort at the moment.
Created attachment 48093 [details]
Script to locate broken hardlinks
But how about a script like the one I've attached that will
locate files that _ought_ to be hardlinks according to the
RPM database ?
Maybe sich a script could be linked to with something like
rpm --check-hardlinks ?
I still feel that broken hardlinks can cost you a lot of diskspace,
and the may potentially mess up upgrades.
The script looks OK, but has little to do with
rpm package management IMHO.
You can add to the rpm command line if you
wish, see /usr/lib/rpm/rpmpopt-X.Y.Z for
numerous examples. Basically you need to put
your script in /usr/lib/rpm/check-hardlinks
and add to /etc/popt a line like
rpm exec --check-hardlinks check-hardlinks
to be invoked as
FWIW, packages managed by rpm do not have broken
hard links. Also, since there are numerous issues
with "partial hard link" sets and the management
thereof, so I'd rather not add the script to rpm's
default configuration at this time.