Hello community,
here is the log from the commit of package yast2-ruby-bindings for
openSUSE:Factory checked in at 2019-03-06 19:02:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-ruby-bindings (Old)
and /work/SRC/openSUSE:Factory/.yast2-ruby-bindings.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-ruby-bindings"
Wed Mar 6 19:02:56 2019 rev:93 rq:681820 version:4.1.4
Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-ruby-bindings/yast2-ruby-bindings.changes
2019-01-24 14:01:02.684213678 +0100
+++
/work/SRC/openSUSE:Factory/.yast2-ruby-bindings.new.28833/yast2-ruby-bindings.changes
2019-03-06 19:02:58.449081520 +0100
@@ -1,0 +2,14 @@
+Tue Mar 5 14:23:29 UTC 2019 - Ladislav Slezák <[email protected]>
+
+- Always return frozen strings from the translation functions,
+ make the results unified (related to bsc#1125006)
+- 4.1.4
+
+-------------------------------------------------------------------
+Mon Mar 4 09:11:50 UTC 2019 - Michal Filka <[email protected]>
+
+- bnc#1127685
+ - Internal error message popup is scaled according to its content
+- 4.1.3
+
+-------------------------------------------------------------------
Old:
----
yast2-ruby-bindings-4.1.2.tar.bz2
New:
----
yast2-ruby-bindings-4.1.4.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-ruby-bindings.spec ++++++
--- /var/tmp/diff_new_pack.tr5fsS/_old 2019-03-06 19:02:59.029081364 +0100
+++ /var/tmp/diff_new_pack.tr5fsS/_new 2019-03-06 19:02:59.029081364 +0100
@@ -17,7 +17,7 @@
Name: yast2-ruby-bindings
-Version: 4.1.2
+Version: 4.1.4
Release: 0
Url: https://github.com/yast/yast-ruby-bindings
BuildRoot: %{_tmppath}/%{name}-%{version}-build
++++++ yast2-ruby-bindings-4.1.2.tar.bz2 -> yast2-ruby-bindings-4.1.4.tar.bz2
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-ruby-bindings-4.1.2/package/yast2-ruby-bindings.changes
new/yast2-ruby-bindings-4.1.4/package/yast2-ruby-bindings.changes
--- old/yast2-ruby-bindings-4.1.2/package/yast2-ruby-bindings.changes
2019-01-23 10:06:13.000000000 +0100
+++ new/yast2-ruby-bindings-4.1.4/package/yast2-ruby-bindings.changes
2019-03-05 16:34:56.000000000 +0100
@@ -1,4 +1,18 @@
-------------------------------------------------------------------
+Tue Mar 5 14:23:29 UTC 2019 - Ladislav Slezák <[email protected]>
+
+- Always return frozen strings from the translation functions,
+ make the results unified (related to bsc#1125006)
+- 4.1.4
+
+-------------------------------------------------------------------
+Mon Mar 4 09:11:50 UTC 2019 - Michal Filka <[email protected]>
+
+- bnc#1127685
+ - Internal error message popup is scaled according to its content
+- 4.1.3
+
+-------------------------------------------------------------------
Tue Jan 22 17:58:53 UTC 2019 - [email protected]
- Support for FastGettext 2.0 (still works with FastGettext 1.6)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-ruby-bindings-4.1.2/package/yast2-ruby-bindings.spec
new/yast2-ruby-bindings-4.1.4/package/yast2-ruby-bindings.spec
--- old/yast2-ruby-bindings-4.1.2/package/yast2-ruby-bindings.spec
2019-01-23 10:06:13.000000000 +0100
+++ new/yast2-ruby-bindings-4.1.4/package/yast2-ruby-bindings.spec
2019-03-05 16:34:56.000000000 +0100
@@ -17,7 +17,7 @@
Name: yast2-ruby-bindings
-Version: 4.1.2
+Version: 4.1.4
Url: https://github.com/yast/yast-ruby-bindings
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-4.1.2/src/ruby/yast/i18n.rb
new/yast2-ruby-bindings-4.1.4/src/ruby/yast/i18n.rb
--- old/yast2-ruby-bindings-4.1.2/src/ruby/yast/i18n.rb 2019-01-23
10:06:13.000000000 +0100
+++ new/yast2-ruby-bindings-4.1.4/src/ruby/yast/i18n.rb 2019-03-05
16:34:56.000000000 +0100
@@ -43,12 +43,19 @@
end
# translates given string
+ # @param str [String] the string to translate
+ # @return [String] the translated string, if the translation is not found
then
+ # the original text is returned. **The returned String is frozen!**
+ # @note **⚠ The translated string is frozen and cannot be modified. To
provide
+ # consistent results the original (not translated) string is also frozen.
+ # This means this function modifies the passed argument! If you do not
want this
+ # behavior then pass a duplicate, e.g. `_(text.dup)`. ⚠**
def _(str)
# no textdomain configured yet
if !@my_textdomain
Yast.y2warning("No textdomain configured, cannot translate
#{str.inspect}")
Yast.y2warning("Called from: #{::Kernel.caller(1).first}")
- return str
+ return str.freeze
end
found = true
@@ -60,7 +67,7 @@
key_exist?(str)
end
end
- found ? Translation._(str) : str
+ found ? Translation._(str) : str.freeze
end
# No translation, only marks the text to be found by gettext when creating
POT file,
@@ -101,8 +108,16 @@
end
# Gets translation based on number.
- # @param (String) singular text for translators for single value
- # @param (String) plural text for translators for bigger value
+ # @param [String] singular text for translators for single value
+ # @param [String] plural text for translators for bigger value
+ # @param [String] num the actual number, used for evaluating the correct
plural form
+ # @return [String] the translated string, if the translation is not found
then
+ # the original text is returned (either the plural or the singular
version,
+ # depending on the `num` parameter). **The returned String is frozen!**
+ # @note **⚠ The translated string is frozen and cannot be modified. To
provide
+ # consistent results the original (not translated) strings are also
frozen.
+ # This means this function modifies the passed argument! If you do not
want this
+ # behavior then pass a duplicate, e.g. `n_(singular.dup, plural.dup,
n)`. ⚠**
def n_(singular, plural, num)
# no textdomain configured yet
if !@my_textdomain
@@ -188,6 +203,10 @@
#
# @return [String] {singular} if {num} == 1; {plural} otherwise.
def fallback_n_(singular, plural, num)
+ # always freeze both strings to have consistent results
+ singular.freeze
+ plural.freeze
+
(num == 1) ? singular : plural
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-4.1.2/src/ruby/yast/wfm.rb
new/yast2-ruby-bindings-4.1.4/src/ruby/yast/wfm.rb
--- old/yast2-ruby-bindings-4.1.2/src/ruby/yast/wfm.rb 2019-01-23
10:06:13.000000000 +0100
+++ new/yast2-ruby-bindings-4.1.4/src/ruby/yast/wfm.rb 2019-03-05
16:34:56.000000000 +0100
@@ -216,7 +216,7 @@
# @return [String] human readable exception description
private_class_method def self.internal_error_msg(e)
msg = "Internal error. Please report a bug report with logs.\n" \
- "Run save_y2logs to get complete logs.\n"
+ "Run save_y2logs to get complete logs.\n\n"
if e.is_a?(ArgumentError) && e.message =~ /invalid byte sequence in
UTF-8/
msg += "A string was encountered that is not valid in UTF-8.\n" \
@@ -224,8 +224,8 @@
"Refer to https://www.suse.com/support/kb/doc?id=7018056.\n\n"
end
- msg + "Details: #{e.message}\n" \
- "Caller: #{e.backtrace.first}"
+ msg + "Caller: #{e.backtrace.first}\n\n" \
+ "Details: #{e.message}"
end
# Handles a SignalExpection
@@ -273,7 +273,12 @@
end
else
Yast.import "Report"
- Report.Error(msg)
+ # Pure approximation here
+ # 50 is for usable text area width, +6 is for additional lines like
+ # button line, Error caption and so. Whole dialog is at most 20 lines
+ # high to fit into screen
+ height = [msg.size / 50 + 6, 20].min
+ Report.LongError(msg.gsub(/\n/, '<br />'), height:height)
end
rescue Exception => e
Builtins.y2internal("Error reporting failed with '%1'.Backtrace:\n%2",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-4.1.2/tests/i18n_spec.rb
new/yast2-ruby-bindings-4.1.4/tests/i18n_spec.rb
--- old/yast2-ruby-bindings-4.1.2/tests/i18n_spec.rb 2019-01-23
10:06:13.000000000 +0100
+++ new/yast2-ruby-bindings-4.1.4/tests/i18n_spec.rb 2019-03-05
16:34:56.000000000 +0100
@@ -8,6 +8,12 @@
module Yast
describe I18n do
+
+ before do
+ # do not read the real translations from the system
+ allow(FastGettext).to receive(:add_text_domain)
+ end
+
describe ".N_" do
it "returns the original parameter" do
input = "INPUT TEST"
@@ -43,6 +49,20 @@
expect(_(SINGULAR)).to eq(TRANSLATED)
end
+ context "translation is not found" do
+ it "returns a frozen string if the translation is not found" do
+ allow(FastGettext).to receive(:key_exist?).and_return(false)
+ expect(_("foo")).to be_frozen
+ end
+
+ it "freezes the passed argument string if the translation is not
found" do
+ allow(FastGettext).to receive(:key_exist?).and_return(false)
+ text = "foo"
+ _(text)
+ expect(text).to be_frozen
+ end
+ end
+
context "when FastGettext throws an Errno::ENOENT exception" do
before do
allow(FastGettext).to receive(:key_exist?)