MSVCDocker icon indicating copy to clipboard operation
MSVCDocker copied to clipboard

WINEPATH -> PATH length limited to 1024 characters

Open fzwoch opened this issue 5 years ago • 4 comments

Not sure where in the chain this is happening but I noticed that the PATH variable inside the container is limited to 1024 characters:

Microsoft Windows 10.0.10240 (4.0)

Z:\root>echo %PATH% C:\tools\bin;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\bin\Roslyn;C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\bin;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\Tools;C:\Program Files (x86)\Windows Resource Kits\Tools;;C:\Users\IEUser\AppData\Local\Microsoft\WindowsApps;;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\CommonExtensions\

So even the base image seems to truncate the default PATH variable set by the MSVC build tools. Fortunately for the basic things this seems working fine. But things may fall apart when adding more custom paths.

Is there a way to increase this limit? It seems that setting the PATH variable from inside a running container allows a bigger buffer.

fzwoch avatar Jun 18 '19 09:06 fzwoch

The limit comes from the vcwine script:

# wine seems to have a max on how long WINEPATH can be
export WINEPATH=${WINEPATH:0:1024}

Sadly it appears to be a bug in Wine itself. I filed a bug about it here.

paleozogt avatar Jun 18 '19 14:06 paleozogt

Ah interesting. I guess 2048 would be a decent value to work with some things. Thanks for looking into it!

fzwoch avatar Jun 18 '19 14:06 fzwoch

I've been looking into building Wine myself to work around some other issues. It's big and complicated, but if I can get that to work I'll also patch this problem.

paleozogt avatar Jun 18 '19 14:06 paleozogt

the function set_registry_variables() containing the 1024 sized buffer is not in process.c anymore

I found another occurrence. Maybe this helps

https://github.com/wine-mirror/wine/blob/6b35cd2903bc9842ce54cee02caee2106625091d/dlls/userenv/userenv_main.c#L105-L109

NeroBurner avatar Feb 20 '20 07:02 NeroBurner