Project

General

Profile

Bug #11155

Files named 'b' cannot be autoloaded

Added by tenderlovemaking (Aaron Patterson) over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.0dev (2015-05-14 trunk 50494) [x86_64-darwin14]
[ruby-core:69206]

Description

I have two files:

a.rb

module A
  autoload :C, 'b'
end

p ::A::C

b.rb

puts "START"
module A
  class C
  end
end
puts "FINISH"

When I run a.rb, I get an exception:

[aaron@TC xxx (master)]$ ruby --disable-gems -I. a.rb 
START
/Users/aaron/git/xxx/b.rb:3:in `<module:A>': uninitialized constant A::C (NameError)
    from /Users/aaron/git/xxx/b.rb:2:in `<top (required)>'
    from a.rb:5:in `require'
    from a.rb:5:in `<main>'
[aaron@TC xxx (master)]$

If I change the file to something else, like c, then the exception will not happen. This seems to break on every version that implements autoload.

Associated revisions

Revision 1fc214c0
Added by tenderlove over 4 years ago

  • load.c (loaded_feature_path): stop returning false negatives for
    filenames which are trailing substrings of file extensions. For
    example, 'b', which a trailing substring of ".rb" should not return
    false. [Bug #11155][ruby-core:69206]

  • test/ruby/test_autoload.rb: test for fix

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

Revision 50515
Added by tenderlovemaking (Aaron Patterson) over 4 years ago

  • load.c (loaded_feature_path): stop returning false negatives for
    filenames which are trailing substrings of file extensions. For
    example, 'b', which a trailing substring of ".rb" should not return
    false. [Bug #11155][ruby-core:69206]

  • test/ruby/test_autoload.rb: test for fix

Revision 50515
Added by tenderlove over 4 years ago

  • load.c (loaded_feature_path): stop returning false negatives for
    filenames which are trailing substrings of file extensions. For
    example, 'b', which a trailing substring of ".rb" should not return
    false. [Bug #11155][ruby-core:69206]

  • test/ruby/test_autoload.rb: test for fix

Revision 50515
Added by tenderlove over 4 years ago

  • load.c (loaded_feature_path): stop returning false negatives for
    filenames which are trailing substrings of file extensions. For
    example, 'b', which a trailing substring of ".rb" should not return
    false. [Bug #11155][ruby-core:69206]

  • test/ruby/test_autoload.rb: test for fix

Revision 50515
Added by tenderlove over 4 years ago

  • load.c (loaded_feature_path): stop returning false negatives for
    filenames which are trailing substrings of file extensions. For
    example, 'b', which a trailing substring of ".rb" should not return
    false. [Bug #11155][ruby-core:69206]

  • test/ruby/test_autoload.rb: test for fix

Revision 50515
Added by tenderlove over 4 years ago

  • load.c (loaded_feature_path): stop returning false negatives for
    filenames which are trailing substrings of file extensions. For
    example, 'b', which a trailing substring of ".rb" should not return
    false. [Bug #11155][ruby-core:69206]

  • test/ruby/test_autoload.rb: test for fix

Revision 4def2274
Added by usa (Usaku NAKAMURA) over 4 years ago

merge revision(s) 50515: [Backport #11155]

    * load.c (loaded_feature_path): stop returning false negatives for
      filenames which are trailing substrings of file extensions.  For
      example, 'b', which a trailing substring of ".rb" should not return
      false. [Bug #11155][ruby-core:69206]

    * test/ruby/test_autoload.rb: test for fix

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

Revision 50805
Added by usa (Usaku NAKAMURA) over 4 years ago

merge revision(s) 50515: [Backport #11155]

* load.c (loaded_feature_path): stop returning false negatives for
  filenames which are trailing substrings of file extensions.  For
  example, 'b', which a trailing substring of ".rb" should not return
  false. [Bug #11155][ruby-core:69206]

* test/ruby/test_autoload.rb: test for fix

Revision b9ae7528
Added by nagachika (Tomoyuki Chikanaga) over 4 years ago

merge revision(s) 50515: [Backport #11155]

    * load.c (loaded_feature_path): stop returning false negatives for
      filenames which are trailing substrings of file extensions.  For
      example, 'b', which a trailing substring of ".rb" should not return
      false. [Bug #11155][ruby-core:69206]

    * test/ruby/test_autoload.rb: test for fix

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

Revision 50835
Added by nagachika (Tomoyuki Chikanaga) over 4 years ago

merge revision(s) 50515: [Backport #11155]

* load.c (loaded_feature_path): stop returning false negatives for
  filenames which are trailing substrings of file extensions.  For
  example, 'b', which a trailing substring of ".rb" should not return
  false. [Bug #11155][ruby-core:69206]

* test/ruby/test_autoload.rb: test for fix

History

#1

Updated by Anonymous over 4 years ago

  • Status changed from Open to Closed

Applied in changeset r50515.


  • load.c (loaded_feature_path): stop returning false negatives for
    filenames which are trailing substrings of file extensions. For
    example, 'b', which a trailing substring of ".rb" should not return
    false. [Bug #11155][ruby-core:69206]

  • test/ruby/test_autoload.rb: test for fix

#2

Updated by nobu (Nobuyoshi Nakada) over 4 years ago

  • Description updated (diff)
  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED

Updated by usa (Usaku NAKAMURA) over 4 years ago

  • Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED to 2.0.0: REQUIRED, 2.1: DONE, 2.2: REQUIRED

ruby_2_1 r50805 merged revision(s) 50515.

Updated by nagachika (Tomoyuki Chikanaga) over 4 years ago

  • Backport changed from 2.0.0: REQUIRED, 2.1: DONE, 2.2: REQUIRED to 2.0.0: REQUIRED, 2.1: DONE, 2.2: DONE

Backported into ruby_2_2 branch at r50835.

Also available in: Atom PDF