[ccache] base_dir and symbolic links

Joel Rosdahl joel at rosdahl.net
Sat Dec 30 19:48:52 UTC 2017

Hi Andreas,

> [...] I understand that it makes
> sense to make the current working directory canonic, but I do not
> see why this done for the path given to `make_relative_path`.  Is
> it really necessary?

Some background can be found in this mail thread:


The summary is that we want to normalize the paths to increase cache hits,
and one simple and robust way of doing that is to use realpath. Writing a
custom function that both normalizes paths and doesn't expand symlinks
might be possible, but note that there are tricky edge cases that need to
be handled.

> Thank you for considering it.  A patch is in the attachment.

ccache has a test suite and it fails like this with your patch:

Running test suite basedir...

Test suite:     basedir
Test case:      Path normalization
Failure reason: Expected "cache hit (direct)" to be 1, actual 0

[From your original mail:]
> For directories they do not work on, but are required to build the sources
> they work on, they create a symbolic link to a reference area in which
> only stuff required for building resides. [...] Now, assume user1 sets
> `base_dir` to `/user1` and user2 sets `base_dir` to `/user2`.

If I understand your setup correctly, would it be possible to instead put
/reference, /user1 and /user2 under a /common directory and then let the
users set basedir to /common?

-- Joel

On 17 September 2017 at 10:43, Andreas Wettstein via ccache <
ccache at lists.samba.org> wrote:

> > Seems like a pretty niche use case, but if you can come up with a
> > patch that doesn't break too much of current behaviour - why not.
> Thank you for considering it.  A patch is in the attachment.
> > Worst case, it could be an option (that defaulted to false) ?
> I would not consider this the worst case.  For me, it would be still
> more convenient than keeping my own modified version around.
> Andreas
> _______________________________________________
> ccache mailing list
> ccache at lists.samba.org
> https://lists.samba.org/mailman/listinfo/ccache

More information about the ccache mailing list