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
F151381200: D31108.diff
Wed, Apr 8, 12:51 AM
F151307650: D31108.id91967.diff
Tue, Apr 7, 11:48 AM
Unknown Object (File)
Thu, Mar 26, 1:43 PM
Unknown Object (File)
Mar 1 2026, 5:19 AM
Unknown Object (File)
Feb 27 2026, 11:56 AM
Unknown Object (File)
Feb 7 2026, 11:29 PM
Unknown Object (File)
Feb 7 2026, 8:40 PM
Unknown Object (File)
Jan 31 2026, 1:33 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