diff options
author | Ben Gamari <ben@smart-cactus.org> | 2020-03-11 15:25:25 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2020-03-12 13:26:39 -0400 |
commit | 386eee1edaef8d19e9988cade1c53d05d45f6e9b (patch) | |
tree | 46c07cfa584e736cc82fbda2a95c48b95b0f6805 | |
parent | 3aa9b35fcc417ab39d8da633482fe64dc9f898b1 (diff) | |
download | haskell-wip/T17912.tar.gz |
base: Make `open` calls interruptiblewip/T17912
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.
-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 |