Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Jul 20, 2025

This PR fixes issue #5978 where command validation crashes when parsing BASH_REMATCH in gh alias commands.

Problem

The command validation system was throwing a "Bad substitution: BASH_REM" error when encountering BASH_REMATCH array syntax in shell commands, causing the application to crash.

Solution

  • Added specific handling for BASH_REMATCH array syntax in the parseCommand function
  • The fix handles both ${BASH_REMATCH[n]} and $BASH_REMATCH[n] patterns
  • These patterns are now temporarily replaced during parsing to prevent the shell-quote library from throwing errors

Testing

  • Added comprehensive test cases to verify BASH_REMATCH parsing works correctly
  • All existing tests continue to pass
  • The specific gh alias command from the issue now parses without errors

Fixes #5978


Important

Fixes crash in parseCommand by handling BASH_REMATCH syntax, with tests added to verify the solution.

  • Behavior:
    • Fixes crash in parseCommand in command-validation.ts when encountering BASH_REMATCH syntax.
    • Handles ${BASH_REMATCH[n]} and $BASH_REMATCH[n] by replacing them temporarily during parsing.
  • Testing:

This description was created by Ellipsis for ff0ad63. You can customize this summary. It will automatically update as commits are pushed.

- Add specific handling for BASH_REMATCH array syntax in parseCommand
- Handle both ${BASH_REMATCH[n]} and $BASH_REMATCH[n] patterns
- Add comprehensive test cases for BASH_REMATCH parsing
- Fixes issue #5978 where gh alias commands with BASH_REMATCH caused crashes
@roomote roomote bot requested review from cte, jr and mrubens as code owners July 20, 2025 04:31
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Jul 20, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 20, 2025
@daniel-lxs
Copy link
Member

Already solved by #5743

@daniel-lxs daniel-lxs closed this Jul 22, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 22, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Jul 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Bug: Command validation crashes when parsing BASH_REMATCH in gh alias

4 participants