Page MenuHomeFreeBSD

zgrep: fix exit status with multiple files
ClosedPublic

Authored by vangyzen on Sep 30 2020, 9:24 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 21, 1:05 PM
Unknown Object (File)
Fri, Apr 5, 3:54 PM
Unknown Object (File)
Sun, Mar 31, 1:53 PM
Unknown Object (File)
Fri, Mar 29, 6:28 AM
Unknown Object (File)
Mar 22 2024, 1:02 PM
Unknown Object (File)
Mar 22 2024, 10:25 AM
Unknown Object (File)
Mar 9 2024, 2:27 PM
Unknown Object (File)
Mar 9 2024, 2:14 PM
Subscribers

Details

Summary

zgrep should exit with success when given multiple files and the
pattern is found in at least one file. Prior to this change,
it would exit with success only if the pattern was found in _every_ file.

Test Plan

The added test case failed before the fix. All tests pass with the fix.

grep_test:zgrep_multiple_files  ->  passed  [0.022s]

Results file id is usr_tests_usr.bin_grep.20200930-212653-629287
Results saved to /root/.kyua/store/results.usr_tests_usr.bin_grep.20200930-212653-629287.db

52/52 passed (0 failed)

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.Oct 1 2020, 1:30 AM

Macro shipit:

contrib/netbsd-tests/usr.bin/grep/t_grep.sh
898 ↗(On Diff #77704)

"Ensures that zgrep functions properly with multiple files" would be a better comment.

vangyzen added inline comments.
contrib/netbsd-tests/usr.bin/grep/t_grep.sh
898 ↗(On Diff #77704)

Indeed, it would. (I'm guilty of copy-and-paste.)

This revision was automatically updated to reflect the committed changes.
vangyzen marked an inline comment as done.