Hi all,
this is JFYI to be aware of an Ops.is() limitation.
During debugging a crash in yast2-sound [1] I found out that Ops.is()
implementaion does not properly support all data types.
The problem is with typed maps/lists, the internal data type is not checked at
all.
Example:
Ops.is({}, "list") => false
Ops.is([], "list") => true
Ops.is([1, 2], "list<integer>") => true
But also:
Ops.is([1, 2], "list<string>") => true
This makes a trouble when the internal data type is important:
if Ops.is(foo, "list<string>")
...
elsif Ops.is(foo, "list<integer>")
...
I have checked all occurencies in Yast ([2]) and only yast2-sound seems to be
affected therefore I have fixed it just there. See the pull request [3], I
simple
replaced Ops.is() by native Ruby #is_a? method [4].
[1] https://bugzilla.novell.com/show_bug.cgi?id=845928
[2] https://bugzilla.novell.com/show_bug.cgi?id=845928#c3
[3] https://github.com/yast/yast-sound/pull/4
[4] http://ruby-doc.org/core-2.0.0/Object.html#method-i-is_a-3F
--
Ladislav Slezák
Appliance department / YaST Developer
Lihovarská 1060/12
190 00 Prague 9 / Czech Republic
tel: +420 284 028 960
[email protected]
SUSE
--
To unsubscribe, e-mail: [email protected]
To contact the owner, e-mail: [email protected]