Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 2146

Summary: qpkg -c incorrectly reporting failed checksums
Product: Portage Development Reporter: Imran Sher Rafique <imran>
Component: UnclassifiedAssignee: Brandon Low (RETIRED) <lostlogic>
Status: RESOLVED FIXED    
Severity: normal CC: lostlogic
Priority: High    
Version: unspecified   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Imran Sher Rafique 2002-04-27 06:32:25 UTC
[SETUP]
gentoolkit-0.1.8, portage-1.9.1

[PROBLEM]
`qpkg -c <pkg>` is incorrectly reporting that all md5 checksums failed to match

[REASON]
qpkg:312  > extracts the stored md5 checksum from the CONTENTS file, as is.
qpkg:313-4> calculates a new md5 checksum, but then converts everything to uppercase

qpkg:331  > obviously, the comparison between both strings fails

[SUGGESTED FIX]
remove the following from line 314:
| awk '{print toupper($1)}'
Comment 1 Imran Sher Rafique 2002-05-02 18:40:50 UTC
I looked again, and my original solution for this bug was misdirected.

Looking through the various CONTENTS files under /var/db/pkg, I see that some were written with the md5 checksum converted to upper case (with my original qpkg), and some were written with the md5 checksum unaltered (my current qpkg).

A better fix would be to force everything to be upper case (for the comparison), then it will work with new-style and old-style CONTENTS formats:

(ignoring indentation)
line312:	[ "$mcheck" ] && md5=${line[2]} && md5=`echo "$md5" | awk '{print toupper($1)}' `

(of course, the real bug is that qpkg is not writing md5 checksums to the CONTENTS file in the same way as before - the above suggestion just bypasses this)
Comment 2 Karl Trygve Kalleberg (RETIRED) gentoo-dev 2002-05-03 19:59:06 UTC
The qpkg tool seems to have been left high and dry by its original author. I
will see if we can't come up with some kind of replacement for it, as I am not
willing to hack actively on it given its current state.
Comment 3 Brandon Low (RETIRED) gentoo-dev 2002-06-04 19:08:01 UTC
For the reason of this here time output, I'm going to have to recommend that we
go with the awkless solution originally suggested, and users who's md5s are in
all upercase are going to have to deal with it...

Doh, just had a thought... I'll be back with you in a moment...

I might have an intermediate solution...

lost ide-smart-1.4 # time qpkg-new -c -v glibc
sys-libs/glibc-2.2.5-r2 *
   /var/db/pkg/sys-libs/glibc-2.2.5-r2/glibc-2.2.5-r2.ebuild
4623/5118


real    0m12.895s
user    0m6.930s
sys     0m5.160s
lost ide-smart-1.4 # time qpkg-new -c -v glibc
sys-libs/glibc-2.2.5-r2 *
   /var/db/pkg/sys-libs/glibc-2.2.5-r2/glibc-2.2.5-r2.ebuild
4623/5118


real    0m49.536s
user    0m18.600s
sys     0m27.380s
lost ide-smart-1.4 # 
Comment 4 Brandon Low (RETIRED) gentoo-dev 2002-06-04 19:17:56 UTC
I lied, I dun have a better solution... For now at least I'm going to do it with
your initial solution of removing the toupper this will work fine on more recent
installs, and is something that will over time become less and less of a problem
as people upgrade packages.
Comment 5 Brandon Low (RETIRED) gentoo-dev 2002-06-04 21:49:10 UTC
W00T thanks to my esteemed collegue carpaski I am now using 'tr' instead of awk.
 AND thanks to me, we now only do that translation on things that fail the md5
check the first time.  I also changed -c -v so that it displays the failing
files, -c -vv displays EVERYTHING, -c doesn't.  I'm closing this now that things
work.  :-D