Hello community,

here is the log from the commit of package yast2-ruby-bindings for 
openSUSE:Factory checked in at 2014-03-11 09:23:58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-ruby-bindings (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-ruby-bindings.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-ruby-bindings"

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-ruby-bindings/yast2-ruby-bindings.changes  
2014-03-01 14:38:21.000000000 +0100
+++ 
/work/SRC/openSUSE:Factory/.yast2-ruby-bindings.new/yast2-ruby-bindings.changes 
    2014-03-11 09:24:01.000000000 +0100
@@ -1,0 +2,6 @@
+Mon Mar  3 16:43:21 UTC 2014 - [email protected]
+
+- do not crash if ruby cannot find yast ruby part
+- 3.1.14
+
+-------------------------------------------------------------------

Old:
----
  yast2-ruby-bindings-3.1.13.tar.bz2

New:
----
  yast2-ruby-bindings-3.1.14.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-ruby-bindings.spec ++++++
--- /var/tmp/diff_new_pack.aKnbJW/_old  2014-03-11 09:24:02.000000000 +0100
+++ /var/tmp/diff_new_pack.aKnbJW/_new  2014-03-11 09:24:02.000000000 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-ruby-bindings
-Version:        3.1.13
+Version:        3.1.14
 Release:        0
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Source0:        yast2-ruby-bindings-%{version}.tar.bz2

++++++ yast2-ruby-bindings-3.1.13.tar.bz2 -> yast2-ruby-bindings-3.1.14.tar.bz2 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-ruby-bindings-3.1.13/package/yast2-ruby-bindings.changes 
new/yast2-ruby-bindings-3.1.14/package/yast2-ruby-bindings.changes
--- old/yast2-ruby-bindings-3.1.13/package/yast2-ruby-bindings.changes  
2014-02-27 16:11:12.000000000 +0100
+++ new/yast2-ruby-bindings-3.1.14/package/yast2-ruby-bindings.changes  
2014-03-06 09:24:30.000000000 +0100
@@ -1,4 +1,10 @@
 -------------------------------------------------------------------
+Mon Mar  3 16:43:21 UTC 2014 - [email protected]
+
+- do not crash if ruby cannot find yast ruby part
+- 3.1.14
+
+-------------------------------------------------------------------
 Thu Feb 27 12:10:11 UTC 2014 - [email protected]
 
 - fix precedence of loading files in lib
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-ruby-bindings-3.1.13/package/yast2-ruby-bindings.spec 
new/yast2-ruby-bindings-3.1.14/package/yast2-ruby-bindings.spec
--- old/yast2-ruby-bindings-3.1.13/package/yast2-ruby-bindings.spec     
2014-02-27 16:11:12.000000000 +0100
+++ new/yast2-ruby-bindings-3.1.14/package/yast2-ruby-bindings.spec     
2014-03-06 09:24:30.000000000 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-ruby-bindings
-Version:        3.1.13
+Version:        3.1.14
 Release:        0
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Source0:        yast2-ruby-bindings-%{version}.tar.bz2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-ruby-bindings-3.1.13/src/binary/Y2RubyUtils.cc 
new/yast2-ruby-bindings-3.1.14/src/binary/Y2RubyUtils.cc
--- old/yast2-ruby-bindings-3.1.13/src/binary/Y2RubyUtils.cc    2014-02-27 
16:11:12.000000000 +0100
+++ new/yast2-ruby-bindings-3.1.14/src/binary/Y2RubyUtils.cc    2014-03-06 
09:24:31.000000000 +0100
@@ -4,11 +4,31 @@
 #include <ruby.h>
 #include <ruby/encoding.h>
 
+#define y2log_component "Y2Ruby"
+#include <ycp/y2log.h>
+
 #include "y2util/stringutil.h"
 #include "Y2RubyUtils.h"
 
 using namespace std;
 
+bool y2_require(const char *str)
+{
+  int error;
+  rb_protect( (VALUE (*)(VALUE))rb_require, (VALUE) str, &error);
+  if (error)
+  {
+    VALUE exception = rb_gv_get("$!"); /* get last exception */
+    VALUE reason = rb_funcall(exception, rb_intern("message"), 0 );
+    VALUE trace = rb_gv_get("$@"); /* get last exception trace */
+    VALUE backtrace = RARRAY_LEN(trace)>0 ? rb_ary_entry(trace, 0) : 
rb_str_new2("Unknown");
+    y2error("cannot require yast:%s at %s", 
StringValuePtr(reason),StringValuePtr(backtrace));
+    return false;
+  }
+
+  return true;
+}
+
 // cache the UTF-8 encoding object
 static rb_encoding *utf8;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-ruby-bindings-3.1.13/src/binary/Y2RubyUtils.h 
new/yast2-ruby-bindings-3.1.14/src/binary/Y2RubyUtils.h
--- old/yast2-ruby-bindings-3.1.13/src/binary/Y2RubyUtils.h     2014-02-27 
16:11:12.000000000 +0100
+++ new/yast2-ruby-bindings-3.1.14/src/binary/Y2RubyUtils.h     2014-03-06 
09:24:31.000000000 +0100
@@ -32,6 +32,11 @@
 VALUE y2ruby_nested_const_get(const std::string &name);
 
 /**
+ * safe variant of rb_require: if an exception happens then log it
+ */
+bool y2_require(const char *str);
+
+/**
  * Create Ruby String object from a C++ string
  * The resulting string has UTF-8 encoding
  */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-ruby-bindings-3.1.13/src/binary/Y2YCPTypeConv.cc 
new/yast2-ruby-bindings-3.1.14/src/binary/Y2YCPTypeConv.cc
--- old/yast2-ruby-bindings-3.1.13/src/binary/Y2YCPTypeConv.cc  2014-02-27 
16:11:12.000000000 +0100
+++ new/yast2-ruby-bindings-3.1.14/src/binary/Y2YCPTypeConv.cc  2014-03-06 
09:24:31.000000000 +0100
@@ -51,10 +51,11 @@
 extern "C" VALUE
 ycp_path_to_rb_path( YCPPath ycppath )
 {
-  int error = 0;
-  rb_protect( (VALUE (*)(VALUE))rb_require, (VALUE) "yast/path",&error);
-  if (error)
-    y2internal("Cannot found yast/path module.");
+  if (!y2_require("yast/path"))
+  {
+    y2internal("Cannot find yast/path module.");
+    return Qnil;
+  }
 
   VALUE yast = rb_define_module("Yast");
   VALUE cls = rb_const_get(yast, rb_intern("Path"));
@@ -65,12 +66,9 @@
 extern "C" VALUE
 ycp_term_to_rb_term( YCPTerm ycpterm )
 {
-  int error = 0;
-//  rb_protect( (VALUE (*)(VALUE))rb_require, (VALUE) "ycp/term",&error);
-  rb_require("yast/term");
-  if (error)
+  if (!y2_require("yast/term"))
   {
-    y2internal("Cannot found yast/term module.");
+    y2internal("Cannot find yast/term module.");
     return Qnil;
   }
 
@@ -87,7 +85,11 @@
 extern "C" VALUE
 ycp_ref_to_rb_ref( YCPReference ycpref )
 {
-  rb_require("yastx");
+  if (!y2_require("yastx"))
+  {
+    y2internal("Cannot find yastx module.");
+    return Qnil;
+  }
 
   VALUE yast = rb_define_module("Yast");
   VALUE cls = rb_const_get(yast, rb_intern("YReference"));
@@ -104,7 +106,11 @@
 extern "C" VALUE
 ycp_bb_to_rb_bb( YCPByteblock ycpbb )
 {
-  rb_require("yastx");
+  if (!y2_require("yastx"))
+  {
+    y2internal("Cannot find yastx module.");
+    return Qnil;
+  }
 
   VALUE yast = rb_define_module("Yast");
   VALUE cls = rb_const_get(yast, rb_intern("Byteblock"));
@@ -121,7 +127,11 @@
 extern "C" VALUE
 ycp_code_to_rb_code( YCPCode ycode )
 {
-  rb_require("yastx");
+  if (!y2_require("yastx"))
+  {
+    y2internal("Cannot find yastx module.");
+    return Qnil;
+  }
 
   VALUE yast = rb_define_module("Yast");
   VALUE cls = rb_const_get(yast, rb_intern("YCode"));
@@ -142,11 +152,9 @@
 ycp_ext_to_rb_ext( YCPExternal ext )
 {
   y2debug("Convert ext %s", ext->toString().c_str());
-  int error = 0;
-  rb_require("yast");
-  if (error)
+  if (!y2_require("yast"))
   {
-    y2internal("Cannot found yast module.");
+    y2internal("Cannot find yast module.");
     return Qnil;
   }
 
@@ -156,7 +164,6 @@
   VALUE argv[] = {rb_utf8_str_new(ext->magic())};
   rb_obj_call_init(tdata, 1, argv);
   return tdata;
-  
 }
 
 /**
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-ruby-bindings-3.1.13/src/binary/YRuby.cc 
new/yast2-ruby-bindings-3.1.14/src/binary/YRuby.cc
--- old/yast2-ruby-bindings-3.1.13/src/binary/YRuby.cc  2014-02-27 
16:11:12.000000000 +0100
+++ new/yast2-ruby-bindings-3.1.14/src/binary/YRuby.cc  2014-03-06 
09:24:31.000000000 +0100
@@ -72,7 +72,7 @@
   // See http://subforge.org/blogs/show/1
   // Note that the solution is different to not touch internal ruby
   rb_define_module("Gem");
-  rb_require("rubygems");
+  y2_require("rubygems");
 
   rb_enc_find_index("encdb");
 
@@ -140,17 +140,10 @@
 {
   YRuby::yRuby();
   string module_path = argList->value(1)->asString()->value();
-  int error = 0;
-  rb_protect( (VALUE (*)(VALUE))rb_require, (VALUE) module_path.c_str(), 
&error);
-  if (error)
-  {
-    VALUE exception = rb_gv_get("$!"); /* get last exception */
-    VALUE reason = rb_funcall(exception, rb_intern("message"), 0 );
-    VALUE trace = rb_gv_get("$@"); /* get last exception trace */
-    VALUE backtrace = RARRAY_LEN(trace)>0 ? rb_ary_entry(trace, 0) : 
rb_str_new2("Unknown");
-    y2error("Module %s load failed:%s at %s", module_path.c_str(), 
StringValuePtr(reason),StringValuePtr(backtrace));
+
+  if (!y2_require(module_path.c_str()))
     return YCPError( "Ruby::loadModule() / Can't load ruby module '" + 
module_path + "'" );
-  }
+
   return YCPVoid();
 }
 
@@ -227,17 +220,8 @@
 
 YCPValue YRuby::callClient(const string& path)
 {
-  int error;
-  rb_protect( (VALUE (*)(VALUE))rb_require, (VALUE) "yast", &error);
-  if (error)
-  {
-    VALUE exception = rb_gv_get("$!"); /* get last exception */
-    VALUE reason = rb_funcall(exception, rb_intern("message"), 0 );
-    VALUE trace = rb_gv_get("$@"); /* get last exception trace */
-    VALUE backtrace = RARRAY_LEN(trace)>0 ? rb_ary_entry(trace, 0) : 
rb_str_new2("Unknown");
-    y2error("cannot require yast:%s at %s", 
StringValuePtr(reason),StringValuePtr(backtrace));
+  if (!y2_require("yast"))
     return YCPBoolean(false);
-  }
 
   VALUE wfm_module = y2ruby_nested_const_get("Yast::WFM");
   VALUE result = rb_funcall(wfm_module, rb_intern("run_client"), 1, 
rb_str_new2(path.c_str()));

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to