Project

General

Profile

Actions

Bug #3882

closed

REGRESSION: File.extname() broken (at least >= 1.8.7)

Bug #3882: REGRESSION: File.extname() broken (at least >= 1.8.7)

Added by AndiM (Andreas Mohr) about 15 years ago. Updated about 6 years ago.

Status:
Closed
Target version:
-
[ruby-core:32599]

Description

=begin
Hi,

#!/usr/bin/ruby

require 'pathname'

mytest_filename = ARGV.shift

#mytest_filename_cleaned = Pathname.new(mytest_filename).cleanpath
mytest_filename_cleaned = mytest_filename

puts "mytest_filename #{mytest_filename} mytest_filename_cleaned #{mytest_filename_cleaned}"

myext = File.extname(mytest_filename_cleaned)
puts "mytest_filename_cleaned #{mytest_filename_cleaned} myext #{myext}"

Try .//test.out
Won't do what it should, at least on u10.04 ruby1.8 1.8.7.249-2 and ruby1.9.1 1.9.1.378-1,
as opposed to correct behaviour on ruby-1.8.5-5.el5_4.8.

Since http://ruby-doc.org/core/classes/File.html#M002543 doesn't really specify extname() argument composition constraints
(other than it being a path), it should accept duplicate slashes since this syntax is treated as a valid path pretty much everywhere.

Do you happen to have a test suite for these core API things? Since extname() also had some other issues (spaces before extension etc.),
this would be useful.

Other than this rather disturbing behaviour, I'm VERY impressed with Ruby.

Thanks,

Andreas Mohr
=end

Updated by usa (Usaku NAKAMURA) about 15 years ago Actions #1

  • Status changed from Open to Assigned
  • Assignee set to wyhaines (Kirk Haines)
  • Priority changed from 5 to Normal

=begin
It's already fixed at 1.8.7-p302.

BTW, ruby_1_8_6 branch has this problem yet.
=end

Updated by nobu (Nobuyoshi Nakada) about 15 years ago Actions #2

=begin
Backport r27404.
=end

Updated by nobu (Nobuyoshi Nakada) about 15 years ago Actions #3

  • Category set to core

=begin

=end

Updated by jeremyevans0 (Jeremy Evans) about 6 years ago Actions #4

  • Tracker changed from Backport to Bug
  • Project changed from 11 to Ruby
  • Description updated (diff)
  • Status changed from Assigned to Closed
  • Backport set to 2.5: UNKNOWN, 2.6: UNKNOWN
Actions

Also available in: PDF Atom