This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
cpp leading / vs // bug
- To: egcs-bugs at egcs dot cygnus dot com
- Subject: cpp leading / vs // bug
- From: Mumit Khan <khan at xraylith dot wisc dot EDU>
- Date: Mon, 19 Apr 1999 12:30:48 -0500
Current code in simplify_filename uses the following test to see if it
should strip leading double slashes from a filename:
stat ("/", &s) == 0 && stat ("//", &s) == 0 && [rest]
I cannot find any reference to what ``stat ("//", &s)'' should return in
either POSIX or Susv2 (please yell if you know more about this ...), other
than telling us that double leading slash is implementation dependent.
This unfortunately breaks Cygwin, where leading "//" is special, but stat
returns 0 for it, and also the same inode and so on. The result is that
cpp reduces to a single slash and valid UNC pathnames fail.
Why does it work for other windows32 targets where '//' is special?
Because stat in all runtimes but Cygwin return -1 for // and the
conditional evaluates to the expected value.
fixes?
- leave leading // alone. However, reduce 3 or more to a single slash as
POSIX tells us and as it is done now. This involves removing the test
that set slashslash_vs_slash altogether.
- #ifdef __CYGWIN__ slashslash_vs_slash = -1 #else ... #endif to be safe.
- Add a variable in xm-target (yuk) that deals with this.
I don't see any such munging in cppfiles/cpplib, but I haven't looked hard
enough yet.
Comments please.
Remember the freeze deadline ;-)
Regards,
Mumit