[ruby-core:95383] [Ruby master Bug#15267] File.basename + File.extname does not restore the original name
From:
nobu@...
Date:
2019-10-17 06:05:20 UTC
List:
ruby-core #95383
Issue #15267 has been updated by nobu (Nobuyoshi Nakada). https://github.com/ruby/ruby/pull/2565 ---------------------------------------- Bug #15267: File.basename + File.extname does not restore the original name https://bugs.ruby-lang.org/issues/15267#change-82094 * Author: nobu (Nobuyoshi Nakada) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- Related to #15224, I found the case `File.basename(name, '.*')+File.extname(name) == File.basename(name)` is not true. ```ruby name = 'file.' File.basename(name, '.*') #=> "name" File.extname(name) #=> "" ``` Both do not contain the last dot. basename(1) seems to result in the base name with the dot, when stripping a wildcard suffix. ``` $ basename name. '.*' name. ``` ---Files-------------------------------- file-basename-trailing-dot-15267.patch (1.96 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>