From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 418 invoked by alias); 15 Sep 2016 13:15:47 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 39346 Received: (qmail 245 invoked from network); 15 Sep 2016 13:15:47 -0000 X-Qmail-Scanner-Diagnostics: from wirrsal.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(37.221.198.119):SA:0(-2.3/5.0):. Processed in 0.486047 secs); 15 Sep 2016 13:15:47 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=RP_MATCHES_RCVD,SPF_PASS, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: seb@wirrsal.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at wirrsal.net designates 37.221.198.119 as permitted sender) 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= User-agent: mu4e 0.9.17; emacs 24.5.1 From: Sebastian =?utf-8?Q?Reu=C3=9Fe?= To: zsh-workers@zsh.org Subject: [BUG] PCRE match hangs when matching U+00A0 Date: Thu, 15 Sep 2016 15:06:34 +0200 Message-ID: <87mvj9uxb9.fsf@wirrsal.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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 ) 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