This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: 'strip out ".." from gcc search paths' causes bootstrap failures
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: jeroen dobbelaere <jeroen dot dobbelaere at acunia dot com>
- Cc: rth at redhat dot com, gcc-patches at gcc dot gnu dot org
- Date: Fri, 19 Jul 2002 22:26:05 +0930
- Subject: Re: 'strip out ".." from gcc search paths' causes bootstrap failures
- References: <3D3805E7.9060006@acunia.com>
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