Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cabal-install:long-tests with Git >=2.38.1 #10329

Merged
merged 1 commit into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading