diff --git a/test/check_ledger.tsv b/test/check_ledger.tsv index 4cf738e9a..39328e2cc 100644 --- a/test/check_ledger.tsv +++ b/test/check_ledger.tsv @@ -1355,6 +1355,7 @@ harness_selftest 340-the-binary-must-be-built-from the stamp writer reports fail harness_selftest 340-the-binary-must-be-built-from the writer writes the file the reader looks for 15;16;17;18;19 never - harness_selftest 340-the-binary-must-be-built-from two installations of one major get different stamp paths 15;16;17;18;19 never - harness_selftest 340-the-binary-must-be-built-from two unreadable pg_configs do not alias onto one stamp 15;16;17;18;19 never - +harness_selftest 340-the-binary-must-be-built-from two unreadable pg_configs whose short hashes collide still get different stamps 15;16;17;18;19 never - harness_selftest 350-the-pytest-corpus-must-be and derives the pins from requirements-test.txt 15;16;17;18;19 never - harness_selftest 350-the-pytest-corpus-must-be and it derives the file list rather than repeating it 15;16;17;18;19 never - harness_selftest 350-the-pytest-corpus-must-be and the job asserts the driver is absent rather than assuming it 15;16;17;18;19 never - diff --git a/test/check_ledger_budget.txt b/test/check_ledger_budget.txt index dca2488fb..83a2a80bb 100644 --- a/test/check_ledger_budget.txt +++ b/test/check_ledger_budget.txt @@ -3277,4 +3277,12 @@ suites_not_covered 201 # never 2923 + 18 = 2941 # dated 1125 + 35 = 1160 # 2941 + 1160 == 4101 -checks_never_observed_red 2941 +# #1478, selftest 340 gains an arm for two unreadable pg_configs whose short hashes +# collide (jdatcmd): 2941 -> 2942. The arm is new and has not been seen red on a +# merged tree, so it enters as never observed red. No row is renamed or removed. +# +# ledger rows 4101 + 1 = 4102 +# never 2941 + 1 = 2942 +# dated 1160 + 0 = 1160 +# 2942 + 1160 == 4102 +checks_never_observed_red 2942 diff --git a/test/lib.sh b/test/lib.sh index 34c0fd2d9..39c017da6 100755 --- a/test/lib.sh +++ b/test/lib.sh @@ -1221,11 +1221,13 @@ pgc_source_stamp_path() { # pgc_source_stamp_path DIR PG_CONFIG _pgc_sp_lib="$("$_pgc_sp_cfg" --pkglibdir 2>/dev/null)" # An unreadable pg_config gets a key that matches nothing rather than one # every broken config shares: `unknown` would alias them together, which is - # the defect being fixed, one level down. + # the defect being fixed, one level down. Eight hex characters, as the + # readable branch keeps (#1478): three aliased two broken configs once in + # about 4096 runs, and selftest 340 failed CI on it. if [ -n "$_pgc_sp_lib" ]; then _pgc_sp_id="$(printf '%s' "$_pgc_sp_lib" | md5sum | cut -c1-8)" else - _pgc_sp_id="nolib$(printf '%s' "$_pgc_sp_cfg" | md5sum | cut -c1-3)" + _pgc_sp_id="nolib$(printf '%s' "$_pgc_sp_cfg" | md5sum | cut -c1-8)" fi printf '%s/.pgc_source_stamp.%s.%s\n' \ "$_pgc_sp_dir" "${_pgc_sp_major:-0}" "$_pgc_sp_id" diff --git a/test/selftest/340-the-binary-must-be-built-from.sh b/test/selftest/340-the-binary-must-be-built-from.sh index ae49258fc..80338fc63 100644 --- a/test/selftest/340-the-binary-must-be-built-from.sh +++ b/test/selftest/340-the-binary-must-be-built-from.sh @@ -410,6 +410,16 @@ check "and two pg_configs for one prefix share a stamp, keyed on pkglibdir" \ # the aliasing defect one level down. printf '#!/bin/sh\nexit 1\n' > "$_fs_cfg/pg_config.broken"; chmod 755 "$_fs_cfg/pg_config.broken" printf '#!/bin/sh\nexit 1\n' > "$_fs_cfg/pg_config.broken2"; chmod 755 "$_fs_cfg/pg_config.broken2" +# AND NOT ONE TIME IN 4096 (#1478). The check above uses a random directory, so a +# key cut too short aliases the two only now and then: three hex characters failed +# it once in about 4096 runs. These two paths collide on their first three md5 hex +# characters (235) and differ at eight, so a three-character key aliases them on +# every run. They need not exist: the key hashes the path string, and a pg_config +# that cannot run is exactly the unreadable case. +check "two unreadable pg_configs whose short hashes collide still get different stamps" \ + "$([ "$(pgc_source_stamp_path /tree /tmp/pgc-collide-870/pg_config.broken)" \ + != "$(pgc_source_stamp_path /tree /tmp/pgc-collide-870/pg_config.broken2)" ] \ + && echo different || echo SAME)" "different" check "two unreadable pg_configs do not alias onto one stamp" \ "$([ "$(pgc_source_stamp_path /tree "$_fs_cfg/pg_config.broken")" \ != "$(pgc_source_stamp_path /tree "$_fs_cfg/pg_config.broken2")" ] \ @@ -430,7 +440,7 @@ unset _fs_bad _fs_ok _fs_rp _fs_before _fs_cfg _fs_n _fs_pa _fs_pb # What the mismatch costs, measured by driving the real function both ways: # # correct (PG_CONFIG): /t/.pgc_source_stamp.18.603d6145 -# a major passed instead: /t/.pgc_source_stamp.0.nolib6f4 +# a major passed instead: /t/.pgc_source_stamp.0.nolib6f4922f4 # # `pgc_major_of 18` finds no version in the string "18", so the major becomes 0 # and the id becomes a hash of the literal "18". The writer and the reader then