Skip to content

conformance: fix expansion diagnostic regressions - #779

Merged
ewhauser merged 2 commits into
mainfrom
ewhauser/more-bash-conformance-fixes
Mar 29, 2026
Merged

ewhauser merged 2 commits into
mainfrom
ewhauser/more-bash-conformance-fixes

Conversation

@ewhauser

Copy link
Copy Markdown
Owner

Summary

This fixes a small batch of bash-conformance regressions in expansion and diagnostics.

  • stop treating ordinary command arguments like x=~ as assignment words, so echo x=~ stays literal
  • normalize arithmetic operand diagnostics to bash's arithmetic syntax error: operand expected wording, including nested bash -c rewriting
  • map incomplete case parse errors to bash-compatible unexpected end of file from 'case' command
  • remove stale xfails for the whitespace arithmetic cases and $PATH is set if unset at startup

Why

These cases were diverging from bash due to a few separate issues:

  • argv field expansion was still allowing assignment-like tilde expansion outside assignment contexts
  • some arithmetic error paths still emitted the older non-bash diagnostic text
  • bash-compat parse error translation did not recognize incomplete case constructs
  • the conformance manifest still carried xfails for cases that now pass

Impact

This makes the bash conformance suite more accurate and removes stale expected failures from the Linux manifest. It also brings user-visible parser and arithmetic diagnostics closer to bash.

Validation

  • make lint
  • go test ./shell/expand ./shell/syntax ./internal/shell/interp ./internal/builtins -run 'TestNormalizeNestedShellArithStderr|TestPrefixNestedShellDiagnosticPreservesOperandSpacing|TestArithmWithSourceRejects(CarriageReturn|VerticalTab|FormFeed)StringToInteger|TestParseErrorBashErrorParseCompatibility|TestAssignmentLikeArgTildeStaysLiteral|TestReadonlyAssignmentTildeUsesLiveHome'
  • GBASH_CONFORMANCE_BASH=$(./scripts/ensure-bash.sh) GBASH_RUN_CONFORMANCE=1 go test ./internal/conformance -run 'TestConformance/bash/oils/tilde.test.sh$|TestConformance/bash/oils/whitespace.test.sh$|TestConformance/bash/oils/vars-special.test.sh$' -count=1

Remaining nearby xfails

The adjacent live tilde failures are still:

  • oils/tilde.test.sh::~ expansion in readonly assignment
  • oils/tilde.test.sh::No tilde expansion in word that looks like assignment but isn't
  • oils/tilde.test.sh::strict tilde

@ewhauser
ewhauser merged commit 021fc88 into main Mar 29, 2026
16 checks passed
@ewhauser
ewhauser deleted the ewhauser/more-bash-conformance-fixes branch March 29, 2026 14:03
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