[BUG?] Seqfault sorting array of Files by ctime

Robert,

$ cat test.rb
dirs = Dir.glob(“*/”)
dirs.sort { | x, y | File.new(x).ctime <=> File.new(y).ctime }
dirs.each { | x | puts x + " " + File.new(x).ctime.to_s }.

Also, why does test.rb produce the following using a native
windows compile.

C:\DEVELO~1\cygwin\home\robertm\test>ruby test.rb
test.rb:2:in initialize': Permission denied - a/ (Errno::EACCES) from test.rb:2:in new’
from test.rb:2
from test.rb:2:in `sort’
from test.rb:2

I can't speak to your segfault issue (I can run your code fine under

cygwin on ruby 1.8.1), but the native Windows issue is easy enough.
According to Microsoft (http://tinyurl.com/2tedp), an EACCES error on
open() means:

“Tried to open read-only file for writing, or file’s sharing mode does
not allow specified operations, or given path is directory”

Basically, you can't open a directory like a file.

I hope this helps.

- Warren Brown