From: Brian Ford Date: 2010-04-22T07:42:13+09:00 Subject: [ruby-core:29710] [Bug #3185] File.expand_path repeats forward slashes at the beginning of the path Bug #3185: File.expand_path repeats forward slashes at the beginning of the path http://redmine.ruby-lang.org/issues/show/3185 Author: Brian Ford Status: Open, Priority: Normal ruby -v: ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin9.8.0] When File.expand_path is passed a string with multiple consecutive forward slashes, it preserves them in the output. This would appear to be a bug since everywhere else in the path, consecutive separators are collapsed to a single one. $ ruby1.8.7 -v -e 'p File.expand_path("//////some/dir")' ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin9.8.0] "//////some/dir" $ ruby1.8.7 -v -e 'p File.expand_path("//////some/dir", "/Foo")' ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin9.8.0] "//////some/dir" The same behavior exists on 1.9. $ ruby1.9 -v -e 'p File.expand_path("//////some/dir")' ruby 1.9.2dev (2010-03-30 trunk 27097) [i386-darwin9.8.0] "//////some/dir" $ ruby1.9 -v -e 'p File.expand_path("//////some/dir", "/Foo")' ruby 1.9.2dev (2010-03-30 trunk 27097) [i386-darwin9.8.0] "//////some/dir" Thanks, Brian ---------------------------------------- http://redmine.ruby-lang.org