'require' does not work under mod_ruby

F

Frantisek Fuka

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?
 
J

Jakub Hegenbart

Frantisek said:
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?

=20
chmod +x engine.rbx

Nezab=EDr=E1?

Kyosuke ;-)
 
F

Frantisek Fuka

A mentioned in my original post, the file already has permissions set
to "755". Thus, "chmod +x" does nothing.
 
W

WATANABE Hirofumi

Hi,

Frantisek Fuka said:
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.
 
J

Jakub Hegenbart

WATANABE said:
Hi,



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.
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,202
Messages
2,571,057
Members
47,665
Latest member
salkete

Latest Threads

Top