test(e2e): add full smoketest covering install, search, upgrade, remove
Creates tests/e2e/smoketest.sh — a hermetic end-to-end test that:
- Sets up a mock ZUUR (python3 http.server serving local index/recipes)
- Creates fake zeta-makepkg and zeta scripts (no real Lua tools needed)
- Tests the full pipeline: search → install → upgrade → info → remove
- Verifies exit codes (0, 2 for not-found)
- Verifies installed.json state tracking
- Verifies binary installation/removal via ZETA_ROOT
BUG FOUND (documented in problems.md, not fixed):
- info.d scanDepsArray stores ptrdiff_t indexOf() result in size_t,
causing ArrayIndexError when recipe lacks a deps field.
Workaround: recipe includes deps = {}.
Evidence: .omo/evidence/task-27-tofu-core.log — 16/16 checks pass.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
# Problems — tofu-core
|
||||
|
||||
Unresolved blockers and technical debt discovered during work on this plan.
|
||||
|
||||
_Auto-scaffolded by /start-work. Append new entries below - never overwrite._
|
||||
|
||||
---
|
||||
|
||||
## BUG FOUND (task 27 smoketest): info.d scanDepsArray — unsigned type stores signed indexOf result
|
||||
|
||||
**Severity:** High (crash on any recipe without `deps` field)
|
||||
|
||||
**Location:** `src/tofu/commands/info.d:93`
|
||||
|
||||
**Root cause:**
|
||||
`size_t pos = content.indexOf("deps")` — indexOf returns ptrdiff_t (-1 for not found), storing it in size_t (unsigned) wraps -1 to SIZE_MAX. The guard `pos < 0` is always false for unsigned types. When deps is absent, `content[pos - 1]` accesses far out of bounds → ArrayIndexError.
|
||||
|
||||
**Why it escaped unit tests:** All 8 info.d unittests use recipes containing a `deps` field. The crash only triggers when `deps` is completely absent.
|
||||
|
||||
**Impact:** `tofu -Si` crashes on recipes without `deps` with an uncaught ArrayIndexError (D Error, not Exception — bypasses catch blocks).
|
||||
|
||||
**Fix (to be dispatched):** Change `size_t pos` to `ptrdiff_t pos` at line 93.
|
||||
|
||||
**Workaround in smoketest:** Recipe includes `deps = {}` to avoid triggering this bug.
|
||||
|
||||
Reference in New Issue
Block a user