[GHC] #7971: doesDirectoryExist description differs from its behavior
GHC
ghc-devs at haskell.org
Sun Jun 9 04:18:42 CEST 2013
#7971: doesDirectoryExist description differs from its behavior
----------------------------------------+-----------------------------------
Reporter: dsf | Owner:
Type: bug | Status: new
Priority: normal | Component: libraries/directory
Version: 7.6.3 | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: Incorrect result at runtime | Blockedby:
Blocking: | Related:
----------------------------------------+-----------------------------------
Comment(by Fuuzetsu):
I have created testDir: it was one level up. It seems that the formatting
swallowed up ‘../’ as is also apparent in your own snippet (so my link was
pointing to ‘../testDir’ which existed (I guess ‘/tmp/testDir’ should be
used in the future to avoid swallowing up in the WikiFormatting blocks)).
Having said that, I did some further investigation and here's what I
uncovered:
If the directory linked to exists in the same directory or in any
subdirectories, doesDirectoryExists will return True. If the directory
linked to exists higher up in the file hierarchy, it will return False.
relative/absolute paths seem to not matter.
So a link ‘/tmp/test/linkToSomething’ to ‘/tmp/something’ will return
False even if ‘/tmp/something’ is present on the filesystem. A link in
‘/tmp/test/linkToOther’ to ‘/tmp/test/foo/bar/baz/someDir’ will return
True given that the someDir exists.
This also means that it might in fact be following symlinks: it just
doesn't matter because the only links to return True for directories are
in the same/subdirectory that is being removed so they would be gone
anyway.
I don't think this strange behaviour is by design and should be fixed, or
carefully documented if it is by design.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7971#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list