[#35027] [Ruby 1.9-Bug#4352][Open] [patch] Fix eval(s, b) backtrace; make eval(s, b) consistent with eval(s) — "James M. Lawrence" <redmine@...>

Bug #4352: [patch] Fix eval(s, b) backtrace; make eval(s, b) consistent with eval(s)

16 messages 2011/02/01

[#35114] [Ruby 1.9-Bug#4373][Open] http.rb:677: [BUG] Segmentation fault — Christian Fazzini <redmine@...>

Bug #4373: http.rb:677: [BUG] Segmentation fault

59 messages 2011/02/06

[#35171] [Ruby 1.9-Bug#4386][Open] encoding: directive does not affect regex expressions — mathew murphy <redmine@...>

Bug #4386: encoding: directive does not affect regex expressions

9 messages 2011/02/09

[#35237] [Ruby 1.9-Bug#4400][Open] nested at_exit hooks run in strange order — Suraj Kurapati <redmine@...>

Bug #4400: nested at_exit hooks run in strange order

12 messages 2011/02/15

[ruby-core:35343] Re: odd require behavior

From: Aaron Patterson <aaron@...>
Date: 2011-02-22 23:41:41 UTC
List: ruby-core #35343
On Wed, Feb 23, 2011 at 04:05:46AM +0900, Roger Pack wrote:
> Hello all.
> In trunk "Queue" appears to be a native class.
> In 1.9.2, its require causes an odd result:
> 
> 
> >> Queue
> NameError: uninitialized constant Object::Queue
>         from (irb):1
>         from D:/Ruby192/bin/irb:12:in `<main>'
> >> require 'queue'
> LoadError: no such file to load -- queue
>         from <internal:lib/rubygems/custom_require>:29:in `require'
>         from <internal:lib/rubygems/custom_require>:29:in `require'
>         from (irb):2
>         from D:/Ruby192/bin/irb:12:in `<main>'
> >> Queue # it appears it was actually successful...
> => Queue
> >> RUBY_DESCRIPTION
> => "ruby 1.9.2p136 (2010-12-25) [i386-mingw32]"
> 
> Any hints out there?

This is probably due to rubygems requiring "thread".  I suspect that
when you do the "require 'queue'", rubygems gets activated (attempting
to find the "queue.rb" file).

When rubygems is activated, it requires thread, which contains Queue.

    $ irb
    irb(main):001:0> Queue
    NameError: uninitialized constant Object::Queue
    from (irb):1
    from /Users/aaron/.ruby19/bin/irb:12:in `<main>'
    irb(main):002:0> require 'thread'
    => true
    irb(main):003:0> Queue
    => Queue
    irb(main):004:0> exit
    $ irb
    irb(main):001:0> require 'rubygems'
    => true
    irb(main):002:0> Queue
    => Queue
    irb(main):003:0>

Note that when rubygems stops requiring thread, this example will fail.

-- 
Aaron Patterson
http://tenderlovemaking.com/

In This Thread