Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a rescue around the internal realpath call for each loaded feature #4931

Merged
merged 2 commits into from Oct 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 28 additions & 1 deletion load.c
Expand Up @@ -1060,6 +1060,33 @@ rb_ext_ractor_safe(bool flag)
GET_THREAD()->ext_config.ractor_safe = flag;
}

#ifdef __sun
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)
Expand Down Expand Up @@ -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 {
Expand Down
3 changes: 0 additions & 3 deletions test/ruby/test_process.rb
Expand Up @@ -1732,9 +1732,6 @@ def test_wait_and_sigchild
end

def test_no_curdir
if /solaris/i =~ RUBY_PLATFORM
skip "Temporary skip to avoid CI failures after commit to use realpath on required files"
end
with_tmpchdir {|d|
Dir.mkdir("vd")
status = nil
Expand Down