Timestamps in static libraries

Erik Trulsson ertr1013 at student.uu.se
Tue Oct 5 14:13:40 UTC 2010


On Tue, Oct 05, 2010 at 03:28:36PM +0200, Erik Cederstrand wrote:
> Hello hackers,
> 
> 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.
> 
> It turns out that timestamps are stored in the library:

Yes, they are.  That is because the file format used for static
libraries include a timestamp for each object file stored in the
archive.

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.

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.



-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013 at student.uu.se


More information about the freebsd-hackers mailing list