<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src-test2/usr.bin/grep/queue.c, branch releng/11.2</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src-test2/atom?h=releng%2F11.2</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src-test2/atom?h=releng%2F11.2'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/'/>
<updated>2018-03-05T07:26:05Z</updated>
<entry>
<title>MFC r326276:</title>
<updated>2018-03-05T07:26:05Z</updated>
<author>
<name>Eitan Adler</name>
<email>eadler@FreeBSD.org</email>
</author>
<published>2018-03-05T07:26:05Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=25d4b2c1b89d42d752e23f9935692f481cb272ea'/>
<id>urn:sha1:25d4b2c1b89d42d752e23f9935692f481cb272ea</id>
<content type='text'>
various: general adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.
</content>
</entry>
<entry>
<title>MFC r318574: bsdgrep: Correct per-line line metadata printing</title>
<updated>2017-08-17T04:30:31Z</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2017-08-17T04:30:31Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=fe826cdad4657a1d0a6490e154afc4bba1fd0981'/>
<id>urn:sha1:fe826cdad4657a1d0a6490e154afc4bba1fd0981</id>
<content type='text'>
Metadata printing with -b, -H, or -n flags suffered from a few flaws:

1) -b/offset printing was broken when used in conjunction with -o

2) With -o, bsdgrep did not print metadata for every match/line, just
   the first match of a line

3) There were no tests for this

Address these issues by outputting this data per-match if the -o flag is
specified, and prior to outputting any matches if -o but not --color,
since --color alone will not generate a new line of output for every
iteration over the matches.

To correct -b output, fudge the line offset as we're printing matches.

While here, make sure we're using grep_printline in -A context.  Context
printing should *never* look at the parsing context, just the line.

The tests included do not pass with gnugrep in base due to it exhibiting
similar quirky behavior that bsdgrep previously exhibited.

Approved by:	emaste (mentor, blanket MFC)
</content>
</entry>
<entry>
<title>bsdgrep: Don't allow negative context flags, add more tests</title>
<updated>2017-08-17T04:04:42Z</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2017-08-17T04:04:42Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=9e400810350813b8e1c372892a41111a8f4101ab'/>
<id>urn:sha1:9e400810350813b8e1c372892a41111a8f4101ab</id>
<content type='text'>
MFC r318302: bsdgrep: don't allow negative -A / -B / -C

Previously, when given a negative -A/-B/-C argument bsdgrep would
overflow the respective context flag(s) and exhibited surprising
behavior.

Fix this by removing unsignedness of Aflag/Bflag and erroring out if
we're given a value &lt; 0.  Also adjust the type used to track 'tail'
context in procfile() so that it accurately reflects the Aflag value
rather than overflowing and losing trailing context.

This also fixes an inconsistency previously existing between -n and
-C "n" behavior.  They are now both limited to LLONG_MAX, to be
consistent.

Add some test cases to make sure grep errors out properly for both
negative context values as well as non-numeric context values rather
than giving bogus matches.

MFC r318317: bsdgrep: add more tests for different binary flags

The existing 'binary' test in netbsd-tests/ does a basic check of the
default treatment for binary behavior, but not much more than that.
Given some opportunity for breakage recently that did not trigger any
failures, add some tests to cover the three different binary file
behaviors (a, -I, -U) and their --binary-files= equivalent values.

Approved by:	emaste (mentor, blanket MFC)
</content>
</entry>
<entry>
<title>bsdgrep: fix -w flag matching with an empty pattern</title>
<updated>2017-08-16T18:00:32Z</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2017-08-16T18:00:32Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=3299215e81c84d3a3b4c4b8c178c5689620a2fa7'/>
<id>urn:sha1:3299215e81c84d3a3b4c4b8c178c5689620a2fa7</id>
<content type='text'>
MFC r317703: bsdgrep: fix -w flag matching with an empty pattern

-w flag matching with an empty pattern was generally 'broken', allowing
matches to occur on any line whether or not it actually matches -w
criteria.

This fix required a good amount of refactoring to address.  procline()
is altered to *only* process the line and return whether it was a match
or not, necessary to be able to short-circuit the whole function in case
of this matchall flag. -m flag handling is moved out as well because it
suffers from the same fate as context handling if we bypass any actual
pattern matching.

The matching context (matches, mostly) didn't previously exist outside
of procline(), so we go ahead and create context object for file
processing bits to pass around.  grep_printline() was created due to
this, for the scenarios where the matches don't actually matter and we
just want to print a line or two, a la flushing the context queue and
no -o or --color specified.

Damage from this broken behavior would have been mitigated by the fact
that it is unlikely users would invoke grep -w with an empty pattern.

This was identified while checking PR 105221 for problems it this may
cause in BSD grep, but PR 105221 is *not* a report of this behavior.

MFC r317741: bsdgrep: correct uninitialized variable introduced in r317703

MFC r317842: bsdgrep: don't ouptut matches with -c, -l, -L

Refactoring done in r317703 broke -c, -l, and -L flags implying
suppression of match printing.  Fortunately this is just a matter of not
doing any printing of the resulting matches and context printing was not
broken in this refactoring.

Add some regression tests since this area may still see further
refactoring, include different context flags as well even though they
were not broken in this case.

PR:		219077
Approved by:	emaste (mentor, blanket MFC)
</content>
</entry>
<entry>
<title>grep: fix some memory leaks.</title>
<updated>2014-07-17T15:59:13Z</updated>
<author>
<name>Pedro F. Giffuni</name>
<email>pfg@FreeBSD.org</email>
</author>
<published>2014-07-17T15:59:13Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=8e5fc70f15b84a2953e6322372dd152925f34f39'/>
<id>urn:sha1:8e5fc70f15b84a2953e6322372dd152925f34f39</id>
<content type='text'>
Add memory leak fix missing from r268799.

Obtained from:	NetBSD
</content>
</entry>
<entry>
<title>grep: fix some memory leaks.</title>
<updated>2014-07-17T15:48:11Z</updated>
<author>
<name>Pedro F. Giffuni</name>
<email>pfg@FreeBSD.org</email>
</author>
<published>2014-07-17T15:48:11Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=f3f50de623c6cdb8ad4c1a2ce4d01fd32214c2af'/>
<id>urn:sha1:f3f50de623c6cdb8ad4c1a2ce4d01fd32214c2af</id>
<content type='text'>
Bring a couple of changes from NetBSD:

queue.c (CVS Rev. 1.4. 1.5)
Fix memory leaks.
NULL does not need a cast.

grep.c (CVS Rev. 1.6)
Use the more portable getline.

Obtained from:	NetBSD
MFC after:	3 days
</content>
</entry>
<entry>
<title>- Adjust a comment to actual behaviour</title>
<updated>2011-04-07T13:03:35Z</updated>
<author>
<name>Gabor Kovesdan</name>
<email>gabor@FreeBSD.org</email>
</author>
<published>2011-04-07T13:03:35Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=b66a823be88d3f3dab30b6beb083a3ef994cbe15'/>
<id>urn:sha1:b66a823be88d3f3dab30b6beb083a3ef994cbe15</id>
<content type='text'>
- Makefile nit
- Add more CVS/SVN keywords to make it easier to track changes from NetBSD
  in case they add further improvements

Approved by:	delphij (mentor)
Obtained from:	The NetBSD Project
</content>
</entry>
<entry>
<title>UTFize my name.</title>
<updated>2010-08-19T09:28:59Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2010-08-19T09:28:59Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=a0ef9ad699a02f3a706d16a525f0c4d243c71c34'/>
<id>urn:sha1:a0ef9ad699a02f3a706d16a525f0c4d243c71c34</id>
<content type='text'>
</content>
</entry>
<entry>
<title>- Revert strlcpy() changes to memcpy() because it's more efficient and</title>
<updated>2010-08-15T22:15:04Z</updated>
<author>
<name>Gabor Kovesdan</name>
<email>gabor@FreeBSD.org</email>
</author>
<published>2010-08-15T22:15:04Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=59218eb770e61b578f0ab296afbbfb381c211939'/>
<id>urn:sha1:59218eb770e61b578f0ab296afbbfb381c211939</id>
<content type='text'>
  former may be safer but in this case it doesn't add extra
  safety [1]
- Fix -w option [2]
- Fix handling of GREP_OPTIONS [3]
- Fix --line-buffered
- Make stdin input imply --line-buffered so that tail -f can be piped
  to grep [4]
- Imply -h if single file is grepped, this is the GNU behaviour
- Reduce locking overhead to gain some more performance [5]
- Inline some functions to help the compiler better optimize the code
- Use shortcut for empty files [6]

PR:		bin/149425 [6]
Prodded by:	jilles [1]
Reported by:	Alex Kozlov &lt;spam@rm-rf.kiev.ua&gt; [2] [3],
		swell.k@gmail.com [2],
		poyopoyo@puripuri.plala.or.jp [4]
Submitted by:	scf [5],
		Shuichi KITAGUCHI &lt;ki@hh.iij4u.or.jp&gt; [6]
Approved by:	delphij (mentor)
</content>
</entry>
<entry>
<title>- Use the traditional behaviour for filename and directory name inclusion</title>
<updated>2010-07-29T00:11:14Z</updated>
<author>
<name>Gabor Kovesdan</name>
<email>gabor@FreeBSD.org</email>
</author>
<published>2010-07-29T00:11:14Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=55e44f511ddc3d5684f5c06220101eba4166ff55'/>
<id>urn:sha1:55e44f511ddc3d5684f5c06220101eba4166ff55</id>
<content type='text'>
  and exclusion patterns [1]
- Some improvements on the exiting code, like replacing memcpy with
  strlcpy/strcpy

Approved by:	delphij (mentor)
Pointed out by:	bf [1], des [1]
</content>
</entry>
</feed>
