Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hooks: fix pkgutil.iter_modules when paths involve symbolic links #6539

Merged
merged 1 commit into from Jan 25, 2022

Conversation

rokm
Copy link
Member

@rokm rokm commented Jan 24, 2022

In our pkgutil.iter_module replacement, we need to fully resolve both the sys._MEIPASS and the given search paths, in case either contains a symbolic link. Failing to do so leads to path mis-match when symbolic links are involved and the given search paths are already fully resolved. This may happen on macOS with onefile builds if the caller of pkgutil.iter_module fully resolves the search path(s) before calling the function (issue #6537).

Add a test that reproduces scenario from #6537.

Fixes #6537.

In our pkgutil.iter_module replacement, we need to fully resolve
both the sys._MEIPASS and the given search paths, in case either
contains a symbolic link. Failing to do so leads to path mis-match
when symbolic links are involved and the given search paths are
already fully resolved. This may happen on macOS with onefile
builds if the caller of pkgutil.iter_module fully resolves the
search path(s) before calling the function (issue pyinstaller#6537).

Add a test that reproduces scenario from pyinstaller#6537.
@rokm rokm merged commit 51df140 into pyinstaller:develop Jan 25, 2022
@rokm rokm added the backported Backported to v4 branch label Jan 25, 2022
@rokm rokm deleted the pkgutil-hook-symlinks branch January 25, 2022 12:45
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backported Backported to v4 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pyi_rth_pkgutil.py hook might not work under MacOS in onefile mode
2 participants