bug#22655: grep -Pz '^' now fails!

2016-11-18 Thread Stephane Chazelas
Hello, I'm just finding out that ^ and $ no longer work with grep -Pz: https://unix.stackexchange.com/questions/324263/grep-command-doesnt-support-and-anchors-when-its-with-pz $ grep -Pz '^' grep: unescaped ^ or $ not supported with -Pz Which points to this bug. Note that, it's not that pcre do

bug#22655: grep -Pz '^' now fails!

2016-11-18 Thread Paul Eggert
Stephane Chazelas wrote: Can that bug please be reopened so it can be addressed differenly (PCRE_MULTILINE removed, PCRE_DOLLAR_ENDONLY added)? Removing PCRE_MULTILINE will make 'grep' wy slower. Can you think of a way of fixing the bug that doesn't involve removing PCRE_MULTILINE?

bug#22655: grep -Pz '^' now fails!

2016-11-18 Thread Stephane Chazelas
2016-11-18 07:54:29 -0800, Paul Eggert: > Stephane Chazelas wrote: > >Can that bug please be reopened so it can be addressed > >differenly (PCRE_MULTILINE removed, PCRE_DOLLAR_ENDONLY added)? > > Removing PCRE_MULTILINE will make 'grep' wy slower. Can you > think of a way of fixing the bug tha

bug#22655: grep -Pz '^' now fails!

2016-11-18 Thread Stephane Chazelas
2016-11-18 16:24:02 +, Stephane Chazelas: [...] > Why would it make it slower. AFAICT, PCRE_MULTILINE *adds* > some overhead. It is really meant to be only about changing the > behaviour of ^ and $. [...] Unsurprisingly, where ~/a contains the output of find / -print0 (which is typically what

bug#22655: grep -Pz '^' now fails!

2016-11-18 Thread Paul Eggert
Stephane Chazelas wrote: Why would it make it slower. AFAICT, PCRE_MULTILINE *adds* some overhead. As I understand it, PCRE_MULTILINE lets 'grep' apply a pattern to an entire buffer that contains many lines, and this lets PCRE efficiently find the first match in the whole buffer. If grep does

bug#22655: grep -Pz '^' now fails!

2016-11-18 Thread Stephane Chazelas
2016-11-18 08:48:04 -0800, Paul Eggert: > Stephane Chazelas wrote: > >Why would it make it slower. AFAICT, PCRE_MULTILINE *adds* > >some overhead. > > As I understand it, PCRE_MULTILINE lets 'grep' apply a pattern to an > entire buffer that contains many lines, and this lets PCRE > efficiently fin

bug#22655: grep -Pz '^' now fails!

2016-11-18 Thread Stephane Chazelas
2016-11-18 17:06:36 +, Stephane Chazelas: [...] > That might have been the case a long time ago, as I remember > some discussion about it as it explained some wrong information > in the documentation, but as far as I and gdb can tell, grep > 2.26 at least call pcre_exec for every line of the in

bug#16871: doc/test confusions with grep -P

2016-11-18 Thread Stephane Chazelas
For the record, the doc/test confusion was fixed by commit b73296ace186451b096b075461634c153d1fa525 http://git.savannah.gnu.org/cgit/grep.git/commit/?id=b73296ace186451b096b075461634c153d1fa525 See also https://debbugs.gnu.org/cgi/bugreport.cgi?bug=22655#47 and below about PCRE_MULTILINE.

bug#22655: grep -Pz '^' now fails!

2016-11-18 Thread Stephane Chazelas
2016-11-18 17:32:59 +, Stephane Chazelas: [...] > And PCRE_MULTILINE now can only improve performance. [...] Sorry, I meant "and *removing* PCRE_MULTILINE now can only improve performance". (and we need to add PCRE_DOLLAR_ENDONLY or otherwise printf 'a\n\0' | grep -Pz 'a$' would still match).

bug#22655: grep -Pz '^' now fails!

2016-11-18 Thread Paul Eggert
Stephane Chazelas wrote: $ time grep -Pz '(?-m)^/' ~/a > /dev/null It looks like you want "^" to stand for a newline character, not the start of a line. That is not how grep -z works. -z causes the null byte to be the line delimiter, and "^" should stand for a position immediately after a nul

bug#22655: grep -Pz '^' now fails!

2016-11-18 Thread Stephane Chazelas
2016-11-18 09:47:50 -0800, Paul Eggert: > Stephane Chazelas wrote: > >$ time grep -Pz '(?-m)^/' ~/a > /dev/null > > It looks like you want "^" to stand for a newline character, not the > start of a line. That is not how grep -z works. -z causes the null > byte to be the line delimiter, and "^" sho

bug#22655: grep -Pz '^' now fails!

2016-11-18 Thread Paul Eggert
Stephane Chazelas wrote: 2016-11-18 08:48:04 -0800, Paul Eggert: Stephane Chazelas wrote: Why would it make it slower. AFAICT, PCRE_MULTILINE *adds* some overhead. As I understand it, PCRE_MULTILINE lets 'grep' apply a pattern to an entire buffer that contains many lines, and this lets PCRE e