From owner-freebsd-hackers@FreeBSD.ORG Tue Oct 5 21:47:44 2010 Return-Path: Delivered-To: hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CEEF8106564A for ; Tue, 5 Oct 2010 21:47:44 +0000 (UTC) (envelope-from erik@cederstrand.dk) Received: from csmtp2.one.com (csmtp2.one.com [91.198.169.22]) by mx1.freebsd.org (Postfix) with ESMTP id 714D98FC08 for ; Tue, 5 Oct 2010 21:47:44 +0000 (UTC) Received: from [192.168.10.202] (0x573b9942.cpe.ge-1-2-0-1101.ronqu1.customer.tele.dk [87.59.153.66]) by csmtp2.one.com (Postfix) with ESMTPA id 315E6CC2DCBBD; Tue, 5 Oct 2010 21:47:42 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: multipart/signed; boundary=Apple-Mail-1468-917900132; protocol="application/pkcs7-signature"; micalg=sha1 From: Erik Cederstrand In-Reply-To: <20101005135906.GA3430@owl.midgard.homeip.net> Date: Tue, 5 Oct 2010 23:47:41 +0200 Message-Id: References: <52C32EA5-A380-4237-A27C-9E2DF2D4E022@cederstrand.dk> <20101005135906.GA3430@owl.midgard.homeip.net> To: Erik Trulsson X-Mailer: Apple Mail (2.1081) X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: FreeBSD Hackers Subject: Re: Timestamps in static libraries X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Oct 2010 21:47:44 -0000 --Apple-Mail-1468-917900132 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Den 05/10/2010 kl. 15.59 skrev Erik Trulsson: > On Tue, Oct 05, 2010 at 03:28:36PM +0200, Erik Cederstrand wrote: >> Hello hackers, >>=20 >> I got reminded of a problem I had a couple of years back compressing >> FreeBSD jails. I was using bsdiff for the compression and found out >> that md5 sums of static libraries (.a files) in /usr/lib and >> /usr/local/lib didn't match between jails, even though the source >> code used to create the jails hadn't changed. One of my goals is to >> detect which files in a distribution change between two commits. >>=20 >> It turns out that timestamps are stored in the library: >=20 > Yes, they are. That is because the file format used for static > libraries include a timestamp for each object file stored in the > archive. >=20 > You can use 'ar -tv /PATH/TO/LIBRARY/libfoo.a' to get a list of the > objects stored in the archive and the corresponding timestamps. >=20 > See the ar(5) manpage for a description of the file format, and the > ar(1) manpage for information on how to manage such files. Thanks, that was very helpful. It seems I can at least normalize the .a = files using something like the following to weed out timestamps and = uid/gid: % ar -x /usr/lib/libfetch.a % chown 0:0 * % touch -t 197001010000 * % ar -r libfetch.a `ar -t /usr/lib/libfetch.a` The above takes ca. 10 seconds for all static libraries on my aging = machine, which is OK in my case. Unfortunately it seems there's still a = creation time of the archive itself that I cant alter using the above, = so the md5 sums still don't match: % diff mod.strings orig.strings 2c2 < / 1286312209 0 0 0 958 ` --- > / 1269146263 0 0 0 958 ` Using Python to replace 1286312209 with 1269146263 in the binary file = now gives me matching md5 sums. It seems a bit complicated just to get = rid of some timestamps, though. Thanks, Erik= --Apple-Mail-1468-917900132--