unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* grep: RE error in ^*** ADVICE-ON-FAILURE-: repetition-operator operand invalid
       [not found] <87fsef9pms.fsf.ref@yahoo.com>
@ 2022-11-19 10:59 ` Po Lu
  2022-11-19 11:24   ` Gregory Heytings
                     ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Po Lu @ 2022-11-19 10:59 UTC (permalink / raw)
  To: emacs-devel

This is what happens when building Emacs on Suns:

grep: RE error in ^*** ADVICE-ON-FAILURE-: repetition-operator operand invalid

I don't want to argue over that dis-message anymore, so would someone
else please fix this.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: grep: RE error in ^*** ADVICE-ON-FAILURE-: repetition-operator operand invalid
  2022-11-19 10:59 ` grep: RE error in ^*** ADVICE-ON-FAILURE-: repetition-operator operand invalid Po Lu
@ 2022-11-19 11:24   ` Gregory Heytings
  2022-11-19 11:35     ` Mattias Engdegård
  2022-11-19 11:57     ` Po Lu
  2022-11-19 11:45   ` Eli Zaretskii
  2022-11-19 14:06   ` Gregory Heytings
  2 siblings, 2 replies; 13+ messages in thread
From: Gregory Heytings @ 2022-11-19 11:24 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel


>
> This is what happens when building Emacs on Suns:
>
> grep: RE error in ^*** ADVICE-ON-FAILURE-: repetition-operator operand 
> invalid
>

That seems like a problem with Sun grep, isn't it?  What does it expect? 
Can you try

echo '*** foo' | grep -v '^\*\*\* foo'

and tell us if it works (i.e. if it does not show any output)?



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: grep: RE error in ^*** ADVICE-ON-FAILURE-: repetition-operator operand invalid
  2022-11-19 11:24   ` Gregory Heytings
@ 2022-11-19 11:35     ` Mattias Engdegård
  2022-11-19 11:49       ` Gregory Heytings
  2022-11-19 11:57     ` Po Lu
  1 sibling, 1 reply; 13+ messages in thread
From: Mattias Engdegård @ 2022-11-19 11:35 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: Po Lu, emacs-devel

19 nov. 2022 kl. 12.24 skrev Gregory Heytings <gregory@heytings.org>:

> That seems like a problem with Sun grep, isn't it?

No, it's a problem with the regexp, but your remedy is accurate.
I pushed a fix, blindly (no Sun here I'm afraid) -- did it help?





^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: grep: RE error in ^*** ADVICE-ON-FAILURE-: repetition-operator operand invalid
  2022-11-19 10:59 ` grep: RE error in ^*** ADVICE-ON-FAILURE-: repetition-operator operand invalid Po Lu
  2022-11-19 11:24   ` Gregory Heytings
@ 2022-11-19 11:45   ` Eli Zaretskii
  2022-11-19 14:06   ` Gregory Heytings
  2 siblings, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2022-11-19 11:45 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Date: Sat, 19 Nov 2022 18:59:07 +0800
> 
> This is what happens when building Emacs on Suns:
> 
> grep: RE error in ^*** ADVICE-ON-FAILURE-: repetition-operator operand invalid
> 
> I don't want to argue over that dis-message anymore, so would someone
> else please fix this.

I don't have access to a system with such a Grep, but does escaping
the asterisks with a backslash, as in

         ^\*\*\* ADVICE-ON-FAILURE-

help with that Grep?



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: grep: RE error in ^*** ADVICE-ON-FAILURE-: repetition-operator operand invalid
  2022-11-19 11:35     ` Mattias Engdegård
@ 2022-11-19 11:49       ` Gregory Heytings
  2022-11-19 12:05         ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Gregory Heytings @ 2022-11-19 11:49 UTC (permalink / raw)
  To: Mattias Engdegård; +Cc: Po Lu, emacs-devel


>> That seems like a problem with Sun grep, isn't it?
>
> No, it's a problem with the regexp
>

I'm not sure, how comes that GNU grep does not complain and does the right 
thing, even with POSIXLY_CORRECT?



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: grep: RE error in ^*** ADVICE-ON-FAILURE-: repetition-operator operand invalid
  2022-11-19 11:24   ` Gregory Heytings
  2022-11-19 11:35     ` Mattias Engdegård
@ 2022-11-19 11:57     ` Po Lu
  2022-11-19 12:00       ` Po Lu
  1 sibling, 1 reply; 13+ messages in thread
From: Po Lu @ 2022-11-19 11:57 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: emacs-devel

Gregory Heytings <gregory@heytings.org> writes:

>>
>> This is what happens when building Emacs on Suns:
>>
>> grep: RE error in ^*** ADVICE-ON-FAILURE-: repetition-operator
>> operand invalid
>>
>
> That seems like a problem with Sun grep, isn't it?  What does it
> expect? Can you try
>
> echo '*** foo' | grep -v '^\*\*\* foo'
>
> and tell us if it works (i.e. if it does not show any output)?

Yes, that works.

Thanks.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: grep: RE error in ^*** ADVICE-ON-FAILURE-: repetition-operator operand invalid
  2022-11-19 11:57     ` Po Lu
@ 2022-11-19 12:00       ` Po Lu
  2022-11-19 12:14         ` Mattias Engdegård
  0 siblings, 1 reply; 13+ messages in thread
From: Po Lu @ 2022-11-19 12:00 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: emacs-devel

Po Lu <luangruo@yahoo.com> writes:

> Yes, that works.

BTW, Sun says their grep complies with POSIX.1 as well:

STANDARDS
     The grep utility is compliant with the IEEE Std 1003.1-2008 (“POSIX.1”)
     specification with the exception of -s option being the same as -q in
     current implementation for historic reasons.  The flags [-AbBChHrRw] are
     extensions to that specification.

So I'm not sure whether or not the bug lies in grep or posixly-correct
GNU grep.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: grep: RE error in ^*** ADVICE-ON-FAILURE-: repetition-operator operand invalid
  2022-11-19 11:49       ` Gregory Heytings
@ 2022-11-19 12:05         ` Eli Zaretskii
  0 siblings, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2022-11-19 12:05 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: mattiase, luangruo, emacs-devel

> Date: Sat, 19 Nov 2022 11:49:26 +0000
> From: Gregory Heytings <gregory@heytings.org>
> cc: Po Lu <luangruo@yahoo.com>, emacs-devel@gnu.org
> 
> 
> >> That seems like a problem with Sun grep, isn't it?
> >
> > No, it's a problem with the regexp
> >
> 
> I'm not sure, how comes that GNU grep does not complain and does the right 
> thing, even with POSIXLY_CORRECT?

That's a feature in GNU Grep: it has extensions over the basic REs.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: grep: RE error in ^*** ADVICE-ON-FAILURE-: repetition-operator operand invalid
  2022-11-19 12:00       ` Po Lu
@ 2022-11-19 12:14         ` Mattias Engdegård
  2022-11-19 12:26           ` Gregory Heytings
  0 siblings, 1 reply; 13+ messages in thread
From: Mattias Engdegård @ 2022-11-19 12:14 UTC (permalink / raw)
  To: Po Lu; +Cc: Gregory Heytings, emacs-devel

19 nov. 2022 kl. 13.00 skrev Po Lu <luangruo@yahoo.com>:

> So I'm not sure whether or not the bug lies in grep or posixly-correct
> GNU grep.

The standard (BSD) grep in macOS signals a similar error as the Sun one did.
Whether allowed by POSIX or not, it's obviously helpful as it helped us discover this incorrect regexp.




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: grep: RE error in ^*** ADVICE-ON-FAILURE-: repetition-operator operand invalid
  2022-11-19 12:14         ` Mattias Engdegård
@ 2022-11-19 12:26           ` Gregory Heytings
  2022-11-19 12:42             ` Mattias Engdegård
  0 siblings, 1 reply; 13+ messages in thread
From: Gregory Heytings @ 2022-11-19 12:26 UTC (permalink / raw)
  To: Mattias Engdegård; +Cc: Po Lu, emacs-devel


>
> Whether allowed by POSIX or not, it's obviously helpful as it helped us 
> discover this incorrect regexp.
>

I just checked, it was not incorrect.  POSIX says that in BREs the '*' is 
special, except wen used:

- in a bracket expression
- as the first character of an entire BRE (after an initial '^', if any)
- as the first character of a subexpression (after an initial '^', if any)



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: grep: RE error in ^*** ADVICE-ON-FAILURE-: repetition-operator operand invalid
  2022-11-19 12:26           ` Gregory Heytings
@ 2022-11-19 12:42             ` Mattias Engdegård
  2022-11-19 12:49               ` Gregory Heytings
  0 siblings, 1 reply; 13+ messages in thread
From: Mattias Engdegård @ 2022-11-19 12:42 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: Po Lu, emacs-devel

19 nov. 2022 kl. 13.26 skrev Gregory Heytings <gregory@heytings.org>:

> I just checked, it was not incorrect.  POSIX says that in BREs the '*' is special, except wen used:
> 
> - in a bracket expression
> - as the first character of an entire BRE (after an initial '^', if any)
> - as the first character of a subexpression (after an initial '^', if any)

That just means that the first of the three asterisks is literal. The other two are special and indicate repetition of the literal asterisk.

In other words: "^***" means "^\**", matching zero or more asterisks at the beginning of a line.

(And even if the three asterisks were interpreted literally, it would be bad style.)




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: grep: RE error in ^*** ADVICE-ON-FAILURE-: repetition-operator operand invalid
  2022-11-19 12:42             ` Mattias Engdegård
@ 2022-11-19 12:49               ` Gregory Heytings
  0 siblings, 0 replies; 13+ messages in thread
From: Gregory Heytings @ 2022-11-19 12:49 UTC (permalink / raw)
  To: Mattias Engdegård; +Cc: Po Lu, emacs-devel


>> I just checked, it was not incorrect.  POSIX says that in BREs the '*' 
>> is special, except wen used:
>>
>> - in a bracket expression
>> - as the first character of an entire BRE (after an initial '^', if any)
>> - as the first character of a subexpression (after an initial '^', if any)
>
> That just means that the first of the three asterisks is literal. The 
> other two are special and indicate repetition of the literal asterisk.
>

Hmmm, you're correct. '^**' would be correct (matching zero or more 
asterisks), but '^***' is not, because POSIX also says that "multiple 
adjacent duplication symbols produces undefined results".

>
> (And even if the three asterisks were interpreted literally, it would be 
> bad style.)
>

It's better if the expression is correctly matched by more grep's, indeed. 
Anyway, bug closed.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: grep: RE error in ^*** ADVICE-ON-FAILURE-: repetition-operator operand invalid
  2022-11-19 10:59 ` grep: RE error in ^*** ADVICE-ON-FAILURE-: repetition-operator operand invalid Po Lu
  2022-11-19 11:24   ` Gregory Heytings
  2022-11-19 11:45   ` Eli Zaretskii
@ 2022-11-19 14:06   ` Gregory Heytings
  2 siblings, 0 replies; 13+ messages in thread
From: Gregory Heytings @ 2022-11-19 14:06 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel


>
> I don't want to argue over that dis-message anymore
>

You asked nicely, so I just added an option do disable these useful 
messages.  Just "touch .no-advice-on-failure" in your repo, and you won't 
see them anymore.



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-11-19 14:06 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87fsef9pms.fsf.ref@yahoo.com>
2022-11-19 10:59 ` grep: RE error in ^*** ADVICE-ON-FAILURE-: repetition-operator operand invalid Po Lu
2022-11-19 11:24   ` Gregory Heytings
2022-11-19 11:35     ` Mattias Engdegård
2022-11-19 11:49       ` Gregory Heytings
2022-11-19 12:05         ` Eli Zaretskii
2022-11-19 11:57     ` Po Lu
2022-11-19 12:00       ` Po Lu
2022-11-19 12:14         ` Mattias Engdegård
2022-11-19 12:26           ` Gregory Heytings
2022-11-19 12:42             ` Mattias Engdegård
2022-11-19 12:49               ` Gregory Heytings
2022-11-19 11:45   ` Eli Zaretskii
2022-11-19 14:06   ` Gregory Heytings

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).