@@ -21,22 +21,24 @@ main = do
2121 samePkgLibDir l1 l2 = pkgDirName l1 == pkgDirName l2
2222 where
2323 pkgDirName p =
24− if countDashes p < 2
24+ if length p < 26 || countDashes p < 2
2525 then error $ p ++ " not in name-version-hash format"
26− else let nv_ = dropEnd 22 p in
27− if last nv_ == '-' then removeDashSegment $ init nv_
28− else error $ p ++ " not in name-version-hash format"
26+ else (removeDashSegment . removeHashSegment) p
2927
3028 countDashes = length . filter (== '-')
3129
3230 removeDashSegment = init . dropWhileEnd (/= '-')
3331
32+ removeHashSegment p = let nv_ = dropEnd 22 p in
33+ if last nv_ == '-' then init nv_
34+ else error $ p ++ " has incorrect hash format"
35+
3436 samePkgDynLib d1 d2 = pkgDynName d1 == pkgDynName d2
3537 where
3638 pkgDynName p =
37− if countDashes p < 3
39+ if length p < 43 || countDashes p < 3
3840 then error $ p ++ " not in libHSname-version-hash-ghc*.so format"
39− else (removeDashSegment . removeDashSegment . removeDashSegment) p
41+ else (removeDashSegment . removeHashSegment . removeDashSegment) p
4042
4143 removeOlder remover files = do
4244 -- keep 2 latest builds