Forum: Ruby 'require' does not work under mod_ruby

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ae03872abd58bcc10b6265169f9050a7?d=identicon&s=25 Frantisek Fuka (Guest)
on 2006-02-26 12:29
(Received via mailing list)
When using: "require 'engine.rbx'" under mod_ruby, I get "File does not
exist" error. However, if I change "require" to "load", it gets loaded
allright. the file and it directory has correct permissions (755).
"Untaint"-ing the file does solve the problem.

I am particularly confused about this error - how can the ruby say the
file does not exist when it evidentnly does?
461b1da26b6b198ef014235928576d81?d=identicon&s=25 Jakub Hegenbart (Guest)
on 2006-02-26 13:14
(Received via mailing list)
Frantisek Fuka wrote:
> When using: "require 'engine.rbx'" under mod_ruby, I get "File does not
> exist" error. However, if I change "require" to "load", it gets loaded
> allright. the file and it directory has correct permissions (755).
> "Untaint"-ing the file does solve the problem.
>
> I am particularly confused about this error - how can the ruby say the
> file does not exist when it evidentnly does?
>
>
chmod +x engine.rbx

Nezabírá?

Kyosuke ;-)
Ae03872abd58bcc10b6265169f9050a7?d=identicon&s=25 Frantisek Fuka (Guest)
on 2006-02-26 15:49
(Received via mailing list)
A mentioned in my original post, the file already has permissions set
to "755". Thus, "chmod +x" does nothing.
5d8990b757a1305f8e9100e9e4e5073d?d=identicon&s=25 WATANABE Hirofumi (Guest)
on 2006-02-26 16:01
(Received via mailing list)
Hi,

"Frantisek Fuka" <fuxoft@gmail.com> writes:

> When using: "require 'engine.rbx'" under mod_ruby, I get "File does not
> exist" error. However, if I change "require" to "load", it gets loaded
> allright. the file and it directory has correct permissions (755).
> "Untaint"-ing the file does solve the problem.
>
> I am particularly confused about this error - how can the ruby say the
> file does not exist when it evidentnly does?

See ri 'Kernel#require'.

  If the file has the extension ``.rb'', it is loaded as a source file;
  if the extension is ``.so'', ``.o'', or ``.dll'', or whatever the
  default shared library extension is on the current platform, Ruby
  loads the shared library as a Ruby extension.
  Otherwise, Ruby tries adding ``.rb'', ``.so'', and so on to the name.
461b1da26b6b198ef014235928576d81?d=identicon&s=25 Jakub Hegenbart (Guest)
on 2006-02-26 16:22
(Received via mailing list)
WATANABE Hirofumi wrote:
>> I am particularly confused about this error - how can the ruby say the
>
>
Oops! Right now I tried this, it really behaves this way. I suspected
initially that this was the case, but in a quick experiment it had
worked for both "require" and "load", so I became confused. But now I
realized I tried it with ".rb" extension rather than ".rbx". /me stupid.

I didn't notice the "file" part in the "file _and_ directory have
correct permissions", so the permissions problem as a logical
afterthought and advice didn't strike this obstacle. :-D

Jakub
This topic is locked and can not be replied to.