You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[bug] Parser over-lax ×4 from the ShellCheck unit-test corpus: [[ 3 \< 4 ]], 'true | ! true', var=( (1 2) (3 4) ), var=(1 [2]=(3 4)) — all rejected by GNU 5.3.0 #360
Found by ecosweep4 lane (wt22/nest22; corpus: ShellCheck's own embedded unit tests, 2164 prop_* snippets extracted from src/ShellCheck/*.hs, bash -n rc-parity vs WSL GNU Bash 5.3.0 script-file runs; worktree base a522eb3, release build).
2164 probes: 2157 parity, 7 divergent → 4 distinct shapes. This issue = the 4 over-lax shapes (rubash rc=0 accept where GNU rc=1/2 rejects); the 1 over-strict shape is a separate issue.
1. [[ 3 \< 4 ]] — escaped operator in conditional
rubash -n: rc=0 (accepted)
GNU 5.3.0: line 1: unexpected token <', conditional binary operator expected+syntax error near `<`` (rc=2)
GNU owner: parse.y:5080 cond_term() — after the lhs WORD, the binary-operator slot only accepts WORDs in test_binop() or the raw tok == '<' || tok == '>' tokens (parse.y:5156-5174); the escaped \< arrives as a WORD that matches neither → the error branch at parse.y:5179-5191. rubash accepts \< as an operator.
2. true | ! true — ! after a pipe
rubash: rc=0 (accepted)
GNU: syntax error near unexpected token !`` (rc=2)
GNU owner: parse.y:1410 pipeline_command: ... | BANG pipeline_command — ! may only prefix a whole pipeline_command, never appear in command position after |. rubash admits the reserved word mid-pipeline. (Same text appears twice in the corpus: Parser_2066/ShellSupport_1846 shapes.)
GNU: syntax error near unexpected token ('` (rc=2)
GNU owner: parse.y:7104 parse_compound_assignment() — the element loop (~parse.y:7145) accepts only WORD and ASSIGNMENT_WORD tokens; a bare ( subshell token inside the array body hits the error path. Note foo=([) over-acceptance was already filed in rubash#221 for the mvdan corpus — same acceptance surface, different constructs (parenthesized element and per-index [i]=(...) compound), both still accepted at this base.
Classification: rubash-caused (parser admission), over-lax direction. Related families: #220 (mksh/zsh operators over-lax), #221 (GNU-invalid constructs over-lax) — these four shapes are NOT covered by the mvdan corpus.
Fixed by wt22/p0fix (7c4d580, master 3ade4b2): four over-lax admissions, all GNU-anchored. (1) [[ 3 < 4 ]] — the operator slot matched on the DEQUOTED value; now matches on the raw (GNU tests the word text before quote removal) and the error text/offending-line echo uses the raw with the full physical line (print_offending_line parse.y:6814). (2) true | ! true — BANG admission now rejects immediately-after-a-pipeline-segment (parse.y:1408-1413: BANG only prefixes a whole pipeline_command); &&/;/if/{ } all still legal (GNU matrix). (3)(4) array ( element positions and after [i]=( — the compound-assignment ctrl-op scanner gains ( (parse.y:7104-7160 element loop takes WORD/ASSIGNMENT_WORD only). Full ShellCheck corpus re-run: 2163/2164 (the one left is #361). cond 100=100, array 8=8, errors 2=2. 9 regressions.
Activity
fix(#360): reject the four over-lax parser admissions (conditional op…
caomengxuan666 commentedon Sep 30, 2026
Fixed by wt22/p0fix (7c4d580, master 3ade4b2): four over-lax admissions, all GNU-anchored. (1) [[ 3 < 4 ]] — the operator slot matched on the DEQUOTED value; now matches on the raw (GNU tests the word text before quote removal) and the error text/offending-line echo uses the raw with the full physical line (print_offending_line parse.y:6814). (2) true | ! true — BANG admission now rejects immediately-after-a-pipeline-segment (parse.y:1408-1413: BANG only prefixes a whole pipeline_command); &&/;/if/{ } all still legal (GNU matrix). (3)(4) array ( element positions and after [i]=( — the compound-assignment ctrl-op scanner gains ( (parse.y:7104-7160 element loop takes WORD/ASSIGNMENT_WORD only). Full ShellCheck corpus re-run: 2163/2164 (the one left is #361). cond 100=100, array 8=8, errors 2=2. 9 regressions.