Re: [ccache] ccache - .d files with absolute system header paths

2017-09-16 Thread Anders Björklund via ccache
Karanam Suryanarayana Rao Venkata Krishna wrote:
> Hello,
> I think I discovered a scenario that results in cache misses in spite of
> using CCACHE_BASEDIR.
> Consider the following command:
> 
> CCACHE_BASEDIR=$PWD /bin/bash -c "ccache clang++
> -fdebug-prefix-map=/proc/self/cwd= -g -c -MD -MF hello.d -o hello.o
> hello.cpp"
> 
> It seems to me that is is perfectly alright to ask for debug prefix mapping
> like: "-fdebug-prefix-map=/proc/self/cwd="
> Unfortunately, ccache is ending up hashing gnu_getcwd(); thus, even though
> we use CCACHE_BASEDIR setting, such a cache cannot be shared by other
> users' from different workspaces resulting in cache misses.
...
> 
> If the string after "=" in the mapping is null string, then, I hash "./".

Can't you just use "$PWD" and ".", instead of this elaborate scheme ?

Especially since using /proc/self/cwd doesn't even work, not with GCC...
i.e. when you give that prefix, it will just look for that path string

In the actual debug info, you will _still_ have a reference the cwd.

/Anders
___
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache


Re: [ccache] base_dir and symbolic links

2017-09-16 Thread Anders Björklund via ccache
Andreas Wettstein wrote:
> In function `make_relative_path` (file `ccache.c`), the given
> path is made "canonic" before it is converted to a path relative
> to the current working directory.  In particular, "canonic" means
> that symbolic links are removed.  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?
> 
> The reason why I am asking is that I have a usage scenario where
> this reduces sharing a cache among different users.

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.

You should still get preprocessor hits, but suppose you would
rather get "direct" hits instead of having to read both files.

Worst case, it could be an option (that defaulted to false) ?

Then you could override it at runtime, for your use case...

/Anders
___
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache