Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug: zsh crashed when completing with pattern
- X-seq: zsh-workers 54207
- From: Ma Rocket <ma2014119@xxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Subject: Re: Bug: zsh crashed when completing with pattern
- Date: Mon, 23 Feb 2026 06:21:18 +0000
- Accept-language: zh-CN, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=N9gWpGG+UaCoYDKnF2MYxtwVSW4v5VesBuPbEdq78o8=; b=gdE9eaGaoExRlgBDfg81lZgX3voIceONxoQCBq3VuUFu++mIowje19nmDKN6MkQhHCFjlbJIPO0XGJp+KStdUPEW3RtbM+snoLsdLbo2TxzLHCjmZJo5nSFFdKcFBHOdeA5ncd1wmvGojYJb2x9SMNiRwlrSyYA+TpfHtgQrR0NF7khFeuNx45kaDbWPOlh1u8foYDuyVE86cPPz7cJdzSoEnHoL10JwMfQ0dem8ZuuOgm+pKBIjT75bUDq9K6+naAP4VpoWjnLglpyDJpuUMuGC/jxyoKg3kcXCqk2jwk+kNdN+vtSOeBfBMYHNviYSLvw9jvgJZknlAT36gWDyWQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fKcuMtAG4x7LpZYiK2eNzueYZ2ZHc4fKvKBl051sRURzDz9Rk44AohmeDoALJ4tneqkZrERdSNpsvvLtzWDVq/ayuVxlUsEMgkyQgS/prkkt2qnYhrY7UoS2Q9jwrh3erij16WsA4e7U6BRxSWAnq8snrgKrnVLoaPYX+8ZcFfnFGypl4SmT+d5V2j8juQ0JGT275qSt8U1eIXrjQy3qZST2gAREThgcB6eF9Sj7IHTDvbzDNV1uT+uzJI1351ZLzb5rJ7Vrn2SNwWYLa1sUvcIGuG15rkreyfO0jTP/4buMzyR9Q6RC5Lj/R44GkT+rrbJ/XOJCzwJLGpUr+QvBog==
- Archived-at: <https://zsh.org/workers/54207>
- In-reply-to: <CAH+w=7ZSwnd4ooNgJzHWh-2LOYub+ARN+UHwPVo95fLBmHUAVA@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- Msip_labels:
- References: <SYAPR01MB2781D475F6BFF1638B4AE9C8EE76A@SYAPR01MB2781.ausprd01.prod.outlook.com> <CAH+w=7ZSwnd4ooNgJzHWh-2LOYub+ARN+UHwPVo95fLBmHUAVA@mail.gmail.com>
- Thread-index: AQHcpBcBa35MVmsOqkKaEHjsxJlbRrWPkUeAgAA8P+8=
- Thread-topic: Bug: zsh crashed when completing with pattern
> It's the parse of the _arguments argument that's at fault.
> Patch below fixes the core dump, but your _arguments syntax is
> wrong. The colons separate parts of the argument spec, so you need to
> protect any that are part of the pattern.
>
> Also, do you perhaps mean [[\:digit\:]] ?
Yes, that's what I mean, I have no idea on zsh pattern writing...
> Note, I'm not 100% sure that the patched test for endpat shouldn't be
> (!endpat || pattry(endpat,line))
> but it doesn't seem to make any difference. Anyone?
After digging into code, I find that it's because zsh failed to compile the pattern.
Src/Zle/computil.c#L2356
endpat = patcompile(state.def->end, 0, NULL);
I did some debug and found that endpat is NULL, which should mean the compilation
failed. Note, another pattern compilation at L2341 should also be considered.
I think zsh should throw an error when zsh fails to compile state.def->end, so that
following code is aborted; or silently treat wrong pattern as no pattern, in this case,
state.def->end && endpat && pattry(endpat, line) should be used to keep
completing current argument.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author