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

ruby-changes:72847

From: Nobuyoshi <ko1@a...>
Date: Sun, 7 Aug 2022 16:02:33 +0900 (JST)
Subject: [ruby-changes:72847] f2423be49d (master): Duplicate libruby self path

https://git.ruby-lang.org/ruby.git/commit/?id=f2423be49d

From f2423be49d6f1b6ae42f542c43b8b02d5115dc0c Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 7 Aug 2022 14:46:59 +0900
Subject: Duplicate libruby self path

When LOAD_RELATIVE, as `sopath` is truncated to the prefix path, make
the duplicate before it.  Also make `rb_libruby_selfpath` frozen and
hidden.
---
 ruby.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/ruby.c b/ruby.c
index 991c9031de..7c6742cac4 100644
--- a/ruby.c
+++ b/ruby.c
@@ -629,7 +629,13 @@ ruby_init_loadpath(void) https://github.com/ruby/ruby/blob/trunk/ruby.c#L629
 #if defined(LOAD_RELATIVE) || defined(__MACH__)
     VALUE libruby_path = runtime_libruby_path();
 # if defined(__MACH__)
-    rb_libruby_selfpath = libruby_path;
+    VALUE selfpath = libruby_path;
+#   if defined(LOAD_RELATIVE)
+    selfpath = rb_str_dup(selfpath);
+#   endif
+    rb_obj_hide(selfpath);
+    OBJ_FREEZE_RAW(selfpath);
+    rb_libruby_selfpath = selfpath;
     rb_gc_register_address(&rb_libruby_selfpath);
 # endif
 #endif
-- 
cgit v1.2.1


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

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