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

ruby-changes:27296

From: nobu <ko1@a...>
Date: Thu, 21 Feb 2013 12:45:16 +0900 (JST)
Subject: [ruby-changes:27296] nobu:r39348 (trunk): ruby.c: fix for multiarch library

nobu	2013-02-21 12:45:07 +0900 (Thu, 21 Feb 2013)

  New Revision: 39348

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

  Log:
    ruby.c: fix for multiarch library
    
    * ruby.c (ruby_init_loadpath_safe): try two levels upper for stripping
      libdir name.  [Bug #7874]

  Modified files:
    trunk/ChangeLog
    trunk/configure.in
    trunk/ruby.c

Index: configure.in
===================================================================
--- configure.in	(revision 39347)
+++ configure.in	(revision 39348)
@@ -2670,6 +2670,9 @@ AS_CASE(["$target_os"], https://github.com/ruby/ruby/blob/trunk/configure.in#L2670
 AC_ARG_ENABLE(multiarch,
 	      AS_HELP_STRING([--enable-multiarch], [enable multiarch compatible directories]),
 	      [multiarch=], [unset multiarch])
+if test ${multiarch+set}; then
+   AC_DEFINE(ENABLE_MULTIARCH)
+fi
 
 archlibdir='${libdir}/${arch}'
 sitearchlibdir='${libdir}/${sitearch}'
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 39347)
+++ ChangeLog	(revision 39348)
@@ -1,4 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
-Thu Feb 21 12:42:19 2013  Nobuyoshi Nakada  <nobu@r...>
+Thu Feb 21 12:45:03 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* ruby.c (ruby_init_loadpath_safe): try two levels upper for stripping
+	  libdir name.  [Bug #7874]
 
 	* configure.in (libdir_basename): expand with multiarch in configure,
 	  not to defer the expansion till ruby.pc.in and mkmf.rb.  [Bug #7874]
Index: ruby.c
===================================================================
--- ruby.c	(revision 39347)
+++ ruby.c	(revision 39348)
@@ -464,15 +464,30 @@ ruby_init_loadpath_safe(int safe_level) https://github.com/ruby/ruby/blob/trunk/ruby.c#L464
 #endif
 	const ptrdiff_t bindir_len = (ptrdiff_t)sizeof(bindir) - 1;
 	const ptrdiff_t libdir_len = (ptrdiff_t)sizeof(libdir) - 1;
-	*p = 0;
-	if (p - libpath >= bindir_len && !STRCASECMP(p - bindir_len, bindir)) {
+
+#ifdef ENABLE_MULTIARCH
+	char *p2 = NULL;
+
+      multiarch:
+#endif
+	if (p - libpath >= bindir_len && !STRNCASECMP(p - bindir_len, bindir, bindir_len)) {
 	    p -= bindir_len;
-	    *p = 0;
 	}
-	else if (p - libpath >= libdir_len && !strcmp(p - libdir_len, libdir)) {
+	else if (p - libpath >= libdir_len && !strncmp(p - libdir_len, libdir, libdir_len)) {
 	    p -= libdir_len;
-	    *p = 0;
 	}
+#ifdef ENABLE_MULTIARCH
+	else if (p2) {
+	    p = p2;
+	}
+	else {
+	    p2 = p;
+	    p = rb_enc_path_last_separator(libpath, p, rb_ascii8bit_encoding());
+	    if (p) goto multiarch;
+	    p = p2;
+	}
+#endif
+	*p = 0;
     }
 #if !VARIABLE_LIBPATH
     else {

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

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