# Autoload problem in 1.8.5

**URL:** <https://www.ruby-forum.com/t/autoload-problem-in-1-8-5/75360>\
**Category:** Ruby\
**Created:** [November 9, 2006, 11:38am UTC](https://www.ruby-forum.com/t/autoload-problem-in-1-8-5/75360 "2006-11-09T11:38:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hanholl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/a87d85/32.png) [@hanholl](https://www.ruby-forum.com/u/hanholl)\
**Post date:** [November 9, 2006, 11:38am UTC](https://www.ruby-forum.com/t/autoload-problem-in-1-8-5/75360/1 "2006-11-09T11:38:10Z")

</div>

Hi,

I encountered a problem in 1.8.5, or at least in ruby-1.8.5-4.fc6 from  
Fedora Core 6.  
Do this:  
irb  
irb(main):001:0\> autoload :Syslog, ‘syslog’  
=\> nil  
irb(main):002:0\> require ‘syslog’

and get a lot of error messages about already initialized constants.  
Also, syslog.so appears twice in $".

It can get even worse if you have a couple of autoloads for the same  
class.  
With 1.8.4 this problem didn’t exist.

Cheers,

Han H.

---

<div class="post-metadata">

**Author:** ![hanholl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/a87d85/32.png) [@hanholl](https://www.ruby-forum.com/u/hanholl)\
**Post date:** [November 9, 2006, 1:44pm UTC](https://www.ruby-forum.com/t/autoload-problem-in-1-8-5/75360/2 "2006-11-09T13:44:32Z")

</div>

Han H. wrote:

> and get a lot of error messages about already initialized constants.  
> Also, syslog.so appears twice in $".

Could this be related to the recurrent FXRuby load bug? If so, it’s  
probably being Worked On.

Already initialized constant messages are _warnings_ - you can safely  
ignore those if you know they’re not your fault. Basically, just ignore  
this until it goes away, Someone Broke ™ DLL/SO loading.

I wonder if that means we’ll get the Christmas release after all 😛

David V.

---

<div class="post-metadata">

**Author:** ![hanholl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/a87d85/32.png) [@hanholl](https://www.ruby-forum.com/u/hanholl)\
**Post date:** [November 9, 2006, 2:22pm UTC](https://www.ruby-forum.com/t/autoload-problem-in-1-8-5/75360/3 "2006-11-09T14:22:50Z")

</div>

On 11/9/06, David V. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > and get a lot of error messages about already initialized constants.  
> > Also, syslog.so appears twice in $".
> 
> Could this be related to the recurrent FXRuby load bug? If so, it’s  
> probably being Worked On.

It has nothing to do with FXRuby.

> Already initialized constant messages are _warnings_ - you can safely  
> ignore those if you know they’re not your fault. Basically, just ignore  
> this until it goes away, Someone Broke ™ DLL/SO loading.

Yes, I know I can ignore them, but sixty lines of them are kind of  
hard to ignore, and in the meantime you have to try to find the  
output.

Cheers,

Han H.

---

<div class="post-metadata">

**Author:** ![hanholl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/a87d85/32.png) [@hanholl](https://www.ruby-forum.com/u/hanholl)\
**Post date:** [November 9, 2006, 2:28pm UTC](https://www.ruby-forum.com/t/autoload-problem-in-1-8-5/75360/4 "2006-11-09T14:28:52Z")

</div>

On 11/9/06, Han H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> It has nothing to do with FXRuby.

What David was trying to say (I think) is that a change was introduced  
in Ruby 1.8.5 that caused Ruby to start spewing “Already initialized  
constant” messages whenever you try to load FXRuby. You may be seeing  
another symptom of the same problem, just in a different context.

For more information, see this bug report:

```
http://rubyforge.org/tracker/?func=detail&aid=5701&group_id=426&atid=1698

```

Hope this helps,

Lyle

---

<div class="post-metadata">

**Author:** ![hanholl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/a87d85/32.png) [@hanholl](https://www.ruby-forum.com/u/hanholl)\
**Post date:** [November 9, 2006, 3:10pm UTC](https://www.ruby-forum.com/t/autoload-problem-in-1-8-5/75360/5 "2006-11-09T15:10:59Z")

</div>

On 11/9/06, Lyle J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ```
> http://rubyforge.org/tracker/?func=detail&aid=5701&group_id=426&atid=1698
> 
> ```
> 
> Hope this helps,

If you do a diff of eval.c from 1.8.4 to 1.8.5, this is part of it:

@@ -7017,12 +7145,11 @@  
ruby\_safe\_level = safe;  
found = search\_required(fname, &feature, &path);  
if (found) {

- 

```
  if (!path || load_wait(RSTRING(path)->ptr)) {

```

- 

```
  if (!path || load_wait(RSTRING(feature)->ptr)) {
  result = Qfalse;
  }
  else {
  ruby_safe_level = 0;

```

- 

```
  rb_provide_feature(feature);
  switch (found) {
    case 'r':
      /* loading ruby library should be serialized. */

```

@@ -7045,6 +7172,7 @@  
rb\_ary\_push(ruby\_dln\_librefs, LONG2NUM(handle));  
break;  
}

- 

```
  rb_provide_feature(feature);
  result = Qtrue;
  }

```

}

I reverted the last patch (put rb\_provide\_feature(feature); at the top  
again) and everything seems fine.  
And yes, it’s possible that FXRuby is bitten by this as well.  
Of course, someone, probably Nobuyoshi N., didn’t push this line  
to the bottom for nothing, so I probably broke something else with my  
reversion.  
I guess this has to do with it (from Changelog):  
Sat Jul 15 23:50:12 2006 Nobuyoshi N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

```
    * eval.c (rb_require_safe): wait for another thread requiring 

```

the same  
feature. fixed: [ruby-core:08229]  
but I could be totally wrong here.

Cheers,

Han H.
