Date: Sat, 06 Dec 2014 23:35:11 +0000 From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 195763] New: bsdgrep, empty matches and -o Message-ID: <bug-195763-8@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195763 Bug ID: 195763 Summary: bsdgrep, empty matches and -o Product: Base System Version: 10.1-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Many People Priority: --- Component: bin Assignee: freebsd-bugs@FreeBSD.org Reporter: dt71@gmx.com bsdgrep(1) behaves weirdly when, apparently, an empty (sub)string is matched. === a session on FreeBSD (10.1-RELEASE) begins === $ echo '01:1:01' | grep -Eo '(^|:)0*' 0 $ # hey, what gives? $ echo '01:1:01' | bsdgrep -Eo '(^|:)0*' 0 : :0 $ # ah, old bugz :} $ echo '1:1:01' | grep -Eo '(^|:)0*' $ # surely, this is the same bug $ echo '1:1:01' | bsdgrep -Eo '(^|:)0*' $ # wtf? === a session on FreeBSD (10.1-RELEASE) ends === OK, let's see Linux. === a session on a GNU/Linux distrubution begins === $ echo '01:1:01' | grep -Eo '(^|:)0*' 0 : :0 $ # OK, just like BSD-grep $ echo '1:1:01' | grep -Eo '(^|:)0*' : :0 $ # correct! === a session on a GNU/Linux distrubution ends === More testing: === a session on FreeBSD (10.1-RELEASE) begins === $ echo 'bla bla' | bsdgrep -Eo '[[:alnum:]]*' bla $ # ??? $ printf 'bla\nbla\n' | bsdgrep -Eo '' bla bla $ # ... === a session on FreeBSD (10.1-RELEASE) ends === === a session on a GNU/Linux distrubution ends === $ echo 'bla bla' | bsdgrep -Eo '[[:alnum:]]*' bla bla $ # most sensible $ printf 'bla\nbla\n' | bsdgrep -Eo '' $ # also sensible === a session on a GNU/Linux distrubution ends === -- You are receiving this mail because: You are the assignee for the bug.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-195763-8>