From a mod_ruby cgi_script I try to use
Dir.mkdir(“mydir”)
to create a new directory via a web application.
For some reason this fails - this is at $SAFE=1
I tried untaint on the mkdir argument, but it makes
no difference.
How can I create directories in this situation?
Cheers
Jesper
···
–
http://JesperOlsen.Net
How is it failing? What is the error being reported or exception
being thrown? Is it possible that you’re trying
to create the directory underneath a directory that doesn’t exist?
As long as the argument is untainted, Dir.mkdir should be allowed at
$SAFE == 1.
-Mark
···
On Sat, Dec 06, 2003 at 07:05:08AM +0900, Jesper Olsen wrote:
From a mod_ruby cgi_script I try to use
Dir.mkdir(“mydir”)
to create a new directory via a web application.
For some reason this fails
Ahm…I forgot that the cgi process did not have my usual file permissions.
That’s the problem with ruby cgi scripts - they give you no feedback when
they fail.
The python cgi module has a very useful “debug” mode, which can tell you
exactly where your script fails. Of course you only enable this while
developing - you don’t want the script to be viewable otherwise.
I don’t think there is anything like that for ruby?
Cheers
Jesper
···
On Sat, December 6, 2003 1:17 Mark J. Reed wrote:
On Sat, Dec 06, 2003 at 07:05:08AM +0900, Jesper Olsen wrote:
From a mod_ruby cgi_script I try to use
Dir.mkdir(“mydir”)
to create a new directory via a web application.
For some reason this fails
How is it failing? What is the error being reported or exception
being thrown? Is it possible that you’re trying
to create the directory underneath a directory that doesn’t exist?
As long as the argument is untainted, Dir.mkdir should be allowed at
$SAFE == 1.
-Mark
–
http://JesperOlsen.Net
Sure they do - just not to the browser. It goes to the web server’s
error log. If you want errors to go to the browser, you can just
wrap the whole thing in a big begin/rescue block:
begin
... entire CGI goes here
rescue
puts "Content-Type: text/plain"
puts
puts "Error #{$!}: #{$!.backtrace}"
end
cgi.rb or mod_ruby may very well have something to do this for you;
I don’t know them well.
-Mark
···
On Sat, Dec 06, 2003 at 11:02:06PM +0900, Jesper Olsen wrote:
That’s the problem with ruby cgi scripts - they give you no feedback when
they fail.
Thanks - I will try that.
Jesper
···
On Sat, December 6, 2003 19:22 Mark J. Reed wrote:
On Sat, Dec 06, 2003 at 11:02:06PM +0900, Jesper Olsen wrote:
That’s the problem with ruby cgi scripts - they give you no feedback
when
they fail.
Sure they do - just not to the browser. It goes to the web server’s
error log. If you want errors to go to the browser, you can just
wrap the whole thing in a big begin/rescue block:
begin
… entire CGI goes here
rescue
puts “Content-Type: text/plain”
puts
puts “Error #{$!}: #{$!.backtrace}”
end
cgi.rb or mod_ruby may very well have something to do this for you;
I don’t know them well.
-Mark
–
http://JesperOlsen.Net