[#23332] to_str再考 — matz@... (Yukihiro Matsumoto)

まつもと ゆきひろです

15 messages 2004/04/05

[#23380] [SEGV] make test-all (bccwin32 ruby1.9.0) — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>

山本です。

17 messages 2004/04/15
[#23400] Re: [SEGV] make test-all (bccwin32 ruby1.9.0) — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2004/04/16

山本です。落ちる場所がわかりました。

[#23402] Re: [SEGV] make test-all (bccwin32 ruby1.9.0) — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2004/04/16

山本です。

[#23403] Re: [SEGV] make test-all (bccwin32 ruby1.9.0) — nobu.nakada@... 2004/04/16

なかだです。

[#23405] Re: [SEGV] make test-all (bccwin32 ruby1.9.0) — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2004/04/16

山本です。

[#23407] Re: [SEGV] make test-all (bccwin32 ruby1.9.0) — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2004/04/16

山本です。

[ruby-dev:23444] Re: Dir#glob proposal

From: "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
Date: 2004-04-27 10:19:22 UTC
List: ruby-dev #23444
山本です。

nobu.nakada@nifty.ne.jp wrote:
(2004/02/20 12:35)

>> |思い付きですが、Dir#globというメソッドはどうでしょうか。例えば、
>> |Dir.open(dir).glob("**/*.rb") とすると dir/**/*.rb が、dirから
>> |の相対パスで返されるようなイメージです。
>> 
>> * どういう風に使うものでしょう
>
>例えばcp_rとか二つのディレクトリに対して再帰処理をするような場
>合、かなり楽になります。
>
>  def lndir(src, dest)
>    parent = src == File.expand_path(src, "/") ? "" : "../"
>    Dir.open(File.expand_path(src, dest)) do |dir|
>      dir.glob("**/*") do |file|
>        if File.directory?(t = File.join(dir.path, file))
>          Dir.mkdir(t)
>        else
>          File.symlink(parent * file.count("/") + file, File.join(dest, file))
>        end
>      end
>    end
>  end
>
>[ruby-dev:22957]だと、thread safeでないところが。

この提案を考えていたのですが、実は今の Dir.glob も thread safe ではないような気がします。

Dir.glob('foo/**/boo') do |path|
    Dir.chdir('hoge')
end

とかすると、基準ディレクトリが処理中に変わってしまいます。これは意図された動作ではないですよね?


In This Thread