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:28:23PM +0200, jeroen dobbelaere wrote:
> - './' is converted to '', resulting in a '-L.' changing into '-L'
> while linking, giving wrong results.

Oops.  I wonder why I never saw this one?

> JDO: prefix.c:before 0x0x2cf80 
> '/usr/local/gcc-head-cvs/lib/gcc-lib/armv5l-unknown-linux-gnu/3.2/../../../../armv5l-unknown-linux-gnu/bin/'
> JDO: prefix.c:afterwards 0x0x2cf80 
> '/usr/local/gcc-head-cvs/lib/gcc-lib/armv5l-unknown-linux-gnu/3..../armv5l-unknown-linux-gnu/bin/'

Arrgh, I missed a `!' when converting my original patch to use
IS_DIR_SEPARATOR.  Sorry for the breakage.  Installing the following
as obvious.

	* prefix.c (update_path): Don't zap `./' and fix typo last patch.

Note that adding "& p[2]" may leave a trailing `/./' but we don't really
care.  The whole point of stripping single `.'s is just to make sure
stripping `dir/..' isn't stripping `./..'

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 12:50:17 -0000
@@ -286,7 +286,8 @@ update_path (path, key)
 	break;
       /* Get rid of a leading `./' and replace `/./' with `/'.  */
       if (IS_DIR_SEPARATOR (p[1])
-	  && (p == result || IS_DIR_SEPARATOR (p[-1])))
+	  && (p == result || IS_DIR_SEPARATOR (p[-1]))
+	  && p[2])
 	{
 	  src = p + 2;
 	  /* Be careful about .//foo  */
@@ -316,7 +317,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]