[yast-devel] Bug in Ruby code with arg_ref
Hi, we had a strange bug in yast-storage with the Ruby code for adding new LVM logical volumes (also see bng #834330). In ep-lvm-lib.rb the function "EpCreateLogicalVolume" has a local variable "data". That variable is passed by reference to "DlgCreateLogicalVolume" in ep-lvm-dialogs.rb along with a reference to the function "Commit". Commit use "data". So the code looks roughly like this: def EpCreateLogicalVolume(device) data = { ... } _Commit = lambda do do something with data end data_ref = arg_ref(data); DlgCreateLogicalVolume(data_ref, fun_ref(_Commit, "symbol ()")) data = data_ref.value; end def DlgCreateLogicalVolume(data, _Commit) modify data _Commit.call end The problem is that "data" when used in "Commit" has wrong values; it's neither the original value set in "EpCreateLogicalVolume" nor the value set in "DlgCreateLogicalVolume" but some mixture. It's caused by the fact that "data = data_ref.value" happens after calling "Commit". We fixed this by passing "data" to "Commit" explicitely. ciao Arvin -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
On 08/13/2013 03:10 PM, Arvin Schnell wrote:
Hi,
we had a strange bug in yast-storage with the Ruby code for adding new LVM logical volumes (also see bng #834330). ... We fixed this by passing "data" to "Commit" explicitely.
Thanks for reporting. Please, open new issue for ycp-killer project and describe that buggy behavior: https://github.com/yast/ycp-killer/issues Bye Lukas -- Lukas Ocilka, Cloud & Systems Management Department SUSE LINUX s.r.o., Praha -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
On Tue, Aug 13, 2013 at 03:13:35PM +0200, Lukas Ocilka wrote:
On 08/13/2013 03:10 PM, Arvin Schnell wrote:
we had a strange bug in yast-storage with the Ruby code for adding new LVM logical volumes (also see bng #834330). ... We fixed this by passing "data" to "Commit" explicitely.
Thanks for reporting.
Please, open new issue for ycp-killer project and describe that buggy behavior: https://github.com/yast/ycp-killer/issues
For reference, it is https://github.com/yast/ycp-killer/issues/622 -- Martin Vidner, Cloud & Systems Management Team http://en.opensuse.org/User:Mvidner Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu
participants (3)
-
Arvin Schnell
-
Lukas Ocilka
-
Martin Vidner