Adam created Bug JRUBY-6846
Issue Type: Bug Bug
Affects Versions: JRuby 1.6.7
Assignee: Thomas E Enebo
Components: Standard Library
Created: 16/Aug/12 3:29 PM
Description:

This loop in mkdir_p
until path == stack.last # dirname("/")=="/", dirname("C:/")=="C:/"
stack.push path
path = File.dirname(path)
end
produces an array that includes "/", despite it's apparent attempt to exclude "/". Later, it calls fu_mkdir, which chomps off the slash and tries to run Dir.mkdir "".

An strace demonstration:
$ strace -e mkdir -f jruby -e 'require "fileutils"; FileUtils.makedirs("/tmp/A/B")' 2>&1 | grep mkdir
[pid 1871] mkdir("/tmp/A/B", 0777) = -1 ENOENT (No such file or directory)
[pid 1871] mkdir("", 0777) = -1 ENOENT (No such file or directory)
[pid 1871] mkdir("/tmp/A", 0777) = 0
[pid 1871] mkdir("/tmp/A/B", 0777) = 0

This does not normally cause problems even though one might say that the code is "incorrect". Where it tripped me up was with my Java SecurityManager. I forgot to tell it that it's OK to write to "".

Project: JRuby
Priority: Minor Minor
Reporter: Adam
Original Estimate: 1 hour
Remaining Estimate: 1 hour
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

Reply via email to