fix(build): close the same codegen race for the four PEG parsers (bug-1798)

Follow-up audit (requested: check other generated sources, specifically
packcc/PEG output) found the identical bug shape in the four PEG-parser
custom_targets: section_parser, rusage_parser, xce_resreq_parser, and
xce_select_parser each produce a .c + a paired .h (section.h, rusage.h,
xce_resreq.h, xce_select_peg.h), but libxce_src only referenced each
parser's [0] (.c) index. lib/resreq.c -- confirmed via a project-wide
grep to be the only consumer of any of these four headers -- had no
declared build-order dependency on any of the four codegen steps.

Fix: pass each of the four custom_targets unindexed into libxce_src,
same pattern as the capnp fix. No libxce_dep change needed here since
nothing outside src/lib/ consumes these headers.

A project-wide search confirms these, plus the capnp custom_target, are
the only multi-output C/H codegen steps in the whole build -- every other
custom_target() (xceadmin, apiserver, xcecli, autoscaler/providers)
produces a single Go-binary/stamp output with no equivalent hazard.

Verified: a third consecutive full from-scratch `./tools/xce-build.sh all
debug` build (1173/1173 targets) succeeded clean; a fresh `lib debug`
build plus the full lib test suite (313/313) passed; a fresh incremental
controller/ASAN rebuild passed 1331/1331 on a quiet re-run (its first,
concurrent-with-the-full-build run hit an unrelated, confirmed-flaky PTY
harness timing failure in test_smoke_launch_send_echo_capture_stdout_and_exit_code,
reproduced as system-load-induced, not caused by this change).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019jaMf9QEwpugH2W9KAuc7f
This commit is contained in:
Rongsong Shen 2026-09-10 07:53:51 +00:00
parent c1c6c9a248
commit f09fbdb342
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
2 changed files with 17 additions and 7 deletions

View file

@ -76,10 +76,20 @@ libxce_src = [ # bug-1798: pass the whole gen_srcs custom_target (both
# before) while ordering the ENTIRE target's build after
# BOTH outputs are generated.
gen_srcs,
section_parser[0],
rusage_parser[0],
xce_resreq_parser[0],
xce_select_parser[0],
# bug-1798 (same class): each packcc parser custom_target
# below also produces a paired .h output (section.h,
# rusage.h, xce_resreq.h, xce_select_peg.h) that only
# resreq.c #includes -- a separate file from each parser's
# own generated .c. Indexing to [0] dropped every one of
# these headers from libxce_src, leaving resreq.c's compile
# with no declared dependency on any of the four codegen
# steps. Passing each custom_target unindexed compiles only
# its .c output (as before) while ordering this whole
# target's build after both of its outputs.
section_parser,
rusage_parser,
xce_resreq_parser,
xce_select_parser,
'client.c',
'client_failover.c',
'dataq.c',