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:52:12 +0930
- Subject: Re: 'strip out ".." from gcc search paths' causes bootstrap failures
- References: <3D3805E7.9060006@acunia.com> <3D3806D5.3010204@acunia.com>
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