Re: Strange behavior with RubyAuthenHandler on ruby 1.8.1 + modruby 1.0.7

Shugo Maeda <[email protected]>
Newsgroups gmane.comp.apache.mod-ruby
Message-ID <[email protected]>
Hi,

At Fri, 02 Apr 2004 11:48:06 +0200,
LHERBIER Lois <[email protected]> wrote:
> Thanks for the patch :o)
> I have noticed this change in ruby 1.8 on the 1.8 changelog and I see 
> the warning ( warning: main#include in the ...) on my apache log too 
> when it crashes.

It seems that my patch is not commited to the ruby_1_8 branch.
Did you applied my patch?

> But I don't use "load", but "require", "load (xx,true)" evaluates the 
> file in an anonymous module, "require" doesn't (?).

Apache::RubyRun load scripts by "load(xx, true)", so test.rbx
is evaluated in an anonymous module.

> I don't understand why this problem appears only when I "require" the 
> foo.rb from the file containing Apache ruby auth handler (auth.rb).
> If I don't require 'foo.rb' form the Apache ruby auth handler (auth.rb), 
> everything works fine (test.rbx) !

"require 'bar/foo'" in test.rbx is evaluated in an anonymous module, but
RubyRequire in httpd.conf is evaluated on the top level context.

You can test it without mod_ruby like this:

$ cd /home/test/bug/
$ ruby1.8 -v -rcgi -I lib -r bar/auth -e 'load("test.rbx", true)' < /dev/null
ruby 1.8.1 (2004-02-03) [i386-linux]
bar/auth loaded
bar/foo loaded
./test.rbx:2: warning: main#include in the wrapped load is effective only for toplevel
Content-Type: text/html
 
./test.rbx:5: uninitialized constant #<Module:0x40322a6c>::Foo (NameError)
        from -e:1:in `load'
        from -e:1

Strangely, it works if I added 'require "cgi"' to test.rbx and
remove -rcgi from the command line option.
There may be more bugs in ruby.

Shugo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.