Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix hidden bug in `rb_feature_p` #63

Closed
wants to merge 1 commit into from

1 participant

@funny-falcon

lazy assigned load_path searched in loading_table were not expanded (line #186),
but all features, pushed to loading table, are expanded.

This bug is hidden because load_path is allways filled in loaded_features loop (line #160),
but if we try to optimize this loop (http://redmine.ruby-lang.org/issues/5427 , https://gist.github.com/1272991),
then load_path could be not filled, and bug exposed.

@funny-falcon funny-falcon Fix hidden bug in `rb_feature_p`
lazy assigned load_path searched in loading_table were not expanded (line #186),
but all features, pushed to loading table, are expanded.

This bug is hidden because load_path is allways filled in loaded_features loop (line #160),
but if we try to optimize this loop (http://redmine.ruby-lang.org/issues/5427), 
then load_path could be not filled, and bug exposed.
3ba7525
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 8, 2011
  1. @funny-falcon

    Fix hidden bug in `rb_feature_p`

    funny-falcon authored
    lazy assigned load_path searched in loading_table were not expanded (line #186),
    but all features, pushed to loading table, are expanded.
    
    This bug is hidden because load_path is allways filled in loaded_features loop (line #160),
    but if we try to optimize this loop (http://redmine.ruby-lang.org/issues/5427), 
    then load_path could be not filled, and bug exposed.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  load.c
View
2  load.c
@@ -183,7 +183,7 @@ rb_feature_p(const char *feature, const char *ext, int rb, int expanded, const c
fs.name = feature;
fs.len = len;
fs.type = type;
- fs.load_path = load_path ? load_path : rb_get_load_path();
+ fs.load_path = load_path ? load_path : rb_get_expanded_load_path();
fs.result = 0;
st_foreach(loading_tbl, loaded_feature_path_i, (st_data_t)&fs);
if ((f = fs.result) != 0) {
Something went wrong with that request. Please try again.