Skip to content

Commit

Permalink
Use normalized path when recursing
Browse files Browse the repository at this point in the history
  • Loading branch information
philderbeast committed Dec 17, 2024
1 parent 69ebe78 commit 120fe42
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions cabal-install/src/Distribution/Client/ProjectConfig/Legacy.hs
Original file line number Diff line number Diff line change
Expand Up @@ -275,19 +275,16 @@ parseProjectSkeleton cacheDir httpTransport verbosity projectDir source (Project
go :: [ParseUtils.Field] -> [ParseUtils.Field] -> IO (ProjectParseResult ProjectConfigSkeleton)
go acc (x : xs) = case x of
(ParseUtils.F _ "import" importLoc) -> do
let importLocPath = importLoc `consProjectConfigPath` source

-- Once we canonicalize the import path, we can check for cyclical imports
normLocPath <- canonicalizeConfigPath projectDir importLocPath

normLocPath <- canonicalizeConfigPath projectDir $ importLoc `consProjectConfigPath` source
debug verbosity $ "\nimport path, normalized\n=======================\n" ++ render (docProjectConfigPath normLocPath)

if isCyclicConfigPath normLocPath
then pure . projectParseFail Nothing (Just source) $ ParseUtils.FromString (render $ cyclicalImportMsg normLocPath) Nothing
else do
normSource <- canonicalizeConfigPath projectDir source
let fs = (\z -> CondNode z [normLocPath] mempty) <$> fieldsToConfig normSource (reverse acc)
res <- parseProjectSkeleton cacheDir httpTransport verbosity projectDir importLocPath . ProjectConfigToParse =<< fetchImportConfig normLocPath
res <- parseProjectSkeleton cacheDir httpTransport verbosity projectDir normLocPath . ProjectConfigToParse =<< fetchImportConfig normLocPath
rest <- go [] xs
pure . fmap mconcat . sequence $ [projectParse Nothing normSource fs, res, rest]
(ParseUtils.Section l "if" p xs') -> do
Expand Down

0 comments on commit 120fe42

Please sign in to comment.