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

Add spec for require after $LOAD_PATH change #1881

Merged
merged 3 commits into from
Apr 26, 2013
Merged

Add spec for require after $LOAD_PATH change #1881

merged 3 commits into from
Apr 26, 2013

Conversation

LTe
Copy link
Contributor

@LTe LTe commented Aug 31, 2012

When developer add something to $LOAD_PATH and require once again the same file ruby should not require it once again.

Example:

Rubinius have lib/racc/parser.rb file. And this file will require after bootstrap.

require 'racc/parser'

After require rubygems $LOAD_PATH will change and now we have access to two version on racc/parser (from Rubinius /lib and /gems/racc). When user try to require once again rubinius will search via $LOAD_PATH and hit racc/parser from RUBYGEMS. In ruby 1.9 mode all paths are expanded so rubinius will require once again racc/parser. This is because in $LOADED_FEATURES we can find only [rubinius_path]/lib/racc/parser.rb. When CodeLoader will find file in $LOAD_PATH ([rubygems]/racc/parser.rb) and full path of this file is not part of $LOADED_FEATURES so parser.rb file will be load once again.

Any ideas how to recognize already loaded file (but from other full path)?

This spec reproduce @txus gist click
Related to issue #1571

@travisbot
Copy link

This pull request fails (merged db572b0 into 149a364).

@dbussink
Copy link
Contributor

Did you work further on implementing these changes on the Rubinius side to pass these specs?

@LTe
Copy link
Contributor Author

LTe commented Sep 27, 2012

No, but I can add fail tag and after that this pull request can be merged.

@stouset
Copy link
Contributor

stouset commented Mar 28, 2013

Can you add this fail tag, so we can merge the spec?

LTe added 2 commits March 29, 2013 14:19
When developer add something to $LOAD_PATH and require once again the
same file ruby should not require it once again.

Example:

Rubinius have lib/racc/parser.rb file. And this file will require after
bootstrap.

  require 'racc/parser'

After require 'rubygems' $LOAD_PATH will change and now we have access
to two version on 'racc/parser' (from Rubinius /lib and /gems/racc).
When user try to require once again rubinius will search via $LOAD_PATH
and hit racc/parser from _RUBYGEMS_. In ruby 1.9 mode all paths are
expanded so rubinius will require once again 'racc/parser'. This is
because in $LOADED_FEATURES we can find only
"[rubinius_path]/lib/racc/parser.rb". When CodeLoader will find file in
$LOAD_PATH ([rubygems]/racc/parser.rb) and full path is not part of
$LOADED_FEATURES this file will be load once again.
@LTe
Copy link
Contributor Author

LTe commented Mar 29, 2013

@stouset updated ;)

@stouset
Copy link
Contributor

stouset commented Mar 29, 2013

Your push doesn't seem to have had the desired effect of making Travis pass — the tests you added are still failing. You can either figure out the issue and solve it on your end, or I can try and take a look this weekend if I get a chance.

dbussink added a commit that referenced this pull request Apr 26, 2013
Add spec for require after $LOAD_PATH change
@dbussink dbussink merged commit 4059190 into rubinius:master Apr 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants