3.0 KiB
3.0 KiB
=== tofu smoketest ===
step 0: build tofu binary... PASS
step 1: create temp workspace and hello binary... PASS
step 2: create hello.recipe... PASS
step 3: create package.lua... PASS
step 4: create fake zeta-makepkg and zeta... PASS
step 5: create mock ZUUR layout... PASS
step 6: start mock ZUUR http server... PASS
ZUUR_URL=http://127.0.0.1:27644
CACHE_DIR=/tmp/tmp.707gC0rrPK/cache
step 7: tofu -Ss hello (search)... PASS
step 8: tofu -S hello --noconfirm (install)... . fetching index http://127.0.0.1:27644/index.lua
ok index loaded: 1 packages
==> fetching recipe hello
. downloading hello.recipe
. downloading package.lua
. downloading build.sh
- no build.sh for hello (optional build script)
ok recipe hello downloaded
==> generating build plan
- + hello (recipe)
ok build plan: 1 packages
- will build 1 package(s): hello
==> ──── building hello (1/1) ────
ok hello
installing hello-1.0 ok installed hello with 0 dependencies
ok installed 1 package(s)
installed.json check... PASS
binary in root check... PASS
step 9: tofu -Syu --noconfirm (upgrade — nothing to do)... PASS
step 10: tofu -Si hello (info)... PASS
step 11: tofu -R hello --noconfirm (remove)... removing hello ok removed hello
binary removed check... PASS
installed.json cleared check... PASS
step 12: tofu -S nonexistent --noconfirm (expect exit 2)... . fetching index http://127.0.0.1:27644/index.lua
ok index loaded: 1 packages
PASS
step 13: cleanup... PASS
=== smoketest complete ===
PASS: 16 checks passed
All checks passed.
=== FIX (task 27): info.d unsigned indexOf wrap ===
Bug: src/tofu/commands/info.d:93 — `size_t pos = content.indexOf("deps")`.
indexOf returns ptrdiff_t (-1 for not found); unsigned size_t wraps -1 to
SIZE_MAX, making `if (pos < 0)` a no-op → ArrayIndexError on recipes
without a deps field (uncaught D Error, crashed -Si).
Fix applied:
1. scanDepsArray: size_t pos → ptrdiff_t pos (+ explanatory comment).
2. Added regression unittest (Test 4): cached recipe WITHOUT deps field
(name/ver/summary/build_system only) → infoCommand returns 0.
Recipe written via existing writeRecipe helper, mirrors Test 3 pattern.
Audit of same pattern elsewhere (checked, NOT bugs):
- info.d:36 auto kp = ...indexOf(key) → auto infers ptrdiff_t ✓
- recipeparse.d:52,112 auto idx = indexOf(...) → ptrdiff_t ✓
- fetch.d:82 auto idx = indexOf(...) → ptrdiff_t ✓
- search.d / remove.d / install.d → inline >= 0 / == -1 ✓
No other unsigned indexOf assignment found.
Verification:
dub build → Linking tofu (pass)
dub test → 23 modules passed unittests
smoketest → PASS: 16 checks passed, All checks passed.
step 0: build tofu binary... PASS
step 1: create temp workspace and hello binary... PASS
step 2: create hello.recipe... PASS
step 3: create package.lua... PASS
step 4: create fake zeta-makepkg and zeta... PASS
step 5: create mock ZUUR layout... PASS
step 6: start mock ZUUR http server... PASS
ZUUR_URL=http://127.0.0.1:27644
CACHE_DIR=/tmp/tmp.707gC0rrPK/cache
step 7: tofu -Ss hello (search)... PASS
step 8: tofu -S hello --noconfirm (install)... . fetching index http://127.0.0.1:27644/index.lua
ok index loaded: 1 packages
==> fetching recipe hello
. downloading hello.recipe
. downloading package.lua
. downloading build.sh
- no build.sh for hello (optional build script)
ok recipe hello downloaded
==> generating build plan
- + hello (recipe)
ok build plan: 1 packages
- will build 1 package(s): hello
==> ──── building hello (1/1) ────
ok hello
installing hello-1.0 ok installed hello with 0 dependencies
ok installed 1 package(s)
installed.json check... PASS
binary in root check... PASS
step 9: tofu -Syu --noconfirm (upgrade — nothing to do)... PASS
step 10: tofu -Si hello (info)... PASS
step 11: tofu -R hello --noconfirm (remove)... removing hello ok removed hello
binary removed check... PASS
installed.json cleared check... PASS
step 12: tofu -S nonexistent --noconfirm (expect exit 2)... . fetching index http://127.0.0.1:27644/index.lua
ok index loaded: 1 packages
PASS
step 13: cleanup... PASS
=== smoketest complete ===
PASS: 16 checks passed
All checks passed.
=== FIX (task 27): info.d unsigned indexOf wrap ===
Bug: src/tofu/commands/info.d:93 — `size_t pos = content.indexOf("deps")`.
indexOf returns ptrdiff_t (-1 for not found); unsigned size_t wraps -1 to
SIZE_MAX, making `if (pos < 0)` a no-op → ArrayIndexError on recipes
without a deps field (uncaught D Error, crashed -Si).
Fix applied:
1. scanDepsArray: size_t pos → ptrdiff_t pos (+ explanatory comment).
2. Added regression unittest (Test 4): cached recipe WITHOUT deps field
(name/ver/summary/build_system only) → infoCommand returns 0.
Recipe written via existing writeRecipe helper, mirrors Test 3 pattern.
Audit of same pattern elsewhere (checked, NOT bugs):
- info.d:36 auto kp = ...indexOf(key) → auto infers ptrdiff_t ✓
- recipeparse.d:52,112 auto idx = indexOf(...) → ptrdiff_t ✓
- fetch.d:82 auto idx = indexOf(...) → ptrdiff_t ✓
- search.d / remove.d / install.d → inline >= 0 / == -1 ✓
No other unsigned indexOf assignment found.
Verification:
dub build → Linking tofu (pass)
dub test → 23 modules passed unittests
smoketest → PASS: 16 checks passed, All checks passed.