Page MenuHomeFreeBSD

Fix remaining zgrep(1) wrapper script regressions
ClosedPublic

Authored by leres on Feb 6 2025, 10:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 12, 6:26 PM
Unknown Object (File)
Fri, Dec 12, 6:23 AM
Unknown Object (File)
Sat, Nov 29, 3:32 AM
Unknown Object (File)
Fri, Nov 28, 4:20 PM
Unknown Object (File)
Thu, Nov 27, 1:55 AM
Unknown Object (File)
Wed, Nov 26, 9:44 PM
Unknown Object (File)
Sat, Nov 22, 8:43 AM
Unknown Object (File)
Nov 13 2025, 1:47 PM
Subscribers

Details

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.

Diff Detail

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

Event Timeline

leres requested review of this revision.Feb 6 2025, 10:13 PM
  • better test for more than one pattern
This revision is now accepted and ready to land.Feb 9 2025, 3:24 PM
bdrewery added inline comments.
usr.bin/grep/zgrep.sh
106

Somehow this change broke bzgrep -q.

Now:

# bzgrep -q '1 2' /var/log/messages.0.bz2
bzcat: Can't open input file 2: No such file or directory.

Before:

# bzgrep -q '1 2' /var/log/messages.0.bz2

Namely this breaks a Poudriere script with a ton of this:

bzcat: Can't open input file fetch: No such file or directory.
bzcat: Can't open input file it: No such file or directory.
bzcat: Can't open input file -: No such file or directory.
bzcat: Can't open input file please: No such file or directory.
bzcat: Can't open input file try: No such file or directory.

I don't have time this week but will definitely look into this next week, including adding a test.