Project

General

Profile

Actions

Feature #3185

closed

File.expand_path repeats forward slashes at the beginning of the path

Added by brixen (Brian Shirai) almost 14 years ago. Updated almost 13 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:29710]

Description

=begin
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
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0