[Git][ghc/ghc][master] JS: fix object file name comparison (#22578)

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Wed Dec 14 03:20:58 UTC 2022



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
8b1f1b45 by Sylvain Henry at 2022-12-13T22:20:28-05:00
JS: fix object file name comparison (#22578)

- - - - -


1 changed file:

- compiler/GHC/Driver/Pipeline/Execute.hs


Changes:

=====================================
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
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8b1f1b4503b810c40d37af797f1c7c566250c3d0

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8b1f1b4503b810c40d37af797f1c7c566250c3d0
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20221213/20a06210/attachment.html>


More information about the ghc-commits mailing list