Project

General

Profile

Backport #4446

autoload failure with relative paths

Added by quix (James M. Lawrence) over 8 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
[ruby-core:35375]

Description

=begin
% cat foo.rb
module Foo
end

% cat run.rb
dir = File.dirname(File.expand_path(FILE))
$LOAD_PATH.unshift(dir + '/../' + File.basename(dir))

autoload :Foo, 'foo'
p Foo

% ruby -v run.rb
ruby 1.9.2p180 (2011-02-18 revision 30907) [i386-darwin9.8.0]
/Users/jlawrence/tmp/foo.rb:1: warning: loading in progress, circular require considered harmful - /Users/jlawrence/tmp/foo.rb
from run.rb:5:in <main>'
from /Users/jlawrence/tmp/foo.rb:1:in
'
/Users/jlawrence/tmp/foo.rb:1:in <top (required)>': uninitialized constant Foo (NameError)
from run.rb:5:in
'

Commit r30789 on trunk fixes this problem (with no conflicts).

=end

Associated revisions

Revision eece2be9
Added by yugui (Yuki Sonoda) about 8 years ago

merges r30789 from trunk into ruby_1_9_2. Fixes #4446.

  • load.c (rb_get_expanded_load_path): always expand load paths.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@31849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 31849
Added by yugui (Yuki Sonoda) about 8 years ago

merges r30789 from trunk into ruby_1_9_2. Fixes #4446.

  • load.c (rb_get_expanded_load_path): always expand load paths.

History

Updated by mame (Yusuke Endoh) about 8 years ago

Hello,

This commit is suspected of big performance degradation of require.
See [ruby-core:36593].

--
Yusuke Endoh mame@tsg.ne.jp

#2

Updated by yugui (Yuki Sonoda) about 8 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r31849.
James, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


merges r30789 from trunk into ruby_1_9_2. Fixes #4446.

  • load.c (rb_get_expanded_load_path): always expand load paths.

Also available in: Atom PDF