Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Dir.mkdir fails

Reply
Thread Tools

Dir.mkdir fails

 
 
Jesper Olsen
Guest
Posts: n/a
 
      12-05-2003
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


 
Reply With Quote
 
 
 
 
Jesper Olsen
Guest
Posts: n/a
 
      12-06-2003

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

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


--
http://JesperOlsen.Net


 
Reply With Quote
 
 
 
 
Jesper Olsen
Guest
Posts: n/a
 
      12-07-2003

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

Thanks - I will try that.
Jesper

--
http://JesperOlsen.Net


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Constant.t fails 240 of 272 tests and recurs.t fails 1 of 25 tests on HPUX using perl 5.8.7 dayo Perl Misc 11 12-16-2005 09:09 PM
slideshow fails, Firefox debugger also fails lkrubner@geocities.com Javascript 2 12-23-2004 06:22 PM
Wireless Zero Configuration Servoce fails to start andrew Wireless Networking 0 07-28-2004 03:08 PM
IAS fails with certs from Stand Alone CA Harrison Midkiff Wireless Networking 2 07-22-2004 09:45 PM
Forms Authentication Fails Between ASP.NET 1.0 and 1.1 Applications (Cookie Decryption Fails) John Saunders ASP .Net 1 11-18-2003 03:25 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57