Skip to content

Commit

Permalink
Merge pull request haskell#10329 from 9999years/cabal-git
Browse files Browse the repository at this point in the history
Fix `cabal-install:long-tests` with Git >=2.38.1
  • Loading branch information
mergify[bot] authored Sep 8, 2024
2 parents 64f8254 + 51e448d commit b09b118
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ jobs:
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-

- name: "Work around git problem https://bugs.launchpad.net/ubuntu/+source/git/+bug/1993586 (cabal PR #8546)"
run: git config --global protocol.file.allow always

# The tool is not essential to the rest of the test suite. If
# hackage-repo-tool is not present, any test that requires it will
# be skipped.
Expand Down
24 changes: 21 additions & 3 deletions cabal-install/tests/UnitTests/Distribution/Client/VCS.hs
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ vcsTestDriverGit
-> VCSTestDriver
vcsTestDriverGit verbosity vcs submoduleDir repoRoot =
VCSTestDriver
{ vcsVCS = vcs
{ vcsVCS = vcs'
, vcsRepoRoot = repoRoot
, vcsIgnoreFiles = Set.empty
, vcsInit =
Expand All @@ -872,7 +872,7 @@ vcsTestDriverGit verbosity vcs submoduleDir repoRoot =
, vcsTagState = \_ tagname ->
git ["tag", "--force", "--no-sign", tagname]
, vcsSubmoduleDriver =
pure . vcsTestDriverGit verbosity vcs submoduleDir . (submoduleDir </>)
pure . vcsTestDriverGit verbosity vcs' submoduleDir . (submoduleDir </>)
, vcsAddSubmodule = \_ source dest -> do
destExists <-
(||)
Expand All @@ -897,8 +897,26 @@ vcsTestDriverGit verbosity vcs submoduleDir repoRoot =
updateSubmodulesAndCleanup
}
where
-- Git 2.38.1 and newer fails to clone from local paths with `fatal: transport 'file'
-- not allowed` unless `protocol.file.allow=always` is set.
--
-- This is not safe in general, but it's fine in the test suite.
--
-- See: https://github.blog/open-source/git/git-security-vulnerabilities-announced/#fn-67904-1
-- See: https://git-scm.com/docs/git-config#Documentation/git-config.txt-protocolallow
vcs' =
vcs
{ vcsProgram =
(vcsProgram vcs)
{ programDefaultArgs =
programDefaultArgs (vcsProgram vcs)
++ [ "-c"
, "protocol.file.allow=always"
]
}
}
gitInvocation args =
(programInvocation (vcsProgram vcs) args)
(programInvocation (vcsProgram vcs') args)
{ progInvokeCwd = Just repoRoot
}
git = runProgramInvocation verbosity . gitInvocation
Expand Down

0 comments on commit b09b118

Please sign in to comment.