Hello community,
here is the log from the commit of package yast2-ruby-bindings for
openSUSE:Factory
checked in at Wed Jul 27 11:56:38 CEST 2011.
--------
--- yast2-ruby-bindings/yast2-ruby-bindings.changes 2009-11-03
16:35:34.000000000 +0100
+++
/mounts/work_src_done/STABLE/yast2-ruby-bindings/yast2-ruby-bindings.changes
2011-07-26 16:29:42.000000000 +0200
@@ -1,0 +2,13 @@
+Tue Jul 26 07:58:02 UTC 2011 - [email protected]
+
+- Re-init the Ruby stack when calling a Ruby function. bnc#708059
+- 0.3.7
+
+-------------------------------------------------------------------
+Mon Jul 25 13:28:56 UTC 2011 - [email protected]
+
+- wrap rb_funcall in rb_protect to prevent segfaults if the
+ calling function raises an exception (bnc#705425)
+- 0.3.6
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
yast2-ruby-bindings-0.3.5.tar.bz2
New:
----
yast2-ruby-bindings-0.3.7.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-ruby-bindings.spec ++++++
--- /var/tmp/diff_new_pack.nDokp7/_old 2011-07-27 11:38:52.000000000 +0200
+++ /var/tmp/diff_new_pack.nDokp7/_new 2011-07-27 11:38:52.000000000 +0200
@@ -1,7 +1,7 @@
#
-# spec file for package yast2-ruby-bindings (Version 0.3.5)
+# spec file for package yast2-ruby-bindings
#
-# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -19,19 +19,20 @@
Name: yast2-ruby-bindings
-Version: 0.3.5
+Version: 0.3.7
Release: 1
License: GPL
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source0: yast2-ruby-bindings-%{version}.tar.bz2
Prefix: /usr
+
BuildRequires: cmake gcc-c++ libxcrypt-devel swig yast2-core-devel
BuildRequires: yast2-devtools >= 2.16.3
# libzypp-devel is missing .la requires
BuildRequires: ruby-devel
-Requires: yast2-core >= 2.16.37
-BuildRequires: yast2-core-devel >= 2.16.37
+Requires: yast2-core >= 2.18.1
+BuildRequires: yast2-core-devel >= 2.18.1
Requires: yast2-ycp-ui-bindings >= 2.16.37
BuildRequires: yast2-ycp-ui-bindings-devel >= 2.16.37
Requires: ruby
++++++ yast2-ruby-bindings-0.3.5.tar.bz2 -> yast2-ruby-bindings-0.3.7.tar.bz2
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-0.3.5/VERSION.cmake
new/yast2-ruby-bindings-0.3.7/VERSION.cmake
--- old/yast2-ruby-bindings-0.3.5/VERSION.cmake 2009-11-03 16:33:44.000000000
+0100
+++ new/yast2-ruby-bindings-0.3.7/VERSION.cmake 2011-07-26 16:26:31.000000000
+0200
@@ -1,3 +1,3 @@
SET(VERSION_MAJOR "0")
SET(VERSION_MINOR "3")
-SET(VERSION_PATCH "5")
+SET(VERSION_PATCH "7")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-ruby-bindings-0.3.5/examples/ruby/module-storage.rb
new/yast2-ruby-bindings-0.3.7/examples/ruby/module-storage.rb
--- old/yast2-ruby-bindings-0.3.5/examples/ruby/module-storage.rb
2009-11-03 16:33:44.000000000 +0100
+++ new/yast2-ruby-bindings-0.3.7/examples/ruby/module-storage.rb
2011-07-26 16:26:31.000000000 +0200
@@ -1,4 +1,4 @@
-require 'yast'
+require 'ycp'
require 'ycp/storage'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-ruby-bindings-0.3.5/examples/ruby/module-timezone.rb
new/yast2-ruby-bindings-0.3.7/examples/ruby/module-timezone.rb
--- old/yast2-ruby-bindings-0.3.5/examples/ruby/module-timezone.rb
2009-11-03 16:33:44.000000000 +0100
+++ new/yast2-ruby-bindings-0.3.7/examples/ruby/module-timezone.rb
2011-07-26 16:26:31.000000000 +0200
@@ -1,4 +1,4 @@
-require 'yast'
+require 'ycp'
require 'ycp/timezone'
zonemap = YCP::Timezone::get_zonemap
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-0.3.5/examples/ruby/test.yml
new/yast2-ruby-bindings-0.3.7/examples/ruby/test.yml
--- old/yast2-ruby-bindings-0.3.5/examples/ruby/test.yml 1970-01-01
01:00:00.000000000 +0100
+++ new/yast2-ruby-bindings-0.3.7/examples/ruby/test.yml 2011-07-26
16:26:31.000000000 +0200
@@ -0,0 +1,20 @@
+# The list of services that could be operated by webYaST services module.
+# Add only name of service if there is /etc/init.d/<service-name> script
available.
+# Otherwise, provide also service description and paths to start, stop and
status scripts.
+
+#cron:
+# name: cron
+
+#beagle:
+# name: beagle
+# description: Desktop Search Application
+# start: "/usr/bin/beagled"
+# stop: "/usr/bin/beagle-shutdown"
+# status: "/usr/bin/beagle-ping"
+
+collectd:
+ name: collectd
+ description: Statistics Collection Daemon for filling RRD Files
+ start: "/usr/sbin/rccollectd start"
+ stop: "/usr/sbin/rccollectd stop"
+ status: "/usr/sbin/rccollectd status"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-0.3.5/examples/ruby/ui.rb
new/yast2-ruby-bindings-0.3.7/examples/ruby/ui.rb
--- old/yast2-ruby-bindings-0.3.5/examples/ruby/ui.rb 2009-11-03
16:33:44.000000000 +0100
+++ new/yast2-ruby-bindings-0.3.7/examples/ruby/ui.rb 2011-07-26
16:26:31.000000000 +0200
@@ -1,23 +1,16 @@
require 'ycp'
-require 'ycp/ui'
-
YCP::Ui::init("qt")
-include YaST::Ui
+include YCP::Ui
t = HBox( Label("Welcome to Ruby!"), PushButton("Push me") )
-
-puts "#{t.to_s} #{t.class}"
-
-ui.OpenDialog(t)
-ui.UserInput()
-
# You can also use downcase, as the symbols are aliased
-t = hbox( label("Welcome to Ruby!"), pushbutton("Push me") )
+#t = hbox( label("Welcome to Ruby!"), pushbutton("Push me") )
puts "#{t.to_s} #{t.class}"
-ui.OpenDialog(t)
-ui.UserInput()
-
+# how should this work?
+# ui.OpenDialog(t)
+# ui.UserInput()
-exit
+p YCP::call_ycp_function( "UI", "OpenDialog", t )
+p YCP::call_ycp_function( "UI", "UserInput" )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-ruby-bindings-0.3.5/package/yast2-ruby-bindings.changes
new/yast2-ruby-bindings-0.3.7/package/yast2-ruby-bindings.changes
--- old/yast2-ruby-bindings-0.3.5/package/yast2-ruby-bindings.changes
2009-11-03 16:33:44.000000000 +0100
+++ new/yast2-ruby-bindings-0.3.7/package/yast2-ruby-bindings.changes
2011-07-26 16:26:31.000000000 +0200
@@ -1,4 +1,17 @@
-------------------------------------------------------------------
+Tue Jul 26 07:58:02 UTC 2011 - [email protected]
+
+- Re-init the Ruby stack when calling a Ruby function. bnc#708059
+- 0.3.7
+
+-------------------------------------------------------------------
+Mon Jul 25 13:28:56 UTC 2011 - [email protected]
+
+- wrap rb_funcall in rb_protect to prevent segfaults if the
+ calling function raises an exception (bnc#705425)
+- 0.3.6
+
+-------------------------------------------------------------------
Tue Nov 3 12:43:21 UTC 2009 - [email protected]
- support for nested namespaces (Foo::Bar)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-0.3.5/src/ruby/CMakeLists.txt
new/yast2-ruby-bindings-0.3.7/src/ruby/CMakeLists.txt
--- old/yast2-ruby-bindings-0.3.5/src/ruby/CMakeLists.txt 2009-11-03
16:33:44.000000000 +0100
+++ new/yast2-ruby-bindings-0.3.7/src/ruby/CMakeLists.txt 2011-07-26
16:26:31.000000000 +0200
@@ -76,6 +76,7 @@
#
TARGET_LINK_LIBRARIES( ycpx ${YAST_PLUGIN_WFM_LIBRARY} )
TARGET_LINK_LIBRARIES( ycpx ${YAST_PLUGIN_SCR_LIBRARY} )
+TARGET_LINK_LIBRARIES( ycpx ${YAST_PLUGIN_UI_LIBRARY} )
TARGET_LINK_LIBRARIES( ycpx ${RUBY_LIBRARY} )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-0.3.5/src/ruby/Y2RubyTypeConv.cc
new/yast2-ruby-bindings-0.3.7/src/ruby/Y2RubyTypeConv.cc
--- old/yast2-ruby-bindings-0.3.5/src/ruby/Y2RubyTypeConv.cc 2009-11-03
16:33:44.000000000 +0100
+++ new/yast2-ruby-bindings-0.3.7/src/ruby/Y2RubyTypeConv.cc 2011-07-26
16:26:31.000000000 +0200
@@ -225,11 +225,11 @@
VALUE cname = rb_funcall(rb_funcall(value, rb_intern("class"), 0),
rb_intern("to_s"), 0);
const char *class_name = StringValuePtr(cname);
/* get the Term class object */
- if ( !strcmp(class_name, "Yast::Term") )
+ if ( !strcmp(class_name, "YaST::Term") )
{
return ryast_yterm_from_rterm(value);
}
- rb_raise( rb_eTypeError, "Conversion of Ruby type not supported");
+ rb_raise( rb_eTypeError, "Conversion of Ruby type %s not supported",
class_name);
return YCPValue();
}
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-0.3.5/src/ruby/YCP.cc
new/yast2-ruby-bindings-0.3.7/src/ruby/YCP.cc
--- old/yast2-ruby-bindings-0.3.5/src/ruby/YCP.cc 2009-11-03
16:33:44.000000000 +0100
+++ new/yast2-ruby-bindings-0.3.7/src/ruby/YCP.cc 2011-07-26
16:26:31.000000000 +0200
@@ -54,11 +54,6 @@
// more useful macros
#define RB_FINALIZER(func) ((void (*)(...))func)
-// this macro saves us from typing
-// (ruby_method*) & method_name
-// in rb_define_method
-#define RB_METHOD(func) ((VALUE (*)(...))func)
-
#define GetY2Object(obj, po) \
Data_Get_Struct(obj, Y2Namespace, po)
@@ -94,7 +89,7 @@
/*--------------------------------------------
*
- * Document-module: Ui
+ * Document-module: YCP::Ui
*
*--------------------------------------------
*/
@@ -666,26 +661,26 @@
* module YCP
*/
rb_mYCP = rb_define_module("YCP");
- rb_define_singleton_method( rb_mYCP, "import",
RB_METHOD(ycp_module_import), 1);
- rb_define_singleton_method( rb_mYCP, "call_ycp_function",
RB_METHOD(ycp_module_call_ycp_function), -1);
- rb_define_singleton_method( rb_mYCP, "call_ycp_builtin",
RB_METHOD(ycp_module_call_ycp_builtin), -1);
- rb_define_singleton_method( rb_mYCP, "method_missing",
RB_METHOD(ycp_method_missing), -1);
-
- rb_define_singleton_method( rb_mYCP, "each_symbol",
RB_METHOD(ycp_module_each_symbol), 1);
- rb_define_singleton_method( rb_mYCP, "each_builtin_symbol",
RB_METHOD(ycp_module_each_builtin_symbol), 1);
- rb_define_singleton_method( rb_mYCP, "each_builtin",
RB_METHOD(ycp_module_each_builtin), 0);
+ rb_define_singleton_method( rb_mYCP, "import",
RUBY_METHOD_FUNC(ycp_module_import), 1);
+ rb_define_singleton_method( rb_mYCP, "call_ycp_function",
RUBY_METHOD_FUNC(ycp_module_call_ycp_function), -1);
+ rb_define_singleton_method( rb_mYCP, "call_ycp_builtin",
RUBY_METHOD_FUNC(ycp_module_call_ycp_builtin), -1);
+ rb_define_singleton_method( rb_mYCP, "method_missing",
RUBY_METHOD_FUNC(ycp_method_missing), -1);
+
+ rb_define_singleton_method( rb_mYCP, "each_symbol",
RUBY_METHOD_FUNC(ycp_module_each_symbol), 1);
+ rb_define_singleton_method( rb_mYCP, "each_builtin_symbol",
RUBY_METHOD_FUNC(ycp_module_each_builtin_symbol), 1);
+ rb_define_singleton_method( rb_mYCP, "each_builtin",
RUBY_METHOD_FUNC(ycp_module_each_builtin), 0);
/*
* module YCP::Ui
*/
rb_mUi = rb_define_module_under(rb_mYCP, "Ui");
- rb_define_singleton_method( rb_mUi, "init", RB_METHOD(ui_init), -1);
+ rb_define_singleton_method( rb_mUi, "init", RUBY_METHOD_FUNC(ui_init), -1);
/*
* module YaST
*/
rb_mYaST = rb_define_module("YaST");
- rb_define_method( rb_mYaST, "logger", RB_METHOD(yast_y2_logger), -1);
+ rb_define_method( rb_mYaST, "logger", RUBY_METHOD_FUNC(yast_y2_logger),
-1);
y2internal("ryast_path_init\n");
ryast_path_init(rb_mYaST);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-0.3.5/src/ruby/YRuby.cc
new/yast2-ruby-bindings-0.3.7/src/ruby/YRuby.cc
--- old/yast2-ruby-bindings-0.3.5/src/ruby/YRuby.cc 2009-11-03
16:33:44.000000000 +0100
+++ new/yast2-ruby-bindings-0.3.7/src/ruby/YRuby.cc 2011-07-26
16:26:31.000000000 +0200
@@ -20,6 +20,7 @@
*/
#include <stdlib.h>
+#include <stdarg.h>
#include <list>
#include <iosfwd>
#include <sstream>
@@ -125,9 +126,7 @@
string module_name = argList->value(0)->asString()->value();
string module_path = argList->value(1)->asString()->value();
//y2milestone("loadModule 3: '%s'", module_name.c_str());
- string require_module = "require(\"" + module_path + "\")";
- //y2milestone("loadModule 3.5");
- VALUE result = rb_eval_string((require_module).c_str());
+ VALUE result = rb_require(module_path.c_str());
if ( result == Qfalse )
return YCPError( "Ruby::loadModule() / Can't load ruby module '" +
module_path + "'" );
//y2milestone("loadModule 4");
@@ -135,6 +134,40 @@
}
+// snprintf into a temp string
+static char *
+fmtstr(const char* fmt, ...)
+{
+ va_list ap;
+ int len;
+ char* str;
+
+ va_start(ap, fmt);
+ len = vsnprintf(NULL, 0, fmt, ap);
+ va_end(ap);
+ if (len <= 0)
+ {
+ return NULL;
+ }
+ str = (char*)malloc(len+1);
+ if (str == NULL)
+ {
+ return NULL;
+ }
+ va_start(ap, fmt);
+ vsnprintf(str, len+1, fmt, ap);
+ va_end(ap);
+ return str;
+}
+
+
+// rb_protect-enabled rb_funcall, see below
+static VALUE
+protected_call(VALUE args)
+{
+ VALUE *values = (VALUE *)args;
+ return rb_funcall3(values[0], values[1], (int)values[2], values+3);
+}
/**
* @param argList arguments start 1!, 0 is dummy
@@ -143,6 +176,7 @@
YRuby::callInner (string module_name, string function, bool method,
YCPList argList, constTypePtr wanted_result_type)
{
+ RUBY_INIT_STACK // bnc#708059
VALUE module = y2ruby_nested_const_get(module_name);
if (module == Qnil)
{
@@ -155,20 +189,39 @@
// make rooms for size-1 arguments to
// the ruby function
- VALUE values[size-1];
+ // +3 for module, function, and number of args
+ // to pass to protected_call()
+ VALUE values[size-1+3];
+ int error;
int i=0;
for ( ; i < size-1; ++i )
{
// get the
YCPValue v = argList->value(i+1);
y2milestone("Adding argument %d of type %s", i, v->valuetype_str());
- values[i] = ycpvalue_2_rbvalue(v);
+ values[i+3] = ycpvalue_2_rbvalue(v);
}
- y2milestone( "Wll call function '%s' in module '%s' with '%d' arguments",
function.c_str(), module_name.c_str(), size-1);
- VALUE result = rb_funcall2( module, rb_intern(function.c_str()), size-1,
values );
+ y2milestone( "Will call function '%s' in module '%s' with '%d' arguments",
function.c_str(), module_name.c_str(), size-1);
+ values[0] = module;
+ values[1] = rb_intern(function.c_str());
+ values[2] = size-1;
+ VALUE result = rb_protect(protected_call, (VALUE)values, &error);
+ if (error)
+ {
+ VALUE exception = rb_gv_get("$!"); /* get last exception */
+ VALUE reason = rb_funcall(exception, rb_intern("to_s"), 0 );
+ VALUE trace = rb_gv_get("$@"); /* get last exception trace */
+ VALUE backtrace = rb_funcall(trace, rb_intern("join"), 1,
rb_str_new("\n\t", 2));
+
+ char* tmp = fmtstr("%s\n\t%s", StringValuePtr(reason),
StringValuePtr(backtrace));
+ y2error("%s.%s failed\n%s", module_name.c_str(), function.c_str(), tmp);
+ }
+ else
+ {
//VALUE result = rb_funcall( module, rb_intern(function.c_str()), 2,
INT2NUM(2), INT2NUM(3) );
- y2milestone( "Called function '%s' in module '%s'", function.c_str(),
module_name.c_str());
+ y2milestone( "Called function '%s' in module '%s'", function.c_str(),
module_name.c_str());
+ }
return rbvalue_2_ycpvalue(result);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-ruby-bindings-0.3.5/src/ruby/ycp.rb
new/yast2-ruby-bindings-0.3.7/src/ruby/ycp.rb
--- old/yast2-ruby-bindings-0.3.5/src/ruby/ycp.rb 2009-11-03
16:33:44.000000000 +0100
+++ new/yast2-ruby-bindings-0.3.7/src/ruby/ycp.rb 2011-07-26
16:26:31.000000000 +0200
@@ -163,7 +163,7 @@
#
module YaST
- class Term
+ class TermBuilder
# blank slate
instance_methods.each { |m| undef_method m unless (m =~
/^__|instance_eval$/)}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-ruby-bindings-0.3.5/yast2-ruby-bindings.spec.in
new/yast2-ruby-bindings-0.3.7/yast2-ruby-bindings.spec.in
--- old/yast2-ruby-bindings-0.3.5/yast2-ruby-bindings.spec.in 2009-11-03
16:33:44.000000000 +0100
+++ new/yast2-ruby-bindings-0.3.7/yast2-ruby-bindings.spec.in 2011-07-26
16:26:31.000000000 +0200
@@ -18,8 +18,8 @@
BuildRequires: yast2-devtools >= 2.16.3
# libzypp-devel is missing .la requires
BuildRequires: ruby-devel
-Requires: yast2-core >= 2.16.37
-BuildRequires: yast2-core-devel >= 2.16.37
+Requires: yast2-core >= 2.18.1
+BuildRequires: yast2-core-devel >= 2.18.1
Requires: yast2-ycp-ui-bindings >= 2.16.37
BuildRequires: yast2-ycp-ui-bindings-devel >= 2.16.37
Requires: ruby
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]