Bug 1021982 - Ruby/Yast2 error on font changing
Summary: Ruby/Yast2 error on font changing
Status: RESOLVED DUPLICATE of bug 1018576
Alias: None
Product: openSUSE Distribution
Classification: openSUSE
Component: YaST2 (show other bugs)
Version: Leap 42.2
Hardware: Other Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: E-mail List
QA Contact: Jiri Srain
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-25 21:04 UTC by Sergio Rafael Lemke
Modified: 2020-11-25 13:05 UTC (History)
4 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
Screenshot of the bug happening on a users desktop (not me). (76.03 KB, image/jpeg)
2017-01-25 21:04 UTC, Sergio Rafael Lemke
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sergio Rafael Lemke 2017-01-25 21:04:31 UTC
Created attachment 711675 [details]
Screenshot of the bug happening on a users desktop (not me).

I don't have much information on this issue, got it reported in a BR Open-SUSE chat:

What I have is the attached screenshot, which points to:
/usr/lib64/ruby/gems/2.1.0/gems/fast_gettext-0.9.2/lib/fast_gettext/vendor/string.rb

then:

zinkpad:/home/bedi # rpm -qf /usr/lib64/ruby/gems/2.1.0/gems/fast_gettext-0.9.2/lib/fast_gettext/vendor/string.rb 
ruby2.1-rubygem-fast_gettext-0.9.2-6.3.x86_64

Changelog does not show any recent version. 
The code related in the screenshot, (line 70) is:

# 1.9.1 if you misspell a %{key} your whole page would blow up, no thanks...
begin
  ("%{b}" % {:a=>'b'})
rescue KeyError
  class String
    alias :_fast_gettext_old_format_m :%
    def %(*args)
      begin
        _fast_gettext_old_format_m(*args)
      rescue KeyError
        self
      end
    end
  end
end

--
Thanks,
Sergio
Comment 1 Marcus Rückert 2017-01-26 10:22:10 UTC
just because the error message shows that file it could still be an incorrect usage from yast.

also the complete backtrace would be useful.
Comment 2 Josef Reidinger 2017-01-26 10:37:08 UTC
In fact, if there is a bug in translation it report error. From yast POV, we do not plan to enclose all _("%{b}") % {:a=>'b'} into rescue as it basically breaks exceptions idea. If there is a bug, then be verbose, that there is a bug.
I am not sure if it is better to show "%{b}" instead of error.

And in fact it is not problem of gettext gem at all. As it do its purpose to translate string.

This sound quite similar to https://bugzilla.novell.com/show_bug.cgi?id=980329 which mention that gettext do not have strong enough validation of string interpolation for ruby. ( so e.g. gettext have to complain if %{a} is translated to %{b} as it is protected key )
Comment 3 Sergio Rafael Lemke 2017-01-27 17:44:44 UTC
I had another look on that screenshot, seems there are many instances of '%'. I will seek the yast pt_BR translation and check is something has be done incorrectly.
Comment 4 Sergio Rafael Lemke 2017-02-02 16:31:11 UTC
Today we got another user reporting this problem, this time always reproducible:

When he uses the system in pt_BR the 'yast2 fonts' gives the error on the screenshot and via terminal a Segmentation Fault:

------
$ xdg-su -c "/sbin/yast2 fonts"
YaST got signal 11 at file /usr/share/YaST2/modules/Popup.rb:953 sender PID: 56

/sbin/yast2: line 440:  4851 Segmentation Fault (imagem do núcleo gravada)$ybindir/y2base $module "$@" "$SELECTED_GUI" $Y2_GEOMETRY $Y2UI_ARGS

------

I asked him to run:
export LANG=C; yast2 fonts => With this command the fonts window opened normally, so clearly something going on with translation.
Comment 5 Marcus Rückert 2017-02-02 19:24:56 UTC
if you can provide a minimal test case for fast_gettext upstream it would be nice.
Comment 6 Sergio Rafael Lemke 2017-02-13 17:39:00 UTC
Hello, I can now reproduce this issue, I can provided specific logs if needed:

linux-pwwq:/var/log/YaST2 # cat y2log
2017-02-13 15:30:00 <1> linux-pwwq(392) [liby2] genericfrontend.cc(main):617 Launched YaST2 component 'y2base' 'fonts' 'qt'
2017-02-13 15:30:00 <1> linux-pwwq(392) [ui-component] YUIComponentCreator.cc(createInternal):124 Creating UI component for ""
2017-02-13 15:30:00 <1> linux-pwwq(392) [liby2] genericfrontend.cc(main):806 YAST_IS_RUNNING is yes
2017-02-13 15:30:00 <1> linux-pwwq(392) [Ruby] yast/wfm.rb:211 Call client /usr/share/YaST2/clients/fonts.rb
2017-02-13 15:30:00 <1> linux-pwwq(392) [ui] YSettings.cc(setProgDir):60 Set progDir to "/usr/share/YaST2"
2017-02-13 15:30:00 <1> linux-pwwq(392) [ui] YSettings.cc(setProgDir):61 progDir is now locked.
2017-02-13 15:30:00 <1> linux-pwwq(392) [ui] YSettings.cc(setLocaleDir):146 Set localeDir to "/usr/share/YaST2/locale"
2017-02-13 15:30:00 <1> linux-pwwq(392) [ui] YSettings.cc(setLocaleDir):147 localeDir is now locked.
2017-02-13 15:30:00 <1> linux-pwwq(392) [ui] YPath.cc(YPath):49 Given filename: libyui-qt.so.7
2017-02-13 15:30:00 <1> linux-pwwq(392) [ui] YSettings.cc(progDir):73 progDir: "/usr/share/YaST2"
2017-02-13 15:30:00 <1> linux-pwwq(392) [ui] YPath.cc(YPath):65 Preferring subdir: /usr/share/YaST2
2017-02-13 15:30:00 <1> linux-pwwq(392) [ui] YPath.cc(YPath):66 Subdir given with filename: 
2017-02-13 15:30:00 <1> linux-pwwq(392) [ui] YPath.cc(YPath):67 Looking for: libyui-qt.so.7
2017-02-13 15:30:00 <1> linux-pwwq(392) [ui] YPath.cc(lsDir):138 Looking in /usr/lib64/yui
2017-02-13 15:30:00 <1> linux-pwwq(392) [ui] YPath.cc(YPath):118 Found libyui-qt.so.7 in /usr/lib64/yui
2017-02-13 15:30:00 <1> linux-pwwq(392) [ui] YUI.cc(YUI):76 This is libyui 3.2.6
2017-02-13 15:30:00 <1> linux-pwwq(392) [ui] YUI.cc(YUI):77 Creating UI with threads
2017-02-13 15:30:00 <1> linux-pwwq(392) [qt-ui] YQUI.cc(YQUI):100 This is libyui-qt 2.46.24
2017-02-13 15:30:00 <1> linux-pwwq(392) [qt-styler] QY2Styler.cc(loadStyleSheet):97 Couldn't open style sheet "/usr/share/YaST2/theme/current/wizard/style.qss"
2017-02-13 15:30:00 <1> linux-pwwq(392) [qt-ui] YQUI.cc(processCommandLineArgs):298 Qt argument: YaST2
2017-02-13 15:30:00 <1> linux-pwwq(392) [qt-ui] YQUI.cc(processCommandLineArgs):298 Qt argument: fonts
2017-02-13 15:30:00 <1> linux-pwwq(392) [qt-ui] YQUI.cc(processCommandLineArgs):298 Qt argument: qt
2017-02-13 15:30:00 <1> linux-pwwq(392) [qt-ui] YQUI.cc(calcDefaultSize):441 Default size: 1344 x 737
2017-02-13 15:30:00 <3> linux-pwwq(392) [qt-ui] YQUI.cc(initUI):264 Forcing /libQtGui.so.5 open failed
2017-02-13 15:30:00 <1> linux-pwwq(392) [qt-ui] YQApplication.cc(loadPredefinedQtTranslations):133 Selected language: pt_BR
2017-02-13 15:30:00 <2> linux-pwwq(392) [qt-ui] YQApplication.cc(loadPredefinedQtTranslations):137 Qt locale directory not set - no translations for predefined Qt dialogs
2017-02-13 15:30:00 <1> linux-pwwq(392) [qt-ui] YQUI.cc(initUI):275 YQUI initialized. Thread ID: 0x0x7f0c8f0a9700
2017-02-13 15:30:00 <1> linux-pwwq(392) [Ruby] fonts/fonts-dialog.rb:929 module started
2017-02-13 15:30:00 <1> linux-pwwq(392) [Ruby] modules/Misc.rb:188 ."/etc/os-release"."NAME": 'openSUSE Leap'
2017-02-13 15:30:00 <1> linux-pwwq(392) [ui] YCP_UI.cc(SetApplicationIcon):1708 Setting application icon to "/usr/share/YaST2/theme/current/icons/64x64/apps/yast.png"
2017-02-13 15:30:01 <1> linux-pwwq(392) [ui] YSettings.cc(localeDir):161 localeDir: "/usr/share/YaST2/locale"
2017-02-13 15:30:01 <1> linux-pwwq(392) [qt-ui] YQUI.cc(qMessageHandler):721 <libqt-debug> Registering  QWidget(0x7f0c880a1300, name="work_area")  for parent  YQWizard(0x7f0c8809e8e0, name="wizard") 
2017-02-13 15:30:01 <1> linux-pwwq(392) [qt-ui] YQUI.cc(qMessageHandler):721 
2017-02-13 15:30:01 <2> linux-pwwq(392) [qt-ui] YQUI.cc(qMessageHandler):731 <libqt-warning> QLayout: Attempting to add QLayout "" to QFrame "", which already has a layout
2017-02-13 15:30:01 <1> linux-pwwq(392) [ui] YPushButton.cc(setFunctionKey):202 Guessing button role YHelpButton for YPushButton "Ajuda" at 0x7f0c8809f040 from function key F1
2017-02-13 15:30:01 <1> linux-pwwq(392) [ui] YPushButton.cc(setFunctionKey):202 Guessing button role YCancelButton for YPushButton "Cancelar" at 0x7f0c882434b0 from function key F9
2017-02-13 15:30:01 <1> linux-pwwq(392) [ui] YPushButton.cc(setFunctionKey):202 Guessing button role YOKButton for YPushButton "Próximo" at 0x7f0c8821d000 from function key F10
2017-02-13 15:30:01 <1> linux-pwwq(392) [Ruby] modules/Progress.rb:344 Progress::New(Reading Font Configuration, 1, ["Read sysconfig file"])
2017-02-13 15:30:01 <1> linux-pwwq(392) [Ruby] fonts/fonts-dialog.rb:942 reading /etc/sysconfig/fonts-config
2017-02-13 15:30:01 <2> linux-pwwq(392) [Interpreter] fonts/fonts-config-state.rb:453 Scripting agent sweeping
2017-02-13 15:30:01 <2> linux-pwwq(392) [scr] ScriptingAgent.cc(parseSingleConfigFile):172 Ignoring re-registration of path '.target'
2017-02-13 15:30:01 <1> linux-pwwq(392) [Ruby] fonts/fonts-dialog.rb:944 read: fpl[sans]=,fpl[serif]=,fpl[monospace]=,search_metric_compatible=true,really_force_fpl=false,force_aa_off=false,force_aa_off_mono=false,force_ah_on=false,force_hintstyle=none,embedded_bitmaps=true,all_ebl=false,ebl=ja:ko:zh-CN:zh-TW:zh-HK:zh-SG,lcd_filter=lcdnone,subpixel_layout=none
2017-02-13 15:30:01 <1> linux-pwwq(392) [Ruby] fonts/fonts-dialog.rb:947 creating temporary default fontconfig in /tmp/yast-fonts-20170213-392-1p4n23u
2017-02-13 15:30:01 <1> linux-pwwq(392) [Ruby] fonts/fonts-dialog.rb:950 running dialog
2017-02-13 15:30:01 <3> linux-pwwq(392) [ui-wizard] YCPWizardCommandParser.cc(isCommand):217 Bad arguments for wizard command SetBackButtonLabel(string) : `SetBackButtonLabel (nil)
2017-02-13 15:30:01 <3> linux-pwwq(392) [ui-wizard] YCPWizardCommandParser.cc(parseAndExecute):104 Undefined wizard command: `SetBackButtonLabel (nil)
2017-02-13 15:30:01 <2> linux-pwwq(392) [ui] YProperty.cc(contains):111         THROW:    Property type mismatch: Label is type String, not Bool
2017-02-13 15:30:01 <2> linux-pwwq(392) [ui] YProperty.cc(contains):111 
2017-02-13 15:30:01 <2> linux-pwwq(392) [ui] YCP_UI.cc(ChangeWidget):728        CAUGHT:   Property type mismatch: Label is type String, not Bool
2017-02-13 15:30:01 <2> linux-pwwq(392) [ui] YCP_UI.cc(ChangeWidget):728 
2017-02-13 15:30:01 <3> linux-pwwq(392) [libycp] modules/Wizard.rb:1067 UI::ChangeWidget failed: UI::ChangeWidget( `id (`back), `Label, nil )
2017-02-13 15:30:01 <3> linux-pwwq(392) [libycp] modules/Wizard.rb:828 Unknown option `immediate in MenuButton widget
2017-02-13 15:30:01 <3> linux-pwwq(392) [libycp] modules/CWMTab.rb:154 Unknown option `immediate in ComboBox widget
2017-02-13 15:30:01 <3> linux-pwwq(392) [libycp] modules/CWMTab.rb:154 Unknown option `immediate in ComboBox widget
2017-02-13 15:30:01 <3> linux-pwwq(392) [libycp] modules/CWMTab.rb:154 Unknown option `immediate in ComboBox widget
2017-02-13 15:30:01 <3> linux-pwwq(392) [libycp] modules/CWMTab.rb:154 Unknown option `immediate in CheckBox widget
2017-02-13 15:30:01 <3> linux-pwwq(392) [libycp] modules/CWMTab.rb:154 Unknown option `immediate in CheckBox widget
2017-02-13 15:30:01 <3> linux-pwwq(392) [libycp] modules/CWMTab.rb:154 Unknown option `immediate in ComboBox widget
2017-02-13 15:30:01 <3> linux-pwwq(392) [libycp] modules/CWMTab.rb:154 Unknown option `immediate in ComboBox widget
2017-02-13 15:30:01 <3> linux-pwwq(392) [libycp] modules/CWMTab.rb:154 Unknown option `immediate in ComboBox widget
2017-02-13 15:30:02 <3> linux-pwwq(392) [Ruby] yast/wfm.rb:229 Client call failed with 'flag after width' and backtrace ["/usr/lib64/ruby/gems/2.1.0/gems/fast_gettext-0.9.2/lib/fast_gettext/vendor/string.rb:70:in `%'", "/usr/lib64/ruby/gems/2.1.0/gems/fast_gettext-0.9.2/lib/fast_gettext/vendor/string.rb:70:in `%'", "/usr/share/YaST2/lib/fonts/fonts-dialog.rb:325:in `graphic_match_preview'", "/usr/share/YaST2/lib/fonts/fonts-dialog.rb:402:in `block in initialize_specimen_widget'", "/usr/share/YaST2/lib/fonts/fonts-dialog.rb:372:in `each'", "/usr/share/YaST2/lib/fonts/fonts-dialog.rb:372:in `initialize_specimen_widget'", "/usr/lib64/ruby/vendor_ruby/2.1.0/yast/fun_ref.rb:33:in `call'", "/usr/lib64/ruby/vendor_ruby/2.1.0/yast/fun_ref.rb:33:in `call'", "/usr/share/YaST2/modules/CWM.rb:351:in `block in initWidgets'", "/usr/lib64/ruby/vendor_ruby/2.1.0/yast/builtins.rb:83:in `call'", "/usr/lib64/ruby/vendor_ruby/2.1.0/yast/builtins.rb:83:in `block in foreach'", "/usr/lib64/ruby/vendor_ruby/2.1.0/yast/builtins.rb:82:in `each'", "/usr/lib64/ruby/vendor_ruby/2.1.0/yast/builtins.rb:82:in `foreach'", "/usr/share/YaST2/modules/CWM.rb:334:in `initWidgets'", "/usr/share/YaST2/modules/CWMTab.rb:102:in `TabInit'", "/usr/share/YaST2/modules/CWMTab.rb:211:in `InitNewTab'", "/usr/share/YaST2/modules/CWMTab.rb:227:in `Init'", "/usr/share/YaST2/modules/CWMTab.rb:283:in `InitWrapper'", "/usr/lib64/ruby/vendor_ruby/2.1.0/yast/fun_ref.rb:33:in `call'", "/usr/lib64/ruby/vendor_ruby/2.1.0/yast/fun_ref.rb:33:in `call'", "/usr/share/YaST2/modules/CWM.rb:351:in `block in initWidgets'", "/usr/lib64/ruby/vendor_ruby/2.1.0/yast/builtins.rb:83:in `call'", "/usr/lib64/ruby/vendor_ruby/2.1.0/yast/builtins.rb:83:in `block in foreach'", "/usr/lib64/ruby/vendor_ruby/2.1.0/yast/builtins.rb:82:in `each'", "/usr/lib64/ruby/vendor_ruby/2.1.0/yast/builtins.rb:82:in `foreach'", "/usr/share/YaST2/modules/CWM.rb:334:in `initWidgets'", "/usr/share/YaST2/modules/CWM.rb:798:in `Run'", "/usr/share/YaST2/modules/CWM.rb:991:in `ShowAndRun'", "/usr/share/YaST2/lib/fonts/fonts-dialog.rb:951:in `run_dialog'", "/usr/share/YaST2/lib/fonts/fonts-dialog.rb:56:in `run'", "/usr/share/YaST2/lib/fonts/fonts-dialog.rb:50:in `run'", "/usr/share/YaST2/clients/fonts.rb:3:in `<top (required)>'", "/usr/lib64/ruby/vendor_ruby/2.1.0/yast/wfm.rb:216:in `eval'", "/usr/lib64/ruby/vendor_ruby/2.1.0/yast/wfm.rb:216:in `run_client'"]
2017-02-13 15:30:02 <3> linux-pwwq(392) [Ruby] yast/wfm.rb:250 Internal error. Please report a bug report with logs.
Details: flag after width
Caller:  /usr/lib64/ruby/gems/2.1.0/gems/fast_gettext-0.9.2/lib/fast_gettext/vendor/string.rb:70:in `%'
2017-02-13 15:30:02 <1> linux-pwwq(392) [ui] YPushButton.cc(setFunctionKey):202 Guessing button role YOKButton for YPushButton "OK" at 0x7f0c881c0cb0 from function key F10
2017-02-13 15:30:03 <2> linux-pwwq(392) [qt-ui] YQUI.cc(qMessageHandler):731 <libqt-warning> QObject::killTimer: Timers cannot be stopped from another thread
2017-02-13 15:30:03 <2> linux-pwwq(392) [qt-ui] YQUI.cc(qMessageHandler):731 <libqt-warning> QObject::~QObject: Timers cannot be stopped from another thread
2017-02-13 15:30:03 <3> linux-pwwq(392) [ui] YUI.cc(~YUI):94 1 open dialogs left over
linux-pwwq:/var/log/YaST2 #
Comment 7 Sergio Rafael Lemke 2017-02-15 01:31:35 UTC
How I reproduced:

Installed a new leap 42.2 using as language Brazilian Portuguese. 
That's all needed, not just run: 'yast2 fonts' and you will trigger the bug.

This bug is somehow related to the language, if I do:
'export LANG=C' the bug doesn't happen.

Also, on a system installed as default in English(en_US) doing:
'export LANG=pt_BR' will not trigger the bug.
Comment 8 Sergio Rafael Lemke 2017-02-17 13:53:57 UTC
Reassigning as it seems more related to yast.
Comment 9 Luiz Fernando Ranghetti 2017-02-18 03:06:21 UTC
Hi,

I see that the language used is pt_BR. I found an error in a translation which probably is the cause of this problem:

<p><b>Specimen for %s</b></p>  ->   <p><b>Espécie de %1 </b></p>

I fixed the wrong "%1" in Weblate:
https://l10n.opensuse.org/translate/yast-fonts/master/pt_BR/?sid=a0172bf4-f586-11e6-8772-525400a48651&offset=0


The same applies to bug 1018576 (https://bugzilla.opensuse.org/show_bug.cgi?id=1018576)
Comment 10 Sergio Rafael Lemke 2017-02-20 03:10:00 UTC
Hello,
I did and ugly 'on the fly' test and indeed this change fixes the problem:

Edited: vim /usr/share/YaST2/locale/pt_BR/LC_MESSAGES/fonts.mo

Changed:
<p><b>Espécie de %1 </b></p>
to
<p><b>Espécie de %s </b></p>
Comment 11 Sergio Rafael Lemke 2017-02-20 03:13:09 UTC
Marking as duplicate of 1018576 since we have the same info and fix there also.

*** This bug has been marked as a duplicate of bug 1018576 ***