L
Luis Lavena
Hello,
We are getting some reports in RubyInstaller project of weird gem
installation issues.
http://groups.google.com/group/rubyinstaller/browse_thread/thread/df7b7c217=
ad7d882
The bug output is the following:
ERROR: While executing gem ... (Errno::EEXIST)
File exists - C:
I've created a simplified test case:
require 'fileutils'
system("rd C:\\Foo /S/Q")
FileUtils.mkdir_p 'C:/Foo/Bar/Baz', :verbose =3D> true
And the following is the output:
C:\Users\Luis>ruby -v t.rb
ruby 1.8.7 (2010-06-23 patchlevel 299) [i386-mingw32]
mkdir -p C:/Foo/Bar/Baz
C:/Users/Luis/Tools/Ruby/ruby-1.8.7-p299-i386-mingw32/lib/ruby/1.8/fileutil=
s.rb:244:in
`mkdir': File exists - C: (Errno::EEXIST)
from C:/Users/Luis/Tools/Ruby/ruby-1.8.7-p299-i386-mingw32/lib/ruby=
/1.8/fileutils.rb:244:in
`fu_mkdir'
from C:/Users/Luis/Tools/Ruby/ruby-1.8.7-p299-i386-mingw32/lib/ruby=
/1.8/fileutils.rb:217:in
`mkdir_p'
from C:/Users/Luis/Tools/Ruby/ruby-1.8.7-p299-i386-mingw32/lib/ruby=
/1.8/fileutils.rb:215:in
`reverse_each'
from C:/Users/Luis/Tools/Ruby/ruby-1.8.7-p299-i386-mingw32/lib/ruby=
/1.8/fileutils.rb:215:in
`mkdir_p'
from C:/Users/Luis/Tools/Ruby/ruby-1.8.7-p299-i386-mingw32/lib/ruby=
/1.8/fileutils.rb:201:in
`each'
from C:/Users/Luis/Tools/Ruby/ruby-1.8.7-p299-i386-mingw32/lib/ruby=
/1.8/fileutils.rb:201:in
`mkdir_p'
from t.rb:3
This happens with 1.8.6, 1.8.7 and 1.9.1 prior patchlevel 429. This do
not show up with 1.9.1, nor with JRuby or IronRuby:
https://gist.github.com/047915f46a88eb11dfcb
Checking the code of FileUtils, specially fu_mkdir:
def fu_mkdir(path, mode) #:nodoc:
path =3D path.sub(%r</\z>, '')
if mode
Dir.mkdir path, mode
File.chmod mode, path
else
Dir.mkdir path
end
end
Seems that no matter if path exists and is a directory, it tries to create =
it.
It fails on Windows when tries to create "C:", since it never tries to
test for File.directory?("C:")
Adding the following line before mode solves the problem:
return if File.directory?(path)
But the weird part of this is that the problem didn't existed before,
just after E-Text Editor installation (which install cygwin)
I've removed all traces of both programs, registry and environment
variables but the issue I've presented above is not going away.
The question is more related to the rescue SystemCallError and the
"next unless File.directory?(path)"
fu_mkdir path call modifies path removing trailing slashes, so:
File.directory?('C:/') # =3D> false
becomes:
File.directory?('C:') # =3D> true
The only problem is that for some reason, path contains the previous
value, not the altered and correct one.
This is a bug? I doubt since it only appeared after the issue
mentioned above, but still wanted to check prior reporting to
Ruby-Core.
Thank you for your attention.
--=20
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exup=E9ry
We are getting some reports in RubyInstaller project of weird gem
installation issues.
http://groups.google.com/group/rubyinstaller/browse_thread/thread/df7b7c217=
ad7d882
The bug output is the following:
ERROR: While executing gem ... (Errno::EEXIST)
File exists - C:
I've created a simplified test case:
require 'fileutils'
system("rd C:\\Foo /S/Q")
FileUtils.mkdir_p 'C:/Foo/Bar/Baz', :verbose =3D> true
And the following is the output:
C:\Users\Luis>ruby -v t.rb
ruby 1.8.7 (2010-06-23 patchlevel 299) [i386-mingw32]
mkdir -p C:/Foo/Bar/Baz
C:/Users/Luis/Tools/Ruby/ruby-1.8.7-p299-i386-mingw32/lib/ruby/1.8/fileutil=
s.rb:244:in
`mkdir': File exists - C: (Errno::EEXIST)
from C:/Users/Luis/Tools/Ruby/ruby-1.8.7-p299-i386-mingw32/lib/ruby=
/1.8/fileutils.rb:244:in
`fu_mkdir'
from C:/Users/Luis/Tools/Ruby/ruby-1.8.7-p299-i386-mingw32/lib/ruby=
/1.8/fileutils.rb:217:in
`mkdir_p'
from C:/Users/Luis/Tools/Ruby/ruby-1.8.7-p299-i386-mingw32/lib/ruby=
/1.8/fileutils.rb:215:in
`reverse_each'
from C:/Users/Luis/Tools/Ruby/ruby-1.8.7-p299-i386-mingw32/lib/ruby=
/1.8/fileutils.rb:215:in
`mkdir_p'
from C:/Users/Luis/Tools/Ruby/ruby-1.8.7-p299-i386-mingw32/lib/ruby=
/1.8/fileutils.rb:201:in
`each'
from C:/Users/Luis/Tools/Ruby/ruby-1.8.7-p299-i386-mingw32/lib/ruby=
/1.8/fileutils.rb:201:in
`mkdir_p'
from t.rb:3
This happens with 1.8.6, 1.8.7 and 1.9.1 prior patchlevel 429. This do
not show up with 1.9.1, nor with JRuby or IronRuby:
https://gist.github.com/047915f46a88eb11dfcb
Checking the code of FileUtils, specially fu_mkdir:
def fu_mkdir(path, mode) #:nodoc:
path =3D path.sub(%r</\z>, '')
if mode
Dir.mkdir path, mode
File.chmod mode, path
else
Dir.mkdir path
end
end
Seems that no matter if path exists and is a directory, it tries to create =
it.
It fails on Windows when tries to create "C:", since it never tries to
test for File.directory?("C:")
Adding the following line before mode solves the problem:
return if File.directory?(path)
But the weird part of this is that the problem didn't existed before,
just after E-Text Editor installation (which install cygwin)
I've removed all traces of both programs, registry and environment
variables but the issue I've presented above is not going away.
The question is more related to the rescue SystemCallError and the
"next unless File.directory?(path)"
fu_mkdir path call modifies path removing trailing slashes, so:
File.directory?('C:/') # =3D> false
becomes:
File.directory?('C:') # =3D> true
The only problem is that for some reason, path contains the previous
value, not the altered and correct one.
This is a bug? I doubt since it only appeared after the issue
mentioned above, but still wanted to check prior reporting to
Ruby-Core.
Thank you for your attention.
--=20
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exup=E9ry