feat: paste, command, getopts, nounset, [[ =~ ]], glob **, backtick subst#232
Merged
feat: paste, command, getopts, nounset, [[ =~ ]], glob **, backtick subst#232
Conversation
The paste builtin already supports -s (serial) and -d (delimiter) with stdin input. Remove incorrect skip markers from spec tests.
Add POSIX `command` builtin with: - `command -v name`: check if command exists (builtins, functions, keywords) - `command -V name`: verbose description of command type - `command name args...`: run command bypassing shell functions Includes 9 spec tests covering all modes.
Real bash prints the full function body with command -V, our implementation only prints the type description.
POSIX getopts for option parsing in shell scripts: - Basic option parsing with optstring - Options with required arguments (: suffix) - Combined flags (-abc) - Silent error mode (leading :) - OPTIND/OPTARG variable management - -- processing terminator Includes 9 spec tests.
…ecks
- Add nounset_error flag to Interpreter, set during expand_word when
referencing unset variables under set -u
- Check and abort in execute_simple_command (name expansion) and
execute_dispatched_command (arg expansion)
- Stop top-level execute loop on non-None control flow so nounset
errors abort the script
- Add is_variable_set() covering special vars, positional params,
locals, shell vars, and env
- Add 7 spec tests (1 skipped for ${var:-default} awareness)
- Update implementation-status with getopts/command/nounset entries
…h =~ regex - Parse [[ ... ]] as CompoundCommand::Conditional in the parser - Handle && and || as literal words inside [[ ]] - Collect regex patterns after =~ with special paren handling - Evaluate conditionals with string, numeric, file, and regex operators - Set BASH_REMATCH array with capture groups on =~ match - Add 17 spec tests covering ==, !=, <, >, !, &&, ||, -z, -n, -eq, -lt, =~ basic match, no match, capture groups, variables
- Add expand_glob_recursive for ** pattern in glob expansion - Recursively collect subdirectories and match file patterns at all depths - Update glob_recursive test from skip to passing with VFS test files
Convert `cmd` to $(cmd) in the lexer for both unquoted words and double-quoted strings, handling backslash escaping per POSIX rules. Unskip subst_backtick spec test.
The security_function_depth_bypass test deliberately bypasses function depth limits, causing deep async recursion. Run on a thread with explicit 8MB stack so the command limit halts execution before the OS stack overflows.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
-sand-d(already implemented)command -v,-V, and function bypass=~regex matching and BASH_REMATCHTest plan
cargo fmt --checkcleancargo clippycleanbash_spec_testsall passbash_comparison_testsall pass