Bug 1159286

Summary: YaST2: Keyboard.rb:306:in `current_kbd': undefined method `empty?' for nil:NilClass
Product: [openSUSE] openSUSE Distribution Reporter: Mindaugas Baranauskas <opensuse.lietuviu.kalba>
Component: YaST2Assignee: Josef Reidinger <jreidinger>
Status: RESOLVED FIXED QA Contact: Jiri Srain <jsrain>
Severity: Normal    
Priority: P5 - None CC: axel.braun, jreidinger, mmanu84, opensuse.lietuviu.kalba
Version: Leap 15.2   
Target Milestone: ---   
Hardware: Other   
OS: Other   
URL: https://trello.com/c/31O3Djrl
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: Screenshoot
y2log
LANG=fr_FR yast2 language - screenshot

Description Mindaugas Baranauskas 2019-12-16 13:17:30 UTC
Created attachment 826199 [details]
Screenshoot

I am testing appliance based on openSUSE Leap 15.2 development version 
(latest build as of today). 

I entered into YaST Language module and received error:

Internal error. Please report a bug report with logs.
Run save_y2logs to get complete logs.
Caller: /usr/share/YaST2/modules/Keyboard.rb:306:in `current_kbd'
Details: undefined method `empty?' for nil:NilClass


Appliance URL:
https://build.opensuse.org/package/show/home:embar-:Lietukas/Lietukas_15.2_mini
You can download ISO image for playing in virtual machine or using as LiveDVD/USB:
https://download.opensuse.org/repositories/home:/embar-:/Lietukas/images/iso/?P=*15.2*
Comment 1 Mindaugas Baranauskas 2019-12-16 13:21:46 UTC
Created attachment 826200 [details]
y2log
Comment 2 Stefan Hundhammer 2019-12-16 15:02:45 UTC
Does this work with Tumbleweed or Leap 15.1?
I guess you tried Lithuanian there before, right?
Does it also crash for other languages, or only for Lithuanian?
Comment 3 Mindaugas Baranauskas 2019-12-16 15:06:26 UTC
This is openSUSE Leap 15.2.

This bug happens at opening of dialog. If I close error dialog, whole YaST module closes. Thus I have no opportunity to switch language via YaST.

I encourage you to try ISO image in virtual machine to reproduce bug.
Comment 4 Stefan Hundhammer 2019-12-16 15:11:12 UTC
Sorry, but I really can't download various applicance ISOs and experiment with them. We already have a lot of different products to maintain.

Please try to start this from a terminal window like in that other bug last week: Set the LANG and/or LC_MESSAGES environment variables and start that module.

  LANG=fr_FR yast2 language
Comment 5 Mindaugas Baranauskas 2019-12-16 15:17:44 UTC
Created attachment 826211 [details]
LANG=fr_FR yast2 language - screenshot

GUI remains in Lithuanian. Same bug.
Comment 6 Mindaugas Baranauskas 2019-12-16 15:35:37 UTC
I also tested openSUSE TW - here I can not reproduce.
Comment 7 Stefan Hundhammer 2019-12-17 10:58:09 UTC
OK, thanks for testing this again.

Something must be different on your appliance ISO. It might be a missing file that this YaST module attempts to read, or a missing configuration setting in a config file.

But independent of that, yast2-country should not crash with such a nil:NilClass exception. If anything is missing, it should properly report it to the user and then maybe terminate itself.
Comment 8 Manu Maier 2019-12-30 13:51:07 UTC
Should be fixed with version 4.2.11
https://build.opensuse.org/request/show/758604
Comment 9 Josef Reidinger 2020-01-02 14:55:15 UTC
Sadly not fixed. it failing when reading values

2019-12-16 15:13:44 <1> localhost.localdomain(7541) [Ruby] modules/Keyboard.rb:103 keyboard_on_entry: 

https://github.com/yast/yast-country/blob/master/keyboard/src/modules/Keyboard.rb#L99

but @curr_kbd should not be nil. So we need to sanitize it in reading.

But why read failed?

localectl has its value 2019-12-16 15:13:44 <1> localhost.localdomain(7541) [Ruby] lib/cheetah.rb:208 Standard output:        VC Keymap: lt

so it see lt. but in data we have only lt.baltic.

https://github.com/yast/yast-country/blob/master/keyboard/src/data/keyboards.rb#L180

So what is problem?
We do not know all variants of given language and we set lt.baltic, but there are more variants. E.g. localectl knows this keymaps for lt:

lt
lt-ibm
lt-lekp
lt-lekpa
lt-std
lt-us
lt.baltic
lt.l4
lt.std

I am not sure how to handle it. Probably we need to fallback somehow? at least we should not crash if given keymap missing in our map.
Comment 10 Josef Reidinger 2020-01-02 15:14:27 UTC
fix is in review https://github.com/yast/yast-country/pull/238
Comment 11 Josef Reidinger 2020-01-02 15:22:23 UTC
fix merged
Comment 12 Mindaugas Baranauskas 2020-01-09 20:56:02 UTC
Today I tested openSUSE Leap 15.2 based appliance with yast2-country 4.2.14 and 
I confirm that this is bug is fixed in with that version.
Thanks!
Comment 13 Ancor Gonzalez Sosa 2020-01-16 21:16:53 UTC
*** Bug 1161111 has been marked as a duplicate of this bug. ***