[commit: packages/Cabal] ghc-head: Explain why we use > instead for >= for modification time checks. (859d989)

git at git.haskell.org git at git.haskell.org
Mon Aug 26 23:22:41 CEST 2013


Repository : ssh://git@git.haskell.org/Cabal

On branch  : ghc-head
Link       : http://git.haskell.org/?p=packages/Cabal.git;a=commit;h=859d989502d23c6ee03b647a1b1efcb8e1d4001f

>---------------------------------------------------------------

commit 859d989502d23c6ee03b647a1b1efcb8e1d4001f
Author: Mikhail Glushenkov <the.dead.shall.rise at gmail.com>
Date:   Mon Apr 29 16:48:17 2013 +0200

    Explain why we use > instead for >= for modification time checks.


>---------------------------------------------------------------

859d989502d23c6ee03b647a1b1efcb8e1d4001f
 cabal-install/Distribution/Client/IndexUtils.hs        |    3 ++-
 cabal-install/Distribution/Client/Sandbox/Timestamp.hs |    1 +
 cabal-install/Distribution/Compat/Time.hs              |    4 ++++
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/cabal-install/Distribution/Client/IndexUtils.hs b/cabal-install/Distribution/Client/IndexUtils.hs
index 871a093..f18bdb1 100644
--- a/cabal-install/Distribution/Client/IndexUtils.hs
+++ b/cabal-install/Distribution/Client/IndexUtils.hs
@@ -228,7 +228,8 @@ whenCacheOutOfDate origFile cacheFile action = do
     else do
       origTime  <- getModificationTime origFile
       cacheTime <- getModificationTime cacheFile
-      unless (cacheTime >= origTime) action
+      -- FIXME: Revert back to >= when we'll add finer-resolution mtime utils.
+      unless (cacheTime > origTime) action
 
 
 ------------------------------------------------------------------------
diff --git a/cabal-install/Distribution/Client/Sandbox/Timestamp.hs b/cabal-install/Distribution/Client/Sandbox/Timestamp.hs
index aff044e..dd6dd65 100644
--- a/cabal-install/Distribution/Client/Sandbox/Timestamp.hs
+++ b/cabal-install/Distribution/Client/Sandbox/Timestamp.hs
@@ -267,6 +267,7 @@ isDepModified verbosity now (packageDir, timestamp) = do
       when (modTime > now) $
         warn verbosity $ "File '" ++ dep
                          ++ "' has a modification time that is in the future."
+      -- FIXME: Revert back to >= when we'll add finer-resolution mtime utils.
       if modTime > timestamp
         then do
           debug verbosity ("Dependency has a modified source file: " ++ dep)
diff --git a/cabal-install/Distribution/Compat/Time.hs b/cabal-install/Distribution/Compat/Time.hs
index 0ab9943..63a24c2 100644
--- a/cabal-install/Distribution/Compat/Time.hs
+++ b/cabal-install/Distribution/Compat/Time.hs
@@ -16,6 +16,10 @@ import System.Time (ClockTime(..), getClockTime
 -- | The number of seconds since the UNIX epoch
 type EpochTime = Int64
 
+-- FIXME: 'getModificationTime' has a very low (second-level) resolution in all
+-- released GHCs, which is bad for our purposes.
+-- See hackage.haskell.org/trac/ghc/ticket/7473
+-- We should copy the file modification utils that Shake uses.
 getModTime :: FilePath -> IO EpochTime
 getModTime path =  do
 #if MIN_VERSION_directory(1,2,0)





More information about the ghc-commits mailing list