From: naruse@... Date: 2019-10-17T05:14:24+00:00 Subject: [ruby-core:95378] [Ruby master Bug#15267] File.basename + File.extname does not restore the original name Issue #15267 has been updated by naruse (Yui NARUSE). > basename(1) seems to result in the base name with the dot, when stripping a wildcard suffix. basename(1) doesn't handle wildcard. https://pubs.opengroup.org/onlinepubs/9699919799/utilities/basename.html ---------------------------------------- Bug #15267: File.basename + File.extname does not restore the original name https://bugs.ruby-lang.org/issues/15267#change-82089 * 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: