Hello community, here is the log from the commit of package ghc-filelock for openSUSE:Factory checked in at 2020-09-07 21:21:36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-filelock (Old) and /work/SRC/openSUSE:Factory/.ghc-filelock.new.3399 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-filelock" Mon Sep 7 21:21:36 2020 rev:8 rq:831205 version:0.1.1.5 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-filelock/ghc-filelock.changes 2019-12-27 13:53:37.160665576 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-filelock.new.3399/ghc-filelock.changes 2020-09-07 21:21:43.161005094 +0200 @@ -1,0 +2,6 @@ +Tue Sep 1 14:41:19 UTC 2020 - [email protected] + +- Update filelock to version 0.1.1.5. + Upstream does not provide a change log file. + +------------------------------------------------------------------- Old: ---- filelock-0.1.1.4.tar.gz New: ---- filelock-0.1.1.5.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-filelock.spec ++++++ --- /var/tmp/diff_new_pack.PpcG5D/_old 2020-09-07 21:21:45.921006360 +0200 +++ /var/tmp/diff_new_pack.PpcG5D/_new 2020-09-07 21:21:45.925006362 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-filelock # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %global pkg_name filelock %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.1.1.4 +Version: 0.1.1.5 Release: 0 Summary: Portable interface to file locking (flock / LockFileEx) License: CC0-1.0 @@ -48,7 +48,7 @@ This package provides the Haskell %{pkg_name} library development files. %prep -%setup -q -n %{pkg_name}-%{version} +%autosetup -n %{pkg_name}-%{version} %build %ghc_lib_build ++++++ filelock-0.1.1.4.tar.gz -> filelock-0.1.1.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/filelock-0.1.1.4/System/FileLock/Internal/Flock.hsc new/filelock-0.1.1.5/System/FileLock/Internal/Flock.hsc --- old/filelock-0.1.1.4/System/FileLock/Internal/Flock.hsc 1970-01-01 01:00:00.000000000 +0100 +++ new/filelock-0.1.1.5/System/FileLock/Internal/Flock.hsc 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +1,5 @@ +{-# LANGUAGE InterruptibleFFI #-} + module System.FileLock.Internal.Flock #ifndef USE_FLOCK () where @@ -7,6 +9,7 @@ #include <sys/file.h> import Control.Applicative +import Control.Concurrent (yield) import qualified Control.Exception as E import Data.Bits import Foreign.C.Error @@ -64,8 +67,12 @@ case () of _ | errno == eWOULDBLOCK -> return False -- already taken - | errno == eINTR - -> flock (Fd fd) exclusive block + | errno == eINTR -> do + -- If InterruptibleFFI interrupted the syscall with EINTR, + -- we need to give the accompanying Haskell exception a chance to bubble. + -- See also https://gitlab.haskell.org/ghc/ghc/issues/8684#note_142404. + E.interruptible yield + flock (Fd fd) exclusive block | otherwise -> throwErrno "flock" where modeOp = case exclusive of @@ -75,7 +82,9 @@ True -> 0 False -> #{const LOCK_NB} -foreign import ccall "flock" +-- `interruptible` so that async exceptions like `timeout` can stop it +-- when used in blocking mode (without `LOCK_NB`). +foreign import ccall interruptible "flock" c_flock :: CInt -> CInt -> IO CInt #endif /* USE_FLOCK */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/filelock-0.1.1.4/System/FileLock.hs new/filelock-0.1.1.5/System/FileLock.hs --- old/filelock-0.1.1.4/System/FileLock.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/filelock-0.1.1.5/System/FileLock.hs 1970-01-01 01:00:00.000000000 +0100 @@ -20,6 +20,10 @@ -- -- Note on the implementation: currently the module uses flock(2) on non-Windows -- platforms, and LockFileEx on Windows. +-- +-- On non-Windows platforms, @InterruptibleFFI@ is used in the implementation to +-- ensures that blocking lock calls can be correctly interrupted by async +-- exceptions (e.g. functions like `timeout`). This has been tested on Linux. module System.FileLock ( FileLock , SharedExclusive(..) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/filelock-0.1.1.4/filelock.cabal new/filelock-0.1.1.5/filelock.cabal --- old/filelock-0.1.1.4/filelock.cabal 1970-01-01 01:00:00.000000000 +0100 +++ new/filelock-0.1.1.5/filelock.cabal 1970-01-01 01:00:00.000000000 +0100 @@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: filelock -version: 0.1.1.4 +version: 0.1.1.5 synopsis: Portable interface to file locking (flock / LockFileEx) description: This package provides an interface to Windows and Unix file locking functionalities. @@ -17,13 +17,14 @@ -- extra-source-files: cabal-version: >=1.10 extra-source-files: tests/lock.log.expected +tested-with: GHC ==8.4.2 || ==8.6.5 || ==8.8.3 library exposed-modules: System.FileLock other-modules: System.FileLock.Internal.Flock System.FileLock.Internal.LockFileEx -- other-extensions: - build-depends: base >=4.5.1.0 && <5 + build-depends: base >=4.9.0.0 && <5 -- hs-source-dirs: default-language: Haskell2010 @@ -43,6 +44,16 @@ ghc-options: -threaded default-language: Haskell2010 +test-suite interrupt + type: exitcode-stdio-1.0 + hs-source-dirs: tests + main-is: interrupt.hs + build-depends: filelock, process >= 1.2.1.0, async, base + ghc-options: -threaded + default-language: Haskell2010 + if os(windows) + buildable: False + source-repository head type: git location: https://github.com/takano-akio/filelock.git diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/filelock-0.1.1.4/tests/interrupt.hs new/filelock-0.1.1.5/tests/interrupt.hs --- old/filelock-0.1.1.4/tests/interrupt.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/filelock-0.1.1.5/tests/interrupt.hs 1970-01-01 01:00:00.000000000 +0100 @@ -0,0 +1,24 @@ +import Control.Concurrent +import Control.Exception +import Control.Monad +import System.FileLock +import System.Exit +import System.Timeout + +main :: IO () +main = withFileLock lockFilePath Exclusive $ \_ -> do + mvar <- newMVar Nothing + _ <- forkIO $ do + -- The attempt to lock the file again should block, but it should be + -- interrupted by the timeout, returning Nothing. + -- + -- Also masking shouldn't change interruptibility. + r <- timeout 1000000 $ mask $ \_ -> lockFile lockFilePath Exclusive + _ <- swapMVar mvar (Just r) + return () + threadDelay 2000000 + res <- readMVar mvar + when (res /= Just Nothing) $ + die $ "unexpected result: " ++ show (fmap (const ()) <$> res) + where + lockFilePath = "interrupt_test.lock"
