From: Ariff Abdullah Date: 2003-06-17T21:14:08+09:00 Subject: win32 Dir.open() misleading error This is a multi-part message in MIME format. --------------020104050609080906030003 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit C:\WINNT\ruby18\bin>dir Volume in drive C is System Volume Serial Number is 78B0-D562 Directory of C:\WINNT\ruby18\bin [.] [..] erb irb erb.bat irb.bat msvcrt-ruby18.dll ruby.exe rubyw.exe 7 File(s) 867,670 bytes 2 Dir(s) 2,004,111,360 bytes free C:\WINNT\ruby18\bin>ruby -e 'Dir.open("erb")' -e:1: [BUG] rb_sys_fail() - errno == 0 ruby 1.8.0 (2003-06-16) [i386-mswin32] abnormal program termination C:\WINNT\ruby18\bin> ....which is quite misleading. Should be Errno::ENOTDIR. Here is the patch (attachment). --------------020104050609080906030003 Content-Type: text/plain; name="win32.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="win32.c.diff" --- win32/win32.c.orig Thu May 29 09:30:16 2003 +++ win32/win32.c Tue Jun 17 19:57:23 2003 @@ -1333,7 +1333,9 @@ // check to see if we've got a directory // - if ((rb_w32_stat(filename, &sbuf) < 0 || ( + if (rb_w32_stat(filename, &sbuf) < 0) + return NULL; + if ((( #ifdef __BORLANDC__ (unsigned short)(sbuf.st_mode) #else @@ -1342,6 +1344,7 @@ & _S_IFDIR) == 0) && (!ISALPHA(filename[0]) || filename[1] != ':' || filename[2] != '\0' || ((1 << (filename[0] & 0x5f) - 'A') & GetLogicalDrives()) == 0)) { + errno = ENOTDIR; return NULL; } --------------020104050609080906030003--