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

GHC trac at galois.com
Sun Apr 27 12:06:51 EDT 2008


#1874: getDirectoryContents yields "invalid argument" instead of "permission
error"
------------------------------------------------------------------+---------
 Reporter:  Orphi                                                 |          Owner:             
     Type:  bug                                                   |         Status:  new        
 Priority:  lowest                                                |      Milestone:  6.8.3      
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 igloo):

  * priority:  normal => lowest

Comment:

 I can't get any exception at all out of getDirectoryContents on Windows.
 {{{
 $ cat q.hs

 module Main (main) where

 import Control.Exception
 import Prelude hiding (catch)
 import System.Directory

 main :: IO ()
 main = do
           (readFile "c:\\cygwin\\tmp\\ian\\noperm" >> return ()) `catch`
 print
           (getDirectoryContents "c:\\cygwin\\tmp\\ian\\npd" >> return ())
 `catch` print
           putStrLn "Foo"
 }}}

 {{{
 $ ls -l
 total 643
 ----------  1 ian None      0 Apr 27 16:57 noperm
 d---------+ 2 ian None      0 Apr 27 16:57 npd
 -rwxr-xr-x  1 ian None 644760 Apr 27 16:59 q.exe
 -rwxr-xr-x  1 ian None    498 Apr 27 16:59 q.exe.manifest
 -rwxr-xr-x  1 ian None    305 Apr 27 16:57 q.hi
 -rw-r--r--  1 ian None    324 Apr 27 16:59 q.hs
 -rwxr-xr-x  1 ian None   5494 Apr 27 16:59 q.o
 }}}

 {{{
 $ ./q.exe
 c:\cygwin\tmp\ian\noperm: openFile: permission denied (Permission denied)
 Foo
 }}}
 Can anyone tell me how I can reproduce the problem please?

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


More information about the Glasgow-haskell-bugs mailing list