splash: perform binary dependency analysis on Tcl/Tk shared libraries - #7679
Merged
Conversation
Extend the existing splash tests (onedir, onefile) that do not collect tkinter (and, in fact, explicitly exclude it) with a variant that forces tkinter collection via hiddenimports. The `tcl86t.dll` shipped with Windows build of Python 3.12b1 depends on `zlib1.dll`, and due to the lack of dependency scanning in splash, we fail to pick it up there. Threrefore, only `tkinter-onedir` test variant succeeds, as the `zlib1.dll` dependency is picked up by dependency scanning in main build process, which analyzes Tcl/Tk DLLs as dependencies of `tkinter`. Both `notkinter` test variants fail to collect `zlib1.dll`, while `tkinter-onefile` collects it, but fails to extract it as it is not listed among the splash screen requirements.
Fix a crash due to NULL pointer dereference in splash tear-down that happens due to incomplete shared library attachment; this may happen either because Tcl or Tk shared library fails to load, or because we fail to load a required symbol from one of the libraries.
Perform binary dependency analysis on Tcl/Tk shared libraries, to ensure that a) they are collected in cases when the progam does not use `tkinter`, and b) they are made available in onefile builds via pre-extraction. Up until now, the only dependency we had to worry about was `vcruntime140.dll` on Windows (and even that only for onefile pre-extraction), but the `tcl86t.dll` that comes with Windows build of Python 3.12b1 also depends on `zlib1.dll`.
rokm
force-pushed
the
splash-dll-dependency-scanning
branch
from
June 4, 2023 22:39
c4bdc41 to
ba4d182
Compare
bwoodsend
approved these changes
Jun 5, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Have
SPLASHperform proper dependency analysis on Tcl/Tk shared libraries, in order to ensure that dependencies are always collected (otherwise they might be missing unless the user's program usestkinter), and that they are added to splash requirements list (so that onefile builds pre-extract them before running the splash screen). Up until now, the only dependency we had to worry about wasvcruntime140.dllon Windows (and even that only in context of pre-extraction). But the python.org Python 3.12b1 Windows build comes withtcl86t.dllthat has additionally dependency onzlib1.dll, which we fail to pick up in our tests.The failed tests revealed that failing to load Tcl/Tk shared libs crashes the bootloader with NULL-pointer dereference, so fix that as well. The program now reaches the user's python code, and if the latter attempts to use
pyi_splashmodule, it will raise an exception.Lastly, the splash tests are now ran in four variants:
notkinter-onedirandnotkinter-onefile(which we've had up until now), as well astkinter-onedirandtkinter-onefile(where we use hidden import to simulate user's program depending ontkinter).