Project

General

Profile

Bug #13932 ยป load.patch

A fix - akihikodaki (Akihiko Odaki), 09/23/2017 04:48 PM

View differences:

load.c
for (i = 0; ; i++) {
VALUE entry;
long index;
int found_expanded;
if (RB_TYPE_P(this_feature_index, T_ARRAY)) {
if (i >= RARRAY_LEN(this_feature_index)) break;
entry = RARRAY_AREF(this_feature_index, i);
......
v = RARRAY_AREF(features, index);
f = StringValuePtr(v);
if ((n = RSTRING_LEN(v)) < len) continue;
if (strncmp(f, feature, len) != 0) {
found_expanded = strncmp(f, feature, len) != 0;
if (found_expanded) {
if (expanded) continue;
if (!load_path) load_path = rb_get_expanded_load_path();
if (!(p = loaded_feature_path(f, n, feature, len, type, load_path)))
continue;
expanded = 1;
f += RSTRING_LEN(p) + 1;
}
if (!*(e = f + len)) {
......
return 'u';
}
if (*e != '.') continue;
if ((!rb || !ext) && (IS_SOEXT(e) || IS_DLEXT(e))) {
return 's';
if (IS_SOEXT(e) || IS_DLEXT(e)) {
if (!ext) {
type = 's';
continue;
}
if (!rb) {
return 's';
}
}
if ((rb || !ext) && (IS_RBEXT(e))) {
return 'r';
}
if (found_expanded) {
expanded = 1;
}
}
}
if (!ext && type) {
return type;
}
loading_tbl = get_loading_table();
f = 0;
if (!expanded) {
test/ruby/test_require.rb
end
end
def test_require_twice_with_shared_object
Dir.mktmpdir do |tmp|
so = File.join(tmp, "very_long_file_name.so")
File.write(so, "dummy");
assert_file.exist?(so)
req = File.join(tmp, "very_long_file_name.rb")
File.write(req, "p :ok\n")
assert_file.exist?(req)
req[/.rb$/i] = ""
assert_in_out_err(['--disable-gems'], <<-INPUT, %w(:ok), [])
require "#{req}"
require "#{req}"
INPUT
end
end
def assert_syntax_error_backtrace
Dir.mktmpdir do |tmp|
req = File.join(tmp, "test.rb")
    (1-1/1)