Project

General

Profile

Actions

Bug #18173

closed

The feature in `$LOADED_FEATURES` is loaded again

Added by nobu (Nobuyoshi Nakada) over 2 years ago. Updated over 2 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:105294]

Description

In general, the feature name registered in $LOADED_FEATURES (e.g. "enumerator.so", "thread.rb", and so on) is expected not to be loaded again.

But, as @ko1 (Koichi Sasada) reported, when a feature name is added to the variable during another file is required, it will be loaded again.

$ echo 'raise __FILE__' > target.rb
$ echo '$" << "target.rb"' > provide.rb
$ ruby -r./provide.rb target.rb 
target.rb:1:in `<main>': target.rb (RuntimeError)
Actions #1

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

  • Status changed from Open to Closed

Applied in changeset git|ddb32e66160ab50849419ef7c7ac584913b79c34.


[Bug #18173] Update loaded_features_index

If $LOADED_FEATURES is changed in the just required file, also the
index table needs to be updated before loaded_features_snapshot is
reset. If the snapshot is reset without updating the table, the
name of the added feature will not be found.

Updated by nagachika (Tomoyuki Chikanaga) over 2 years ago

  • Backport changed from 2.6: REQUIRED, 2.7: REQUIRED, 3.0: REQUIRED to 2.6: REQUIRED, 2.7: REQUIRED, 3.0: DONE

ruby_3_0 5341eca588e738cd5031ab7d8bb5c300471c00e9 merged revision(s) ddb32e66160ab50849419ef7c7ac584913b79c34.

Updated by usa (Usaku NAKAMURA) over 2 years ago

  • Backport changed from 2.6: REQUIRED, 2.7: REQUIRED, 3.0: DONE to 2.6: REQUIRED, 2.7: DONE, 3.0: DONE

ruby_2_7 61a02168f7ba353a2838f2783f291a816d7e0c90 merged revision(s) ddb32e66160ab50849419ef7c7ac584913b79c34.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0