Repository navigation
fix(parser): [[ a < b ]] compares strings, not a redirection - #2603
Merged
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | e02b1d4 | Commit Preview URL Branch Preview URL |
Oct 07 2026, 10:23 PM |
The conditional grammar has no redirects, so < and > inside [[ ]] are the string comparison operators. shopt listings use bash's 15-column + tab form. Claude-Session: https://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA
chaliy
force-pushed
the
claude/conditional-string-order
branch
from
October 7, 2026 22:23
c0f4336 to
e02b1d4
Compare
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.
Requested by Михайло · project thread
What changed
<and>inside[[ ]]are string comparison operators. The conditional parser used to skip them as redirection tokens, so[[ a < B ]]silently became[[ a ]]and reported "true" for any non-empty left operand.shoptlistings print the option name padded to 15 columns followed by a tab, the same shape as bash (and as this crate'sset -ooutput already used).Why
Debian-oracle cases
string-comparison-sort-orderandshopt-and-set-o-listing. The comparison bug is the more serious one: a script branching on[[ "$a" < "$b" ]]took the wrong branch without any error.Before / After
[[ a < B ]]; echo $?01[[ "" < B ]]; echo $?10[[ zzz < B ]]; echo $?01shopt extglobextglob+ 25 spaces +offextglob+ 8 spaces + tab +offNew spec file
conditional-string-order.test.sh(3 cases), verified against bash 5.2. Theshopt_show_specificcase invariables.test.shloses itsbash_diffmarker, since the output now matches.Risk
Low.
[[ ]]never accepted redirections, so no script could have relied on the old behavior other than by accident. Full lib, integration and bash-comparison suites pass.Checklist
cargo test -p bashkit --lib,--test integrationcargo clippy --all-targets -D warnings,cargo fmt --checkhttps://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA
Generated by Claude Code