nar: throw error if there are collisions during unpacking

This commit is contained in:
Sander 2024-10-04 18:26:21 +04:00
parent d35aa18e34
commit 67ea0d05b6
No known key found for this signature in database
GPG Key ID: D1A763BC84F34603

View File

@ -99,7 +99,10 @@ streamNarIOWithOptions opts effs basePath yield = do
if Nar.optUseCaseHack opts
then undoCaseHack f
else f
in Map.insert name f acc
in
case Map.insertLookupWithKey (\_ n _ -> n) name f acc of
(Nothing, newMap) -> newMap
(Just conflict, _) -> error $ "File name collision between " ++ (path </> name) ++ " and " ++ (path </> conflict)
) Map.empty fs
yield $ strs ["type", "directory"]
forM_ (Map.toAscList entries) $ \(unhacked, original) -> do