[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-core
Subject:    [ruby-core:89615] [Ruby trunk Bug#15267] File.basename + File.extname does not restore the original 
From:       nobu () ruby-lang ! org
Date:       2018-10-29 6:25:28
Message-ID: redmine.issue-15267.20181029062527.8c97bb4dd8c0b11f () ruby-lang ! org
[Download RAW message or body]

Issue #15267 has been reported by nobu (Nobuyoshi Nakada).

----------------------------------------
Bug #15267: File.basename + File.extname does not restore the original name
https://bugs.ruby-lang.org/issues/15267

* 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.
```




-- 
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>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic