Bug 20810 – Freshly built DMD fails to read config file
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2020-05-08T17:04:53Z
Last change time
2021-01-30T20:26:06Z
Keywords
pull
Assigned to
Andrej Mitrovic
Creator
Andrej Mitrovic
Comments
Comment #0 by andrej.mitrovich — 2020-05-08T17:04:53Z
$ C:\dev\dmd\src>rdmd build.d -v
..\generated\windows\release\64\dmd.exe
It tries to get the canonical name of this path:
C:\dev\dmd\generated\windows\release\64\sc.ini
But it fails at this assertion:
> core.exception.AssertError@dmd\root\filename.d(1011): Assertion failure
This assert fails:
assert(length == fullPathLength);
I've read the docs here: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfullpathnamew
It seems on the second call the count will actually not include the null character, specifically this note from MSDN:
> Note Although the return value in this case is a length that includes the terminating null character, the return value on success does not include the terminating null character in the count.
I'll submit a PR.
Comment #1 by dlang-bot — 2020-05-08T17:11:54Z
@AndrejMitrovic updated dlang/dmd pull request #11111 "Fix issue 20810: Freshly built DMD fails to read config file " fixing this issue:
- Fix getting canonical path in GetFullPathNameW
According to MSDN docs, the return value of GetFullPathName
does *not* count the terminating null character.
In the first call, it *does* include this count because
a buffer was not specified in that initial call.
Fix Issue 20810
https://github.com/dlang/dmd/pull/11111
Comment #2 by moonlightsentinel — 2021-01-30T20:26:06Z