@@ -817,7 +817,7 @@ iseq_eval_in_namespace(VALUE arg)
817817}
818818
819819static inline void
820- load_iseq_eval (rb_execution_context_t * ec , VALUE fname )
820+ load_iseq_eval (rb_execution_context_t * ec , VALUE fname , int * fd )
821821{
822822 GET_loading_vm_ns ();
823823 const rb_namespace_t * loading_ns = rb_loading_namespace ();
@@ -834,7 +834,7 @@ load_iseq_eval(rb_execution_context_t *ec, VALUE fname)
834834 result .options .line = 1 ;
835835 result .node .coverage_enabled = 1 ;
836836
837- VALUE error = pm_load_parse_file (& result , fname , NULL );
837+ VALUE error = pm_load_parse_file (& result , fname , fd , NULL );
838838
839839 if (error == Qnil ) {
840840 int error_state ;
@@ -915,7 +915,7 @@ load_wrapping(rb_execution_context_t *ec, VALUE fname, VALUE load_wrapper)
915915 EC_PUSH_TAG (ec );
916916 state = EC_EXEC_TAG ();
917917 if (state == TAG_NONE ) {
918- load_iseq_eval (ec , fname );
918+ load_iseq_eval (ec , fname , NULL );
919919 }
920920 EC_POP_TAG ();
921921
@@ -958,7 +958,7 @@ rb_load_internal(VALUE fname, VALUE wrap)
958958 state = load_wrapping (ec , fname , namespace );
959959 }
960960 else {
961- load_iseq_eval (ec , fname );
961+ load_iseq_eval (ec , fname , NULL );
962962 }
963963 raise_load_if_failed (ec , state );
964964}
@@ -996,7 +996,7 @@ load_entrypoint_internal(VALUE fname, VALUE wrap)
996996
997997 path = rb_find_file (fname );
998998 if (!path ) {
999- if (!rb_file_load_ok (RSTRING_PTR (fname )))
999+ if (!rb_file_load_ok (RSTRING_PTR (fname ), NULL ))
10001000 load_failed (orig_fname );
10011001 path = fname ;
10021002 }
@@ -1189,7 +1189,7 @@ rb_f_require_relative(VALUE obj, VALUE fname)
11891189typedef int (* feature_func )(vm_ns_t * vm_ns , const char * feature , const char * ext , int rb , int expanded , const char * * fn );
11901190
11911191static int
1192- search_required (vm_ns_t * vm_ns , VALUE fname , volatile VALUE * path , feature_func rb_feature_p )
1192+ search_required (vm_ns_t * vm_ns , VALUE fname , volatile VALUE * path , feature_func rb_feature_p , int * fd )
11931193{
11941194 VALUE tmp ;
11951195 char * ext , * ftptr ;
@@ -1204,7 +1204,7 @@ search_required(vm_ns_t *vm_ns, VALUE fname, volatile VALUE *path, feature_func
12041204 if (loading ) * path = rb_filesystem_str_new_cstr (loading );
12051205 return 'r' ;
12061206 }
1207- if ((tmp = rb_find_file (fname )) != 0 ) {
1207+ if ((tmp = rb_find_file_internal (fname , fd )) != 0 ) {
12081208 ext = strrchr (ftptr = RSTRING_PTR (tmp ), '.' );
12091209 if (!rb_feature_p (vm_ns , ftptr , ext , TRUE, TRUE, & loading ) || loading )
12101210 * path = tmp ;
@@ -1245,7 +1245,7 @@ search_required(vm_ns_t *vm_ns, VALUE fname, volatile VALUE *path, feature_func
12451245 return 'r' ;
12461246 }
12471247 tmp = fname ;
1248- const unsigned int type = rb_find_file_ext (& tmp , ft == 's' ? ruby_ext : loadable_ext );
1248+ const unsigned int type = rb_find_file_ext_internal (& tmp , ft == 's' ? ruby_ext : loadable_ext , ft == 's' ? NULL : fd );
12491249
12501250 // Check if it's a statically linked extension when
12511251 // not already a feature and not found as a dynamic library.
@@ -1339,7 +1339,7 @@ rb_resolve_feature_path(VALUE klass, VALUE fname)
13391339
13401340 fname = rb_get_path (fname );
13411341 path = rb_str_encode_ospath (fname );
1342- found = search_required (vm_ns , path , & path , no_feature_p );
1342+ found = search_required (vm_ns , path , & path , no_feature_p , NULL );
13431343
13441344 switch (found ) {
13451345 case 'r' :
@@ -1429,9 +1429,10 @@ require_internal(rb_execution_context_t *ec, VALUE fname, int exception, bool wa
14291429 if ((state = EC_EXEC_TAG ()) == TAG_NONE ) {
14301430 VALUE handle ;
14311431 int found ;
1432+ int fd = -1 ;
14321433
14331434 RUBY_DTRACE_HOOK (FIND_REQUIRE_ENTRY , RSTRING_PTR (fname ));
1434- found = search_required (vm_ns , path , & saved_path , rb_feature_p );
1435+ found = search_required (vm_ns , path , & saved_path , rb_feature_p , & fd );
14351436 RUBY_DTRACE_HOOK (FIND_REQUIRE_RETURN , RSTRING_PTR (fname ));
14361437 path = saved_path ;
14371438
@@ -1459,7 +1460,7 @@ require_internal(rb_execution_context_t *ec, VALUE fname, int exception, bool wa
14591460 load_wrapping (saved .ec , path , vm_ns -> ns -> ns_object );
14601461 }
14611462 else {
1462- load_iseq_eval (saved .ec , path );
1463+ load_iseq_eval (saved .ec , path , & fd );
14631464 }
14641465 break ;
14651466
0 commit comments