History log of /freebsd/contrib/netbsd-tests/usr.bin/grep/t_grep.sh (Results 1 – 25 of 61)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1070477c 08-Feb-2025 Craig Leres <leres@FreeBSD.org>

Fix remaining zgrep(1) wrapper script regressions

Summary:
Fix short flags without whitespace, e.g:

zgrep -wefoo test

Fix multiple -e flags:

zgrep -e foo -e xxx test

Previously only the

Fix remaining zgrep(1) wrapper script regressions

Summary:
Fix short flags without whitespace, e.g:

zgrep -wefoo test

Fix multiple -e flags:

zgrep -e foo -e xxx test

Previously only the last pattern would be used.

Clean up possible leading blank in ${grep_args}.

Update comment: 2.51 -> 2.6.0

Add a test case for the last known zgrep wrapper issue: recursion
(-r) not implemented.

Reviewers: markj, kevans, ngie, bapt

Reviewed By: markj

Subscribers: imp

Differential Revision: https://reviews.freebsd.org/D48873

show more ...


Revision tags: release/14.1.0-p7, release/14.2.0-p1, release/13.4.0-p3, release/14.2.0, release/13.4.0
# a700bef1 07-Sep-2024 Mark Johnston <markj@FreeBSD.org>

netbsd-tests: Update a test case to chase grep symlink handling changes

This test case verifies that grep detects symlink loops when traversing
a directory hierarchy.

Fixes: fc12c191c087 ("grep: D

netbsd-tests: Update a test case to chase grep symlink handling changes

This test case verifies that grep detects symlink loops when traversing
a directory hierarchy.

Fixes: fc12c191c087 ("grep: Default to -p instead of -S.")
Reviewed by: ngie, jhb
Reported by: Jenkins
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D46544

show more ...


Revision tags: release/14.1.0, release/13.3.0, release/14.0.0, release/13.2.0, release/12.4.0, release/13.1.0, release/12.3.0, release/13.0.0
# 3e2d96ac 08-Feb-2021 Kyle Evans <kevans@FreeBSD.org>

grep: fix -A handling in conjunction with -m match limitation

The basic issue here is that grep, when given -m 1, would stop all
line processing once it hit the match count and exit immediately. Th

grep: fix -A handling in conjunction with -m match limitation

The basic issue here is that grep, when given -m 1, would stop all
line processing once it hit the match count and exit immediately. The
problem with exiting immediately is that -A processing only happens when
subsequent lines are processed and do not match.

The fix here is relatively easy; when bsdgrep matches a line, it resets
the 'tail' of the matching context to the value supplied to -A and
dumps anything that's been queued up for -B. After the current line has
been printed and tail is reset, we check our mcount and do what's
needed. Therefore, at the time that we decide we're doing nothing, we
know that 'tail' of the context is correct and we can simply continue
on if there's still more to pick up.

With this change, we still bail out immediately if there's been no -A
flag. If -A was supplied, we signal that we should continue on. However,
subsequent lines will not even bothere to try and process the line. We
have reached the match count, so even if the next line would match then
we must process it if it hadn't. Thus, the loop in procfile() can
short-circuit and just process the line as a non-match until
procmatches() indicates that it's safe to stop.

A test has been added to reflect both that we should be picking up the
next line and that the next line should be considered a non-match even
if it should have been.

PR: 253350
MFC-after: 3 days

show more ...


# f823c6dc 04-Feb-2021 Kyle Evans <kevans@FreeBSD.org>

grep: fix null pattern and empty pattern file behavior

The null pattern semantics were terrible because I tried to match gnugrep,
but I got it wrong. Let's unwind that:

- The null pattern should m

grep: fix null pattern and empty pattern file behavior

The null pattern semantics were terrible because I tried to match gnugrep,
but I got it wrong. Let's unwind that:

- The null pattern should match every line if neither -w nor -x.
- The null pattern should match empty lines if -x.
- The null pattern should not match any lines if -w.

The first two will stop processing (shortcut) even if additional patterns
are specified. In any other case, we will continue processing other
patterns. If no other patterns are specified beside a null pattern, then
we match if neither -w nor -x or set and do not match if either of those
are specified.

The justification for -w is that it should match on a whole word, but the
null pattern deos not have a whole word to match on.

Empty pattern files should never match anything, and more importantly, -v
should cause everything to be written.

PR: 253209
MFC-after: 4 days

show more ...


Revision tags: release/12.2.0
# 63c8336d 01-Oct-2020 Eric van Gyzen <vangyzen@FreeBSD.org>

zgrep: fix exit status with multiple files

zgrep should exit with success when given multiple files and the
pattern is found in at least one file. Prior to this change,
it would exit with success o

zgrep: fix exit status with multiple files

zgrep should exit with success when given multiple files and the
pattern is found in at least one file. Prior to this change,
it would exit with success only if the pattern was found in _every_ file.

Reviewed by: dab ngie
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D26616

show more ...


# c7aa572c 31-Jul-2020 Glen Barber <gjb@FreeBSD.org>

MFH

Sponsored by: Rubicon Communications, LLC (netgate.com)


# c4cbf1fb 21-Jul-2020 Craig Leres <leres@FreeBSD.org>

Fix some regressions with the zgrep(1) wrapper.

- Handle whitespace with long flags that take arguments:

echo 'foo bar' > test
zgrep --regexp='foo bar' test

- Do not hang reading from stdin wi

Fix some regressions with the zgrep(1) wrapper.

- Handle whitespace with long flags that take arguments:

echo 'foo bar' > test
zgrep --regexp='foo bar' test

- Do not hang reading from stdin with patterns in a file:

echo foobar > test
echo foo > pattern
zgrep -f pattern test
zgrep --file=pattern test

- Handle any flags after -e:

echo foobar > test
zgrep -e foo --ignore-case < test

These two are still outstanding problems:

- Does not handle flags that take an argument if there is no
whitespace:

zgrep -enfs /etc/rpc

- When more than one -e pattern used matching should occur for all
patterns (similar to multiple patterns supplied with -f file).
Instead only the last pattern is used for matching:

zgrep -e rex -e nfs /etc/rpc

(This problem is masked in the unpatched version by the "any
flags after -e" problem.)

Add tests for the above problems.

Update the mange and add references to gzip(1) and zstd(1) and also
document the remaining known problems.

PR: 247126
Approved by: markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25613

show more ...


Revision tags: release/11.4.0, release/12.1.0
# 668ee101 26-Sep-2019 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r352587 through r352763.


# 38325e2a 25-Sep-2019 Kyle Evans <kevans@FreeBSD.org>

bsdgrep(1): various fixes of empty pattern/exit code/-c behavior

When an empty pattern is encountered in the pattern list, I had previously
broken bsdgrep to count that as a "match all" and ignore a

bsdgrep(1): various fixes of empty pattern/exit code/-c behavior

When an empty pattern is encountered in the pattern list, I had previously
broken bsdgrep to count that as a "match all" and ignore any other patterns
in the list. This commit rectifies that mistake, among others:

- The -v flag semantics were not quite right; lines matched should have been
counted differently based on whether the -v flag was set or not. procline
now definitively returns whether it's matched or not, and interpreting
that result has been kicked up a level.
- Empty patterns with the -x flag was broken similarly to empty patterns
with the -w flag. The former is a whole-line match and should be more
strict, only matching blank lines. No -x and no -w will will match the
empty string at the beginning of each line.
- The exit code with -L was broken, w.r.t. modern grep. Modern grap will
exit(0) if any file that didn't match was output, so our interpretation
was simply backwards. The new interpretation makes sense to me.

Tests updated and added to try and catch some of this.

This misbehavior was found by autoconf while fixing ports found in PR 229925
expecting either a more sane or a more GNU-like sed.

MFC after: 1 week

show more ...


Revision tags: release/11.3.0, release/12.0.0, release/11.2.0
# 52cf8965 07-Jun-2018 Kyle Evans <kevans@FreeBSD.org>

netbsd-tests: bsdgrep(1): Add a test for -m, too


# ce024bdc 07-Jun-2018 Kyle Evans <kevans@FreeBSD.org>

netbsd-tests: grep(1): Add test for -c flag

Someone might be inclined to accidentally break this. someone might have
written said test because they broke it locally.


# acfa114e 29-Jan-2018 Kyle Evans <kevans@FreeBSD.org>

Remove t_grep:mmap_eof_not_eol test

The test was marked as an expected failure in r320414 after r319971's import
of a newer jemalloc removed an essential feature (opt.redzone) for
reproducing the be

Remove t_grep:mmap_eof_not_eol test

The test was marked as an expected failure in r320414 after r319971's import
of a newer jemalloc removed an essential feature (opt.redzone) for
reproducing the behavior it was testing. Since then, no way has been found
or demonstrated to reliably test the behavior, so remove the test.

PR: 220309

show more ...


Revision tags: release/10.4.0
# b754c279 13-Sep-2017 Navdeep Parhar <np@FreeBSD.org>

MFH @ r323558.


# 1be4c195 25-Aug-2017 Enji Cooper <ngie@FreeBSD.org>

MFhead@r322870


# c552f48b 24-Aug-2017 Kyle Evans <kevans@FreeBSD.org>

bsdgrep: add some additional tests for fgrep

Previously added tests only check that fgrep is somewhat sane and works. Add
some more tests that check that the implementation is basically functional
a

bsdgrep: add some additional tests for fgrep

Previously added tests only check that fgrep is somewhat sane and works. Add
some more tests that check that the implementation is basically functional
and not producing incorrect results with various flags.

Reviewed by: cem, emaste, ngie
Approved by: emaste (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D12056

show more ...


# 0275f9db 11-Aug-2017 Hans Petter Selasky <hselasky@FreeBSD.org>

Merge ^/head r321383 through r322397.


# 69ef36e3 01-Aug-2017 Enji Cooper <ngie@FreeBSD.org>

MFhead@r321829


# 95101c1c 25-Jul-2017 Enji Cooper <ngie@FreeBSD.org>

MFhead@r321457


# 0e957942 25-Jul-2017 Kyle Evans <kevans@FreeBSD.org>

bsdgrep(1): Don't exit before processing every file

Given an empty pattern (i.e. grep "" A B), bsdgrep(1) would previously exit()
with the appropriate exit code upon encountering an empty file. Like

bsdgrep(1): Don't exit before processing every file

Given an empty pattern (i.e. grep "" A B), bsdgrep(1) would previously exit()
with the appropriate exit code upon encountering an empty file. Likely intended
as an optimization, but this behavior is technically incorrect since an empty
pattern should match every line.

PR: 220924
Reviewed by: emaste, cem (earlier version), ngie
Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D11698

show more ...


# 531c2d7a 24-Jul-2017 Enji Cooper <ngie@FreeBSD.org>

MFhead@r320180


# bca9d05f 23-Jul-2017 Hans Petter Selasky <hselasky@FreeBSD.org>

Merge ^/head r319973 through 321382.


Revision tags: release/11.1.0
# f6e653bb 02-Jul-2017 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r320398 through r320572.


# 69a3d9e7 27-Jun-2017 Enji Cooper <ngie@FreeBSD.org>

Expect :mmap_eof_not_eol to fail

It relies on a jemalloc feature (opt.redzone) no longer available after
r319971.

MFC with: r318908, r319971
PR: 220309


# d02c951f 26-May-2017 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r318658 through r318963.


# d7b65474 26-May-2017 Ed Maste <emaste@FreeBSD.org>

bsdgrep: add --mmap tests

Basic sanity tests as well as coverage for the bug fixed in r318565.

Submitted by: Kyle Evans <kevans91@ksu.edu>
Reviewed by: bapt, ngie
Differential Revision: https://rev

bsdgrep: add --mmap tests

Basic sanity tests as well as coverage for the bug fixed in r318565.

Submitted by: Kyle Evans <kevans91@ksu.edu>
Reviewed by: bapt, ngie
Differential Revision: https://reviews.freebsd.org/D10827

show more ...


123