Timestamps in static libraries

Tim Kientzle tim at kientzle.com
Wed Oct 6 06:19:11 UTC 2010


On Oct 5, 2010, at 2:47 PM, Erik Cederstrand wrote:
> Den 05/10/2010 kl. 15.59 skrev Erik Trulsson:
> On Tue, Oct 05, 2010 at 03:28:36PM +0200, Erik Cederstrand wrote:
>>> 
>>> 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:
>> 
> 
> Thanks, that was very helpful. It seems I can at least normalize the .a files ... 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       `

That's the timestamp on the pseudo-entry used to store the archive
symbol table.  (GNU/SysV ar files use a pseudo-entry named "/" to
store the symbol table.  Since '/' is added to end of names in this
format, this is essentially an entry with an empty name.)

The current ar code generates this entry and sets the timestamp
around line 624 of usr.bin/ar/write.c.

As far as I can tell, ar itself doesn't care about the timestamp here;
it's possible that ranlib or ld do care.  If they don't, we could set
this timestamp to zero always.

Tim






More information about the freebsd-hackers mailing list