summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--ext/pathname/lib/pathname.rb2
-rw-r--r--test/pathname/test_pathname.rb8
-rw-r--r--version.h2
4 files changed, 20 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 092318b914..d6ad20fa78 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Sun Aug 31 16:24:54 2014 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/lib/pathname.rb (cleanpath_aggressive): make all
+ separators File::SEPARATOR from File::ALT_SEPARATOR.
+ Reported by Daniel Rikowski.
+ Fixed by Nobuyoshi Nakada. [Bug #9618]
+
+ * ext/pathname/lib/pathname.rb (cleanpath_conservative): ditto.
+
Sun Aug 31 16:23:41 2014 Naohisa Goto <ngotogenome@gmail.com>
* lib/fileutils.rb (rmdir): rescue Errno::EEXIST in addition to
diff --git a/ext/pathname/lib/pathname.rb b/ext/pathname/lib/pathname.rb
index 46fa72b784..e7e47ceac6 100644
--- a/ext/pathname/lib/pathname.rb
+++ b/ext/pathname/lib/pathname.rb
@@ -113,6 +113,7 @@ class Pathname
end
end
end
+ pre.tr!(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
if /#{SEPARATOR_PAT}/o =~ File.basename(pre)
names.shift while names[0] == '..'
end
@@ -161,6 +162,7 @@ class Pathname
pre, base = r
names.unshift base if base != '.'
end
+ pre.tr!(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
if /#{SEPARATOR_PAT}/o =~ File.basename(pre)
names.shift while names[0] == '..'
end
diff --git a/test/pathname/test_pathname.rb b/test/pathname/test_pathname.rb
index ccdc5bd8eb..03e09bfb6f 100644
--- a/test/pathname/test_pathname.rb
+++ b/test/pathname/test_pathname.rb
@@ -88,6 +88,10 @@ class TestPathname < Test::Unit::TestCase
defassert(:cleanpath_aggressive, '/', '///a/../..')
end
+ if DOSISH
+ defassert(:cleanpath_aggressive, 'c:/foo/bar', 'c:\\foo\\bar')
+ end
+
def cleanpath_conservative(path)
Pathname.new(path).cleanpath(true).to_s
end
@@ -124,6 +128,10 @@ class TestPathname < Test::Unit::TestCase
defassert(:cleanpath_conservative, '/a', '/../.././../a')
defassert(:cleanpath_conservative, 'a/b/../../../../c/../d', 'a/b/../../../../c/../d')
+ if DOSISH
+ defassert(:cleanpath_conservative, 'c:/foo/bar', 'c:\\foo\\bar')
+ end
+
if DOSISH_UNC
defassert(:cleanpath_conservative, '//', '//')
else
diff --git a/version.h b/version.h
index 246e773125..2e73360fec 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.0.0"
#define RUBY_RELEASE_DATE "2014-08-31"
-#define RUBY_PATCHLEVEL 537
+#define RUBY_PATCHLEVEL 538
#define RUBY_RELEASE_YEAR 2014
#define RUBY_RELEASE_MONTH 8