https://bugs.winehq.org/show_bug.cgi?id=54228
Bug ID: 54228 Summary: CPython fails to import symlinked packages Product: Wine-staging Version: 8.0-rc2 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: ernst@pleiszenburg.de CC: leslie_alistair@hotmail.com, z.figura12@gmail.com Distribution: ---
Created attachment 73774 --> https://bugs.winehq.org/attachment.cgi?id=73774 complete, minimal reproducing example
- Present in, at least: Wine Staging 7.22 and 8.0-rc2 - Not present: Wine Stable 7.0 - Wine builds: dl.winehq.org/wine-builds/ubuntu - System: Ubuntu 22.04 - Expected behavior: CPython <= 3.9 can import symlink-ed modules and their submodules - Actual behavior: CPython sees the folder and can navigate it, but fails to import its contents (submodules) - Reproduced by: https://gist.github.com/s-m-e/84d5fbf5663825a46d9ae98e4636d8ec (also attached)
---
I have noticed this issue in Wine Staging 7.22 and 8.0-rc2. I believe it must have found its way into Wine Staging in the October to November 2022 time frame. This issue does not appear in Wine Staging until about September. It also does not appear in stable releases of Wine 7. Python's import mechanism was rewritten recently, so only versions prior to Python 3.10 appear to be affected. Many packages support down to 3.7 at the moment.
I am heavily using CPython on top of Wine. When Python imports modules, it looks for them in certain paths, specified in `sys.path`. For development, it is common practise to symlink a package's folder from e.g. a git repo into one of the folders contained in `sys.path`, usually `site-packages`. Python then happily imports the module from there for e.g. testing. Many tools are built around this workflow.
``` Traceback (most recent call last): File "<string>", line 1, in <module> File "Z:\work\bar__init__.py", line 1, in <module> from .subbar import funcbar ModuleNotFoundError: No module named 'bar.subbar' ```
Python's module import mechanism appears to follow the symlink correctly (into module "bar") but fails to "locate" stuff within the linked folder (submodule "bar.subbar"). Other Python code can at least correctly navigate the linked folder's contents, so I am suspecting a `stat` syscall of some kind to return unusual values.
For a complete, minimal reproducing example see link above or attached script.
https://bugs.winehq.org/show_bug.cgi?id=54228
--- Comment #1 from Sebastian Ernst ernst@pleiszenburg.de --- A quick "poor-man's regression test" based on Ubuntu packages actually puts the breaking change between staging 7.17 (working) and staging 7.18 (broken), i.e. between ca September 9th and 23rd 2022 (build dates). Thanks for keeping them all online.
https://bugs.winehq.org/show_bug.cgi?id=54228
--- Comment #2 from Rafał Mużyło galtgendo@o2.pl --- Given we're talking about some change in handling files (and - hopefully - not a staging specific problem), two logs (one working, one not) with WINEDEBUG=file might help narrow things down.
https://bugs.winehq.org/show_bug.cgi?id=54228
Erich E. Hoover erich.e.hoover@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |erich.e.hoover@gmail.com
--- Comment #3 from Erich E. Hoover erich.e.hoover@gmail.com --- It's possible that this is related to updates to the repairs point support. I've been busy lately, but I'll try to take a look.
https://bugs.winehq.org/show_bug.cgi?id=54228
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dark.shadow4@web.de Status|UNCONFIRMED |NEW Ever confirmed|0 |1
--- Comment #4 from Fabian Maurer dark.shadow4@web.de --- Bisected to https://github.com/wine-staging/wine-staging/blob/master/patches/ntdll-Junct...
Reverting that commit on top of wine-staging fixes the error.
https://bugs.winehq.org/show_bug.cgi?id=54228
--- Comment #5 from Sebastian Ernst ernst@pleiszenburg.de --- Created attachment 73777 --> https://bugs.winehq.org/attachment.cgi?id=73777 logs
4 log files, two from 7.17 (no error) and two from 7.18 (error in the symlink version, no error in the folder version)