diff options
| author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-06-30 13:01:26 +0000 |
|---|---|---|
| committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-06-30 13:01:26 +0000 |
| commit | 25a2e376bb3cfcbbfadc856bf3c29c4376ec8caf (patch) | |
| tree | c1333d4269f5e1fdb6d5d1359a5f4e178460624f | |
| parent | 971b99f3ed87560ad1523f1442ec0a842fa2606b (diff) | |
merge revision(s) 59102: [Backport #13515]
pathname.rb: UNC root pathname needs a separator
* ext/pathname/lib/pathname.rb (Pathname#plus): UNC root pathname
needs a separator. File.basename returns "/" on UNC root, as
well as sole drive letter, even if it does not end with a
separator. [ruby-core:80900] [Bug #13515]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@59240 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 6 | ||||
| -rw-r--r-- | ext/pathname/lib/pathname.rb | 2 | ||||
| -rw-r--r-- | test/pathname/test_pathname.rb | 6 | ||||
| -rw-r--r-- | version.h | 2 |
4 files changed, 12 insertions, 4 deletions
@@ -1,3 +1,9 @@ +Fri Jun 30 22:00:56 2017 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * ext/pathname/lib/pathname.rb (Pathname#plus): UNC root pathname needs + a separator. File.basename returns "/" on UNC root, as well as sole + drive letter, even if it does not end with a separator. [Bug #13515] + Fri Jun 30 21:57:27 2017 Kouhei Sutou <kou@cozmixng.org> * lib/rexml/parsers/streamparser.rb: add close tag check on end of diff --git a/ext/pathname/lib/pathname.rb b/ext/pathname/lib/pathname.rb index a6621565d0..8bdb73f439 100644 --- a/ext/pathname/lib/pathname.rb +++ b/ext/pathname/lib/pathname.rb @@ -378,7 +378,7 @@ class Pathname basename_list2.shift end r1 = chop_basename(prefix1) - if !r1 && /#{SEPARATOR_PAT}/o =~ File.basename(prefix1) + if !r1 && (r1 = /#{SEPARATOR_PAT}/o =~ File.basename(prefix1)) while !basename_list2.empty? && basename_list2.first == '..' index_list2.shift basename_list2.shift diff --git a/test/pathname/test_pathname.rb b/test/pathname/test_pathname.rb index 2690a3f6de..e3b4004fe0 100644 --- a/test/pathname/test_pathname.rb +++ b/test/pathname/test_pathname.rb @@ -14,8 +14,8 @@ class TestPathname < Test::Unit::TestCase end def self.get_linenum - if /:(\d+):/ =~ caller[1] - $1.to_i + if loc = caller_locations(2, 1) + loc[0].lineno else nil end @@ -221,6 +221,8 @@ class TestPathname < Test::Unit::TestCase defassert(:plus, 'a//b/d//e', 'a//b/c', '../d//e') + defassert(:plus, '//foo/var/bar', '//foo/var', 'bar') + def test_slash assert_kind_of(Pathname, Pathname("a") / Pathname("b")) end @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.3.5" #define RUBY_RELEASE_DATE "2017-06-30" -#define RUBY_PATCHLEVEL 336 +#define RUBY_PATCHLEVEL 337 #define RUBY_RELEASE_YEAR 2017 #define RUBY_RELEASE_MONTH 6 |
