Project

General

Profile

Actions

Bug #3175

closed

extname and basename fail in "foo//bar.rb" style paths.

Added by many (rico gloeckner) over 14 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
Backport:
[ruby-core:29627]

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

Actions #1

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

Actions

Also available in: Atom PDF

Like0
Like0