Hello community,

here is the log from the commit of package ghc-filelock for openSUSE:Factory 
checked in at 2019-05-12 11:35:13
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-filelock (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-filelock.new.5148 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-filelock"

Sun May 12 11:35:13 2019 rev:6 rq:701765 version:0.1.1.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-filelock/ghc-filelock.changes        
2018-10-25 08:25:32.443824241 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-filelock.new.5148/ghc-filelock.changes      
2019-05-12 11:35:18.230204547 +0200
@@ -1,0 +2,6 @@
+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.3.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-filelock.spec ++++++
--- /var/tmp/diff_new_pack.vOADe2/_old  2019-05-12 11:35:19.738208961 +0200
+++ /var/tmp/diff_new_pack.vOADe2/_new  2019-05-12 11:35:19.738208961 +0200
@@ -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,7 +19,7 @@
 %global pkg_name filelock
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        0.1.1.2
+Version:        0.1.1.3
 Release:        0
 Summary:        Portable interface to file locking (flock / LockFileEx)
 License:        CC0-1.0

++++++ filelock-0.1.1.2.tar.gz -> filelock-0.1.1.3.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.3/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.3/System/FileLock/Internal/Flock.hsc     2001-09-09 
03:46:40.000000000 +0200
@@ -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,17 @@
 unlock fd = closeFd fd
 
 open :: FilePath -> IO Fd
-open path = openFd path WriteOnly (Just stdFileMode) defaultFileFlags
+open path = do
+  fd <- openFd path WriteOnly (Just stdFileMode) defaultFileFlags
+  -- 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.3/filelock.cabal
--- old/filelock-0.1.1.2/filelock.cabal 2017-08-04 18:15:50.000000000 +0200
+++ new/filelock-0.1.1.3/filelock.cabal 2001-09-09 03:46:40.000000000 +0200
@@ -2,7 +2,7 @@
 -- documentation, see http://haskell.org/cabal/users-guide/
 
 name:                filelock
-version:             0.1.1.2
+version:             0.1.1.3
 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.3/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.3/tests/lock.log.expected        2001-09-09 
03:46:40.000000000 +0200
@@ -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.3/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.3/tests/test.hs  2001-09-09 03:46:40.000000000 +0200
@@ -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"
 


Reply via email to