Skip to content

fix(make): admit substitution before allocation - #2721

Merged
chaliy merged 2 commits into
mainfrom
codex/make-subst-admission
Oct 14, 2026
Merged

chaliy merged 2 commits into
mainfrom
codex/make-subst-admission

Conversation

@chaliy

@chaliy chaliy commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

What changed

Make substitution now admits its checked output size before constructing it. Arguments and generated expansion buffers use the shared execution budget, and immutable variable values retain their capacity leases through parser copies, replacement and recipe preparation. Matching and copying check work, cancellation and deadlines.

Why

The previous $(subst) implementation allocated its complete replacement before checking the remaining 4 MiB expansion allowance. The later size error could not protect that allocation.

Before / After

Tiny admission regression: a four-byte replacement with three bytes of remaining allowance previously returned success from substitution; it now returns expansion exceeds 4 MiB before result construction. The same replacement is accepted with four bytes remaining. Numeric overflow checks allocate no output.

Ordinary Unicode, immediate/recursive/append assignment and recipe proof, identical through Bashkit CLI and GNU Make:

caf🌱 🌱 tail|za

Empty-pattern behavior remains covered by an ordinary fixture. Tiny ownership tests prove retained results survive expander drop and share their lease through clones, then release it with the last owner. New tests contain no recursive amplification chain or oversized allocation.

Validation: just pre-pr, just test (including serialized failpoints), all-target/all-feature and lean clippy, warning-denied rustdoc, OKF/doc/workflow checks, 162 repository-script tests, tiny admission/ownership fixtures and ordinary CLI/GNU Make output comparison all passed. Existing benchmark harnesses passed their ordinary echo cases; no Make-specific performance claim is made.

Unchanged CI passed on c313597c, including the aggregate Check gate.

Risk

Medium: Make-generated text now counts toward the configured live-memory/work limits throughout its lifetime. Ordinary substitution and assignment semantics are retained. Other Make function algorithms and raw makefile storage remain outside this focused pre-allocation repair.

Checklist

  • Tests added or updated
  • Backward compatibility considered

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit c313597 Commit Preview URL

Branch Preview URL
Oct 14 2026, 01:46 AM

@chaliy
chaliy merged commit aec2a97 into main Oct 14, 2026
49 checks passed
@chaliy
chaliy deleted the codex/make-subst-admission branch October 14, 2026 02:13
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.

1 participant