This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 'strip out ".." from gcc search paths' causes bootstrap failures


On Fri, Jul 19, 2002 at 02:32:21PM +0200, jeroen dobbelaere wrote:
> BUT : because of the stripping of './', a specs file in the current 
> directory
> will result in the built-in being used... ("./specs" is returned as "specs" 
> with the
> above patch)

Oh dear, another unforseen problem.  For a patch mostly aimed at
helping developers, this is causing too much pain.  Instead of the
previous fix I posted, not yet installed, do this:

	* prefix.c (update_path): Don't zap single `.' path components
	unless followed by another `.' and fix typo last patch.

And if this doesn't work, someone please revert the whole wretched
thing..

Index: gcc/prefix.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/prefix.c,v
retrieving revision 1.35
diff -u -p -r1.35 prefix.c
--- gcc/prefix.c	18 Jul 2002 06:44:35 -0000	1.35
+++ gcc/prefix.c	19 Jul 2002 13:13:17 -0000
@@ -284,7 +284,8 @@ update_path (path, key)
       p = strchr (p, '.');
       if (p == NULL)
 	break;
-      /* Get rid of a leading `./' and replace `/./' with `/'.  */
+      /* Get rid of a leading `./' and replace `/./' with `/', when
+	 such components are followed with another `.'.  */
       if (IS_DIR_SEPARATOR (p[1])
 	  && (p == result || IS_DIR_SEPARATOR (p[-1])))
 	{
@@ -292,9 +293,14 @@ update_path (path, key)
 	  /* Be careful about .//foo  */
 	  while (IS_DIR_SEPARATOR (*src))
 	    ++src;
-	  dest = p;
-	  while ((*dest++ = *src++) != 0)
-	    ;
+	  if (*src == '.')
+	    {
+	      dest = p;
+	      while ((*dest++ = *src++) != 0)
+		;
+	    }
+	  else
+	    ++p;
 	}
       /* Look for `/../'  */
       else if (p[1] == '.'
@@ -316,7 +322,7 @@ update_path (path, key)
 	      dest = p - 1;
 	      while (dest != result && IS_DIR_SEPARATOR (*dest))
 		--dest;
-	      while (dest != result && IS_DIR_SEPARATOR (dest[-1]))
+	      while (dest != result && !IS_DIR_SEPARATOR (dest[-1]))
 		--dest;
 	      /* Don't strip leading `/'.  */
 	      while (IS_DIR_SEPARATOR (*dest))

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]