[Git][ghc/ghc][master] 3 commits: hadrian: Handle broken symlinks properly when creating source dist directories

Zubin (@wz1000) gitlab at gitlab.haskell.org
Sun Oct 13 11:30:31 UTC 2024



Zubin pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
8b402da2 by Zubin Duggal at 2024-10-12T20:36:57+00:00
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.

- - - - -
16f97667 by Zubin Duggal at 2024-10-12T20:36:57+00:00
hadrian: exclude cabal.project.symlink.broken from source archives

Cabal 3.14 introduced a broken symlink in its testsuite. Unfortunately,
this broke our source distribution as we use use `tar --dereference` to avoid
issues with symlink compatibility on windows, and `tar --dereference` chokes
when it encounters any broken symlinks.

We can't get rid of `--dereference` because symlinks are generally broken on
windows, so the only option is to exclude this file from source archives.

see also https://github.com/haskell/cabal/issues/10442

- - - - -
f1a2c9fc by Zubin Duggal at 2024-10-12T20:36:57+00:00
Bump Cabal submodule to 3.14

Metric Decrease:
    MultiLayerModulesTH_OneShot
Metric Increase:
    haddock.Cabal

- - - - -


4 changed files:

- hadrian/src/Rules/SourceDist.hs
- libraries/Cabal
- testsuite/tests/driver/T4437.hs
- utils/haddock/haddock-test/src/Test/Haddock/Config.hs


Changes:

=====================================
hadrian/src/Rules/SourceDist.hs
=====================================
@@ -55,8 +55,9 @@ archiveSourceTree prepare fname = do
   runBuilderWithCmdOptions
       [Cwd $ sourceDistRoot -/- dirName]
       (Tar Create)
-      ["chJf", ".." -/- tarName,  baseName]
-      ["chJf", ".." -/- tarName] [baseName]
+      -- See https://github.com/haskell/cabal/issues/10442 for why we exclude this file.
+      ["--exclude=cabal.project.symlink.broken","-chJf", ".." -/- tarName,  baseName]
+      ["--exclude=cabal.project.symlink.broken","-chJf", ".." -/- tarName] [baseName]
 
 
 -- | This creates a symlink to the 'source' at 'target'
@@ -74,7 +75,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


=====================================
libraries/Cabal
=====================================
@@ -1 +1 @@
-Subproject commit 56fb1dc9baa20b079eb0fa84ccafb284a6e91d41
+Subproject commit 2a48e40fdf320caa4240ce8eb28841e31f4f3de3


=====================================
testsuite/tests/driver/T4437.hs
=====================================
@@ -36,11 +36,7 @@ check title expected got
 
 -- See Note [Adding a language extension] in compiler/GHC/Driver/Session.hs.
 expectedGhcOnlyExtensions :: [String]
-expectedGhcOnlyExtensions =
-    [ "OrPatterns"
-    , "NamedDefaults"
-    , "MultilineStrings"
-    ]
+expectedGhcOnlyExtensions = [ ]
 
 expectedCabalOnlyExtensions :: [String]
 expectedCabalOnlyExtensions = ["Generics",


=====================================
utils/haddock/haddock-test/src/Test/Haddock/Config.hs
=====================================
@@ -18,7 +18,7 @@ import Data.Maybe
 import Distribution.Text
 import Distribution.Types.PackageName
 import Distribution.InstalledPackageInfo
-import Distribution.Simple.Compiler (PackageDB(..))
+import Distribution.Simple.Compiler (PackageDB(..), PackageDBX( GlobalPackageDB ))
 import Distribution.Simple.GHC
 import Distribution.Simple.PackageIndex
 import Distribution.Simple.Program
@@ -257,7 +257,7 @@ baseDependencies ghcPath = do
 
     (comp, _, cfg) <- configure normal (Just ghcPath) Nothing
         defaultProgramDb
-    pkgIndex <- getInstalledPackages normal comp [GlobalPackageDB] cfg
+    pkgIndex <- getInstalledPackages normal comp Nothing [GlobalPackageDB] cfg
     let
       pkgs =
         [ "array"



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c08b68bc7ab947843d20621eb483a0fc3c42703a...f1a2c9fc140baa0aaeda00c02648aa75deb59723

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c08b68bc7ab947843d20621eb483a0fc3c42703a...f1a2c9fc140baa0aaeda00c02648aa75deb59723
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/20241013/203b87ff/attachment-0001.html>


More information about the ghc-commits mailing list