[#39325] File.fnmatch の改良について — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>

はじめまして、山本です。

18 messages 2004/03/05

[#39429] trial version of Ruby/Tk — Hidetoshi NAGAI <nagai@...>

永井@知能.九工大です.

18 messages 2004/03/23
[#39454] Re: trial version of Ruby/Tk — "Shirai,Kaoru" <shirai@...> 2004/03/31

白井です。

[#39460] Re: trial version of Ruby/Tk — Hidetoshi NAGAI <nagai@...> 2004/04/01

永井@知能.九工大です.

[#39465] Re: trial version of Ruby/Tk — "Shirai,Kaoru" <shirai@...> 2004/04/01

白井です。

[#39466] Re: trial version of Ruby/Tk — Hidetoshi NAGAI <nagai@...> 2004/04/01

永井@知能.九工大です.

[#39453] Re: int/int in Ruby2? — Masaaki Sakano <mas@...>

坂野 正明です。

36 messages 2004/03/31
[#39455] Re: int/int in Ruby2? — NISHIMATSU Takeshi <t-nissie@...> 2004/03/31

西松と申します.

[#39470] Re: int/int in Ruby2? — Masaaki Sakano <mas@...> 2004/04/01

坂野 正明です。

[#39473] Re: int/int in Ruby2? — matz@... (Yukihiro Matsumoto) 2004/04/01

まつもと ゆきひろです

[#39484] Re: int/int in Ruby2? — Masaaki Sakano <mas@...> 2004/04/03

坂野 正明です。

[#39528] Re: int/int in Ruby2? — "T Akutsu" <locrian@...> 2004/04/09

あくつです。なんかわくわくしてきだぞ。(^^;)

[ruby-list:39341] Re: File.fnmatch の改良について

From: "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
Date: 2004-03-06 10:12:31 UTC
List: ruby-list #39341
山本です。

>| うーん・・・すみません、glob(3) はどう振舞ってますか?
>| 
>|   ・fnmatch(3) + FNM_PATHNAME と同じく、'[a/c]' ==> '[ac]' で 'a' か 'c' にマッチ
>|   ・bash と同じく、'[a/c]' は '[a' の下の 'c]' にマッチ
>
>オプションなしでいいのかな。
>えーと、どっちともマッチしません。

よくわからなくなってきました。

>ところで、どうやって調べたかわかりませんが、おそらくbashでも
>[a/c] はいずれにもマッチしてないと思います。

下のようにしました。

Welcome to the BeOS shell.

$ cd /tmp
$ dir
total 0
$ dir [a/c]
/bin/ls: [a/c]: No such file or directory
$ mkdir [a
$ touch [a/c]
$ dir [a/c]
-rw-r--r--   1 baron    users           0 Mar  6 18:45 [a/c]

マッチしてるように見えます。(csh,tcsh != zsh != bash ?)

でも、わかりました。

  ・File.fnmatch の挙動は、世間に流通している fnmatch(3) と同一なので問題ない
  ・fnmatch(3) は SUSv3 に準拠してない(涙)
  ・むしろ Dir.glob の '[a/c]' の解釈が glob(3) と違う可能性がある

ということですね。glob(3) についてよくわからないので、とりあえず

  ・'*' の高速化
  ・'**/' の実装
  ・セパレータは '/' だけ

だけ変更することにして、もう一度実装しなおします。(FNM_PERIOD 復活は議論待ち)

In This Thread