Commit 0b1284a
Pin the generators the checked-in parser and lexer are made with (Covered by dco/Brian_Egge.md)
hexpr.parse.C, hexpr.parse.H and hexpr.lex.C are checked in, generated from
hexpr.y and hexpr.l by pgen.sh -- with whatever bison and flex are on the
path. Nothing recorded which, and it matters: regenerating the unmodified
hexpr.l produced 997 lines of churn with Apple's flex and 809 with one GNU
flex 2.6.4 build against the checked-in file from another, which is how morganstanley#548
came to carry a thousand-line diff for a two-line change to the lexer. A
diff like that cannot be reviewed, and a generated file nobody can
regenerate identically is one nobody can safely change.
So pin them. pgen.sh now runs the generators in a container -- Ubuntu 24.04,
pinned by digest, which packages GNU Bison 3.8.2 and flex 2.6.4, the
versions the checked-in files name -- using podman or docker, whichever is
installed. PGEN_NATIVE=1 runs them from the path instead, for CI and for a
machine that has exactly those versions, and refuses anything else by whole
version line, since Apple's flex calls itself 2.6.4 too.
One thing the script now also does: re-apply the single hand edit the
checked-in parser carries. bison's generated cleanup frees the parser stack
only if it was moved off the initial array, GCC cannot see that and warns
(-Wfree-nonheap-object, gcc bugzilla 98753), and -Werror turns the warning
into a failed build, so someone once spelled the condition out by hand in
hexpr.parse.C. Regenerating dropped it. pgen.sh puts it back, so the edit
survives regeneration and is documented where it is made.
With the pin, regenerating all three files from the unmodified grammar and
lexer -- on top of morganstanley#548, whose lexer was regenerated with this same flex --
reproduces the checked-in files byte for byte. A new workflow does exactly
that on every change under lib/hobbes/read/pgen or include/hobbes/read/pgen
and fails on any difference: a change to the grammar has to come with its
regenerated output, and that output has to be the pinned generators'.
Built on morganstanley#548, which it depends on: the pinned flex produces morganstanley#548's lexer,
not the one before it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016rGT4C394qeh2DBQhqy3Tb1 parent 16fef2a commit 0b1284a
2 files changed
Lines changed: 127 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
2 | 19 | | |
3 | | - | |
| 20 | + | |
4 | 21 | | |
5 | | - | |
6 | | - | |
7 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
8 | 29 | | |
9 | | - | |
10 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
11 | 43 | | |
12 | | - | |
13 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
0 commit comments