diff options
author | Joey Hess <joey@kitenet.net> | 2014-03-04 23:58:43 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-03-05 00:10:11 -0400 |
commit | 93405153c154b6ecd02f377757fad06b413eb434 (patch) | |
tree | a99dfd8cdb5d9344ad0d576e6841f428dbcd83fc /Types/Key.hs | |
parent | a9db3fe8b44701cf593bac204920bfbf797c1f8d (diff) |
quickcheck says: "a-s--a" is not a legal key filename
Found this in failed armhf build log, where quickcheck found a way to break
prop_idempotent_key_decode. The "s" indicates size, but since nothing comes
after it, that's not valid. When encoding the resulting key, no size was
present, so it encoded to "a--a".
Also, "a-sX--a" is not legal, since X is not a number. Not found by
quickcheck.
Diffstat (limited to 'Types/Key.hs')
-rw-r--r-- | Types/Key.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Types/Key.hs b/Types/Key.hs index 598d5ed20..ea142e4aa 100644 --- a/Types/Key.hs +++ b/Types/Key.hs @@ -78,8 +78,12 @@ file2key s findfields _ v = v addbackend k v = Just k { keyBackendName = v } - addfield 's' k v = Just k { keySize = readish v } - addfield 'm' k v = Just k { keyMtime = readish v } + addfield 's' k v = do + sz <- readish v + return $ k { keySize = Just sz } + addfield 'm' k v = do + mtime <- readish v + return $ k { keyMtime = Just mtime } addfield _ _ _ = Nothing instance Arbitrary Key where |