<div dir="ltr"><div>Confirming that it's dlls/kernelbase PathAllocCanonicalize() that breaks it.</div><div><br></div><div>I can't debug this further at the moment. Please feel free to continue.<br></div><div><br></div><div><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Sep 15, 2019 at 11:10 AM Damjan Jovanovic <<a href="mailto:damjan.jov@gmail.com">damjan.jov@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Confirming with Python 3.7.4 on FreeBSD.</div><div><br></div><div>You don't need PYTHONHOME. It is sufficient to symlink any directory in the path leading up to Python's installation directory into a "."-prefix link, and to run python.exe with CWD coming through that link:</div><div><br></div><div>(With CWD = ~/.wine/drive_c/users/me/Local Settings/Application Data/Programs/.py/Python37-32)</div><div>wine python.exe -c "import sys; print(sys.executable)"<br>C:\users\me\Local Settings\Application Data\Programspy\Python37-32\python.exe</div><div><br></div><div>It breaks the same way if a PYTHONHOME that doesn't go through .py is set.</div><div><br></div><div>I think it breaks in dlls/kernelbase PathAllocCanonicalize(). Testing.<br></div><div><br></div><div>Regards<br></div><div>Damjan</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Sep 15, 2019 at 10:25 AM Sebastian M. Ernst <<a href="mailto:ernst@pleiszenburg.de" target="_blank">ernst@pleiszenburg.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi all,<br>
<br>
I am working with CPython on top of Wine 4.14. I know for certain that<br>
some path manipulation logic in Wine is broken but I am having trouble<br>
tracking down the root cause.<br>
<br>
I am launching Python like this:<br>
<br>
user@comp:/path/other> WINEDEBUG=-all PYTHONHOME="z:\\path\\.to\\target"<br>
wine /path/.to/target/python.exe<br>
<br>
Notice that the environment variable PYTHONHOME contains a folder with a<br>
leading dot (`.to`). Python should pick it up and expose it as the path<br>
to its executable - like this:<br>
<br>
user@comp:/path/other> WINEDEBUG=-all PYTHONHOME="z:\\path\\.to\\target"<br>
wine /path/.to/target/python.exe -c "import sys; print(sys.executable)"<br>
Z:\pathto\target\python.exe<br>
<br>
Notice that `\.` is missing from the path that is being printed.<br>
<br>
It gets even weirder if the folder name starts with two leading dots,<br>
i.e. `..to` - like this:<br>
<br>
user@comp:/path/other> WINEDEBUG=-all<br>
PYTHONHOME="z:\\path\\..to\\target" wine /path/..to/target/python.exe -c<br>
"import sys; print(sys.executable)"<br>
Z:\to\target\python.exe<br>
<br>
Now an even longer segment is missing: `path\..`<br>
<br>
I confirmed that the above steps work correctly on Windows 10, so it is<br>
very likely a bug in Wine. I collected all necessary steps required for<br>
reproducing this bug below this email.<br>
<br>
The startup code of CPython is somewhat convoluted, which is why I am<br>
having trouble identifying the Wine/Windows API in question. Any help is<br>
greatly appreciated.<br>
<br>
Best regards,<br>
Sebastian<br>
<br>
<br>
---<br>
<br>
<br>
user@comp:/path/.to/target> wget<br>
<a href="https://www.python.org/ftp/python/3.7.4/python-3.7.4-embed-win32.zip" rel="noreferrer" target="_blank">https://www.python.org/ftp/python/3.7.4/python-3.7.4-embed-win32.zip</a> 2><br>
/dev/null<br>
user@comp:/path/.to/target> unzip python-3.7.4-embed-win32.zip ><br>
/dev/null; rm python-3.7.4-embed-win32.zip<br>
user@comp:/path/.to/target> rm python37._pth<br>
user@comp:/path/.to/target> mkdir Lib; mv python37.zip Lib/; cd Lib;<br>
unzip python37.zip > /dev/null; rm python37.zip; cd ..<br>
user@comp:/path/.to/target> cd /path/other/<br>
user@comp:/path/other> WINEDEBUG=-all PYTHONHOME="z:\\path\\.to\\target"<br>
wine /path/.to/target/python.exe<br>
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 19:29:22) [MSC v.1916<br>
32 bit (Intel)] on win32<br>
Type "help", "copyright", "credits" or "license" for more information.<br>
Traceback (most recent call last):<br>
  File "/etc/pythonstart", line 7, in <module><br>
    import readline<br>
ModuleNotFoundError: No module named 'readline'<br>
>>> exit()<br>
user@comp:/path/other> WINEDEBUG=-all PYTHONHOME="z:\\path\\.to\\target"<br>
wine /path/.to/target/python.exe -c "import sys; print(sys.executable)"<br>
Z:\pathto\target\python.exe<br>
<br>
</blockquote></div>
</blockquote></div></div>