Subject: Re: make: Dir_FindFile still broken
To: None <tech-toolchain@netbsd.org>
From: Simon Gerraty <sjg@juniper.net>
List: tech-toolchain
Date: 11/12/2002 11:37:21
On Tue, 12 Nov 2002 10:27:41 -0800 (PST), Simon Gerraty writes:
>I'm still looking at the diffs for rev 1.32 and 1.27 to spot what to
>do about it.

Is the following fix too ugly?

--- dir.c.~1~	Mon Sep 16 16:16:14 2002
+++ dir.c	Tue Nov 12 11:33:10 2002
@@ -799,6 +799,19 @@ DirLookupSubdir(Path *p, char *name)
     char 	 *file;		/* the current filename to check */
 
     if (p != dot) {
+	if (p->name[0] == '.' && p->name[1] == '.' && p->name[2] == '/' &&
+	    strncmp(p->name, name, strlen(p->name)) == 0 &&
+	    stat (name, &stb) == 0) {
+	    /*
+	     * We have a ../../ path in .PATH and we've previously found
+	     * a path via it so 'name' is correct as is.
+	     */
+	    file = estrdup(name);
+	    if (DEBUG(DIR)) {
+		printf("checking %s...", file);
+	    }
+	    goto gotit;			/* skip the stat(2) */
+	}
 	file = str_concat (p->name, name, STR_ADDSLASH);
     } else {
 	/*
@@ -812,6 +825,7 @@ DirLookupSubdir(Path *p, char *name)
     }
 
     if (stat (file, &stb) == 0) {
+    gotit:
 	if (DEBUG(DIR)) {
 	    printf("got it.\n");
 	}