GNU bug report logs -
#49978
28.0.50; grep-highlight-matches auto-detection broken on macOS [PATCH]
Previous Next
Reported by: Mattias Engdegård <mattiase <at> acm.org>
Date: Tue, 10 Aug 2021 12:56:01 UTC
Severity: normal
Tags: patch
Found in version 28.0.50
Done: Mattias Engdegård <mattiase <at> acm.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 49978 in the body.
You can then email your comments to 49978 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#49978
; Package
emacs
.
(Tue, 10 Aug 2021 12:56:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Mattias Engdegård <mattiase <at> acm.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 10 Aug 2021 12:56:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
The auto-detection of colourised grep fails on macOS (and presumably BSD in general) because grep --help exits with a nonzero status (while still printing a useful option summary).
We should just ignore the exit status. Anyone against the attached patch?
[grep-highlight-matches-autodetect.diff (application/octet-stream, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#49978
; Package
emacs
.
(Tue, 10 Aug 2021 13:24:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 49978 <at> debbugs.gnu.org (full text, mbox):
> From: Mattias Engdegård <mattiase <at> acm.org>
> Date: Tue, 10 Aug 2021 14:54:43 +0200
>
> The auto-detection of colourised grep fails on macOS (and presumably BSD in general) because grep --help exits with a nonzero status (while still printing a useful option summary).
>
> We should just ignore the exit status. Anyone against the attached patch?
Not me (this time ;-). 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?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#49978
; Package
emacs
.
(Tue, 10 Aug 2021 13:40:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 49978 <at> debbugs.gnu.org (full text, mbox):
10 aug. 2021 kl. 15.23 skrev Eli Zaretskii <eliz <at> gnu.org>:
> 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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#49978
; Package
emacs
.
(Tue, 10 Aug 2021 13:58:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 49978 <at> debbugs.gnu.org (full text, mbox):
> From: Mattias Engdegård <mattiase <at> acm.org>
> Date: Tue, 10 Aug 2021 15:39:04 +0200
> Cc: 49978 <at> debbugs.gnu.org
>
> 10 aug. 2021 kl. 15.23 skrev Eli Zaretskii <eliz <at> gnu.org>:
>
> > 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.
I think just looking for "--color[[]?=" should go a long way towards
avoiding false positives. WDYT?
Lars, any comments?
Btw, is this usage message translatable? If so, perhaps we should
inject LC_ALL=C when running the probe?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#49978
; Package
emacs
.
(Tue, 10 Aug 2021 14:04:03 GMT)
Full text and
rfc822 format available.
Message #17 received at 49978 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> I think just looking for "--color[[]?=" should go a long way towards
> avoiding false positives. WDYT?
>
> Lars, any comments?
No, I'm not really that familiar with this code.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Reply sent
to
Mattias Engdegård <mattiase <at> acm.org>
:
You have taken responsibility.
(Tue, 10 Aug 2021 15:12:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Mattias Engdegård <mattiase <at> acm.org>
:
bug acknowledged by developer.
(Tue, 10 Aug 2021 15:12:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 49978-done <at> debbugs.gnu.org (full text, mbox):
10 aug. 2021 kl. 15.57 skrev Eli Zaretskii <eliz <at> gnu.org>:
> I think just looking for "--color[[]?=" should go a long way towards
> avoiding false positives.
Right, pushed something like that. Thank you!
> Btw, is this usage message translatable? If so, perhaps we should
> inject LC_ALL=C when running the probe?
I don't think we need to bother -- even if the message is translated the options themselves are not.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 08 Sep 2021 11:24:09 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 344 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.