[ccache] Path rewriting in ccache make_relative_path - realpath conversion and its necessity

vkr venkatakrishnarao.ks at gmail.com
Wed Jan 13 05:32:07 UTC 2016

While I still look forward to hearing if the above is acceptable or not, I
noticed that
the <path> in argument -isystem<path> is not converted to
relative.(Unsupported, not bug :) )

                if (str_startswith(argv[i], "-isystem/")) {
                        /* Handle the -isystem option, if prefix path comes
from inside base_dir,

                        char *relpath = make_relative_path(x_strdup(argv[i]
+ 8));
                        char *option = format("-isystem%s", relpath);
                        args_add(stripped_args, option);

That inserted in ccache.c should solve the problem. Please comment on this


On Tue, Jan 12, 2016 at 3:05 PM, vkr <venkatakrishnarao.ks at gmail.com> wrote:

> Hello,
> I've a question around the function `make_relative_path()' that rewrites
> the given path to its relative path, and while doing so,
> it converts the given path to the realpath, and then returns the relative
> path for the realpath based on the current working directory.
> I was wondering why it was necessary to use the realpath while rewriting
> the path to relative, instead of the given path as-is?
> i.e When the check for `x_realpath' on a given path passes, why not just
> use the given path to rewrite it to relative?
> like so:
>                 relpath = get_relative_path(get_current_working_dir(),
> canon_path); // Current
>                 relpath = get_relative_path(get_current_working_dir(),
> path); // proposed
> The reason I'm asking this is, while technically there is nothing wrong in
> first converting the given path to realpath, and then
> rewriting it to relative, in a build system where there are external tools
> that use the build system provided paths,
> but miss out that "converting to that realpath" part, then it gets
> difficult.
> Handling it at ccache itself is perhaps more faster, and convenient.
> Your comments are appreciated.
> regards,
> Venkat.

More information about the ccache mailing list