[ruby-core:94737] [Ruby master Bug#15244] Method #extname return empty string if filename is dot ('.')

[email protected]
Newsgroups gmane.comp.lang.ruby.core
Message-ID <redmine.journal-81355.20190902071239.7debcc4b4a867182@ruby-lang.org>
Issue #15244 has been updated by znz (Kazuhiro NISHIYAMA).


In some other languages:

```
% python
Python 2.7.16 (default, Mar  4 2019, 09:01:38)
[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.path.splitext('..jpg')
('..jpg', '')
```

```
% python3
Python 3.7.4 (default, Jul  9 2019, 18:13:23)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.path.splitext('..jpg')
('..jpg', '')
```

```
% php --version
PHP 7.1.23 (cli) (built: Feb 22 2019 22:19:32) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
% php -r 'var_export(pathinfo("..jpg", PATHINFO_EXTENSION));'
'jpg'
```

ref https://hydrocul.github.io/wiki/programming_languages_diff/io/extname.html

----------------------------------------
Bug #15244: Method #extname return empty string if filename is dot ('.')
https://bugs.ruby-lang.org/issues/15244#change-81355

* Author: TiSer (Sergey TiSer)
* Status: Feedback
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.7.0dev
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
### Example 1:
Current behaviour:
```
File.extname('..jpg')
=> ""
```

Expected behaviour: 
```
File.extname('..jpg')
=> ".jpg"
```


### Example 2:
Current behaviour:
```
File.extname('....jpg')
=> ""
```

Expected behaviour: 
```
=> ".jpg"
```

---Files--------------------------------
dot-names.diff (891 Bytes)
multiple-leading-dot-basename-extname-15244.patch (1.94 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.