Skip to content

awk: fix GNU runtime parity in vendored goawk - #773

Merged
ewhauser merged 3 commits into
mainfrom
ewhauser/awk-vendored-fixes
Mar 28, 2026
Merged

awk: fix GNU runtime parity in vendored goawk#773
ewhauser merged 3 commits into
mainfrom
ewhauser/awk-vendored-fixes

Conversation

@ewhauser

Copy link
Copy Markdown
Owner

Summary

  • fix vendored goawk field splitting so each record keeps the split mode active when it was read, including restoring FS after FIELDWIDTHS or FPAT assignments
  • default three-argument gensub calls to the live current record ($0) and honor the DST component in mktime datespecs
  • add GNU awk conformance coverage and direct regression tests for the repaired behaviors

Root Cause

  • lazy field parsing was consulting mutable FIELDWIDTHS and FPAT state instead of preserving the split mode that applied when the record was read
  • the native gensub helper had no access to the interpreter's current record, so omitted targets silently operated on an empty string
  • mktime parsed the DST datespec field but never applied it when resolving timestamps in local time zones

Validation

  • make lint
  • go test ./contrib/awk -count=1
  • env GBASH_CONFORMANCE_AWK="$(./scripts/ensure-awk.sh)" GBASH_CONFORMANCE_BASH="$(./scripts/ensure-bash.sh)" GBASH_RUN_AWK_CONFORMANCE=1 go test ./contrib/awk -run TestAWKConformance -count=1

@ewhauser
ewhauser marked this pull request as ready for review March 28, 2026 22:28

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e3185a4040

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread contrib/awk/awk.go Outdated
@ewhauser ewhauser changed the title [codex] awk: fix GNU runtime parity in vendored goawk awk: fix GNU runtime parity in vendored goawk Mar 28, 2026
@ewhauser
ewhauser merged commit 0c0ed10 into main Mar 28, 2026
16 checks passed
@ewhauser
ewhauser deleted the ewhauser/awk-vendored-fixes branch March 28, 2026 23:20
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