test: ask run_san.sh for its subset, with the override cleared (#521 follow-up) - #525
Conversation
…follow-up) run_san.sh gains --list-suites, answered before its prerequisite check so it works on a box with no sanitizer build, and harness_selftest asks it instead of parsing the SUITES= block with sed. **The reason I gave for this in review of #521 was wrong, and the correction is the useful part.** I claimed the dangerous direction was a suite named in a COMMENT inside the SUITES= block: satisfying the grep and reporting coverage that does not exist. That cannot happen. SUITES= is a double-quoted string spanning backslash continuations, not a bash array, so a `#` inside it is literal text and not a comment. I tested it rather than asserting it, and the simulated hazard failed to reproduce -- the runner and the parser agreed, because the "comment" was still string content. So the source parse was not unsafe in the way I said. What it was, was a second reading of a definition that only run_san.sh should own, which is #473's rule and CONTEXT.md's: ask the runner, never parse the source. That reason stands on its own and does not need the hazard I invented. **And a plain --list-suites here is a REGRESSION, which is why the override is cleared.** The claim under test is about the shipped DEFAULT. Asking the runner inherits PGC_SAN_SUITES, so a developer with an override exported gets a red from a check that is not about their override. Verified: with PGC_SAN_SUITES='smoke differential' the runner reports no encode_invariants, and the check fails while the default is perfectly correct. `env -u` fixes it. Three directions verified rather than one: default 54 checks, PASSED with PGC_SAN_SUITES exported 54 checks, PASSED (would have red) encode_invariants cut from default FAIL ... got [encode_invariants] want [] Refs #521 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FeNm2Gw6h16Z123We3F1vJ
|
Verified by running it rather than reading it, including the one that decides whether this is safe to take: does my #521 check still protect anything afterwards? It does.
That last row is the one I would not have taken on inspection. A refactor that quietly stops protecting the thing is worse than the parser it replaces, because it reads as an improvement. On the retractionBuilding the case before shipping a fix for it, finding the hazard cannot occur, and saying so — rather than keeping the fix and quietly changing the justification — is the right call, and it is the harder one once the code is already written. The weaker reason you kept is sufficient on its own: it is a second reading of a definition only I will add the symmetric correction. My One thing I stopped doing because of this PRI was about to convert Worth doing as a follow-up after this lands, and it is strictly easier then: once No blocking comments. |
|
Re-checked against current main. This branched before #524, and it edits the
54 is the same count as main, so the replacement of the |
run_san.shgains--list-suites, andharness_selftestasks it instead of parsing theSUITES=block withsed.The reason I gave in review of #521 was wrong
I claimed the dangerous direction was a suite named in a comment inside the
SUITES=block — satisfying thegrep -qwand reporting coverage that does not exist. That cannot happen. I built the case to prove it before shipping a fix for it, and the runner and the parser agreed:SUITES=is a double-quoted string spanning backslash continuations, not a bash array, so a#inside it is literal text.What survives is the weaker and sufficient reason, which #473 and
CONTEXT.md:169already give: it is a second reading of a definition onlyrun_san.shshould own. That stands without the hazard I invented.And the obvious fix was a regression
A plain
--list-suitesinheritsPGC_SAN_SUITES. The claim under test is about the shipped default, so a developer with an override exported gets a red from a check that is not about their override. Verified — withPGC_SAN_SUITES='smoke differential'the runner reports noencode_invariantsand the check fails while the default is perfectly correct.@ChronicallyJD's source parse was right about that, because it read the default regardless of environment.
env -u PGC_SAN_SUITESkeeps that property while making the runner authoritative.Verified in three directions, not one
The middle row is the one that matters: it is the regression this would have shipped, and it only appears if you think to export the variable before running the suite.
Why
--list-suitesis worth having anywayIt is answered before the prerequisite check, so
bash test/run_san.sh --list-suitesworks on a box with no sanitizer build at all. A caller asking "what does this cover" should not need one, and the gate can now ask rather than parse.Refs #521