> 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

>From b7acbbf1c61b137d10904ed8c4e3e2cbf27ddb6f Mon Sep 17 00:00:00 2001
From: Andreas Wettstein <wetts...@gmail.com>
Date: Sat, 16 Sep 2017 20:24:27 +0200
Subject: [PATCH] When computing a relative path with respect to the current
 working directory, use the original path, without making it canonical.

Signed-off-by: Andreas Wettstein <wetts...@gmail.com>
---
 ccache.c | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/ccache.c b/ccache.c
index edbc5cc..2e605b3 100644
--- a/ccache.c
+++ b/ccache.c
@@ -709,23 +709,15 @@ make_relative_path(char *path)
 		free(p);
 	}
 
-	char *canon_path = x_realpath(path);
-	if (canon_path) {
-		free(path);
-		char *relpath = get_relative_path(get_current_working_dir(), canon_path);
-		free(canon_path);
-		if (path_suffix) {
-			path = format("%s/%s", relpath, path_suffix);
-			free(relpath);
-			free(path_suffix);
-			return path;
-		} else {
-			return relpath;
-		}
-	} else {
-		// path doesn't exist, so leave it as it is.
+	char *relpath = get_relative_path(get_current_working_dir(), path);
+	free(path);
+	if (path_suffix) {
+		path = format("%s/%s", relpath, path_suffix);
+		free(relpath);
 		free(path_suffix);
 		return path;
+	} else {
+		return relpath;
 	}
 }
 
-- 
2.14.1

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

Reply via email to