diff options
| author | Danilo M. <danix@danix.xyz> | 2026-07-08 12:11:02 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-07-08 12:11:02 +0200 |
| commit | 6de9cec3ff26620c6e11de0dc426310346d7786c (patch) | |
| tree | b6ce6a6bb6d351f0931b809dcc16e05ffe0a2660 /tests | |
| parent | 9b57db37b6dca87247e30b1e5e2259094c7157b5 (diff) | |
| download | mkhintfile-6de9cec3ff26620c6e11de0dc426310346d7786c.tar.gz mkhintfile-6de9cec3ff26620c6e11de0dc426310346d7786c.zip | |
feat: suppress continuation-URL prompt for manifest-listed pkgs; release v1.2.4v1.2.4
On a primary version bump of a manifest-listed package, mkhint used to
prompt interactively for each extra DOWNLOAD (continuation) URL, then
Phase 2 (reconcile_bundle_deps) rewrote those same lines from the
upstream manifest — a pointless double-touch (13 prompts for neovim).
update_hint_file now detects a listed package and threads a skip_cont
flag through update_checksums -> _process_download_var, which leaves the
continuation URLs for the manifest reconcile and prints a short notice
instead of prompting. Non-listed packages prompt exactly as before.
Also fixes a set -e abort: the manifest-lookup guard was written as
`pkg_has_manifest ... && _skip_cont=1`, whose false result (non-listed
package) killed the run right after the backup. Rewritten as an if. This
would have broken every non-listed --hintfile -V update. Verified live on
a non-listed multiline package (exploitdb).
Tests: T-BM18 now asserts the listed-pkg suppression, T-BM25 guards
against over-suppression (non-listed still prompts); the read -p prompt
is invisible under piped stdin, so both assert on the always-echoed
"line N (current)" header. 184 passed.
Also defers the multi-file split TODO with a rationale and revisit
triggers (extract only the bundled-dep block when the time comes).
Bump MKHINT_VERSION and man title to 1.2.4, rebuild mkhint.1.gz.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/mkhint_test.sh | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/tests/mkhint_test.sh b/tests/mkhint_test.sh index 30383d2..85d988d 100755 --- a/tests/mkhint_test.sh +++ b/tests/mkhint_test.sh @@ -1860,14 +1860,43 @@ DOWNLOAD_x86_64="" MD5SUM_x86_64="" ARCH="x86_64" EOF -# stdin: continuation-URL prompt(s) for the primary bump, then apply Y, then slackrepo n -run_mkhint -f bmnvim -V 0.14.0 < <(printf '\nY\nn\n') >/dev/null 2>&1 || true +# stdin: apply Y, then slackrepo n. NO continuation-URL prompt: bmnvim is +# manifest-listed, so the primary bump must NOT ask for the extra URLs. +out=$(run_mkhint -f bmnvim -V 0.14.0 < <(printf 'Y\nn\n') 2>&1) || true grep -q 'VERSION="0.14.0"' "$MOCK_HINT/bmnvim.hint" \ && grep -q 'tree-sitter/archive/v0.26.8' "$MOCK_HINT/bmnvim.hint" \ - && { echo " PASS: -f -V bumped primary + reconciled deps"; (( PASS++ )); } \ - || { echo " FAIL: -f -V parity:"; cat "$MOCK_HINT/bmnvim.hint"; (( FAIL++ )); ERRORS+=("T-BM18"); } + && echo "$out" | grep -q 'left to bundled-dep reconcile' \ + && ! echo "$out" | grep -q 'line 2 (current)' \ + && { echo " PASS: -f -V bumped primary + reconciled deps, no continuation prompt"; (( PASS++ )); } \ + || { echo " FAIL: -f -V parity/suppression. out=$out"; cat "$MOCK_HINT/bmnvim.hint"; (( FAIL++ )); ERRORS+=("T-BM18"); } rm -f "$MOCK_BASE/manifest_fixture" "$MOCK_BASE/bundle-manifests" "$MOCK_HINT/bmnvim.hint" +# ── T-BM25: NON-listed multiline pkg still prompts for continuation URLs ────── +# Guard against over-suppression: a package with no bundle manifest must keep +# the interactive continuation-URL prompt on a primary bump. +echo "" +echo "T-BM25: non-listed multiline pkg → continuation URL prompt still shown" +: > "$MOCK_BASE/bundle-manifests" # nothing listed +cat > "$MOCK_HINT/plainml.hint" << 'EOF' +VERSION="1.0.0" +DOWNLOAD="https://example.com/plainml-1.0.0.tar.gz \ + https://example.com/extra-9.9.tar.gz" +MD5SUM="aaa \ + bbb" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +ARCH="x86_64" +EOF +# stdin: blank (keep continuation URL), then slackrepo n. The read -p prompt is +# suppressed by bash when stdin is piped, so assert on the always-echoed +# "line N (current)" header instead. +out=$(run_mkhint -f plainml -V 1.1.0 < <(printf '\nn\n') 2>&1) || true +echo "$out" | grep -q 'line 2 (current)' \ + && ! echo "$out" | grep -q 'left to bundled-dep reconcile' \ + && { echo " PASS: non-listed still prompts"; (( PASS++ )); } \ + || { echo " FAIL: non-listed suppression leak. out=$out"; (( FAIL++ )); ERRORS+=("T-BM25"); } +rm -f "$MOCK_HINT/plainml.hint" "$MOCK_HINT/plainml.hint.bak" "$MOCK_BASE/bundle-manifests" + # ── T-BM19: --check --force apply writes a .bak before rewriting the hint ──── echo "" echo "T-BM19: --check --force reconcile apply creates a .bak with original content" |
