From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <quinn@nmt.edu>
X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on finch.gentoo.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.1 required=5.0 tests=DMARC_NONE,MAILING_LIST_MULTI,
	NICE_REPLY_A autolearn=unavailable autolearn_force=no version=4.0.0
Received: from mailhost.nmt.edu (mailhost.nmt.edu [129.138.4.52])
	by chiba.3jane.net (Postfix) with ESMTP id 0C81DABB38
	for <gentoo-dev@gentoo.org>; Sat,  5 Oct 2002 17:10:39 -0500 (CDT)
Received: from a117b.rcn.NMT.EDU (a117b.rcn.nmt.edu [129.138.36.78])
	by mailhost.nmt.edu (8.12.6/8.12.6) with ESMTP id g95MAYiw007983
	for <gentoo-dev@gentoo.org>; Sat, 5 Oct 2002 16:10:34 -0600
Subject: Re: [gentoo-dev] glibc-2.3 and prelinking
From: Quinn Harris <quinn@nmt.edu>
To: gentoo-dev@gentoo.org
In-Reply-To: <1033798935.27154.112.camel@quinn.rcn.nmt.edu>
References: <1033798935.27154.112.camel@quinn.rcn.nmt.edu>
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
X-Mailer: Ximian Evolution 1.0.8 
Date: 05 Oct 2002 16:16:01 -0600
Message-Id: <1033856161.6167.13.camel@quinn.rcn.nmt.edu>
Mime-Version: 1.0
Sender: gentoo-dev-admin@gentoo.org
Errors-To: gentoo-dev-admin@gentoo.org
X-BeenThere: gentoo-dev@gentoo.org
X-Mailman-Version: 2.0.6
Precedence: bulk
List-Help: <mailto:gentoo-dev-request@gentoo.org?subject=help>
List-Post: <mailto:gentoo-dev@gentoo.org>
List-Subscribe: <http://lists.gentoo.org/mailman/listinfo/gentoo-dev>,
	<mailto:gentoo-dev-request@gentoo.org?subject=subscribe>
List-Id: Gentoo Linux developer list <gentoo-dev.gentoo.org>
List-Unsubscribe: <http://lists.gentoo.org/mailman/listinfo/gentoo-dev>,
	<mailto:gentoo-dev-request@gentoo.org?subject=unsubscribe>
List-Archive: <http://lists.gentoo.org/pipermail/gentoo-dev/>
X-Archives-Salt: 869e0af5-7b98-490a-8860-b6b2fef3dcb7
X-Archives-Hash: 994f51ad7542f39f0848741441f9736c

I have a crappy but functional solution to this problem.  I changed the
portage.py code to use the prelink --verify option to get the input for
the MD5 checksum.  This probably incurres a substantial performance
hit.  In addition prelink is used to help calculate all MD5 checksums
which is pointless.  On the other hand, I essentally deleted 5 lines and
changed 1 to get it to work.  Heres the patch.

--- /usr/lib/python2.2/site-packages/portage.py 2002-09-25 20:17:44.000000000 -0600
+++ /mnt/gentoo/usr/lib/python2.2/site-packages/portage.py  2002-10-05 16:05:22.000000000 -0600
@@ -47,33 +47,28 @@
        if mtime != cached_mtime:
                list = os.listdir(path)
                dircache[path] = mtime, list
        return list

-try:
-       import fchksum
-       def perform_checksum(filename):
-               return fchksum.fmd5t(filename)
-except ImportError:
-       import md5
-       def md5_to_hex(md5sum):
-               hexform = ""
-               for ix in xrange(len(md5sum)):
-                       hexform = hexform + "%02x" % ord(md5sum[ix])
-               return(string.lower(hexform))
-
-       def perform_checksum(filename):
-               f = open(filename, 'rb')
-               blocksize=32768
+import md5
+def md5_to_hex(md5sum):
+       hexform = ""
+       for ix in xrange(len(md5sum)):
+               hexform = hexform + "%02x" % ord(md5sum[ix])
+       return(string.lower(hexform))
+
+def perform_checksum(filename):
+       f = os.popen3("/usr/sbin/prelink --verify " + filename, 'r')[1]
+       blocksize=32768
+       data = f.read(blocksize)
+       size = 0L
+       sum = md5.new()
+       while data:
+               sum.update(data)
+               size = size + len(data)
                data = f.read(blocksize)
-               size = 0L
-               sum = md5.new()
-               while data:
-                       sum.update(data)
-                       size = size + len(data)
-                       data = f.read(blocksize)
-               return (md5_to_hex(sum.digest()),size)
+       return (md5_to_hex(sum.digest()),size)

 starttime=int(time.time())

 features=[]



On Sat, 2002-10-05 at 00:22, Quinn Harris wrote:
> I have started to build a system with glibc-2.3 primarily to use
> prelinking.  But I just realized that prelinking and portage aren't
> going to get along.
> 
> The prelink tool will change binaries and shared libraries on the system
> and therefor the modify time and the MD5 checksum.  I expect portage
> will no longer properly unmerge these changed files.
> 
> The prelink tool can be changed to update the portage db probably by
> using a wrapper script.  Or, portage could be modified to utilize
> prelink to determine if the file was modified by prelink.  This is
> explained in 
> http://sources.redhat.com/ml/libc-alpha/2002-10/msg00089.html
> 
> What would be the best solution?
> 
> 
> Some info about prelinking
> http://dforce.sh.cvut.cz/~seli/en/linking2/
> 
> 
> On a side note.  gcc-3.2 won't compile right with glibc-2.3.  It looks
> like the gcc-3.2-branch cvs has the problem fixed. 
> http://gcc.gnu.org/ml/gcc/2002-10/msg00333.html
> 
> _______________________________________________
> gentoo-dev mailing list
> gentoo-dev@gentoo.org
> http://lists.gentoo.org/mailman/listinfo/gentoo-dev
>