* [ruby-core:89529] [Ruby trunk Bug#15244] Method #extname return empty string if filename is dot ('.')
[not found] <redmine.issue-15244.20181023111714@ruby-lang.org>
@ 2018-10-23 11:17 ` ug.tiser
2018-10-23 11:56 ` [ruby-core:89531] " ug.tiser
` (14 subsequent siblings)
15 siblings, 0 replies; 16+ messages in thread
From: ug.tiser @ 2018-10-23 11:17 UTC (permalink / raw)
To: ruby-core
Issue #15244 has been reported by TiSer (Sergey TiSer).
----------------------------------------
Bug #15244: Method #extname return empty string if filename is dot ('.')
https://bugs.ruby-lang.org/issues/15244
* Author: TiSer (Sergey TiSer)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.5.0p0
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
Current behaviour:
```
File.extname('..jpg')
=> ""
```
Expected behaviour:
```
File.extname('..jpg')
=> '.'
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 16+ messages in thread
* [ruby-core:89531] [Ruby trunk Bug#15244] Method #extname return empty string if filename is dot ('.')
[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 ` ug.tiser
2018-10-23 12:19 ` [ruby-core:89532] " shevegen
` (13 subsequent siblings)
15 siblings, 0 replies; 16+ messages in thread
From: ug.tiser @ 2018-10-23 11:56 UTC (permalink / raw)
To: ruby-core
Issue #15244 has been updated by TiSer (Sergey TiSer).
Description updated
add one more example
----------------------------------------
Bug #15244: Method #extname return empty string if filename is dot ('.')
https://bugs.ruby-lang.org/issues/15244#change-74582
* Author: TiSer (Sergey TiSer)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.5.0p0
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
### Example 1:
Current behaviour:
```
File.extname('..jpg')
=> ""
```
Expected behaviour:
```
File.extname('..jpg')
=> "."
```
### Example 2:
Current behaviour:
```
File.extname('....jpg')
=> ""
```
Expected behaviour:
```
=> "..."
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 16+ messages in thread
* [ruby-core:89532] [Ruby trunk Bug#15244] Method #extname return empty string if filename is dot ('.')
[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 ` shevegen
2018-10-23 12:31 ` [ruby-core:89533] " pdahorek
` (12 subsequent siblings)
15 siblings, 0 replies; 16+ messages in thread
From: shevegen @ 2018-10-23 12:19 UTC (permalink / raw)
To: ruby-core
Issue #15244 has been updated by shevegen (Robert A. Heiler).
Is this a real problem?
How many people have had entries with more leading '.'?
File.extname('foobar......jpg') # => ".jpg"
File.extname('......jpg') # => ""
It's not that I am not inclined to agree about it; I just think
it's a bit strange to want to change that behaviour. Do people
use lots of '.' for names to files or directories or symlinks?
----------------------------------------
Bug #15244: Method #extname return empty string if filename is dot ('.')
https://bugs.ruby-lang.org/issues/15244#change-74583
* Author: TiSer (Sergey TiSer)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.5.0p0
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
### Example 1:
Current behaviour:
```
File.extname('..jpg')
=> ""
```
Expected behaviour:
```
File.extname('..jpg')
=> "."
```
### Example 2:
Current behaviour:
```
File.extname('....jpg')
=> ""
```
Expected behaviour:
```
=> "..."
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 16+ messages in thread
* [ruby-core:89533] [Ruby trunk Bug#15244] Method #extname return empty string if filename is dot ('.')
[not found] <redmine.issue-15244.20181023111714@ruby-lang.org>
` (2 preceding siblings ...)
2018-10-23 12:19 ` [ruby-core:89532] " shevegen
@ 2018-10-23 12:31 ` pdahorek
2018-10-23 12:42 ` [ruby-core:89534] " ug.tiser
` (11 subsequent siblings)
15 siblings, 0 replies; 16+ messages in thread
From: pdahorek @ 2018-10-23 12:31 UTC (permalink / raw)
To: ruby-core
Issue #15244 has been updated by ahorek (Pavel Rosický).
IMO
```
File.extname('..jpg')
```
should be
```
=> ".jpg"
```
proposed
```
=> "."
```
or the current behaviour
```
=> ""
```
makes no sense
----------------------------------------
Bug #15244: Method #extname return empty string if filename is dot ('.')
https://bugs.ruby-lang.org/issues/15244#change-74584
* Author: TiSer (Sergey TiSer)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.5.0p0
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
### Example 1:
Current behaviour:
```
File.extname('..jpg')
=> ""
```
Expected behaviour:
```
File.extname('..jpg')
=> "."
```
### Example 2:
Current behaviour:
```
File.extname('....jpg')
=> ""
```
Expected behaviour:
```
=> "..."
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 16+ messages in thread
* [ruby-core:89534] [Ruby trunk Bug#15244] Method #extname return empty string if filename is dot ('.')
[not found] <redmine.issue-15244.20181023111714@ruby-lang.org>
` (3 preceding siblings ...)
2018-10-23 12:31 ` [ruby-core:89533] " pdahorek
@ 2018-10-23 12:42 ` ug.tiser
2018-10-29 5:42 ` [ruby-core:89613] " nobu
` (10 subsequent siblings)
15 siblings, 0 replies; 16+ messages in thread
From: ug.tiser @ 2018-10-23 12:42 UTC (permalink / raw)
To: ruby-core
Issue #15244 has been updated by TiSer (Sergey TiSer).
ahorek (Pavel Rosický) wrote:
> IMO
> ```
> File.extname('..jpg')
> ```
> should be
> ```
> => ".jpg"
> ```
>
> proposed
> ```
> => "."
> ```
> or the current behaviour
> ```
> => ""
> ```
> makes no sense
Yes, sure. I'm sorry, I oversleep correct cases.
Updated.
----------------------------------------
Bug #15244: Method #extname return empty string if filename is dot ('.')
https://bugs.ruby-lang.org/issues/15244#change-74586
* Author: TiSer (Sergey TiSer)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.5.0p0
* 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"
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 16+ messages in thread
* [ruby-core:89613] [Ruby trunk Bug#15244] Method #extname return empty string if filename is dot ('.')
[not found] <redmine.issue-15244.20181023111714@ruby-lang.org>
` (4 preceding siblings ...)
2018-10-23 12:42 ` [ruby-core:89534] " ug.tiser
@ 2018-10-29 5:42 ` nobu
2018-11-13 14:40 ` [ruby-core:89785] " ug.tiser
` (9 subsequent siblings)
15 siblings, 0 replies; 16+ messages in thread
From: nobu @ 2018-10-29 5:42 UTC (permalink / raw)
To: ruby-core
Issue #15244 has been updated by nobu (Nobuyoshi Nakada).
If `File.extname("..jpg")` returns `".jpg"`, `File.basename("..jpg", ".*")` should return `"."` without that part, to restore the original name from from these results.
It is different from basename(1).
```
$ basename ..jpg '.*'
..jpg
```
----------------------------------------
Bug #15244: Method #extname return empty string if filename is dot ('.')
https://bugs.ruby-lang.org/issues/15244#change-74652
* Author: TiSer (Sergey TiSer)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.5.0p0
* 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"
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 16+ messages in thread
* [ruby-core:89785] [Ruby trunk Bug#15244] Method #extname return empty string if filename is dot ('.')
[not found] <redmine.issue-15244.20181023111714@ruby-lang.org>
` (5 preceding siblings ...)
2018-10-29 5:42 ` [ruby-core:89613] " nobu
@ 2018-11-13 14:40 ` ug.tiser
2018-11-22 15:11 ` [ruby-core:89975] " ug.tiser
` (8 subsequent siblings)
15 siblings, 0 replies; 16+ messages in thread
From: ug.tiser @ 2018-11-13 14:40 UTC (permalink / raw)
To: ruby-core
Issue #15244 has been updated by TiSer (Sergey TiSer).
This is still present.
----------------------------------------
Bug #15244: Method #extname return empty string if filename is dot ('.')
https://bugs.ruby-lang.org/issues/15244#change-74846
* Author: TiSer (Sergey TiSer)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.5.0p0
* 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"
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 16+ messages in thread
* [ruby-core:89975] [Ruby trunk Bug#15244] Method #extname return empty string if filename is dot ('.')
[not found] <redmine.issue-15244.20181023111714@ruby-lang.org>
` (6 preceding siblings ...)
2018-11-13 14:40 ` [ruby-core:89785] " ug.tiser
@ 2018-11-22 15:11 ` ug.tiser
2019-02-16 8:01 ` [ruby-core:91575] " ug.tiser
` (7 subsequent siblings)
15 siblings, 0 replies; 16+ messages in thread
From: ug.tiser @ 2018-11-22 15:11 UTC (permalink / raw)
To: ruby-core
Issue #15244 has been updated by TiSer (Sergey TiSer).
Still present.
----------------------------------------
Bug #15244: Method #extname return empty string if filename is dot ('.')
https://bugs.ruby-lang.org/issues/15244#change-75081
* Author: TiSer (Sergey TiSer)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.5.0p0
* 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"
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 16+ messages in thread
* [ruby-core:91575] [Ruby trunk Bug#15244] Method #extname return empty string if filename is dot ('.')
[not found] <redmine.issue-15244.20181023111714@ruby-lang.org>
` (7 preceding siblings ...)
2018-11-22 15:11 ` [ruby-core:89975] " ug.tiser
@ 2019-02-16 8:01 ` ug.tiser
2019-07-26 17:16 ` [ruby-core:93934] [Ruby master " rushsteve1
` (6 subsequent siblings)
15 siblings, 0 replies; 16+ messages in thread
From: ug.tiser @ 2019-02-16 8:01 UTC (permalink / raw)
To: ruby-core
Issue #15244 has been updated by TiSer (Sergey TiSer).
Still present.
----------------------------------------
Bug #15244: Method #extname return empty string if filename is dot ('.')
https://bugs.ruby-lang.org/issues/15244#change-76839
* Author: TiSer (Sergey TiSer)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.5.0p0
* 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"
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 16+ messages in thread
* [ruby-core:93934] [Ruby master Bug#15244] Method #extname return empty string if filename is dot ('.')
[not found] <redmine.issue-15244.20181023111714@ruby-lang.org>
` (8 preceding siblings ...)
2019-02-16 8:01 ` [ruby-core:91575] " ug.tiser
@ 2019-07-26 17:16 ` rushsteve1
2019-08-02 15:16 ` [ruby-core:94113] " rushsteve1
` (5 subsequent siblings)
15 siblings, 0 replies; 16+ messages in thread
From: rushsteve1 @ 2019-07-26 17:16 UTC (permalink / raw)
To: ruby-core
Issue #15244 has been updated by rushsteve1 (Steven vanZyl).
File dot-names.diff added
The issue seemed to be in how .dotfiles were handled, where all leading periods were trimmed when only the first should have been.
I've created a patch that seems to fix the issue and added a spect test for it. It's only a 2 line change.
This is my first patch submission so any and all feedback would be greatly appreciated.
----------------------------------------
Bug #15244: Method #extname return empty string if filename is dot ('.')
https://bugs.ruby-lang.org/issues/15244#change-80090
* Author: TiSer (Sergey TiSer)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.5.0p0
* 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 (885 Bytes)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 16+ messages in thread
* [ruby-core:94113] [Ruby master Bug#15244] Method #extname return empty string if filename is dot ('.')
[not found] <redmine.issue-15244.20181023111714@ruby-lang.org>
` (9 preceding siblings ...)
2019-07-26 17:16 ` [ruby-core:93934] [Ruby master " rushsteve1
@ 2019-08-02 15:16 ` rushsteve1
2019-08-14 1:15 ` [ruby-core:94332] " merch-redmine
` (4 subsequent siblings)
15 siblings, 0 replies; 16+ messages in thread
From: rushsteve1 @ 2019-08-02 15:16 UTC (permalink / raw)
To: ruby-core
Issue #15244 has been updated by rushsteve1 (Steven vanZyl).
File dot-names.diff added
Updated the diff to also account for the if (*p) case so that it will stop if p == 0.
----------------------------------------
Bug #15244: Method #extname return empty string if filename is dot ('.')
https://bugs.ruby-lang.org/issues/15244#change-80355
* Author: TiSer (Sergey TiSer)
* Status: Open
* 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 (885 Bytes)
dot-names.diff (891 Bytes)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 16+ messages in thread
* [ruby-core:94332] [Ruby master Bug#15244] Method #extname return empty string if filename is dot ('.')
[not found] <redmine.issue-15244.20181023111714@ruby-lang.org>
` (10 preceding siblings ...)
2019-08-02 15:16 ` [ruby-core:94113] " rushsteve1
@ 2019-08-14 1:15 ` merch-redmine
2019-09-02 6:50 ` [ruby-core:94734] " matz
` (3 subsequent siblings)
15 siblings, 0 replies; 16+ messages in thread
From: merch-redmine @ 2019-08-14 1:15 UTC (permalink / raw)
To: ruby-core
Issue #15244 has been updated by jeremyevans0 (Jeremy Evans).
File multiple-leading-dot-basename-extname-15244.patch added
I agree that this is a bug. The comparison that nobu made with `basename(1)` is relevant, but unlike `File.basename`, `basename(1)` does not handle `.*` specially. You can see that `basename(1)` does actually strip the extension even for multiple leading periods:
```
basename '..*' '.*'
..
```
Attached is a patch that fixes the issue, both for `File.basename` and `File.extname`. With the patch:
```ruby
File.basename('..jpg', '.*')
# => "."
File.extname('..jpg')
# => ".jpg"
```
----------------------------------------
Bug #15244: Method #extname return empty string if filename is dot ('.')
https://bugs.ruby-lang.org/issues/15244#change-80724
* Author: TiSer (Sergey TiSer)
* Status: Open
* 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/
^ permalink raw reply [flat|nested] 16+ messages in thread
* [ruby-core:94734] [Ruby master Bug#15244] Method #extname return empty string if filename is dot ('.')
[not found] <redmine.issue-15244.20181023111714@ruby-lang.org>
` (11 preceding siblings ...)
2019-08-14 1:15 ` [ruby-core:94332] " merch-redmine
@ 2019-09-02 6:50 ` matz
2019-09-02 7:12 ` [ruby-core:94737] " zn
` (2 subsequent siblings)
15 siblings, 0 replies; 16+ messages in thread
From: matz @ 2019-09-02 6:50 UTC (permalink / raw)
To: ruby-core
Issue #15244 has been updated by matz (Yukihiro Matsumoto).
Status changed from Open to Feedback
`.git` is not an extension but a filename. `.a.jpg` has `.jpg` extension. I wonder how we can parse `..jpg`. It's undefined behavior for me.
Any reasoning?
Matz.
----------------------------------------
Bug #15244: Method #extname return empty string if filename is dot ('.')
https://bugs.ruby-lang.org/issues/15244#change-81350
* 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/
^ permalink raw reply [flat|nested] 16+ messages in thread
* [ruby-core:94737] [Ruby master Bug#15244] Method #extname return empty string if filename is dot ('.')
[not found] <redmine.issue-15244.20181023111714@ruby-lang.org>
` (12 preceding siblings ...)
2019-09-02 6:50 ` [ruby-core:94734] " matz
@ 2019-09-02 7:12 ` zn
2019-09-02 9:42 ` [ruby-core:94741] " nobu
2019-09-24 19:08 ` [ruby-core:95064] " ug.tiser
15 siblings, 0 replies; 16+ messages in thread
From: zn @ 2019-09-02 7:12 UTC (permalink / raw)
To: ruby-core
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/
^ permalink raw reply [flat|nested] 16+ messages in thread
* [ruby-core:94741] [Ruby master Bug#15244] Method #extname return empty string if filename is dot ('.')
[not found] <redmine.issue-15244.20181023111714@ruby-lang.org>
` (13 preceding siblings ...)
2019-09-02 7:12 ` [ruby-core:94737] " zn
@ 2019-09-02 9:42 ` nobu
2019-09-24 19:08 ` [ruby-core:95064] " ug.tiser
15 siblings, 0 replies; 16+ messages in thread
From: nobu @ 2019-09-02 9:42 UTC (permalink / raw)
To: ruby-core
Issue #15244 has been updated by nobu (Nobuyoshi Nakada).
znz (Kazuhiro NISHIYAMA) wrote:
> ```
> % 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'
> ```
Seems not for us:
```php
var_export(pathinfo(".profile", PATHINFO_EXTENSION)); //=> 'profile'
```
----------------------------------------
Bug #15244: Method #extname return empty string if filename is dot ('.')
https://bugs.ruby-lang.org/issues/15244#change-81358
* 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/
^ permalink raw reply [flat|nested] 16+ messages in thread
* [ruby-core:95064] [Ruby master Bug#15244] Method #extname return empty string if filename is dot ('.')
[not found] <redmine.issue-15244.20181023111714@ruby-lang.org>
` (14 preceding siblings ...)
2019-09-02 9:42 ` [ruby-core:94741] " nobu
@ 2019-09-24 19:08 ` ug.tiser
15 siblings, 0 replies; 16+ messages in thread
From: ug.tiser @ 2019-09-24 19:08 UTC (permalink / raw)
To: ruby-core
Issue #15244 has been updated by TiSer (Sergey TiSer).
Example from .NET:
```
class Program
{
static void Main(string[] args)
{
string ext = Path.GetExtension("..jpg");
Console.WriteLine(ext);
Console.ReadLine();
}
}
=> '.jpg'
```
----------------------------------------
Bug #15244: Method #extname return empty string if filename is dot ('.')
https://bugs.ruby-lang.org/issues/15244#change-81697
* 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/
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2019-09-24 19:08 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[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 ` [ruby-core:94737] " zn
2019-09-02 9:42 ` [ruby-core:94741] " nobu
2019-09-24 19:08 ` [ruby-core:95064] " ug.tiser
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).