Skip to content

Commit 67ea0d0

Browse files
committed
nar: throw error if there are collisions during unpacking
1 parent d35aa18 commit 67ea0d0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

hnix-store-nar/src/System/Nix/Nar/Streamer.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,10 @@ streamNarIOWithOptions opts effs basePath yield = do
9999
if Nar.optUseCaseHack opts
100100
then undoCaseHack f
101101
else f
102-
in Map.insert name f acc
102+
in
103+
case Map.insertLookupWithKey (\_ n _ -> n) name f acc of
104+
(Nothing, newMap) -> newMap
105+
(Just conflict, _) -> error $ "File name collision between " ++ (path </> name) ++ " and " ++ (path </> conflict)
103106
) Map.empty fs
104107
yield $ strs ["type", "directory"]
105108
forM_ (Map.toAscList entries) $ \(unhacked, original) -> do

0 commit comments

Comments
 (0)