Skip to content

Commit cd5dc29

Browse files
committed
merge revision(s) r45827: [Backport ruby#9618]
* 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 ruby#9618] * ext/pathname/lib/pathname.rb (cleanpath_conservative): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@46911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 755128c commit cd5dc29

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

ChangeLog

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
Wed Jul 23 23:05:19 2014 Tanaka Akira <[email protected]>
2+
3+
* ext/pathname/lib/pathname.rb (cleanpath_aggressive): make all
4+
separators File::SEPARATOR from File::ALT_SEPARATOR.
5+
Reported by Daniel Rikowski.
6+
Fixed by Nobuyoshi Nakada. [Bug #9618]
7+
8+
* ext/pathname/lib/pathname.rb (cleanpath_conservative): ditto.
9+
110
Wed Jul 23 22:51:34 2014 Naohisa Goto <[email protected]>
211

312
* lib/fileutils.rb (rmdir): rescue Errno::EEXIST in addition to

ext/pathname/lib/pathname.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ def cleanpath_aggressive # :nodoc:
113113
end
114114
end
115115
end
116+
pre.tr!(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
116117
if /#{SEPARATOR_PAT}/o =~ File.basename(pre)
117118
names.shift while names[0] == '..'
118119
end
@@ -161,6 +162,7 @@ def cleanpath_conservative # :nodoc:
161162
pre, base = r
162163
names.unshift base if base != '.'
163164
end
165+
pre.tr!(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
164166
if /#{SEPARATOR_PAT}/o =~ File.basename(pre)
165167
names.shift while names[0] == '..'
166168
end

test/pathname/test_pathname.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ def cleanpath_aggressive(path)
8888
defassert(:cleanpath_aggressive, '/', '///a/../..')
8989
end
9090

91+
if DOSISH
92+
defassert(:cleanpath_aggressive, 'c:/foo/bar', 'c:\\foo\\bar')
93+
end
94+
9195
def cleanpath_conservative(path)
9296
Pathname.new(path).cleanpath(true).to_s
9397
end
@@ -124,6 +128,10 @@ def cleanpath_conservative(path)
124128
defassert(:cleanpath_conservative, '/a', '/../.././../a')
125129
defassert(:cleanpath_conservative, 'a/b/../../../../c/../d', 'a/b/../../../../c/../d')
126130

131+
if DOSISH
132+
defassert(:cleanpath_conservative, 'c:/foo/bar', 'c:\\foo\\bar')
133+
end
134+
127135
if DOSISH_UNC
128136
defassert(:cleanpath_conservative, '//', '//')
129137
else

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#define RUBY_VERSION "2.1.2"
22
#define RUBY_RELEASE_DATE "2014-07-23"
3-
#define RUBY_PATCHLEVEL 179
3+
#define RUBY_PATCHLEVEL 180
44

55
#define RUBY_RELEASE_YEAR 2014
66
#define RUBY_RELEASE_MONTH 7

0 commit comments

Comments
 (0)