This is the mail archive of the 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: RFA: Fix problem with trailing slashes in include paths on mingw

Joern RENNECKE <> writes:

>> C:\\ -- ?
>> C:// -- ?

Did you check this case?

>> C:\foo\bar\ -- ?
> NOT Ok.
>> C:\foo\bar\\ -- ?
> NOT Ok.
>> C:/foo/bar// -- presumably not ok
> Indeed, not OK.

Thank you.  This makes a good deal more sense.

>>Please also check all the above cases with a leading slash (or
>>backslash) but no drive letter; with a drive letter but no leading
>>slash (or backslash); and with neither a drive letter nor a leading
>>slash (or backslash); omitting, of course, those paths that when
>>transformed are vacuous or identical to already-tested cases.

Did you check these?

> Ok, how about that:
> /* While the native stat() on NT4 accepts trailing slashes, the
>    one on MS Windows 2000 / XP does not accept any trailing slashes
>    or backslashes, neither single nor double, except where they appear
>    as a drive root directory designator. So remove any trailing slashes
>    except for the first one after a colon.  */

Better, but still not ideal, especially with your observation below
that this is cygwin-specific.  (Just the trailing slashes, or slashes
and backslashes both?)  On the theory that the whole problem is Cygwin
specific, I would say something like

/* Canonicalize all path separators to forward slashes.  */

// backward-to-forward slash converter here

/* When running under MS Windows 2000 or XP, Cygwin's stat() fails
   when the pathname has trailing slashes (either variety), except
   for drive root directories (X:/).  Removing those slashes is
   harmless in other contexts, so we do it unconditionally.  */

// trailing-slash stripper here


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