Bug #5264

Commit 33157

Added by Charlie Savage over 2 years ago. Updated over 2 years ago.

[ruby-core:39227]
Status:Closed
Priority:Normal
Assignee:-
Category:core
Target version:1.9.3
ruby -v:r33157 Backport:

Description

It appears this commit:

https://github.com/ruby/ruby/commit/43284b6bf8324a762808537d5cd2c0774b662a84

Breaks our test suite, with this error from the redis namespace gem. Here is a trackeback from our Rails app:

Namespace is not a module
/usr/lib/ruby/gems/1.9.1/bundler/gems/redis-store-b70b9326d083/lib/redis/store/namespace.rb:3:in <class:Store>'
/usr/lib/ruby/gems/1.9.1/bundler/gems/redis-store-b70b9326d083/lib/redis/store/namespace.rb:2:in
class:Redis'
/usr/lib/ruby/gems/1.9.1/bundler/gems/redis-store-b70b9326d083/lib/redis/store/namespace.rb:1:in <top (required)>'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in
require'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/activesupport/dependencies.rb:240:in block in require'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in
block in load
dependency'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/activesupport/dependencies.rb:640:in new_constants_in'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in
load
dependency'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in require'
/usr/lib/ruby/gems/1.9.1/bundler/gems/redis-store-b70b9326d083/lib/redis-store.rb:6:in
'

Line 6 in redis-store.rb is:

require "redis/store/namespace"

And then the top of namespace looks like this:
class Redis
class Store < self
module Namespace

Not sure if this is an intentional change or not, but a heads up its breaks the gem.

Thanks - Charlie

Note the ruby -v version attached to the ticket isn't the one I used for testing.


Related issues

Related to ruby-trunk - Bug #3423: Inconsistent behaviour of Module#const_get with included ... Closed 06/11/2010

Associated revisions

Revision 33163
Added by Nobuyoshi Nakada over 2 years ago

  • vminsnhelper.c (vmsearchconstdefined_class): search ancestors only when global scope. [Bug #5264]

History

#1 Updated by Nobuyoshi Nakada over 2 years ago

  • Status changed from Open to Feedback
  • ruby -v changed from ruby 1.9.4dev (2011-09-01 trunk 33153) [x86_64-linux] to r33157

Simplified code doesn't reproduce it.

class Redis; class Store < self; module Namespace; end; end; end

Is "Namespace" constant defined elsewhere at that point?

#2 Updated by Charlie Savage over 2 years ago

Ok, can reproduce like this:

require 'rubygems'
require 'redis-namespace'
require 'redis-store'

Which when you go look at the gems source ends up like this:

from redis-namespace (lib/redis/namespace.rb)

class Redis
class Namespace
end
end

from redis-store (lib/redis/store/namespace.rb)

class Redis
class Store < self
module Namespace
end
end
end

I can see why Ruby is complaining, but this code works on 1.8.7 and did work on 1.9.3 until commit 33157.

#3 Updated by Nobuyoshi Nakada over 2 years ago

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

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


  • vminsnhelper.c (vmsearchconstdefined_class): search ancestors only when global scope. [Bug #5264]

Also available in: Atom PDF