Directory.doesDirectoryExist inconsistency
Claus Reinke
claus.reinke at talk21.com
Wed Oct 16 10:21:32 EDT 2002
I've just been chasing a portability problem, where a largish third-party
program works fine on our suns (ghc-5.02.3), but chokes under
cygwin/windows (ghc-5.04). Comes down to an inconsistency in the
handling of (trailing?) slashes in Directory.doesDirectoryExist (see
a and b below).
Consequence: under cygwin, the program doesn't see the existing directory,
tries to create it, and fails (error message doesn't seem to include the file
name, btw).
Cheers,
Claus
$ uname -a
CYGWIN_98-4.10 VAIO 1.3.10(0.51/3/2) 2002-02-25 11:14 i686 unknown
$ ghci
___ ___ _
/ _ \ /\ /\/ __(_)
/ /_\// /_/ / / | | GHC Interactive, version 5.04, for Haskell 98.
/ /_\\/ __ / /___| | http://www.haskell.org/ghc/
\____/\/ /_/\____/|_| Type :? for help.
Loading package base ... linking ... done.
Loading package haskell98 ... linking ... done.
Prelude>
Prelude> Directory.doesDirectoryExist "u" >>= print
False
Prelude> Directory.createDirectory "u"
Prelude> Directory.doesDirectoryExist "u" >>= print
True
Prelude> Directory.doesDirectoryExist "u/" >>= print -- (a)
note this one, compare with b
False
Prelude> Directory.doesDirectoryExist "u\\" >>= print
False
Prelude> :q
Leaving GHCi.
> uname -a
SunOS myrtle 5.8 Generic_108528-16 sun4u sparc SUNW,Ultra-4
> ghci
___ ___ _
/ _ \ /\ /\/ __(_)
/ /_\// /_/ / / | | GHC Interactive, version 5.02.3, for Haskell 98.
/ /_\\/ __ / /___| | http://www.haskell.org/ghc/
\____/\/ /_/\____/|_| Type :? for help.
Loading package std ... linking ... done.
Prelude> Directory.doesDirectoryExist "u" >>= print
False
Prelude> Directory.createDirectory "u"
Prelude> Directory.doesDirectoryExist "u" >>= print
True
Prelude> Directory.doesDirectoryExist "u/" >>= print -- (b) note
this one, compare with a
True
Prelude> Directory.doesDirectoryExist "u\\" >>= print
False
Prelude> :q
Leaving GHCi.
More information about the Glasgow-haskell-bugs
mailing list