Bug 1192650

Summary: YaST2 sw_single fatal error when trying to install single rpm due to new UI check
Product: [openSUSE] openSUSE Tumbleweed Reporter: Tejas Guruswamy <masterpatricko>
Component: YaST2Assignee: Stefan Hundhammer <shundhammer>
Status: RESOLVED FIXED QA Contact: Jiri Srain <jsrain>
Severity: Normal    
Priority: P2 - High CC: alexinfobag, jshand2013, sb56637, sebix+novell.com
Version: Current   
Target Milestone: ---   
Hardware: x86-64   
OS: openSUSE Tumbleweed   
URL: https://trello.com/c/bM1EFCcS
See Also: http://bugzilla.opensuse.org/show_bug.cgi?id=1195519
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: Relevent section of y2log

Description Tejas Guruswamy 2021-11-12 20:53:12 UTC
Using the DE file associations to open & install a downloaded RPM file with yast2 sw_single fails with the following error:

Caller: /usr/share/YaST2/lib/ui/ui_extension_checker.rb:93:in `exist?'

Details: no implicit conversion of nil into String

y2logs confirms that the auto-detection of loaded UI library introduced in https://github.com/yast/yast-yast2/pull/1194 is failing -- UI list is empty.

2021-11-12 14:49:28 <1> hobbes(9794) [Ruby] yast2/ui_plugin_info.rb(ui_plugins):53 UI plug-ins: []
2021-11-12 14:49:28 <3> hobbes(9794) [Ruby] yast/wfm.rb(handle_exception):272 Client /usr/share/YaST2/clients/sw_single.rb failed with 'no implicit conversion of nil into String' (TypeError).
Backtrace:
/usr/share/YaST2/lib/ui/ui_extension_checker.rb:93:in `exist?'
/usr/share/YaST2/lib/ui/ui_extension_checker.rb:93:in `installed?'
/usr/share/YaST2/lib/ui/ui_extension_checker.rb:60:in `ensure_ext_installed'
/usr/share/YaST2/lib/ui/ui_extension_checker.rb:39:in `initialize'
/usr/share/YaST2/clients/sw_single.rb:77:in `new'
/usr/share/YaST2/clients/sw_single.rb:77:in `main'
/usr/share/YaST2/clients/sw_single.rb:823:in `<top (required)>'
/usr/lib64/ruby/vendor_ruby/2.7.0/yast/wfm.rb:347:in `eval'
/usr/lib64/ruby/vendor_ruby/2.7.0/yast/wfm.rb:347:in `run_client'
/usr/lib64/ruby/vendor_ruby/2.7.0/yast/wfm.rb:207:in `call_builtin'
/usr/lib64/ruby/vendor_ruby/2.7.0/yast/wfm.rb:207:in `call_builtin_wrapper'
/usr/lib64/ruby/vendor_ruby/2.7.0/yast/wfm.rb:196:in `CallFunction'
/usr/lib/YaST2/bin/y2start:60:in `<main>'
2021-11-12 14:49:28 <3> hobbes(9794) [Ruby] yast/wfm.rb(handle_exception):309 Internal error. Please report a bug report with logs.<br>Run save_y2logs to get complete logs.<br><br>Caller:  /usr/share/YaST2/lib/ui/ui_extension_checker.rb:93:in `exist?&#39;<br><br>Details: no implicit conversion of nil into String

> rpm -qa | grep libyui
libyui-qt-pkg15-4.2.21-1.1.x86_64
libyui-ncurses-pkg15-4.2.21-1.1.x86_64
libyui-qt15-4.2.21-1.1.x86_64
libyui-qt-graph15-4.2.21-1.1.x86_64
libyui-ncurses15-4.2.21-1.1.x86_64
libyui15-4.2.21-1.1.x86_64

> rpm -q yast2-packager
yast2-packager-4.4.12-1.1.x86_64

> cat /etc/os-release 
NAME="openSUSE Tumbleweed"
# VERSION="20211110"
Comment 1 Tejas Guruswamy 2021-11-12 20:58:28 UTC
Created attachment 853723 [details]
Relevent section of y2log

Full logs from sw_single installing a single rpm attached
Comment 2 Stefan Hundhammer 2021-11-15 09:41:53 UTC
*** Bug 1192680 has been marked as a duplicate of this bug. ***
Comment 3 Stefan Hundhammer 2021-11-15 09:56:55 UTC
This crash seems to affect multiple users. Bumping priority to P2.
Comment 4 Stefan Hundhammer 2021-11-15 12:17:58 UTC
So this was started with:

2021-11-12 14:49:28 <1> hobbes(9794) [Ruby]
  bin/y2start(<main>):22 y2base called with
  ["sw_single",
   "--arg", 
   "/home/tejas/src/obs/packages/opensuse-welcome-lang-0.1.8-0.noarch.rpm",
   "qt",
   "-name", "YaST2",
   "-icon", "yast"]
Comment 5 Stefan Hundhammer 2021-11-15 12:55:10 UTC
So in this setup, there don't seem to be any UI plug-ins loaded yet:

2021-11-12 14:49:28 <1> hobbes(9794) [Ruby] 
  yast2/ui_plugin_info.rb(ui_plugins):53 
  UI plug-ins: []
Comment 6 Stefan Hundhammer 2021-11-15 15:15:17 UTC
AFAICS this is called via /usr/share/applications/org.opensuse.yast.Packager.desktop:


[Desktop Entry]
Encoding=UTF-8
Name=YaST Software
...
Exec=/usr/lib/YaST2/bin/sw_single_wrapper %F
...
MimeType=application/x-rpm;application/x-redhat-package-manager;
Comment 7 Stefan Hundhammer 2021-11-15 16:22:12 UTC
So, it turned out that this was caused by an unfortunate mixture of the YaST command line mode and that new UIExtensionChecker class: The CLI mode was initiated by that additional argument (the name of the RPM) on the command line.

But in that case, creating the UI YaST component is delayed until the first real UI call; basically, until a window is opened.

That other class checks what shared libs: It reads /proc/self/maps for "libyui*" so it can compare if the matching libyui*-pkg is available, and if not, it asks if it should install the corresponding package. But since not even the main part of the UI (libyui-qt or libyui-ncurses) was loaded yet, it didn't find it there, and it tried to build the name of the -pkg plug-in from 'nil' which was what failed.
Comment 8 Stefan Hundhammer 2021-11-15 17:53:50 UTC
Pull request with a fix:

  https://github.com/yast/yast-yast2/pull/1204
Comment 10 Stefan Hundhammer 2021-11-16 08:53:25 UTC
The fix will arrive with yast2-4.4.22.
OBS submit request:

https://build.opensuse.org/request/show/931637
Comment 11 David Diaz 2021-11-19 08:39:24 UTC
*** Bug 1192859 has been marked as a duplicate of this bug. ***