[GHC] #7985: Allow openFile on unknown file type
GHC
ghc-devs at haskell.org
Tue Feb 9 00:46:54 UTC 2016
#7985: Allow openFile on unknown file type
-------------------------------------+-------------------------------------
Reporter: singpolyma | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Core Libraries | Version: 7.6.3
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by rwbarton):
I believe these cryptic communications refer to the following function.
{{{
statGetType :: Ptr CStat -> IO IODeviceType
statGetType p_stat = do
c_mode <- st_mode p_stat :: IO CMode
case () of
_ | s_isdir c_mode -> return Directory
| s_isfifo c_mode || s_issock c_mode || s_ischr c_mode
-> return Stream
| s_isreg c_mode -> return RegularFile
-- Q: map char devices to RawDevice too?
| s_isblk c_mode -> return RawDevice
| otherwise -> ioError ioe_unknownfiletype
}}}
These are all the types of file defined by POSIX, but I suppose a system
could add others.
But it's unclear what to do here. What should we return for, say,
`hIsSeekable` if you opened such a file? Just guessing once and for all
that files of unknown type are seekable (or not seekable) doesn't seem
right. Haven't looked into what else the file type is used for.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/7985#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list