|
From: | Paul Eggert |
Subject: | bug#18266: grep -P and invalid exits with error |
Date: | Tue, 09 Sep 2014 17:00:51 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 |
Norihiro Tanaka wrote:
I see that new version has no response for following test which was used previously. printf '\x80ab\n' | env LC_ALL=en_US.utf8 src/grep -P '.?b'
Thanks for reporting that. The test case works for me (Fedora 20 x86-64, GCC 4.9.1):
$ printf '\x80ab\n' | env LC_ALL=en_US.utf8 src/grep -P '.?b' | od -c 0000000 200 a b \n 0000004Fedora 20 is using pcre version 8.33-6.fc20; perhaps there's a PCRE version dependency here? Can you use GDB to put a breakpoint on pcre_exec and see what values it's returning, and what it's storing into sub[0] and sub[1]? Here's what I see (I compiled grep with '-g3 -O0'):
$ printf '\x80ab\n' >in $ gdb src/grep ... (gdb) b pcre_exec ... (gdb) r -P '.?b' in ... (gdb) fin ... (gdb) n ... (gdb) p e $1 = -10 (gdb) c ... (gdb) fin ... (gdb) n ... (gdb) p e $2 = -1 (gdb) c ... (gdb) fin ... (gdb) n ... (gdb) p e $3 = 1 (gdb) p sub[0] $4 = 0 (gdb) p sub[1] $5 = 2 (gdb) p p $6 = 0x62f001 "ab\n" (gdb) p buf $7 = 0x62f000 "\200ab\n"That is, the first call to pcre_exec reports the encoding error, the second one (on the empty string) reports no match, and the third one (on "ab") finds the match.
[Prev in Thread] | Current Thread | [Next in Thread] |