Skip to content

syntax (completion-context): fix an infinite loop with three or more nested brace contexts#699

Merged
akinomyoga merged 4 commits into
akinomyoga:masterfrom
dlyongemallo:master
May 28, 2026
Merged

syntax (completion-context): fix an infinite loop with three or more nested brace contexts#699
akinomyoga merged 4 commits into
akinomyoga:masterfrom
dlyongemallo:master

Conversation

@dlyongemallo

Copy link
Copy Markdown
Contributor

nest[3] stores nlen (the length to the parent nest), not the parent's absolute index. Following the same pattern as nest-pop, convert it via inest1-nest[3]. Without this, every _ble_syntax_nest[k] for k>=1 inside {{{...} has nlen=1, and the walk-outward loop becomes a fixed point at inest1=1.

Fixes #698.

Copilot AI review requested due to automatic review settings May 17, 2026 19:29

Copilot AI 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.

Pull request overview

Fixes an infinite loop in completion-context handling when walking outward through three or more nested brace-expansion contexts.

Changes:

  • Converts nested brace parent links from stored relative nlen values to absolute indices while walking outward.
  • Aligns brace completion-context traversal with existing nest-pop semantics.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/core-syntax.sh
@dlyongemallo

Copy link
Copy Markdown
Contributor Author

The test failures seem unrelated to this PR.

@akinomyoga

Copy link
Copy Markdown
Owner

The CI issue turned out to be caused by the change of the OSTYPE special shell variable in the MSYS-2.0 environment (which is used by the Windows host in GitHub Actions). The Bash in the MSYS-2.0 environment has been setting OSTYPE=msys, but Bash in the current version of the MSYS-2.0 environment seems to set OSTYPE=cygwin. I'm not sure if this is an intentional change or a breakage of config.guess in Bash, but I added a workaround in commit e9bef3c.

@akinomyoga akinomyoga merged commit f38850c into akinomyoga:master May 28, 2026
1 check passed
@akinomyoga

Copy link
Copy Markdown
Owner

Thank you for the fix! I've merged the PR.

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.

Typing "{{{" hangs ble.sh (infinite loop in prefix:brace)

3 participants