fix: clean up tmp_dll_path on integrity verification failure#44
Open
catalini82 wants to merge 1 commit into
Open
fix: clean up tmp_dll_path on integrity verification failure#44catalini82 wants to merge 1 commit into
catalini82 wants to merge 1 commit into
Conversation
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes a temporary file leak in
ensure_binary()when the Windows CUDA DLL archive path fails during download, integrity verification, size validation, or extraction.The main archive temporary file (
tmp_path) was already cleaned up in the exception handler. The separate Windows CUDA DLL archive temporary file (tmp_dll_path) was not, because it is also created withNamedTemporaryFile(delete=False)and needs explicit cleanup.Changes
oprel/runtime/binaries/installer.pyAdds
tmp_dll_pathcleanup in theexcept Exception as e:handler.Cleanup is guarded with:
"tmp_dll_path" in locals()so failures before DLL temp creation are safe.tmp_dll_path.exists()so already-removed files do not cause errors.Existing
tmp_pathcleanup is preserved.Original exceptions remain chained through
BinaryNotFoundError(... ) from e.tests/unit/test_download_integrity.pyAdds coverage for:
tmp_path.tmp_dll_path.tmp_dll_path.The Windows CUDA tests monkeypatch
get_binary_info()andresolve_version()so they do not depend on current registry constants. Fake downloads route by exact fake URL equality, with an assertion on unexpected URLs.What did not change
Validation
python3 -m py_compile oprel/runtime/binaries/installer.pypython3 -m py_compile oprel/runtime/binaries/integrity.pypython3 -m pytest tests/unit/test_download_integrity.py -q -o addopts=""→ 33 passedpython3 -m pytest tests/unit/test_integrity.py -q -o addopts=""→ 33 passedPYTHONPATH=. python3 scripts/smoke_import.py→ passedgit diff --check→ passedTarget branch:
dev