Bug 277459 - Ruby bindings produce huge amount of warnings in ruby 1.9
Summary: Ruby bindings produce huge amount of warnings in ruby 1.9
Status: RESOLVED UNMAINTAINED
Alias: None
Product: bindings
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: kde-bindings
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-10 08:44 UTC by Stefano Crocco
Modified: 2022-12-22 06:50 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefano Crocco 2011-07-10 08:44:00 UTC
Version:           unspecified (using Devel) 
OS:                Linux

Requiring 'Qt4' or 'korundum4' using ruby 1.9 (this doesn't happen with ruby 1.8) with warnings enabled (using the -w switch) prints a huge amount of warnings. There are two kind of warnings:

usr/lib64/ruby/site_ruby/1.9.1/Qt/qtruby4.rb:2527: warning: method redefined; discarding old const_missing

/usr/lib64/ruby/site_ruby/1.9.1/Qt/qtruby4.rb:2527: warning: method redefined; discarding old method_missing

Other warnings of these kinds are also shown later when running the ruby script. This is very annoying as it makes it impossible to see warnings produced by the script itself, as they're lost in the sea of warnings produced by qtruby/korundum

Reproducible: Always

Steps to Reproduce:
run the command

ruby -w -e 'require "Qt4"'

using ruby 1.9

Actual Results:  
A lot of warnings saying

usr/lib64/ruby/site_ruby/1.9.1/Qt/qtruby4.rb:2527: warning: method redefined; discarding old const_missing

and

/usr/lib64/ruby/site_ruby/1.9.1/Qt/qtruby4.rb:2527: warning: method redefined; discarding old method_missing

are shown

Expected Results:  
No (or at least only a few) warnings shown
Comment 1 Richard Dale 2011-07-17 18:44:48 UTC
On Sunday, July 10, 2011 09:44:00 AM Stefano Crocco wrote:
> https://bugs.kde.org/show_bug.cgi?id=277459
> 
>            Summary: Ruby bindings produce huge amount of warnings in ruby
>                     1.9
>            Product: bindings
>            Version: unspecified
>           Platform: Gentoo Packages
>         OS/Version: Linux
>             Status: UNCONFIRMED
>           Severity: normal
>           Priority: NOR
>          Component: general
>         AssignedTo: kde-bindings@kde.org
>         ReportedBy: stefano.crocco@alice.it
> 
> 
> Version:           unspecified (using Devel)
> OS:                Linux
> 
> Requiring 'Qt4' or 'korundum4' using ruby 1.9 (this doesn't happen with
> ruby 1.8) with warnings enabled (using the -w switch) prints a huge amount
> of warnings. There are two kind of warnings:
> 
> usr/lib64/ruby/site_ruby/1.9.1/Qt/qtruby4.rb:2527: warning: method
> redefined; discarding old const_missing
> 
> /usr/lib64/ruby/site_ruby/1.9.1/Qt/qtruby4.rb:2527: warning: method
> redefined; discarding old method_missing
Are we redefining method_missing in the wrong way or something? Is there an api 
in Ruby 1.9 to supress warnings like this? Otherwise, I can't see how to avoid 
these warnings, as QtRuby completely depends on overriding method_missing - it 
is the basic principle by which it works.

-- Richard

> Other warnings of these kinds are also shown later when running the ruby
> script. This is very annoying as it makes it impossible to see warnings
> produced by the script itself, as they're lost in the sea of warnings
> produced by qtruby/korundum
> 
> Reproducible: Always
> 
> Steps to Reproduce:
> run the command
> 
> ruby -w -e 'require "Qt4"'
> 
> using ruby 1.9
> 
> Actual Results:
> A lot of warnings saying
> 
> usr/lib64/ruby/site_ruby/1.9.1/Qt/qtruby4.rb:2527: warning: method
> redefined; discarding old const_missing
> 
> and
> 
> /usr/lib64/ruby/site_ruby/1.9.1/Qt/qtruby4.rb:2527: warning: method
> redefined; discarding old method_missing
> 
> are shown
> 
> Expected Results:
> No (or at least only a few) warnings shown
Comment 2 Stefano Crocco 2011-07-18 16:58:19 UTC
I tried looking at the ruby source code to find out when this warning is generated, but I couldn't understand it (if you want to take a look, it's at line 236 of vm_method.c in the ruby 1.9.2 source). From my tests it seems this warning is produced when you redefine a method already defined in the same class (redefining an inherited method doesn't produce it), and this behaviour is the same in ruby 1.8 and 1.9. My best guess is that the class you're redefining const_missing and method_missing doesn't have those method already defined in ruby 1.8, while they're already defined in ruby 1.9. Is this possibile?

I don't know if ruby behavior has changed between 1.8 and 1.9 regarding this issue. If you want, I can ask for more information on the ruby mailing list (I tried google but found nothing useful).

If the root of this issue can't be found, there are some workarounds which can be used to avoid the issue, at least if they don't affect performance:
* set the $VERBOSE global variable to 0 before redefining the methods and restore it after it's done
* use remove_method to remove the existing methods before redefining the new ones
* alias the existing methods to something else, since the warning won't be produced when the existing method has an alias
Comment 3 Andrew Crouthamel 2018-11-06 15:10:31 UTC
Dear Bug Submitter,

This bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? I am setting the status to NEEDSINFO pending your response, please change the Status back to REPORTED when you respond.

Thank you for helping us make KDE software even better for everyone!
Comment 4 Andrew Crouthamel 2018-11-18 03:32:16 UTC
Dear Bug Submitter,

This is a reminder that this bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? This bug will be moved back to REPORTED Status for manual review later, which may take a while. If you are able to, please lend us a hand.

Thank you for helping us make KDE software even better for everyone!
Comment 5 Stefano Crocco 2018-11-18 17:52:53 UTC
It's still valid
Comment 6 Mathieu Jobin 2022-12-22 06:50:06 UTC
QtRuby only existed for Qt4 and Korundum, which never got updated for 5.x

This is unmaintained and any effort towards QtRuby for Qt6 will be from scratch.

Therefore, closing this ticket

Additionally, not only ruby 1.9 is out of support, but ruby 2.7 will be out of support 4 months from now.