Subject: bug#49978: 28.0.50; grep-highlight-matches auto-detection broken on macOS [PATCH]

From: Mattias Engdegård <[email-masked]>
Date: Tue, 10 Aug 2021 15:39:04 +0200

10 aug. 2021 kl. 15.23 skrev Eli Zaretskii <[email-masked]>:

> Although perhaps we should strengthen the
> search string to be sure we don't hit some false positive: "--color"
> sounds a bit too general, no?  Or do you think it's good enough even
> if "--help" causes a non-zero exit code?

I honestly don't know. The patch works here (obviously) but strengthening it using a regexp to avoid matching "--colorise", say, probably won't hurt. Not that it's very likely that this would ever make a difference, but if you think that it's better safe then sorry then I'll do that.

For the record, on this Mac I get:

$ grep --help
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
	[-e pattern] [-f file] [--binary-files=value] [--color=when]
	[--context[=num]] [--directories=action] [--label] [--line-buffered]
	[--null] [pattern] [file ...]
$ grep --version
grep (BSD grep) 2.5.1-FreeBSD

The exit status is probably a red herring; we do not seem to gain any useful information from it.