Commit 93c88c26 authored by Ben Gamari's avatar Ben Gamari 🐢 Committed by Marge Bot

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.
parent 73133a3b
Pipeline #16708 passed with stages
in 568 minutes and 46 seconds
{-# 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"
......
# 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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment