Skip to content

fix indirect default expansion under nounset - #788

Merged
ewhauser merged 3 commits into
mainfrom
ewhauser/fix-indirect-nounset-defaults
Mar 29, 2026
Merged

ewhauser merged 3 commits into
mainfrom
ewhauser/fix-indirect-nounset-defaults

Conversation

@ewhauser

Copy link
Copy Markdown
Owner

Summary

  • fix indirect expansion under set -u so ${!name:-word} lets the outer operator handle an unset target instead of failing early
  • thread the shared indirect-resolution behavior through quoted element, field, and scalar expansion paths
  • add regressions for the Harness reproducer and for :? diagnostics using the outer indirect operand name

Root Cause

Simple indirect targets were resolved eagerly under nounset. When the referenced variable was unset, gbash raised unbound variable for the resolved target before outer operators like :- or :? could apply.

Validation

  • go test ./shell/expand ./internal/shell/interp
  • make lint

@ewhauser
ewhauser marked this pull request as ready for review March 29, 2026 22:46
@ewhauser ewhauser changed the title [codex] Fix indirect default expansion under nounset fix indirect default expansion under nounset 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: 923b317d01

ℹ️ 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 shell/expand/param.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: d07ff9bb44

ℹ️ 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 shell/expand/param.go Resolved
@ewhauser
ewhauser merged commit 50ec5b2 into main Mar 29, 2026
16 checks passed
@ewhauser
ewhauser deleted the ewhauser/fix-indirect-nounset-defaults branch March 29, 2026 23:27
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