[ccache] ccache problem with CCACHE_BASEDIR

Eric Blau eric.blau at tekelec.com
Thu Jul 19 13:21:12 MDT 2012


On 2012-06-11 07:54, Eric Blau wrote:
> On 2012-06-10 16:09, Joel Rosdahl wrote:
> > My suggestion is that get_relative_path essentially should stay the
> > same and continue to assume that the paths are well-formed and
> > canonical. make_relative_path (the only caller of get_relative_path)
> > should canonicalize current_working_dir and path by calling
> > realpath(3). Does this sound reasonble?
>
> Thanks for looking at this, Joel. I modified the code to do essentially
> this and it is working great now. I'll send a patch to you and the list
> shortly.
Hi Joel,

Sorry for the slow response, but I have a patch attached for this issue. 
Please let me know if you have any comments.

Thanks,
Eric
-------------- next part --------------
diff -uNr ccache-3.1.7/util.c ccache-3.1.7.patched/util.c
--- ccache-3.1.7/util.c	2012-01-08 09:40:55.000000000 -0500
+++ ccache-3.1.7.patched/util.c	2012-07-19 12:41:37.000000000 -0400
@@ -993,11 +993,15 @@
 	int i;
 	const char *p;
 	char *result;
+	char *cpath;
 
 	if (!*to || *to != '/') {
 		return x_strdup(to);
 	}
 
+	cpath = x_realpath(from);
+	from = cpath;
+
 	result = x_strdup("");
 	common_prefix_len = common_dir_prefix_length(from, to);
 	for (p = from + common_prefix_len; *p; p++) {
@@ -1021,6 +1025,7 @@
 		free(result);
 		result = x_strdup(".");
 	}
+	free(cpath);
 	return result;
 }
 


More information about the ccache mailing list