dev-vcs/pre-commit: allow the tests to use the 'file' transport

Needed for the test suite to work against git versions including the fix
for CVE-2022-39253. Should be harmless enough even if upstream gets
compromised and publishes a tarball containing malicious symlinks,
unless someone makes a serious effort to grant Portage a lot of
unnecessary privileges.

Closes: https://bugs.gentoo.org/878781
Signed-off-by: Marek Szuba <marecki@gentoo.org>
This commit is contained in:
Marek Szuba
2022-11-13 22:26:10 +00:00
parent 379cfb3eb5
commit 96238e309d
2 changed files with 45 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
--- a/tests/commands/install_uninstall_test.py
+++ b/tests/commands/install_uninstall_test.py
@@ -176,7 +176,7 @@
def test_install_in_submodule_and_run(tempdir_factory, store):
src_path = make_consuming_repo(tempdir_factory, 'script_hooks_repo')
parent_path = git_dir(tempdir_factory)
- cmd_output('git', 'submodule', 'add', src_path, 'sub', cwd=parent_path)
+ cmd_output('git', '-c', 'protocol.file.allow=always', 'submodule', 'add', src_path, 'sub', cwd=parent_path)
git_commit(cwd=parent_path)
sub_pth = os.path.join(parent_path, 'sub')
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -90,7 +90,7 @@
git_dir_1 = git_dir(tempdir_factory)
git_dir_2 = git_dir(tempdir_factory)
git_commit(msg=in_conflicting_submodule.__name__, cwd=git_dir_2)
- cmd_output('git', 'submodule', 'add', git_dir_2, 'sub', cwd=git_dir_1)
+ cmd_output('git', '-c', 'protocol.file.allow=always', 'submodule', 'add', git_dir_2, 'sub', cwd=git_dir_1)
with cwd(os.path.join(git_dir_1, 'sub')):
_make_conflict()
yield
--- a/tests/repository_test.py
+++ b/tests/repository_test.py
@@ -443,7 +443,7 @@
repo.join('main.go').write(main_go)
cmd_output('git', '-C', str(repo), 'init', '.')
cmd_output('git', '-C', str(repo), 'add', '.')
- cmd_output('git', '-C', str(repo), 'submodule', 'add', str(sub), 'sub')
+ cmd_output('git', '-C', str(repo), '-c', 'protocol.file.allow=always', 'submodule', 'add', str(sub), 'sub')
git.commit(str(repo))
config = make_config_from_repo(str(repo))
--- a/tests/staged_files_only_test.py
+++ b/tests/staged_files_only_test.py
@@ -207,7 +207,7 @@
cmd_output('git', 'add', 'bar')
git_commit()
cmd_output(
- 'git', 'submodule', 'add', repo_with_commits.path, 'sub',
+ 'git', '-c', 'protocol.file.allow=always', 'submodule', 'add', repo_with_commits.path, 'sub',
)
checkout_submodule(repo_with_commits.rev1)
cmd_output('git', 'add', 'sub')

View File

@@ -35,6 +35,7 @@ BDEPEND="test? (
PATCHES=(
"${FILESDIR}"/${PN}-2.20.0-no_toml.patch
"${FILESDIR}"/${PN}-2.20.0-tests_git_file_transport.patch
)
DOCS=( CHANGELOG.md CONTRIBUTING.md README.md )