summaryrefslogtreecommitdiff
path: root/compiler/GHC/Driver/Pipeline/Execute.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2022-12-12 15:13:16 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-12-13 22:20:28 -0500
commit8b1f1b4503b810c40d37af797f1c7c566250c3d0 (patch)
tree50a94e1e6f60e4eabaf799ce0086de8ae427fa44 /compiler/GHC/Driver/Pipeline/Execute.hs
parent9f3011896aa3dc8cc14bd61ccb68ab09e17c330e (diff)
downloadhaskell-8b1f1b4503b810c40d37af797f1c7c566250c3d0.tar.gz
JS: fix object file name comparison (#22578)
Diffstat (limited to 'compiler/GHC/Driver/Pipeline/Execute.hs')
-rw-r--r--compiler/GHC/Driver/Pipeline/Execute.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/GHC/Driver/Pipeline/Execute.hs b/compiler/GHC/Driver/Pipeline/Execute.hs
index 7c8dcaaa88..30bd0531a0 100644
--- a/compiler/GHC/Driver/Pipeline/Execute.hs
+++ b/compiler/GHC/Driver/Pipeline/Execute.hs
@@ -388,7 +388,14 @@ runJsPhase pipe_env hsc_env input_fn = do
-- ensure the timestamp is refreshed, see Note [JS Backend .o file procedure]. If
-- they are not the same then we embed the .js file into a .o file with the
-- addition of a header
- if (input_fn /= output_fn)
+ --
+ -- We need to canonicalize the paths, otherwise the comparison can return
+ -- wrong results (e.g. with Cabal using paths containing "build/./Foo/..."
+ -- that are compared to "build/Foo/...").
+ --
+ cin <- canonicalizePath input_fn
+ cout <- canonicalizePath output_fn
+ if (not (equalFilePath cin cout))
then embedJsFile logger dflags tmpfs unit_env input_fn output_fn
else touchObjectFile logger dflags output_fn