Skip to content

fix(executor): word-side byte-char gate for carried-byte patterns - #983

Merged
caomengxuan666 merged 1 commit into
masterfrom
fix/word-side-byte-matching
Oct 21, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
fix/word-side-byte-matching

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

GNU matches bytes not chars (subst.c glob_pattern_patscan walks unsigned char). The byte-spelling gate only checked the pattern side, so a carried byte on the word side (e.g. [[ $x == ? ]] with a stored 0x11 byte) fell through to the plain char-wise matcher and wrongly failed. Widen the gate to either side and move it before the pattern-only fast paths (which verdict on raw chars). Plain patterns + plain words unchanged. Verified byte-identical vs GNU bash 5.3.20: carried-byte ?/*/literal/case shapes + exp5.sub-style strips. Unit + integration regression tests included. obsoletes the pattern-matching half of #821 (the rest — coproc/extra bits — stays there).

GNU matches bytes not chars (subst.c glob_pattern_patscan walks unsigned
char). The byte-spelling gate only checked the pattern side, so a carried
byte on the word side fell through to the plain char-wise matcher and
e.g. `[[ $x == ? ]]` wrongly failed for a one-byte word. Widen the gate
to either side and move it before the pattern-only fast paths (which verdict
on raw chars). Plain patterns + plain words unchanged.

Verified byte-identical vs GNU bash 5.3.20: carried-byte ?/* /literal/case
shapes, plus exp5.sub-style compound strips.
@caomengxuan666
caomengxuan666 merged commit f17feb5 into master Oct 21, 2026
8 checks passed
@caomengxuan666
caomengxuan666 deleted the fix/word-side-byte-matching branch October 23, 2026 08:54
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