Page MenuHomeFreeBSD

grep: fix combination of quite and count flag
ClosedPublic

Authored by oshogbo on Jul 8 2021, 11:45 AM.
Tags
None
Referenced Files
F173895262: D31108.id92004.diff
Tue, Sep 29, 4:35 AM
Unknown Object (File)
Sat, Sep 26, 5:04 AM
Unknown Object (File)
Sun, Sep 20, 8:23 AM
Unknown Object (File)
Sun, Sep 13, 1:39 PM
Unknown Object (File)
Sat, Sep 12, 10:24 PM
Unknown Object (File)
Sun, Sep 6, 5:25 PM
Unknown Object (File)
Sat, Sep 5, 2:24 PM
Unknown Object (File)
Aug 28 2026, 11:57 PM
Subscribers
None

Details

Summary

When the quite (-q) flag is provided, we don't expect any output.
Currently, the behavior is broken:
$ grep -cq flag util.c
1

$ grep -cs flag util.c
55

First of all, we print a number to stdout. Secondly, it just returns 0 or 1
(which is unexpected). GNU grep with c and q flags doesn't print anything.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable