Bug #3175
closedextname and basename fail in "foo//bar.rb" style paths.
Description
=begin
as reported in #ruby@freenode:
12:37 < jetienne> irb(main):002:0> File.extname('/tmp//bla.rb')
12:37 < jetienne> => ""
This Bug is present in 1.8 and 1.9.
The problem seems to nail down in that rb_file_s_basename calls rb_path_last_separator, which seem to return "/bla.rb" instead of "bla.rb", since *path isnt saved into *tmp (actually the pointer, not the content) when PATH_SEPARATORS are skipped.
rb_file_s_extname itself returns with 0 immediately, when the first char of the returned string is "/"; this makes the behaviour look somewhat intentional, while in unix its (imho) clearly a bug.
Incase the specific behaviour isnt changed, i think API docs should include this as example, so people know that it is intentional.
Thanks,
-many
=end
Updated by nobu (Nobuyoshi Nakada) over 14 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
This issue was solved with changeset r27404.
rico, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
=end