ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: merch-redmine@jeremyevans.net
To: ruby-core@ruby-lang.org
Subject: [ruby-core:94331] [Ruby master Bug#15267] File.basename + File.extname does not restore the original name
Date: Tue, 13 Aug 2019 23:49:48 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-80723.20190813234948.651f9f6acd450e63@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-15267.20181029062527@ruby-lang.org

Issue #15267 has been updated by jeremyevans0 (Jeremy Evans).

File file-basename-trailing-dot-15267.patch added

Attached is a patch that fixes this issue.  With the patch:

```ruby
name = 'file.'
File.basename(name, '.*')
# => "file."
File.extname(name)
# => ""
```

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

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

  parent reply	other threads:[~2019-08-13 23:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-15267.20181029062527@ruby-lang.org>
2018-10-29  6:25 ` [ruby-core:89615] [Ruby trunk Bug#15267] File.basename + File.extname does not restore the original name nobu
2019-08-13 23:49 ` merch-redmine [this message]
2019-10-17  5:14 ` [ruby-core:95378] [Ruby master " naruse
2019-10-17  5:41 ` [ruby-core:95380] " akr
2019-10-17  6:05 ` [ruby-core:95383] " nobu

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-80723.20190813234948.651f9f6acd450e63@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).