* [ruby-core:118867] [Ruby master Bug#20681] Regular expression warnings are treated as compiler warnings during runtime
@ 2024-08-17 11:08 Earlopain (A S) via ruby-core
2024-08-18 3:25 ` [ruby-core:118873] " nobu (Nobuyoshi Nakada) via ruby-core
2024-08-18 8:30 ` [ruby-core:118875] " Earlopain (A S) via ruby-core
0 siblings, 2 replies; 3+ messages in thread
From: Earlopain (A S) via ruby-core @ 2024-08-17 11:08 UTC (permalink / raw)
To: ruby-core; +Cc: Earlopain (A S)
Issue #20681 has been reported by Earlopain (A S).
----------------------------------------
Bug #20681: Regular expression warnings are treated as compiler warnings during runtime
https://bugs.ruby-lang.org/issues/20681
* Author: Earlopain (A S)
* Status: Open
* ruby -v: 3.3.4
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
I have some code that recieves arbitrary input and parses it as a regexp. To supress potential warnings I'm defining the `warn` method. Unfortunately it is not getting called:
```rb
def warn(...)
puts "CALLED"
end
source = "/\w**/"
Regexp.new(source)
```
Running this emits a warning and doesn't print "CALLED":
```
$ ruby test.rb
test.rb:6: warning: regular expression has redundant nested repeat operator '*': /\/w**\//
```
I looked a bit at the code and found something which I think is supposed to handle this case but it seems like its not checking against the right thing: https://github.com/ruby/ruby/blob/4dbf386ca248df0f47f31dc28cdeabe8d4477e5b/regparse.c#L2986-L2994
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
* [ruby-core:118873] [Ruby master Bug#20681] Regular expression warnings are treated as compiler warnings during runtime
2024-08-17 11:08 [ruby-core:118867] [Ruby master Bug#20681] Regular expression warnings are treated as compiler warnings during runtime Earlopain (A S) via ruby-core
@ 2024-08-18 3:25 ` nobu (Nobuyoshi Nakada) via ruby-core
2024-08-18 8:30 ` [ruby-core:118875] " Earlopain (A S) via ruby-core
1 sibling, 0 replies; 3+ messages in thread
From: nobu (Nobuyoshi Nakada) via ruby-core @ 2024-08-18 3:25 UTC (permalink / raw)
To: ruby-core; +Cc: nobu (Nobuyoshi Nakada)
Issue #20681 has been updated by nobu (Nobuyoshi Nakada).
Status changed from Open to Feedback
You may want to re-define `Warning.warn`.
----------------------------------------
Bug #20681: Regular expression warnings are treated as compiler warnings during runtime
https://bugs.ruby-lang.org/issues/20681#change-109445
* Author: Earlopain (A S)
* Status: Feedback
* ruby -v: 3.3.4
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
I have some code that recieves arbitrary input and parses it as a regexp. To supress potential warnings I'm defining the `warn` method. Unfortunately it is not getting called:
```rb
def warn(...)
puts "CALLED"
end
source = "/\w**/"
Regexp.new(source)
```
Running this emits a warning and doesn't print "CALLED":
```
$ ruby test.rb
test.rb:6: warning: regular expression has redundant nested repeat operator '*': /\/w**\//
```
I looked a bit at the code and found something which I think is supposed to handle this case but it seems like its not checking against the right thing: https://github.com/ruby/ruby/blob/4dbf386ca248df0f47f31dc28cdeabe8d4477e5b/regparse.c#L2986-L2994
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
* [ruby-core:118875] [Ruby master Bug#20681] Regular expression warnings are treated as compiler warnings during runtime
2024-08-17 11:08 [ruby-core:118867] [Ruby master Bug#20681] Regular expression warnings are treated as compiler warnings during runtime Earlopain (A S) via ruby-core
2024-08-18 3:25 ` [ruby-core:118873] " nobu (Nobuyoshi Nakada) via ruby-core
@ 2024-08-18 8:30 ` Earlopain (A S) via ruby-core
1 sibling, 0 replies; 3+ messages in thread
From: Earlopain (A S) via ruby-core @ 2024-08-18 8:30 UTC (permalink / raw)
To: ruby-core; +Cc: Earlopain (A S)
Issue #20681 has been updated by Earlopain (A S).
nobu (Nobuyoshi Nakada) wrote in #note-1:
> You may want to re-define `Warning.warn`.
Thank you, that works. Apologies for the wrong report.
----------------------------------------
Bug #20681: Regular expression warnings are treated as compiler warnings during runtime
https://bugs.ruby-lang.org/issues/20681#change-109447
* Author: Earlopain (A S)
* Status: Feedback
* ruby -v: 3.3.4
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
I have some code that recieves arbitrary input and parses it as a regexp. To supress potential warnings I'm defining the `warn` method. Unfortunately it is not getting called:
```rb
def warn(...)
puts "CALLED"
end
source = "/\w**/"
Regexp.new(source)
```
Running this emits a warning and doesn't print "CALLED":
```
$ ruby test.rb
test.rb:6: warning: regular expression has redundant nested repeat operator '*': /\/w**\//
```
I looked a bit at the code and found something which I think is supposed to handle this case but it seems like its not checking against the right thing: https://github.com/ruby/ruby/blob/4dbf386ca248df0f47f31dc28cdeabe8d4477e5b/regparse.c#L2986-L2994
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-18 8:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-17 11:08 [ruby-core:118867] [Ruby master Bug#20681] Regular expression warnings are treated as compiler warnings during runtime Earlopain (A S) via ruby-core
2024-08-18 3:25 ` [ruby-core:118873] " nobu (Nobuyoshi Nakada) via ruby-core
2024-08-18 8:30 ` [ruby-core:118875] " Earlopain (A S) via ruby-core
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 NNTP newsgroup(s).