Skip to content

fix(awk): make expression format errors fatal - #2458

Merged
chaliy merged 1 commit into
mainfrom
codex/issue-2456-awk-expression
Sep 25, 2026
Merged

chaliy merged 1 commit into
mainfrom
codex/issue-2456-awk-expression

Conversation

@chaliy

@chaliy chaliy commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

What changed

AWK formatting errors inside sprintf expressions now stop the AWK program with exit 2 and a fatal diagnostic. Direct printf uses the same error behavior. Scripts and agents no longer receive a successful result after a rejected format width or precision.

Closes #2456.

Why

sprintf("%10001s", "x") printed an error but yielded an empty string and exit 0. A later calculation could look complete although the format cap had been hit.

Before / After

Before: awk 'BEGIN { s=sprintf("%10001s","x"); print length(s) }' printed 0, reported the width error, and exited 0.

After: the same command prints no stdout, reports awk: fatal: format width 10001 exceeds maximum (10000), and exits 2. The focused builtin_cap_security_tests::awk_format suite passes all 3 tests; the bash spec suite and 100 awk unit tests pass.

Risk

  • Low. Programs that relied on successful exit after an invalid AWK format now receive exit 2. Formatting within the cap is unchanged.
  • Local just pre-pr exposed two SQLite CSV differential failures against macOS host sqlite3; this PR does not change SQLite. Required Linux CI is the merge gate.

Checklist

  • Tests added or updated
  • Backward compatibility considered

@cloudflare-workers-and-pages

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 c8c8fc6 Commit Preview URL

Branch Preview URL
Sep 25 2026, 04:11 AM

@chaliy
chaliy merged commit 50425c9 into main Sep 25, 2026
47 checks passed
@chaliy
chaliy deleted the codex/issue-2456-awk-expression branch September 25, 2026 04:24
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.

awk: expression format errors exit successfully

1 participant