[GHC] #1874: getDirectoryContents yields "invalid argument" instead of "permission error"

GHC trac at galois.com
Tue Jun 3 06:07:42 EDT 2008


#1874: getDirectoryContents yields "invalid argument" instead of "permission
error"
------------------------------------------------------------------+---------
 Reporter:  Orphi                                                 |          Owner:             
     Type:  bug                                                   |         Status:  new        
 Priority:  low                                                   |      Milestone:  6.10 branch
Component:  libraries/directory                                   |        Version:  6.8.1      
 Severity:  normal                                                |     Resolution:             
 Keywords:                                                        |     Difficulty:  Easy (1 hr)
 Testcase:  getDirectoryContents "C:\\System Volume Information"  |   Architecture:  x86        
       Os:  Windows                                               |  
------------------------------------------------------------------+---------
Changes (by simonmar):

  * priority:  lowest => low
  * milestone:  6.8.3 => 6.10 branch

Comment:

 This is really a bug in MinGW's readdir():

 {{{
 #include <dirent.h>
 #include <errno.h>

 main()
 {
     DIR *pdir;
     struct dirent *pdirent;

     pdir = opendir("foo");
     printf("%x %d\n", pdir, errno);
     pdirent = readdir(pdir);
     printf("%x %d\n", pdirent, errno);
 }
 }}}

 yields:

 {{{
 $ ls -ld foo
 d---------+ 2 simonmar mkgroup-l-d 0 Jun  3 10:19 foo/
 $ a.exe
 3d2c48 0
 0 22
 }}}

 where 22 is EINVAL.  We should really be using the native Win32 API
 instead of MinGW here.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1874#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list