[GHC] #8859: import conditionalization in System.Posix.Files.Common is wrong

#8859: import conditionalization in System.Posix.Files.Common is wrong ------------------------------------+--------------------------------- Reporter: rwbarton | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: libraries/unix | Version: 7.8.1-rc2 Keywords: | Operating System: Other Architecture: Unknown/Multiple | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+--------------------------------- `System/Posix/Files/Common.hsc` imports `Data.Int` and `Data.Ratio` conditionally, to avoid "unused import" compiler warnings: {{{ #if defined(HAVE_STRUCT_STAT_ST_CTIM) || \ defined(HAVE_STRUCT_STAT_ST_MTIM) || \ defined(HAVE_STRUCT_STAT_ST_ATIM) || \ defined(HAVE_STRUCT_STAT_ST_ATIMESPEC) || \ defined(HAVE_STRUCT_STAT_ST_MTIMESPEC) || \ defined(HAVE_STRUCT_STAT_ST_CTIMESPEC) import Data.Int import Data.Ratio #endif }}} but those modules are actually used in functions like {{{ accessTimeHiRes (FileStatus stat) = unsafePerformIO $ withForeignPtr stat $ \stat_ptr -> do sec <- (#peek struct stat, st_atime) stat_ptr :: IO EpochTime #ifdef HAVE_STRUCT_STAT_ST_ATIM nsec <- (#peek struct stat, st_atim.tv_nsec) stat_ptr :: IO (#type long) let frac = toInteger nsec % 10^(9::Int) #elif HAVE_STRUCT_STAT_ST_ATIMESPEC nsec <- (#peek struct stat, st_atimespec.tv_nsec) stat_ptr :: IO (#type long) let frac = toInteger nsec % 10^(9::Int) #elif HAVE_STRUCT_STAT_ST_ATIMENSEC nsec <- (#peek struct stat, st_atimensec) stat_ptr :: IO (#type long) let frac = toInteger nsec % 10^(9::Int) #elif HAVE_STRUCT_STAT_ST_ATIME_N nsec <- (#peek struct stat, st_atime_n) stat_ptr :: IO (#type int) let frac = toInteger nsec % 10^(9::Int) #elif HAVE_STRUCT_STAT_ST_UATIME usec <- (#peek struct stat, st_uatime) stat_ptr :: IO (#type int) let frac = toInteger usec % 10^(6::Int) #else let frac = 0 #endif return $ fromRational $ toRational sec + frac }}} so there should be additional tests for `defined(HAVE_STRUCT_STAT_ST_ATIMENSEC)`, `defined(HAVE_STRUCT_STAT_ST_ATIME_N)`, ... (15 total). Or, maybe there's a better alternative, since this is very long-winded and fragile... This breaks the build on Android, which has `st_atimensec`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8859 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8859: import conditionalization in System.Posix.Files.Common is wrong -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: ekmett Type: bug | Status: new Priority: normal | Milestone: Component: Core Libraries | Version: 7.8.1-rc2 Resolution: | Keywords: Operating System: Other | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by ekmett): * cc: core-libraries-committee@… (added) Comment: Passed upstream as https://github.com/haskell/unix/issues/36 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8859#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8859: import conditionalization in System.Posix.Files.Common is wrong -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: hvr Type: bug | Status: new Priority: normal | Milestone: 8.0.1 Component: Core Libraries | Version: 7.8.1-rc2 Resolution: | Keywords: Operating System: Other | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by hvr): * owner: => hvr * cc: ekmett (added) * milestone: => 8.0.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8859#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8859: import conditionalization in System.Posix.Files.Common is wrong -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: hvr Type: bug | Status: closed Priority: normal | Milestone: 8.0.1 Component: Core Libraries | Version: 7.8.1-rc2 Resolution: fixed | Keywords: Operating System: Other | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * status: new => closed * resolution: => fixed Comment: hvr fixed this in https://github.com/haskell/unix/commit/03632e32eb1d2e8f5d41ddc0f81bc6eff6a34... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8859#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC