Pull requests / #1801
#1801 fix(setup): discard damaged llama.cpp source archives
closed · draft · @hulkbig · 0 comentários · No GitHub
Setup & installAMD / HIPNVIDIA / CUDASecurityWindowsLinux
Descrição
## Title Issue: Fixes #1797 ## Summary A damaged cached llama.cpp source ZIP can keep its `.done` mark after `get_llama_cpp()` raises `BadZipFile`. Every later setup run then reuses the same bad archive. Remove that archive and its mark so the next run can download it again. Kept as a draft: CUDA/HIP/SYCL builds have not been run, so the backend-build requirement in AGENTS.md has not been met. The applicability of that requirement to this installer-only change still needs clarification before requesting review. ## What changed - Catch `zipfile.BadZipFile` only around opening and extracting the llama.cpp source archive, and reuse `drop_archive()` for that exact ZIP and its `.done` mark. - Re-raise the original exception. If cleanup raises `OSError`, warn about manual cleanup without replacing the original archive error. - Add isolated local-file regressions for invalid/truncated archives, extraction-time CRC failure and recovery, cleanup edge cases, successful reuse, and non-corruption errors that must retain their cache. The download strategy, retries, source pin, archive member filtering, successful extraction path, and engine/backend code are unchanged. This does not add checksums or change archive-security policy. Related: #1126 changes the same function to use `safe_extract()`, but its current implementation does not remove this damaged source cache. These changes address different behavior; any future integration must preserve that safe-extraction work. #424 covers the analogous engine-archive path. ## Extra Notes Local validation on Linux x86_64 (kernel 6.18.44), Python 3.12.14, at `cdb17c717260bdb9122099bac055df82ef197f0e`: - Real production `get_llama_cpp()` / `download(file://...)` reproduction: two calls on unchanged base `fb58e0d` keep reusing the bad ZIP and mark. With the fix, the first call removes them and the second installs a valid local archive. Network calls are prohibited in these regressions. - `python tools/test_setup_llama_archive.py -v`: 10 tests passed. The same final suite fails on the unchanged base. - Independent review: 9 additional boundary checks passed. - `python tools/test_setup_golden.py -v`: 4 passed, including saved-configuration byte consistency. - 33 selected adjacent archive checks passed through an offline runner with socket calls blocked: `tools.test_setup_pins.Engine`; `tools.test_setup_engine_hash` classes `ArchiveVerification`, `DigestLookup`, `WhereTheHashComesFrom`, `Wiring`; and `WhatARefusalDoesToTheCaller.test_the_cuda_and_amd_paths_both_verify`. - `python tools/test_setup_choices.py -v`: 39 passed, 1 environment error (`RotationalDisk.test_sysfs`: missing `/sys/block`), identical on base and patch. - `python -m py_compile setup.py tools/test_setup_llama_archive.py`, `git diff --check`, and exact-base patch replay checks passed. Validation limits: no CUDA/HIP/SYCL build, Windows run, GPU/model execution, or real remote llama.cpp download. Three existing adjacent checks with unmocked HEAD requests were excluded from the final offline selection. An earlier broad engine-hash run made release-asset HEAD requests, received HTTP 404, and was interrupted; the full suite is not reported as passing. No online CI success is assumed.
No site
Links install, modelos, releases.