Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[BUG] PCRE match hangs when matching U+00A0
- X-seq: zsh-workers 39346
- From: Sebastian Reuße <seb@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [BUG] PCRE match hangs when matching U+00A0
- Date: Thu, 15 Sep 2016 15:06:34 +0200
- Authentication-results: mail.wirrsal.net; dmarc=none header.from=wirrsal.net
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wirrsal.net; s=wirrsal; t=1473944796; bh=tmPcuD8PruWaJe/LG6MsFcodokVCZXC4RtrCawirfGo=; h=From:To:Subject:Date; b=FbYOAbRrm19VVHnEB2Y5AcFBv3RlaweUWrtReeHsjnEegzxxRi1rlPFKGDqSHp82m cMAHGWZuA2k9nyOFXPydXCICi97eRTAdB0KEyK8PKKoymUXcPVHbCvK33kn+Vkf1A+ Gy13d/MSr7NLCzZ0tkVFF5LcZbw/8Itof4yTqqVk=
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
After enabling the shell option «rematchpcre», a zsh (ver. 5.2) match
freezes when the matched string contains the character «NO-BREAK SPACE»
(U+00A0).
This may be reproduced by running the following:
setopt rematchpcre
s=$(echo -en \\ua0)
[[ $s =~ . ]]
This occurred while using the en_US.utf-8 locale.
The hang seems to arise from an infinite loop at pcre.c:202
(zpcre_get_substrings). At least gdb never showed zsh returning from
this stack frame. A typical backtrace after interrupting the loop is:
#0 mb_metacharlenconv_r (s=0x716542 "\240b", wcp=0x0, mbsp=0x6d8f28 <mb_shiftstate>) at utils.c:4988
#1 0x00000000004a7143 in mb_metacharlenconv (s=0x716542 "\240b", wcp=0x0) at utils.c:5031
#2 0x00007ffff5eec71d in zpcre_get_substrings (arg=0x716540 "a b", ovec=0x7165e0, ret=1, matchvar=0x7ffff5eed0df "MATCH", substravar=0x7ffff5eed0e5 "match", want_offset_pair=0, matchedinarr=0, want_begin_end=1) at pcre.c:204
#3 0x00007ffff5eecf4b in cond_pcre_match (a=0x7ffff7ff2778, id=0) at pcre.c:389
#4 0x0000000000426574 in evalcond (state=0x7fffffffdab0, fromtest=0x0) at cond.c:155
#5 0x0000000000433d5a in execcond (state=0x7fffffffdab0, do_exec=0) at exec.c:4530
#6 0x000000000042a42d in execsimple (state=0x7fffffffdab0) at exec.c:1131
#7 0x000000000042a7a2 in execlist (state=0x7fffffffdab0, dont_change_job=0, exiting=0) at exec.c:1255
#8 0x000000000042a14a in execode (p=0x7ffff7ff25e8, dont_change_job=0, exiting=0, context=0x4b17b7 "toplevel") at exec.c:1075
#9 0x000000000044b8a9 in loop (toplevel=1, justonce=0) at init.c:208
#10 0x000000000044f144 in zsh_main (argc=2, argv=0x7fffffffdd88) at init.c:1680
#11 0x000000000040f366 in main (argc=2, argv=0x7fffffffdd88) at ./main.c:93
While stepping through, I’ve also noticed that mb_metacharlenconv_r hits:
4991 return 0; /* Probably shouldn't happen */
Best regards,
Sebastian Reuße
Messages sorted by:
Reverse Date,
Date,
Thread,
Author