Skip to content

Commit b09b118

Browse files
authored
Merge pull request #10329 from 9999years/cabal-git
Fix `cabal-install:long-tests` with Git >=2.38.1
2 parents 64f8254 + 51e448d commit b09b118

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

.github/workflows/validate.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,6 @@ jobs:
133133
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }}
134134
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
135135

136-
- name: "Work around git problem https://bugs.launchpad.net/ubuntu/+source/git/+bug/1993586 (cabal PR #8546)"
137-
run: git config --global protocol.file.allow always
138-
139136
# The tool is not essential to the rest of the test suite. If
140137
# hackage-repo-tool is not present, any test that requires it will
141138
# be skipped.

cabal-install/tests/UnitTests/Distribution/Client/VCS.hs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ vcsTestDriverGit
847847
-> VCSTestDriver
848848
vcsTestDriverGit verbosity vcs submoduleDir repoRoot =
849849
VCSTestDriver
850-
{ vcsVCS = vcs
850+
{ vcsVCS = vcs'
851851
, vcsRepoRoot = repoRoot
852852
, vcsIgnoreFiles = Set.empty
853853
, vcsInit =
@@ -872,7 +872,7 @@ vcsTestDriverGit verbosity vcs submoduleDir repoRoot =
872872
, vcsTagState = \_ tagname ->
873873
git ["tag", "--force", "--no-sign", tagname]
874874
, vcsSubmoduleDriver =
875-
pure . vcsTestDriverGit verbosity vcs submoduleDir . (submoduleDir </>)
875+
pure . vcsTestDriverGit verbosity vcs' submoduleDir . (submoduleDir </>)
876876
, vcsAddSubmodule = \_ source dest -> do
877877
destExists <-
878878
(||)
@@ -897,8 +897,26 @@ vcsTestDriverGit verbosity vcs submoduleDir repoRoot =
897897
updateSubmodulesAndCleanup
898898
}
899899
where
900+
-- Git 2.38.1 and newer fails to clone from local paths with `fatal: transport 'file'
901+
-- not allowed` unless `protocol.file.allow=always` is set.
902+
--
903+
-- This is not safe in general, but it's fine in the test suite.
904+
--
905+
-- See: https://github.blog/open-source/git/git-security-vulnerabilities-announced/#fn-67904-1
906+
-- See: https://git-scm.com/docs/git-config#Documentation/git-config.txt-protocolallow
907+
vcs' =
908+
vcs
909+
{ vcsProgram =
910+
(vcsProgram vcs)
911+
{ programDefaultArgs =
912+
programDefaultArgs (vcsProgram vcs)
913+
++ [ "-c"
914+
, "protocol.file.allow=always"
915+
]
916+
}
917+
}
900918
gitInvocation args =
901-
(programInvocation (vcsProgram vcs) args)
919+
(programInvocation (vcsProgram vcs') args)
902920
{ progInvokeCwd = Just repoRoot
903921
}
904922
git = runProgramInvocation verbosity . gitInvocation

0 commit comments

Comments
 (0)