Skip to content

Claude/upgrade ape c library mm z gd - #722

Merged
staalmannen merged 2 commits into
mainfrom
claude/upgrade-ape-c-library-mmZGd
Nov 5, 2026
Merged

staalmannen merged 2 commits into
mainfrom
claude/upgrade-ape-c-library-mmZGd

Conversation

@staalmannen

Copy link
Copy Markdown
Owner

No description provided.

RULE was `^[^=#]*:[A-Z]*:', which needs two colons -- an attribute
rule like `install:V:' and nothing else.  An ordinary
`target: prereq' header was therefore not a rule, and the recipe
lines under it were never read.  870 recipe lines before, 1859 after,
with 0 findings both times: the tree is clean, and 989 lines of it
were being reported clean without being looked at.  That is the
failure mode this file's own header warns about two paragraphs down,
for backquotes.

Found by control rather than by reading, and only because the control
was planted twice.  A bare `=' put in cmd/php/mkfile's `clean:V:' was
duly reported -- which looks like proof the sweep works -- and the
same `=' in one of that file's `ext/...$O: $PHPSRC/....c' rules was
not.  Planting the break in one place would have passed.

So --control now covers the three ways mk hands text to rc: an
attribute rule, a plain rule and a backquoted assignment.  It also
checks two things that must NOT be reported, a quoted `=' and a
leading assignment, since widening a pattern is how a sweep starts
crying wolf.  Against the old two-colon regex the control fails on
exactly the plain rule and passes the other two, which is what makes
it a discriminator rather than a smoke test.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGAwvvTwDg2yknFkmZ3qzs
TSRM/TSRM.h:20 includes <main/php_config.h> while Zend and opcache
include <php_config.h>, so both spellings have to work.  The
hand-kept headers are under cmd/php/cfg/ now, with the answers in
cfg/main/php_config.h and cfg/php_config.h a one-line redirect rather
than a second copy that could drift.  One -Icfg answers all four
spellings, and the resolution was verified on the host: TSRM.c's
whole include tree preprocesses with no missing file.

-I. is deliberately absent, since the build writes its objects into
main/, Zend/, TSRM/ and ext/ right there and `.' on the include path
would put directories named after php's source trees in front of
php's source trees.  It is also why the headers are under cfg/ rather
than a main/ beside the mkfile: clean does `rm -rf main'.

Preprocessing all 513 sources on the host then found 31 with an
unresolvable include, in two clusters that both want flags rather
than files.  pcre2's 28 need -DHAVE_CONFIG_H -DHAVE_MEMMOVE and its
own pcre2lib on the include path; Keccak's 3 need the three
-D..._excluded flags, which is why KeccakP-200-SnP.h was reported
missing -- it is excluded by a flag, not absent.

Those flags cannot go in the global CFLAGS, and that was measured
rather than feared: -DHAVE_CONFIG_H together with -I.../pcre2lib
would hand ext/json/json.c, json_encoder.c and main/php_odbc_utils.c
-- each `#ifdef HAVE_CONFIG_H / #include <config.h>' -- pcre2's
config.h.  Not a failure, a different header, silently.

The 32 rules are explicit rather than patterned because mk's
precedence between a general and a specific meta-rule is something I
would be recalling rather than reading, there is no mk on the build
host to check it with, and a wrong guess costs a round trip.
Explicit beats meta-rule in every mk.

All 31 were found in one host pass rather than 31 VM round trips.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGAwvvTwDg2yknFkmZ3qzs
@staalmannen
staalmannen merged commit 8e12d63 into main Nov 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants