[GHC] #14460: Symlink resolving fails against SMB mounts

GHC ghc-devs at haskell.org
Thu Jul 26 18:40:31 UTC 2018


#14460: Symlink resolving fails against SMB mounts
-------------------------------------+-------------------------------------
        Reporter:  astert            |                Owner:  Phyx-
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:  8.4.1
       Component:  Compiler          |              Version:  8.2.1
      Resolution:  fixed             |             Keywords:
Operating System:  Windows           |         Architecture:
 Type of failure:  GHC doesn't work  |  Unknown/Multiple
  at all                             |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D4216
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Vyse007):

 So for some strange weirdness with `autoconf` I can't actually test my
 fix, but sleuthing with APIMonitor as suggested by Phyx- leads me to the
 following conclusion:

 In the `getBaseDir` function in `BaseDir.hs`, the value of
 `GetModuleFileName` is indeed `Z:\sandbox\Vyse\8.4.3\bin\ghc.exe` -
 APIMonitor confirms this. This function then calls `getFinalPath` defined
 under it, which attempts to find the 'final' path of the executable. This
 function internally calls `GetFinalPathNameByHandleW`, and this function
 returns a slightly different value (after adding the backslashes):
 `\\\\?\\UNC\\vNetwork\\users\\sandbox\\Vyse\\8.4.3\\bin\\ghc.exe` - again,
 as reported by APIMonitor.

 Now calling `sanitize` and `takeDirectory` (twice) gets rid of the
 preceding `\\\\?\\`, but still leaves us with
 `UNC\\vNetworks\\users\\sandbox\\Vyse\\8.4.3`. This directory, according
 to `doesDirectoryExist`, does not exist. And that is correct in a way, as
 you cant `cd` to that location with that path, but you can use (without
 the extra slashes) `cd \\vNetwork\users\sandbox...`

 Anyway, API monitor reports that after the `GetFinalPathNameByHandleW`
 call, which returns the value with the `UNC` prefix, we end up calling
 `CreateFileW` again, but this time with the bizarre value of
 `\\?\Z:\sandbox\Vyse\8.4.3\bin\UNC\vNetwork\users\sandbox\Vyse\8.4.3\lib`
 - not sure where this came from, but at this point `NtCreateFile` errors
 out.

 I'll look into it a bit more when I get some time.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14460#comment:20>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list