Bug 1121865

Summary: undefined method `_' for FastGettext::Translation:Module
Product: [openSUSE] openSUSE Tumbleweed Reporter: Alexander Graul <alexander.graul>
Component: YaST2Assignee: Ladislav Slezák <lslezak>
Status: RESOLVED FIXED QA Contact: Jiri Srain <jsrain>
Severity: Normal    
Priority: P1 - Urgent CC: alexander.graul, fcrozat, jreidinger, locilka, Mathias.Homann, mvidner, snwint
Version: Current   
Target Milestone: ---   
Hardware: Other   
OS: Other   
URL: https://trello.com/c/uL36NReV
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: save_y2logs output
output of ls -l /usr/lib64/ruby/gems/2.5.0/gems/

Description Alexander Graul 2019-01-14 14:15:00 UTC
Created attachment 794369 [details]
save_y2logs output

Upon starting the YaST TUI or any Qt YaST module (the Qt Control Center works fine), I am greeted with the following error message:

Internal error. Please report a bug report with logs.
Run save_y2logs to get complete logs.
Details: undefined method `_' for FastGettext::Translation:Module
Caller:  /usr/lib64/ruby/vendor_ruby/2.5.0/yast/builtins.rb:787:in `dpgettext'

Today was the first time I ran into this issue, I am running Tumbleweed (20190110).
Comment 1 Steffen Winterfeldt 2019-01-15 12:21:48 UTC
I could not reproduce this with a fresh TW-20190110 install.

My initial thought was that there had been some yast version mixup during your
upgrade process. But I couldn't spot any difference between your setup
and my fresh install. (I might have missed something, though.)

Josef, Martin, any idea what could cause this?
Comment 2 Josef Reidinger 2019-01-15 13:30:53 UTC
(In reply to Alexander Graul from comment #0)
> Created attachment 794369 [details]
> save_y2logs output
> 
> Upon starting the YaST TUI or any Qt YaST module (the Qt Control Center
> works fine), I am greeted with the following error message:
> 
> Internal error. Please report a bug report with logs.
> Run save_y2logs to get complete logs.
> Details: undefined method `_' for FastGettext::Translation:Module
> Caller:  /usr/lib64/ruby/vendor_ruby/2.5.0/yast/builtins.rb:787:in
> `dpgettext'
> 
> Today was the first time I ran into this issue, I am running Tumbleweed
> (20190110).

my wild guess is inconsistency in ruby and rubygems installation. or some strange fastgettext version. Can you please post here content of ls -l /usr/lib64/ruby/gems/2.5.0/gems/ ?
Comment 3 Alexander Graul 2019-01-15 14:03:38 UTC
Created attachment 794461 [details]
output of ls -l /usr/lib64/ruby/gems/2.5.0/gems/

Some weird rubygem interaction would not surprise me either, here is the list you requested.
Comment 4 Steffen Winterfeldt 2019-01-15 14:18:56 UTC
I see fast_gettext-2.0.0 there - but I don't know if that makes a difference..
Comment 5 Josef Reidinger 2019-01-15 16:06:39 UTC
hmm, there is a lot of changes in 2.0 in fast gettext in Translation.rb. So steffen for you it works with fast_gettext 2.0 ? 

For me potential problem can be https://github.com/grosser/fast_gettext/commit/b04659d7a58dfb254a08790851785c2158724232#diff-c57b1d2229b221d6856308a01804b83d as we use it https://github.com/yast/yast-ruby-bindings/blob/master/src/ruby/yast/builtins.rb#L787 directly with module. So without that extend self it probably cannot be called directly. But it is strange if it works for Steffen.
Comment 6 Steffen Winterfeldt 2019-01-16 09:40:22 UTC
> steffen for you it works with fast_gettext 2.0 ? 

I do not know. TW comes with 1.8.
Comment 7 Steffen Winterfeldt 2019-01-16 14:09:07 UTC
Looks like either yast needs to be adjusted or it should require the old gem.

Tracking in YaST Scrum board.
Comment 8 Steffen Winterfeldt 2019-01-17 13:44:39 UTC
*** Bug 1122350 has been marked as a duplicate of this bug. ***
Comment 11 Ladislav Slezák 2019-01-18 09:44:24 UTC
Or we might need to add "extend FastGettext::Translation" or "include FastGettext::Translation" somewhere, like in this commit: https://github.com/grosser/fast_gettext/commit/b04659d7a58dfb254a08790851785c2158724232#diff-13715f7b8da878de01baf08e02d98a54
Comment 12 Martin Vidner 2019-01-18 10:31:10 UTC
module Yast::I18n calls 
  FastGettext::Translation._(...)
  FastGettext::Translation.n_(...)
in its methods, but the F::T module no longer exposes them as module_method's intending the users to instead include the module. We cannot do that directly as Yast::I18n has additional logic in _ and n_, but we could simply introduce Yast::I18n::Translation which does include FastGettext::Translation AND provides the 2 methods as module_method's.

That *should* work with both f_g 1.8 and 2.0, we just need to test that.
Comment 14 Ladislav Slezák 2019-01-23 09:25:01 UTC
Fixed in yast2-ruby-bindings-4.1.2 (https://github.com/yast/yast-ruby-bindings/pull/226, https://build.opensuse.org/request/show/667954).

The same fix in the SLE15-GA/Leap15.0 queue (will be released with the next real fix, https://github.com/yast/yast-ruby-bindings/pull/225)