diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-07-27 07:38:11 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-07-27 07:46:08 -0400 |
commit | 2cb464a0e641254aa28a788587b089022922577a (patch) | |
tree | f44742a774b22139e6590a545cb70bb3f18287c0 /Annex | |
parent | 13295d61d5c8aad8761b7ea54f741e498ffdf872 (diff) |
When built with ut uid-1.3.12, generate more random UUIDs than before
Use nextRandom to generate the random UUID, rather than using randomIO.
This gets fixes for the following two bugs in the uuid library.
However, this did not impact git-annex much, so a hard depedency has
not been added on uuid-1.3.12.
https://github.com/aslatter/uuid/issues/15
"v4 UUIDs are not that random"
This doesn't greatly affect git-annex, because even with only
2^64 possible UUIDs, the chance that two git-annex repositories
that are clones of the same git repo get the same UUID is miniscule.
And, git-annex generates only one UUID per run, so preducting
subsequent UUIDs is not a problem.
https://github.com/aslatter/uuid/issues/16
"Remove Random instance for UUID, or mark it as deprecated"
git-annex was using that instance; let's stop before it gets
deprecated or removed.
Diffstat (limited to 'Annex')
-rw-r--r-- | Annex/UUID.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Annex/UUID.hs b/Annex/UUID.hs index 1e80d6fe1..0e87cda59 100644 --- a/Annex/UUID.hs +++ b/Annex/UUID.hs @@ -35,8 +35,8 @@ import qualified Git.Config import Config import qualified Data.UUID as U +import qualified Data.UUID.V4 as U4 import qualified Data.UUID.V5 as U5 -import System.Random import Data.Bits.Utils configkey :: ConfigKey @@ -44,7 +44,7 @@ configkey = annexConfig "uuid" {- Generates a random UUID, that does not include the MAC address. -} genUUID :: IO UUID -genUUID = UUID . show <$> (randomIO :: IO U.UUID) +genUUID = UUID . show <$> U4.nextRandom {- Generates a UUID from a given string, using a namespace. - Given the same namespace, the same string will always result |