summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-19 15:43:05 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-19 15:43:05 +0000
commitcb508fe7397a6054a45cac11cf3e865f13f24aea (patch)
treee404a68163a9aef008f978be71eda26ca949e20c
parenta91d8b8c33b834f47ab000cc3844e9b18c1becba (diff)
* file.c (rb_file_s_extname): skip last directory separators.
[ruby-core:29627] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--file.c2
-rw-r--r--test/ruby/test_file_exhaustive.rb2
3 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index c92bfb8d54e..d65df98a975 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Apr 20 00:43:03 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (rb_file_s_extname): skip last directory separators.
+ [ruby-core:29627]
+
Tue Apr 20 00:41:25 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* io.c (internal_{read,write}_func, rb_{read,write}_internal):
diff --git a/file.c b/file.c
index af2730a12fd..f9f81926372 100644
--- a/file.c
+++ b/file.c
@@ -3500,7 +3500,7 @@ rb_file_s_extname(VALUE klass, VALUE fname)
if (!p)
p = name;
else
- name = ++p;
+ do name = ++p; while (isdirsep(*p));
e = 0;
while (*p && *p == '.') p++;
diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb
index 4a26e435b8b..634197e0a76 100644
--- a/test/ruby/test_file_exhaustive.rb
+++ b/test/ruby/test_file_exhaustive.rb
@@ -454,6 +454,8 @@ class TestFileExhaustive < Test::Unit::TestCase
end
end
end
+ bug3175 = '[ruby-core:29627]'
+ assert_equal(".rb", File.extname("/tmp//bla.rb"), bug3175)
assert_incompatible_encoding {|d| File.extname(d)}
end