Skip to content

fix 10 cross-platform conformance xfails - #781

Merged
ewhauser merged 5 commits into
mainfrom
ewhauser/fix-cross-platform-conformance-xfails
Mar 29, 2026
Merged

ewhauser merged 5 commits into
mainfrom
ewhauser/fix-cross-platform-conformance-xfails

Conversation

@ewhauser

Copy link
Copy Markdown
Owner

Summary

This PR clears 10 cross-platform (darwin + linux) conformance xfails in the OILS suite and removes those entries from internal/conformance/manifest.json.

The fixes cover:

  • builtin-getopts: keep OPTARG set to "" for no-arg options under set -u
  • builtin-getopts: restore the OPTIND narrowed down case
  • strict-options: sourced top-level return
  • strict-options: top-level control-flow diagnostics
  • strict-options: errexit and top-level control-flow diagnostics
  • here-doc: multiple pipeline here-doc FDs
  • here-doc: multiple pipeline here-doc FDs on multiple lines
  • pipeline: initial PIPESTATUS remains unset until materialized
  • builtin-trap-bash: trap RETURN
  • builtin-trap-err: redirect-only ERR trap line accounting

Root Cause

A few separate runtime/interpreter mismatches were involved:

  • sourced scripts continued after return because chunked execution did not stop on returning
  • top-level control-flow builtins were missing bash-style file: line N: diagnostics for real script files
  • nested shell-script execution was not reliably inheriting extra redirected FDs across command boundaries
  • redirect-only failures used the wrong statement line for ERR trap $LINENO
  • command-string execution did not match bash's one-leading-newline line-number behavior
  • PIPESTATUS was being materialized too early for compound wrappers
  • getopts needed bash-compatible empty-OPTARG handling for successful no-arg options

Validation

Ran:

  • go test ./internal/shell/interp -run 'Test(Getopts|PIPESTATUS|SourceReturnTrap|TopLevelControlFlow|ErrTrap)' -count=1
  • go test ./internal/runtime -run 'Test(PipelineRegressionNestedShellCommandsInheritHereDocFDs|ErrTrapRegressionCommandStringLeadingBlankUsesSpecLineNumbers)$' -count=1
  • GBASH_RUN_CONFORMANCE=1 GBASH_CONFORMANCE_BASH=$(./scripts/ensure-bash.sh) go test ./internal/conformance -run 'TestConformance/bash/oils/(builtin-getopts|strict-options|here-doc|pipeline|builtin-trap-bash|builtin-trap-err)\\.test\\.sh/(OPTARG_is_empty_\\(not_unset\\)_after_parsing_a_flag_doesn'"'"'t_take_an_arg|OPTIND_narrowed_down|Sourcing_a_script_that_returns_at_the_top_level|top_level_control_flow|errexit_and_top-level_control_flow|Multiple_here_docs_in_pipeline|Multiple_here_docs_in_pipeline_on_multiple_lines|Initial_value_of_PIPESTATUS_is_empty_string|trap_RETURN|trap_ERR_with_redirect)$' -count=1
  • make lint

Notes

A broader file-level conformance sweep for these same files still shows unrelated, non-target failures, mainly older trap LINENO mismatches and the neighboring builtin-getopts.test.sh::OPTIND after multiple getopts with different spec case. Those were left out of this batch intentionally.

@ewhauser
ewhauser force-pushed the ewhauser/fix-cross-platform-conformance-xfails branch from 475f779 to 7b4cf3c Compare March 29, 2026 16:16
@ewhauser
ewhauser marked this pull request as ready for review March 29, 2026 17:07
@ewhauser ewhauser changed the title [codex] Fix 10 cross-platform conformance xfails fix 10 cross-platform conformance xfails Mar 29, 2026

@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: 5f8b6bcbde

ℹ️ 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 internal/shell/interp/fds.go Resolved

@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: b9cfdf09c6

ℹ️ 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 internal/shell/interp/runner.go Resolved
@ewhauser
ewhauser merged commit e271a6a into main Mar 29, 2026
16 checks passed
@ewhauser
ewhauser deleted the ewhauser/fix-cross-platform-conformance-xfails branch March 29, 2026 17:51

@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: a053e9594a

ℹ️ 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 on lines +1105 to +1110
file := r.currentCallFile()
line := r.currentVisibleLine(0)
if file == "" || file == "stdin" || line == 0 || strings.HasSuffix(file, " trap") {
return msg
}
return fmt.Sprintf("%s: line %d: %s", path.Clean(file), line, msg)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve caller line for eval control-flow diagnostics

controlFlowBuiltinErrorf always uses currentVisibleLine(0), which is the line number inside the currently parsed chunk. When break/continue/top-level return are triggered via eval, the chunk is parsed from runShellReader(..., name="") and lines restart at 1, but currentCallFile() still points to the outer script path; this produces misleading errors like <script>: line 1 instead of the actual callsite line. This regression affects file+line diagnostics added in this commit for control-flow builtins invoked through eval.

Useful? React with 👍 / 👎.

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