Hello community, here is the log from the commit of package ghc-filelock for openSUSE:Leap:15.2 checked in at 2020-02-19 18:39:01 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Leap:15.2/ghc-filelock (Old) and /work/SRC/openSUSE:Leap:15.2/.ghc-filelock.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-filelock" Wed Feb 19 18:39:01 2020 rev:11 rq:771310 version:0.1.1.4 Changes: -------- --- /work/SRC/openSUSE:Leap:15.2/ghc-filelock/ghc-filelock.changes 2020-01-15 15:02:02.509798104 +0100 +++ /work/SRC/openSUSE:Leap:15.2/.ghc-filelock.new.26092/ghc-filelock.changes 2020-02-19 18:39:03.082023476 +0100 @@ -1,0 +2,17 @@ +Fri Nov 22 03:02:44 UTC 2019 - [email protected] + +- Update filelock to version 0.1.1.4. + Upstream does not provide a change log file. + +------------------------------------------------------------------- +Fri Nov 8 16:13:45 UTC 2019 - Peter Simons <[email protected]> + +- Drop obsolete group attributes. + +------------------------------------------------------------------- +Fri May 3 02:03:04 UTC 2019 - [email protected] + +- Update filelock to version 0.1.1.3. + Upstream does not provide a change log file. + +------------------------------------------------------------------- Old: ---- filelock-0.1.1.2.tar.gz New: ---- filelock-0.1.1.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-filelock.spec ++++++ --- /var/tmp/diff_new_pack.MTowqZ/_old 2020-02-19 18:39:03.338024011 +0100 +++ /var/tmp/diff_new_pack.MTowqZ/_new 2020-02-19 18:39:03.342024020 +0100 @@ -1,7 +1,7 @@ # # spec file for package ghc-filelock # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,11 +19,10 @@ %global pkg_name filelock %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.1.1.2 +Version: 0.1.1.4 Release: 0 Summary: Portable interface to file locking (flock / LockFileEx) License: CC0-1.0 -Group: Development/Libraries/Haskell URL: https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz BuildRequires: ghc-Cabal-devel @@ -40,7 +39,6 @@ %package devel Summary: Haskell %{pkg_name} library development files -Group: Development/Libraries/Haskell Requires: %{name} = %{version}-%{release} Requires: ghc-compiler = %{ghc_version} Requires(post): ghc-compiler = %{ghc_version} ++++++ filelock-0.1.1.2.tar.gz -> filelock-0.1.1.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/filelock-0.1.1.2/System/FileLock/Internal/Flock.hsc new/filelock-0.1.1.4/System/FileLock/Internal/Flock.hsc --- old/filelock-0.1.1.2/System/FileLock/Internal/Flock.hsc 2017-08-04 13:03:57.000000000 +0200 +++ new/filelock-0.1.1.4/System/FileLock/Internal/Flock.hsc 1970-01-01 01:00:00.000000000 +0100 @@ -12,7 +12,7 @@ import Foreign.C.Error import Foreign.C.Types import System.Posix.Files -import System.Posix.IO (openFd, closeFd, defaultFileFlags, OpenMode(..)) +import System.Posix.IO (openFd, closeFd, defaultFileFlags, OpenMode(..), setFdOption, FdOption(..)) import System.Posix.Types import Prelude @@ -38,7 +38,21 @@ unlock fd = closeFd fd open :: FilePath -> IO Fd -open path = openFd path WriteOnly (Just stdFileMode) defaultFileFlags +open path = do +#if MIN_VERSION_unix(2,8,0) + fd <- openFd path WriteOnly defaultFileFlags +#else + fd <- openFd path WriteOnly (Just stdFileMode) defaultFileFlags +#endif + -- Ideally, we would open the file descriptor with CLOEXEC enabled, but since + -- unix 2.8 hasn't been released yet and we want backwards compatibility with + -- older releases, we set CLOEXEC after opening the file descriptor. This + -- may seem like a race condition at first. However, since the lock is always + -- taken after CLOEXEC is set, the worst that can happen is that a child + -- process inherits the open FD in an unlocked state. While non-ideal from a + -- performance standpoint, it doesn't introduce any locking bugs. + setFdOption fd CloseOnExec True + return fd flock :: Fd -> Bool -> Bool -> IO Bool flock (Fd fd) exclusive block = do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/filelock-0.1.1.2/filelock.cabal new/filelock-0.1.1.4/filelock.cabal --- old/filelock-0.1.1.2/filelock.cabal 2017-08-04 18:15:50.000000000 +0200 +++ new/filelock-0.1.1.4/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.2 +version: 0.1.1.4 synopsis: Portable interface to file locking (flock / LockFileEx) description: This package provides an interface to Windows and Unix file locking functionalities. @@ -39,6 +39,10 @@ type: exitcode-stdio-1.0 hs-source-dirs: tests main-is: test.hs - build-depends: filelock, process, async, base + build-depends: filelock, process >= 1.2.1.0, async, base ghc-options: -threaded default-language: Haskell2010 + +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.2/tests/lock.log.expected new/filelock-0.1.1.4/tests/lock.log.expected --- old/filelock-0.1.1.2/tests/lock.log.expected 2017-08-04 13:03:57.000000000 +0200 +++ new/filelock-0.1.1.4/tests/lock.log.expected 1970-01-01 01:00:00.000000000 +0100 @@ -1,12 +1,12 @@ took shared lock took shared lock +releasing shared lock lock not available took shared lock -released shared lock -released shared lock -released shared lock +releasing shared lock +releasing shared lock took exclusive lock -released exclusive lock +releasing exclusive lock took shared lock -released shared lock +releasing shared lock lock was available diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/filelock-0.1.1.2/tests/test.hs new/filelock-0.1.1.4/tests/test.hs --- old/filelock-0.1.1.2/tests/test.hs 2017-08-04 13:03:57.000000000 +0200 +++ new/filelock-0.1.1.4/tests/test.hs 1970-01-01 01:00:00.000000000 +0100 @@ -3,6 +3,7 @@ import Control.Monad import Control.Concurrent import Control.Concurrent.Async +import Data.Maybe import System.Environment import System.Exit import System.Process @@ -28,19 +29,23 @@ _ -> do withFile "lock.log" WriteMode $ \h -> void $ mapConcurrently id - [ callSelf h ["shared", "300"] - , callSelf h ["shared", "200"] - , msleep 10 >> callSelf h ["exclusive", "500"] - , msleep 20 >> callSelf h ["try"] - , msleep 50 >> callSelf h ["shared", "500"] - , msleep 700 >> callSelf h ["shared", "10"] - , msleep 1500 >> callSelf h ["try"] + [ callSelf h ["shared", "5"] + , callSelf h ["shared", "2"] + , sleep 1 >> callSelf h ["exclusive", "3"] + , sleep 3 >> callSelf h ["try"] + , sleep 4 >> callSelf h ["shared", "1"] + , sleep 6 >> callSelf h ["shared", "1"] + , sleep 10 >> callSelf h ["try"] ] - msleep 2000 + sleep 11 log <- readFile "lock.log" expected <- readFile "tests/lock.log.expected" when (log /= expected) $ do putStrLn "log mismatch!" + putStrLn "log:" + putStrLn log + putStrLn "expected:" + putStrLn expected exitFailure callSelf :: Handle -> [String] -> IO () @@ -51,15 +56,15 @@ ExitSuccess <- waitForProcess ph return () -msleep :: Int -> IO () -msleep = threadDelay . (*1000) +sleep :: Int -> IO () +sleep = threadDelay . (*1000000) holdLock :: String -> SharedExclusive -> Int -> IO () holdLock ty sex duration = do withFileLock lockfile sex $ \_ -> do putStrLn $ "took " ++ desc - msleep duration - putStrLn $ "released " ++ desc + sleep duration + putStrLn $ "releasing " ++ desc where desc = ty ++ " lock" @@ -76,10 +81,9 @@ tryHoldLock ty sex duration = do res <- withTryFileLock lockfile sex $ \_ -> do putStrLn $ "took " ++ desc - msleep duration - case res of - Nothing -> putStrLn "lock not available" - Just _ -> putStrLn $ "released " ++ desc + sleep duration + putStrLn $ "released " ++ desc + when (isNothing res) $ putStrLn "lock not available" where desc = ty ++ " lock"
