diff options
author | Ben Gamari <ben@smart-cactus.org> | 2020-03-11 15:25:25 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-03-14 05:31:42 -0400 |
commit | 93c88c266eacd80a7f2a1754778167390c287b18 (patch) | |
tree | d726c9cc757b61a18d14d3539e5d958c3b599ae0 /libraries | |
parent | 73133a3b601b76c46098fb8ad3c76de5fe04c9b2 (diff) | |
download | haskell-93c88c266eacd80a7f2a1754778167390c287b18.tar.gz |
base: Make `open` calls interruptible
As noted in #17912, `open` system calls were `safe` rather than
`interruptible`. Consequently, the program could not be interrupted with
SIGINT if stuck in a slow open operation. Fix this by marking
`c_safe_open` as interruptible.
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/base/System/Posix/Internals.hs | 4 | ||||
-rw-r--r-- | libraries/base/changelog.md | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/libraries/base/System/Posix/Internals.hs b/libraries/base/System/Posix/Internals.hs index 15a02ff1e1..ea8ddf2173 100644 --- a/libraries/base/System/Posix/Internals.hs +++ b/libraries/base/System/Posix/Internals.hs @@ -1,4 +1,5 @@ {-# LANGUAGE Trustworthy #-} +{-# LANGUAGE InterruptibleFFI #-} {-# LANGUAGE CPP, NoImplicitPrelude, CApiFFI #-} {-# OPTIONS_HADDOCK not-home #-} @@ -355,7 +356,8 @@ type CFilePath = CWString foreign import ccall unsafe "HsBase.h __hscore_open" c_open :: CFilePath -> CInt -> CMode -> IO CInt -foreign import ccall safe "HsBase.h __hscore_open" +-- e.g. use `interruptible` rather than `safe` due to #17912. +foreign import ccall interruptible "HsBase.h __hscore_open" c_safe_open :: CFilePath -> CInt -> CMode -> IO CInt foreign import ccall unsafe "HsBase.h __hscore_fstat" diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index 026de1df82..e667b3fef9 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -1,7 +1,10 @@ # Changelog for [`base` package](http://hackage.haskell.org/package/base) ## 4.15.0.0 *TBA* - * TODO + + * `openFile` now calls the `open` system call with an `interruptible` FFI + call, ensuring that the call can be interrupted with `SIGINT` on POSIX + systems. ## 4.14.0.0 *TBA* * Bundled with GHC 8.10.1 |