Hi Venkat,

> cache hit(preprocessed) puts the .d file from the workspace as-is into the
> cache, thus, if such a compilation resulted in absolute paths in the .d
> file(in workspace), then, the cache will also contain .d files with
> absolute paths, resulting in troubles later on(from another users
workspace)
> [...]

Thanks for noting this!

I had a look at it and I think that the

put_file_in_cache(output_dep, cached_dep);


call in from_cache is just a mistake in commit 38301c0d – it should have
been removed when I added the corresponding call in to_cache. So currently
on a preprocessed hit, the .d file that already exists in the cache (with
absolute paths adjusted to relative) will be overwritten with a new version
(potentially with absolute paths).

Thus I think that the proper fix looks like this:

--- a/ccache.c
+++ b/ccache.c
@@ -1964,11 +1964,6 @@ from_cache(enum fromcache_call_mode mode, bool
put_object_in_manifest)
                update_mtime(cached_dwo);
        }

-       if (generating_dependencies && mode == FROMCACHE_CPP_MODE
-           && !conf->read_only && !conf->read_only_direct) {
-               put_file_in_cache(output_dep, cached_dep);
-       }
-
        send_cached_stderr();

        if (put_object_in_manifest) {


What do you think?

-- Joel


On 6 October 2017 at 15:50, Karanam Suryanarayana Rao Venkata Krishna via
ccache <ccache@lists.samba.org> wrote:

> Hello,
> cache hit(preprocessed) puts the .d file from the workspace as-is into the
> cache, thus, if such a compilation resulted in absolute paths in the .d
> file(in workspace), then, the cache will also contain .d files with
> absolute paths, resulting in troubles later on(from another users
> workspace)
>
> I mean, https://github.com/ccache/ccache/blob/3.3-maint/ccache.c#L1969
> should precede a function call use_relative_paths_in_depfile(output_dep);
> just the way it is on
> https://github.com/ccache/ccache/blob/3.3-maint/ccache.c#L1307
>
> Please comment.
>
> best regards,
> Venkat.
> _______________________________________________
> ccache mailing list
> ccache@lists.samba.org
> https://lists.samba.org/mailman/listinfo/ccache
>
_______________________________________________
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache
  • [ccache] use_relative... Karanam Suryanarayana Rao Venkata Krishna via ccache
    • Re: [ccache] use... Joel Rosdahl via ccache

Reply via email to