[Bug preprocessor/61922] Recursive #include overruns Win32 MAX_PATH due to lack of path canonization

ilya.konstantinov at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Jul 27 17:48:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61922

--- Comment #3 from Ilya Konstantinov <ilya.konstantinov at gmail dot com> ---
Both mingw and cygwin will eventually call CreateFile, there's no way around
that. The 260 characters limitation is on CreateFile.

Re symlinks - see discussion on the llvm issue. I'm not proposing textual
canonization since it will not respect symlinks. However, applying
GetFullPathName each time will be much better than the current state.

Here's an example:

> cd c:\dev\test\
> gcc test.c

test.c:
#include "foo/foo.h"

   BEFORE: CreateFile("foo/foo.h")

   AFTER:  GetFullPathName("foo/foo.h") --> CreateFile("c:\dev\foo\foo.h)

foo\foo.h:
#include "../bar/bar.h"

   BEFORE: CreateFile("foo/../bar/foo.h")

   AFTER:  GetFullPathName("c:\dev\foo\../bar/bar.h") -->
CreateFile("c:\dev\bar\bar.h)

bar\bar.h:
#include "../baz/baz.h"

   BEFORE: CreateFile("foo/../bar/../baz/baz.h")

   AFTER:  GetFullPathName("c:\dev\bar\../baz/baz.h") -->
CreateFile("c:\dev\baz\baz.h)



More information about the Gcc-bugs mailing list