The following reply was made to PR bin/166842; it has been noted by GNATS.

From: Jim Pryor <dubious...@gmail.com>
To: bug-follo...@freebsd.org
Cc:  
Subject: Re: bin/166842: bsdgrep(1) inconsistently handles ^ in non-anchoring
 positions
Date: Wed, 11 Apr 2012 15:21:01 -0400

 I've noticed some more issues with the same version of grep. I don't
 know whether they're related, but I'll append them here for now.
 
 $ printf abc | grep -o '^[a-c]'
 
 should just print 'a', but instead gives three hits, against each letter
 of the incoming text. The same issue occurs when handling multiline
 buffers:
 
 $ printf 'abc\ndef' | grep -o --null '^[a-f]'
 
 incorrectly matches 6 times.
 
 $ printf 'abc\ndef' | grep -o --null '[a-f]$'
 
 correctly only matches 'c' and 'f'.
 
 
 $ printf 'abc\ndef' | grep -o --null '\`[a-f]'
 
 has the same issue as ^, whereas:
 
 $ printf 'abc\ndef' | grep -o --null '[a-f]\'\'
 
 matches 'c' and 'f'. To fix \` in a way that matches the behavior of \',
 it should only match the 'a' and 'd'. In fact, though, both of these
 should only match against a single character: 'a' for \` and 'f' for \'.
 That's the specified behavior of these Gnu extensions, and how they
 behave in the Gnu grep and BusyBox grep implementations I'm testing
 against. If that behavior isn't going to be provided, then wouldn't it'd
 be better for these extensions not even pretend to be present? And so,
 just match against a literal ` or '?
 -- 
 dubious...@gmail.com
 
_______________________________________________
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to