# Load bug?

**URL:** <https://www.ruby-forum.com/t/load-bug/137912>\
**Category:** Ruby\
**Created:** [May 18, 2008, 6:22am UTC](https://www.ruby-forum.com/t/load-bug/137912 "2008-05-18T06:22:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rogerdpack](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Post date:** [May 18, 2008, 6:22am UTC](https://www.ruby-forum.com/t/load-bug/137912/1 "2008-05-18T06:22:08Z")

</div>

> > require ‘…/ext/rubyeventmachine’  
> > =\> true
> 
> > require ‘eventmachine’

hmm.  
Typically this works. On my newest machine, however, it errs as above.  
LoadError: no such file to load – rubyeventmachine

It’s trying to load the file that I just required one line above,  
successfully.

I assume this is a bug?

Info:  
the file it is trying to load is ‘…/ext/rubyeventmachine.bundle’  
If I copy that file to the local directory [or sym link it in] then

> > require ‘eventmachine’  
> > =\> true  
> > loads like a charm.

Egh. Looks like an obscure bug to me. Might be OS X only, anyway.  
-R

---

<div class="post-metadata">

**Author:** ![rogerdpack](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Post date:** [May 18, 2008, 6:05pm UTC](https://www.ruby-forum.com/t/load-bug/137912/2 "2008-05-18T18:05:53Z")

</div>

Roger P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

> I assume this is a bug?

No, it’s not, it’s just what Ruby does. Some people would argue that  
Ruby should be a bit more helpful here, but once you know the rule,  
it’s not that big of a deal.

When loading a file with require, Ruby will remember the name of the  
file you loaded, and not load it again. The trick here is, it only  
remembers the name you give it, so if you refer to the same file using  
a different path, Ruby will load the file a second time.

All of the following will load the same file several times.

,----  
| require ‘foo.rb’  
| require ‘./foo.rb’  
| require ‘…/foo/foo.rb’  
`----

> the file it is trying to load is ‘…/ext/rubyeventmachine.bundle’  
> If I copy that file to the local directory [or sym link it in] then
> 
> > > require ‘eventmachine’  
> > > =\> true  
> > > loads like a charm.
> 
> Egh. Looks like an obscure bug to me. Might be OS X only, anyway.

Looks like a bad LOADPATH to me.

---

<div class="post-metadata">

**Author:** ![rogerdpack](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Post date:** [May 18, 2008, 6:17pm UTC](https://www.ruby-forum.com/t/load-bug/137912/3 "2008-05-18T18:17:38Z")

</div>

On May 17, 2008, at 10:22 PM, Roger P. wrote:

> I assume this is a bug?

it’s been a ‘feature’ up until 1.9, which fixes. this.

typically i’ll write all my production code to use absolute require  
paths. also, production libs can/should be protected via:

unless defined? MyCode

module MyCode

end

end

etc.

a @ [http://codeforpeople.com/](http://codeforpeople.com/)
