The zgrep shell wrapper that has been used since r332993 to handle
compressed input files does not handle the -f flag correctly:
- Works % zfgrep RELEASE /etc/motd FreeBSD 12.1-RELEASE-p3 GENERIC
- Hangs reading from stdin % echo RELEASE > /tmp/0 % zfgrep -f /tmp/0 /etc/motd /etc/motd:FreeBSD 12.1-RELEASE-p3 GENERIC ^Z Suspended leviathan 89 % ps t PID TT STAT TIME COMMAND 11249 4 Ss 0:00.11 -csh (csh) 12190 4 T 0:00.00 /bin/sh /usr/bin/zfgrep -f /tmp/0 /etc/motd 12191 4 T 0:00.00 /usr/bin/zcat -f - 12192 4 T 0:00.00 grep -F -f /tmp/0 -- /etc/motd - 12193 4 R+ 0:00.00 ps t
In addition the script does not handle certain combined flags:
- Works % fgrep -we RELEASE /etc/motd FreeBSD 12.1-RELEASE-p3 GENERIC
- Fails % zfgrep -we RELEASE /etc/motd grep: RELEASE: No such file or directory
Add tests for the various failure cases and update the zgrep.sh
wrapper script to correct the issues.