[Git][ghc/ghc][wip/toolchain-selection] ghc-toolchain: Fix ar supports at file

Rodrigo Mesquita (@alt-romes) gitlab at gitlab.haskell.org
Mon Jun 19 11:07:29 UTC 2023



Rodrigo Mesquita pushed to branch wip/toolchain-selection at Glasgow Haskell Compiler / GHC


Commits:
1435a431 by Rodrigo Mesquita at 2023-06-19T12:07:05+01:00
ghc-toolchain: Fix ar supports at file

- - - - -


1 changed file:

- utils/ghc-toolchain/src/GHC/Toolchain/Tools/Ar.hs


Changes:

=====================================
utils/ghc-toolchain/src/GHC/Toolchain/Tools/Ar.hs
=====================================
@@ -107,15 +107,19 @@ checkArSupportsDashL bareAr = checking "that ar supports -L" $ withTempDir $ \di
 
 checkArSupportsAtFile :: Program -> Program -> M Bool
 checkArSupportsAtFile bareAr mkArchive = checking "that ar supports @-files" $ withTempDir $ \dir -> do
-    let f = dir </> "conftest.file"
+    let conftest = "conftest.file"
+        f = dir </> conftest
         atfile = dir </> "conftest.atfile"
         archive = dir </> "conftest.a"
         objs = replicate 2 f
     createFile f
     writeFile atfile (unlines objs)
-    callProgram mkArchive [archive, "@" ++ dir </> "conftest.atfile"]
+    callProgram mkArchive [archive, "@" ++ atfile]
     contents <- readProgramStdout bareAr ["t", archive]
-    if lines contents == objs
+    -- Careful: The files output by `ar t` use relative paths, so we can't
+    -- compare against `objs`
+    if lines contents == replicate 2 conftest
       then return True
       else logDebug "Contents didn't match" >> return False
 
+



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1435a431a6c39d4078c768b2f79a4fad737ac110

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1435a431a6c39d4078c768b2f79a4fad737ac110
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/20230619/902122a0/attachment-0001.html>


More information about the ghc-commits mailing list