Bug 248813 - bzgrep ignores --no-filename flag
Summary: bzgrep ignores --no-filename flag
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.1-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: Eugene Grosbein
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-21 17:24 UTC by Moviuro
Modified: 2020-11-27 08:47 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Moviuro 2020-08-21 17:24:18 UTC
Steps:

echo '1.1.1.1' > file1; echo '1.1.1.0' > file2
bzip2 -k file1 ; bzip2 -k file2
bzgrep --no-filename 1.1.1 file*bz2

Expected: flag is honored

1.1.1.1
1.1.1.0

Actual: flag is ignored

file1.bz2:1.1.1.1
file2.bz2:1.1.1.0

Patch below:

--- /usr/bin/bzgrep.orig        2020-08-21 19:10:56.072359000 +0200
+++ /usr/bin/bzgrep     2020-08-21 19:08:19.219508000 +0200
@@ -114,6 +114,9 @@
            exec ${grep} -V
            ;;
        -*)
+            case $1 in
+              --no-filename) silent=1 ;;
+            esac
            grep_args="${grep_args} $1"
            shift
            ;;

FWIW; the bzgrep from https://sourceware.org/bzip2/ also has troubles with that specific --no-filename flag.
Comment 1 commit-hook freebsd_committer 2020-11-20 09:56:55 UTC
A commit references this bug:

Author: eugen
Date: Fri Nov 20 09:56:46 UTC 2020
New revision: 367866
URL: https://svnweb.freebsd.org/changeset/base/367866

Log:
  bzgrep: make flag --no-filename work

  PR:		248813
  MFC after:	1 week

Changes:
  head/usr.bin/grep/zgrep.sh
Comment 2 commit-hook freebsd_committer 2020-11-27 08:46:08 UTC
A commit references this bug:

Author: eugen
Date: Fri Nov 27 08:45:43 UTC 2020
New revision: 368095
URL: https://svnweb.freebsd.org/changeset/base/368095

Log:
  MFC r367866: bzgrep: make flag --no-filename work

  PR:		248813

Changes:
_U  stable/12/
  stable/12/usr.bin/grep/zgrep.sh
Comment 3 Eugene Grosbein freebsd_committer 2020-11-27 08:47:15 UTC
Fixed. Thank you for the report!