[ccache] Would backdating source files allow sharing hardlinks between trees?

Justin Lebar jlebar at mozilla.com
Thu Nov 25 13:56:43 MST 2010


Hi, all.

One of the things we'd like to do at Mozilla is use ccache with
CCACHE_HARDLINK between two separate checkouts of our code.

This is currently problematic, because all of the hardlinked object
files share the same modified-time.  As a result, when a source file
matches an object file in the cache, we have two unappealing options:

1) Update the object file's mtime to now.  If we do this, then when we
rebuild in another tree, the object file will be newer than the things
which depend on it (e.g. shared libraries which include the file), so
we'll have to relink.

2) Leave the object file's mtime unmodified.  If we do this, then when
we rebuild this same tree, the object file will appear out of date.

I believe ccache takes the first approach, which seems sensible.

But as an alternative, what if we backdated the source file's mtime to
before the object file was created and left the object file's mtime
unchanged?  (If we didn't want to arbitrarily choose a time, we could
save the mtime of the source file which originally generated the
object file and use that.)

This would be an option, of course -- it's kind of strange behavior,
so it certainly shouldn't be on unless the user asks for it.  But I
wonder if this actually solves the problem.  I suspect it might screw
up some important tool, but I can't think of a potential bad
interaction off the top of my head.

What do you all think?

-Justin


More information about the ccache mailing list