ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: zn@mbf.nifty.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:94737] [Ruby master Bug#15244] Method #extname return empty string if filename is dot ('.')
Date: Mon, 02 Sep 2019 07:12:39 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-81355.20190902071239.7debcc4b4a867182@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-15244.20181023111714@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/

  parent reply	other threads:[~2019-09-02  7:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-15244.20181023111714@ruby-lang.org>
2018-10-23 11:17 ` [ruby-core:89529] [Ruby trunk Bug#15244] Method #extname return empty string if filename is dot ('.') ug.tiser
2018-10-23 11:56 ` [ruby-core:89531] " ug.tiser
2018-10-23 12:19 ` [ruby-core:89532] " shevegen
2018-10-23 12:31 ` [ruby-core:89533] " pdahorek
2018-10-23 12:42 ` [ruby-core:89534] " ug.tiser
2018-10-29  5:42 ` [ruby-core:89613] " nobu
2018-11-13 14:40 ` [ruby-core:89785] " ug.tiser
2018-11-22 15:11 ` [ruby-core:89975] " ug.tiser
2019-02-16  8:01 ` [ruby-core:91575] " ug.tiser
2019-07-26 17:16 ` [ruby-core:93934] [Ruby master " rushsteve1
2019-08-02 15:16 ` [ruby-core:94113] " rushsteve1
2019-08-14  1:15 ` [ruby-core:94332] " merch-redmine
2019-09-02  6:50 ` [ruby-core:94734] " matz
2019-09-02  7:12 ` zn [this message]
2019-09-02  9:42 ` [ruby-core:94741] " nobu
2019-09-24 19:08 ` [ruby-core:95064] " ug.tiser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-81355.20190902071239.7debcc4b4a867182@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).