SWI-Prolog / issues

Dummy repository for issue tracking
8 stars 3 forks source link

getenv('PATH', A) has a 0-code replacing last character of A #114

Closed anionic closed 2 years ago

anionic commented 2 years ago

For 64-bit Windows, starting with 8.5.11-1, we get e.g. (shortened)

?- getenv('PATH', Q).
Q = '...;C:\\Users\\paul\\AppData\\Local\\Microsoft\\WindowsApps\u0000'.

Doesn't matter what the last path component is, or exactly how long PATH is (haven't tried very short ones). Other env vars (all much shorter) seem uncorrupted.

JanWielemaker commented 2 years ago

That doesn't reproduce, neither under Wine, nor under Windows 10. Please try asking on Discourse and/or try to find something that I can reproduce. Recently there was a change in the Windows binding to deal consistently with file name buffers. That code is also used by the getenv() emulation, so yes, things did change.

anionic commented 2 years ago

Hi Jan, sorry about that, I've experimented a bit and it's nothing to do with PATH (1172 chars in my case) but occurs for any env var of 1023 chars or more; here's a .bat file (zipped for uploadability) demoing the boundary cases: getenv.zip

JanWielemaker commented 2 years ago

Thanks. Fixed with SWI-Prolog/swipl-devel@268c2849e282930711c5ab3886adae62633de5db. Should be in tomorrows daily build.