1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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.
This commit is contained in:
Jeremy Evans 2021-10-04 07:35:39 -07:00
parent c4570acc86
commit bfd2f159f0

29
load.c
View file

@ -1060,6 +1060,33 @@ rb_ext_ractor_safe(bool flag)
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
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 {