Don’t understand why the following segfault under Cygwin when you have a
directory of 21 entries (see example below)
$ 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 }
but the following doesn’t
$ cat test2.rb
dirs = Dir.glob("*/")
dirs.sort { | x, y | File.ctime(x) <=> File.ctime(y) }
dirs.each { | x | puts x + " " + File.ctime(x).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 tried to capture a back trace but when I ran it through gdb it ran
perfectly.
Rob
--------------running test.rb in cygwin-------------------------
$ ruby test.rb
a/ Wed May 26 11:08:00 GMT0:00 2004
b/ Wed May 26 11:08:02 GMT0:00 2004
c/ Wed May 26 11:08:03 GMT0:00 2004
d/ Wed May 26 11:08:04 GMT0:00 2004
e/ Wed May 26 11:08:05 GMT0:00 2004
f/ Wed May 26 11:08:07 GMT0:00 2004
g/ Wed May 26 11:08:22 GMT0:00 2004
h/ Wed May 26 11:08:24 GMT0:00 2004
i/ Wed May 26 11:10:37 GMT0:00 2004
j/ Wed May 26 11:10:42 GMT0:00 2004
k/ Wed May 26 11:10:47 GMT0:00 2004
m/ Wed May 26 11:11:17 GMT0:00 2004
n/ Wed May 26 11:11:20 GMT0:00 2004
o/ Wed May 26 11:11:24 GMT0:00 2004
p/ Wed May 26 11:11:29 GMT0:00 2004
test.rb:3: [BUG] Segmentation fault
ruby 1.9.0 (2004-05-26) [i386-cygwin]
----------------running test2.rb in cygwin-------------------------
robertm@PC126 ~/test
$ ruby test2.rb
a/ Wed May 26 11:08:00 GMT0:00 2004
b/ Wed May 26 11:08:02 GMT0:00 2004
c/ Wed May 26 11:08:03 GMT0:00 2004
d/ Wed May 26 11:08:04 GMT0:00 2004
e/ Wed May 26 11:08:05 GMT0:00 2004
f/ Wed May 26 11:08:07 GMT0:00 2004
g/ Wed May 26 11:08:22 GMT0:00 2004
h/ Wed May 26 11:08:24 GMT0:00 2004
i/ Wed May 26 11:10:37 GMT0:00 2004
j/ Wed May 26 11:10:42 GMT0:00 2004
k/ Wed May 26 11:10:47 GMT0:00 2004
m/ Wed May 26 11:11:17 GMT0:00 2004
n/ Wed May 26 11:11:20 GMT0:00 2004
o/ Wed May 26 11:11:24 GMT0:00 2004
p/ Wed May 26 11:11:29 GMT0:00 2004
q/ Wed May 26 11:11:35 GMT0:00 2004
r/ Wed May 26 11:11:40 GMT0:00 2004
s/ Wed May 26 11:11:44 GMT0:00 2004
t/ Wed May 26 11:11:48 GMT0:00 2004
u/ Wed May 26 11:11:53 GMT0:00 2004
v/ Wed May 26 11:11:57 GMT0:00 2004
---------------Contents of ruby.exe.stackdump------------------
$ less ruby.exe.stackdump
Stack trace:
Frame Function Args
02409D28 77E7AC21 (00000000, F0C43524, 0240F098, 77E94809)
02409E28 6108A370 (000014C8, 02409E40, 02409E58, 610E8D26)
02409EE8 6108A64A (000014C8, 00000006, 02409F18, 6108AA1D)
02409EF8 6108A46C (00000006, 00000400, 02409F28, 0240A364)
02409F18 6108AA1D (61115378, 100102D9, 1009A4E0, 1009A4E6)
0240A358 610882AF (10085A02, 0240F140, 0240A398, 61027459)
0240A368 10085A32 (0000000B, 000000A4, 0240F098, 77E94809)
0240A398 61027459 (000004E8, 0000EA60, 000000A4, 0240A3D4)
0240A4A8 6108D282 (0240F098, 610252CD, 0240A990, 00000000)
0240A8A8 61025327 (0240A990, 0240F098, 0240A9AC, 0240A968)
0240A8CC 77FB172E (0240A990, 0240F098, 0240A9AC, 0240A968)
0240A978 77FB1700 (00000000, 0240A9AC, 0240A990, 0240A9AC)
0240AC78 77F75DBA (00000000, 00000000, 0240ACB8, 6101E154)
0240AC88 610317F4 (00000000, 006F0068, 0065006D, 0072005C)
0240ACB8 6101E154 (0240ACD0, 00000000, 00000000, 00000000)
0240B028 6101DEB8 (10148ED8, 00000000, 00000001, 00000000)
End of stack trace (more stack frames may be present)
----------------Attempt to get stack trace------------------
$ gdb ruby
GNU gdb 2003-09-20-cvs (cygwin-special)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type “show copying” to see the conditions.
There is absolutely no warranty for GDB. Type “show warranty” for
details.
This GDB was configured as “i686-pc-cygwin”…
(gdb) run test.rb
Starting program: /usr/local/bin/ruby.exe test.rb
a/ Wed May 26 11:08:00 GMT0:00 2004
b/ Wed May 26 11:08:02 GMT0:00 2004
c/ Wed May 26 11:08:03 GMT0:00 2004
d/ Wed May 26 11:08:04 GMT0:00 2004
e/ Wed May 26 11:08:05 GMT0:00 2004
f/ Wed May 26 11:08:07 GMT0:00 2004
g/ Wed May 26 11:08:22 GMT0:00 2004
h/ Wed May 26 11:08:24 GMT0:00 2004
i/ Wed May 26 11:10:37 GMT0:00 2004
j/ Wed May 26 11:10:42 GMT0:00 2004
k/ Wed May 26 11:10:47 GMT0:00 2004
m/ Wed May 26 11:11:17 GMT0:00 2004
n/ Wed May 26 11:11:20 GMT0:00 2004
o/ Wed May 26 11:11:24 GMT0:00 2004
p/ Wed May 26 11:11:29 GMT0:00 2004
q/ Wed May 26 11:11:35 GMT0:00 2004
r/ Wed May 26 11:11:40 GMT0:00 2004
s/ Wed May 26 11:11:44 GMT0:00 2004
t/ Wed May 26 11:11:48 GMT0:00 2004
u/ Wed May 26 11:11:53 GMT0:00 2004
v/ Wed May 26 11:11:57 GMT0:00 2004
Program exited normally.
(gdb)