diff options
| author | Danilo M. <danix@danix.xyz> | 2026-07-07 10:49:22 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-07-07 10:49:22 +0200 |
| commit | 4840c4f8a744ad6a7d296ecf87b84a10b8f4ce0c (patch) | |
| tree | fd8076d0c8740bf25a9b6435410b3706407c5d88 /tests/mkhint_test.sh | |
| parent | 0c588523a5c5afd6b28e36e14e9ca2c166d61097 (diff) | |
| download | mkhintfile-9df7221f7e1b5aefd9a421c84a41c607ed7aac28.tar.gz mkhintfile-9df7221f7e1b5aefd9a421c84a41c607ed7aac28.zip | |
fix: bump dash-form dated URLs on version changev1.1.3
--hintfile -V and --new -V only substituted the packaged underscore form
of the old version, so download URLs using the upstream dash form (dates
like 2026-07-07, tags) kept pointing at the old tarball and their md5
went stale. Now both the underscore and dash variants of old->new are
rewritten. exploitdb was the trigger case.
Tests T74 (--hintfile) and T75 (--new) cover the dashed-URL bump.
Release v1.1.3.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'tests/mkhint_test.sh')
| -rwxr-xr-x | tests/mkhint_test.sh | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/mkhint_test.sh b/tests/mkhint_test.sh index ff8bffc..18f0e43 100755 --- a/tests/mkhint_test.sh +++ b/tests/mkhint_test.sh @@ -22,6 +22,7 @@ setup() { "$MOCK_REPO/development/gopkg" \ "$MOCK_REPO/development/rustpkg" \ "$MOCK_REPO/development/mixedpkg" \ + "$MOCK_REPO/system/datedpkg" \ "$MOCK_HINT" \ "$MOCK_TMP" @@ -39,6 +40,21 @@ MAINTAINER="Test" EMAIL="test@test.com" EOF + # .info whose VERSION is underscore-dated but DOWNLOAD URL is dash-dated + # (exploitdb pattern). --new -V must bump both forms. + cat > "$MOCK_REPO/system/datedpkg/datedpkg.info" << 'EOF' +PRGNAM="datedpkg" +VERSION="2026_04_30" +HOMEPAGE="https://example.com/" +DOWNLOAD="https://example.com/archive/2026-04-30/datedpkg-2026-04-30.tar.gz" +MD5SUM="abc123def456abc123def456abc123de" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="Test" +EMAIL="test@test.com" +EOF + # Multiline DOWNLOAD .info cat > "$MOCK_REPO/development/protoc-gen-go-grpc/protoc-gen-go-grpc.info" << 'EOF' PRGNAM="protoc-gen-go-grpc" @@ -1413,6 +1429,33 @@ echo "$out" | grep -q 'man mkhint' \ && { echo " PASS: --help points at man page"; (( PASS++ )); } \ || { echo " FAIL: --help missing man pointer: $out"; (( FAIL++ )); ERRORS+=("T73 pointer"); } +# ── T74: --hintfile -V dash-dated URL → both '_' and '-' forms bumped ──────── +echo "" +echo "T74: --hintfile -V dashed URL → underscore VERSION and dashed URL both bumped" +cat > "$MOCK_HINT/datedpkg.hint" << 'EOF' +VERSION="2026_04_30" +ARCH="x86_64" +DOWNLOAD="https://example.com/archive/2026-04-30/datedpkg-2026-04-30.tar.gz" +MD5SUM="abc123def456abc123def456abc123de" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +EOF +run_mkhint -f datedpkg -V 2026_07_07 < <(printf 'n\n') +assert_contains "VERSION underscore bumped" "$MOCK_HINT/datedpkg.hint" 'VERSION="2026_07_07"' +assert_contains "URL dashed date bumped" "$MOCK_HINT/datedpkg.hint" 'datedpkg-2026-07-07.tar.gz' +assert_not_contains "no stale dashed date" "$MOCK_HINT/datedpkg.hint" '2026-04-30' +assert_not_contains "MD5SUM recalculated" "$MOCK_HINT/datedpkg.hint" 'abc123def456' + +# ── T75: --new -V dash-dated .info → both forms bumped ─────────────────────── +echo "" +echo "T75: --new -V dashed .info URL → underscore VERSION and dashed URL both bumped" +rm -f "$MOCK_HINT/datedpkg.hint" "$MOCK_HINT/datedpkg.hint.bak" +run_mkhint -n datedpkg -V 2026_07_07 +assert_contains "VERSION underscore bumped" "$MOCK_HINT/datedpkg.hint" 'VERSION="2026_07_07"' +assert_contains "URL dashed date bumped" "$MOCK_HINT/datedpkg.hint" 'datedpkg-2026-07-07.tar.gz' +assert_not_contains "no stale dashed date" "$MOCK_HINT/datedpkg.hint" '2026-04-30' +assert_not_contains "MD5SUM recalculated" "$MOCK_HINT/datedpkg.hint" 'abc123def456' + # ─── SUMMARY ────────────────────────────────────────────────────────────────── teardown |
