[前][次][番号順一覧][スレッド一覧]

ruby-changes:38331

From: nobu <ko1@a...>
Date: Fri, 1 May 2015 13:30:32 +0900 (JST)
Subject: [ruby-changes:38331] nobu:r50412 (trunk): dln.c: check incompatible libruby

nobu	2015-05-01 13:30:26 +0900 (Fri, 01 May 2015)

  New Revision: 50412

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50412

  Log:
    dln.c: check incompatible libruby
    
    * dln.c (dln_load): check if a different libruby is loaded by the
      extension library, and then bail out to get rid of very frequent
      reported stale bug reports.

  Modified files:
    trunk/ChangeLog
    trunk/dln.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 50411)
+++ ChangeLog	(revision 50412)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri May  1 13:30:24 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* dln.c (dln_load): check if a different libruby is loaded by the
+	  extension library, and then bail out to get rid of very frequent
+	  reported stale bug reports.
+
 Thu Apr 30 19:51:11 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* compile.c (iseq_compile_each): revert r46873 and r46875, not to
Index: dln.c
===================================================================
--- dln.c	(revision 50411)
+++ dln.c	(revision 50412)
@@ -1324,6 +1324,21 @@ dln_load(const char *file) https://github.com/ruby/ruby/blob/trunk/dln.c#L1324
 	    error = dln_strerror();
 	    goto failed;
 	}
+# if defined RUBY_EXPORT
+	{
+	    static const char incompatible[] = "incompatible library version";
+	    void *ex = dlsym(handle, EXPORT_PREFIX"ruby_xmalloc");
+	    if (ex && ex != ruby_xmalloc) {
+
+#   if !defined __APPLE__
+		/* dlclose() segfaults */
+		dlclose(handle);
+#   endif
+		error = incompatible;
+		goto failed;
+	    }
+	}
+# endif
 
 	init_fct = (void(*)())(VALUE)dlsym(handle, buf);
 	if (init_fct == NULL) {

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]