Re: [PATCH] parser: Only reject non-word tokens in case pattern

Nicolas Cavallari <[email protected]> Mon, 13 Apr 2026 10:01:57 +0200
Newsgroups org.kernel.vger.dash
Message-ID <[email protected]>
Le 12/04/2026 à 11:45, Herbert Xu a écrit :
> Nicolas Cavallari <[email protected]> wrote:
>> This syntax is accepted by all shells except dash 0.5.13.2:
>>
>> case "$test" in
>> in) echo input;;
>> out) echo output;;
>> do) echo start;;
>> done) echo stop;;
>> esac
>>
>> on dash 0.5.13.2, it fails with "Syntax error: "in" unexpected (expecting word)".
>> Reverting e8c0324af64c("parser: Catch bogus case patterns") fixes it.
>>
>> POSIX says that only esac should be recognized as a keyword when parsing the
>> first pattern of a case.
>>
>> An example of a real script broken by this change:
>>
>> https://salsa.debian.org/debian/netplug/-/blob/debian/unstable/scripts/netplug?ref_type=heads
> 
> Thanks for the report.  This patch should fix the problem:

Indeed, this patch works.  Thanks for the fix !