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

ruby-changes:68249

From: Jeremy <ko1@a...>
Date: Tue, 5 Oct 2021 01:43:35 +0900 (JST)
Subject: [ruby-changes:68249] d9b7403746 (master): Use a rescue around the internal realpath call for each loaded feature

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

From d9b7403746249b532ac57ca80112d7e63a417d86 Mon Sep 17 00:00:00 2001
From: Jeremy Evans <code@j...>
Date: Mon, 4 Oct 2021 07:35:39 -0700
Subject: Use a rescue around the internal realpath call for each loaded
 feature

This appears to be only necessary on Solaris, but this commit
enables it unconditionally to test breakage.  The following
commit will switch to only enabling it on Solaris.
---
 load.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/load.c b/load.c
index 3c0c723f72..38b26881ce 100644
--- a/load.c
+++ b/load.c
@@ -1060,6 +1060,33 @@ rb_ext_ractor_safe(bool flag) https://github.com/ruby/ruby/blob/trunk/load.c#L1060
     GET_THREAD()->ext_config.ractor_safe = flag;
 }
 
+#if 1
+static VALUE
+required_feature__realpath(VALUE path)
+{
+    return rb_realpath_internal(Qnil, path, 1);
+}
+
+static VALUE
+required_feature_realpath_rescue(VALUE path, VALUE exc)
+{
+    return path;
+}
+
+static VALUE
+required_feature_realpath(VALUE path)
+{
+    return rb_rescue(required_feature__realpath, path,
+        required_feature_realpath_rescue, path);
+}
+#else
+static VALUE
+required_feature_realpath(VALUE path)
+{
+    return rb_realpath_internal(Qnil, path, 1);
+}
+#endif
+
 /*
  * returns
  *  0: if already loaded (false)
@@ -1111,7 +1138,7 @@ require_internal(rb_execution_context_t *ec, VALUE fname, int exception, bool wa https://github.com/ruby/ruby/blob/trunk/load.c#L1138
 		result = TAG_RETURN;
 	    }
             else if (RTEST(rb_hash_aref(realpaths,
-                                        realpath = rb_realpath_internal(Qnil, path, 1)))) {
+                                        realpath = required_feature_realpath(path)))) {
                 result = 0;
             }
 	    else {
-- 
cgit v1.2.1


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

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