Project

General

Profile

Actions

Bug #14899

closed

Pathname#glob Matching to the directory results in lack

Added by hazi (yuhei mukoyama) almost 6 years ago. Updated almost 6 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.6.0preview2 (2018-05-31 trunk 63539) [x86_64-darwin17]
[ruby-dev:50588]

Description

Pathname.glob では問題ないのですが、
ruby 2.5 から追加された Pathname#glob で、スラッシュで終わる引数を渡すとディレクトリ名の最初の1文字がかけた状態で返ってきます

Pathname('/tmp/test').glob('**/*')  => [#<Pathname:/tmp/test/abc>,  #<Pathname:/tmp/test/123>]
Pathname.glob('/tmp/test/**/*/')    => [#<Pathname:/tmp/test/abc/>, #<Pathname:/tmp/test/123/>]
Pathname('/tmp/test').glob('**/*/') => [#<Pathname:/tmp/test/bc>,   #<Pathname:/tmp/test/23>]
Actions #1

Updated by nobu (Nobuyoshi Nakada) almost 6 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r63909.


dir.c: fix directory glob

  • dir.c (glob_helper): fix directory glob which resulted in lacking
    the first byte. adjust the length of basename to be appended as
    well as removing the heading path, not the length of the joined
    path. [ruby-dev:50588] [Bug #14899]
Actions

Also available in: Atom PDF

Like0
Like0