Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Apr 2017 05:38:57 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 218806] bsdgrep(1)'s -o flag with context is completely wrong
Message-ID:  <bug-218806-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D218806

            Bug ID: 218806
           Summary: bsdgrep(1)'s -o flag with context is completely wrong
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: bsdports@kyle-evans.net
                CC: emaste@freebsd.org

Compare, with d_context_a.in from /usr/tests/usr.bin/grep:

$ gnugrep -C1 -o pig d_context_a.in=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20
pig
pig
--
pig
pig
pig
# Behavior is same on newer gnugrep.
$ grep -C1 -o pig d_context_a.in=20
pig
Boar, sow, barrow, or gilt --
pig
Though mountains may topple and tilt.
--
Though you may be thrown over by Tabby and Rover,
pig
pig
pig
                -- Thomas Pynchon, "Gravity's Rainbow"
# Ugh

I note here that it *looks* like we should do all of the normal context
behavior but not actually print the context, just the lines that actually
matched and the separators that comes with context. I'll have to create some
further test cases for different scenarios of overlapping/adjacency behavio=
r of
both matching lines and non-matching lines to make sure that's right.

This is likely a really strange corner case that probably won't have any
practical application, but consistency is good.

--=20
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-218806-8>