www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17888] New: dmd fails on Windows if path is too long


          Issue ID: 17888
           Summary: dmd fails on Windows if path is too long
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: laeeth laeeth.com

DMD fails on Windows if the path is too long.  (Sorry for not giving specific
test case yet - I'm on Linux right now, but Atila Neves will elaborate

This is particularly a problem when using dub, which likes to turn all paths
into relative ones and this has the consequence of making even a shortish path

There are two reasons for this.  One is that the static array in tk/filespec.c
in the function that builds a path is only 131 chars + null.  Another is that
for the getcwd Windows API function we call, the MAXPATH limit of 260
characters applies.  The way to avoid this is to use the unicode function and
Win32 File namespaces instead of a regular path.  So if the path does not begin
\\ then we should make it look something like: \?\C\D\foo  (note, not \?C\D\foo
- which does something entirely different).  I believe that should:

1. be one step towards permitting unicode characters in the path.  (probably
there are  other functions that would need to be changed - I haven't had time
to look).  See  https://issues.dlang.org/show_bug.cgi?id=13493

2. be one step towards removing the path length limit on Windows which
interacts badly with dub's style in relativisation of paths.  there might be
other functions that need to be changed - in a hurry.

line 119 - cwd is 131 chars + null

extern (C) char* getcwd(char* buffer, size_t maxlen);

it's deprecated and replaced by the ISO function:

on Windows and indeed other operating systems we already have the correct code
to get current working directory. so we just need to update dmd to use this.

even if we can't use Phobos I guess we could copy /paste that code.

Oct 09 2017