Skip to content

Commit

Permalink
Change moreRecentFile test to workaround races
Browse files Browse the repository at this point in the history
This changes `moreRecentFile a b` to return true not only when `a`
is younger than `b`, but also when `a` is exactly the same age of `b`, as
that case is subject to race-conditions, and it's better to err on assuming
it needs to be regenerated.

This is an attempt to provide a pragmatic workaround for #2311
  • Loading branch information
hvr committed Jan 14, 2015
1 parent afa460a commit 6016771
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Cabal/Distribution/Simple/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ moreRecentFile a b = do
then return True
else do tb <- getModificationTime b
ta <- getModificationTime a
return (ta > tb)
return (ta >= tb)

-- | Like 'moreRecentFile', but also checks that the first file exists.
existsAndIsMoreRecentThan :: FilePath -> FilePath -> IO Bool
Expand Down

0 comments on commit 6016771

Please sign in to comment.