Skip to content
Snippets Groups Projects
Commit 7564b6a7 authored by Zubin's avatar Zubin Committed by Zubin
Browse files

hadrian: Handle broken symlinks properly when creating source dist directories

If we have a broken symlink in the repository, don't try to `need` the symlink
or the target of the symlink. Attempting to do so has `shake` attempt to read the
target to compute its hash, which fails because the target doesn't exist.

(cherry picked from commit 8b402da2)
parent b2c53e75
No related branches found
No related tags found
No related merge requests found
......@@ -74,7 +74,9 @@ copyFileSourceDist source target = do
error ("source-dist: tried to create non-relative symlink in source dist: " ++ show link_target)
putProgressInfo =<< renderAction ("Create symlink (" ++ link_target ++ ")") source target
isDirectory <- liftIO $ IO.doesDirectoryExist source
when (not isDirectory) $
-- We don't want to call `need` on broken symlinks
linkTargetExists <- liftIO $ IO.doesPathExist link_target
when (not isDirectory && linkTargetExists) $
need [source]
let createLink src tgt
| isDirectory = liftIO $ IO.createDirectoryLink src tgt
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment