File fix-git-transport-file-not-allowed.patch of Package python3-check-manifest

From: Antonio Larrosa <alarrosa@suse.com>
Subject: Fix tests with new git version

Due to CVE-2022-39253, git now doesn't allow the file transport
by default, which results in the following error when running
the tests:

[   20s] ======================================================================
[   20s] ERROR: test_get_versioned_files_with_git_submodules (tests.TestGit)
[   20s] ----------------------------------------------------------------------
[   20s] Traceback (most recent call last):
[   20s]   File "/home/abuild/rpmbuild/BUILD/check-manifest-0.37/tests.py", line 1004, in test_get_versioned_files_with_git_submodules
[   20s]     self._add_submodule('repo2', 'sub3', '../repo3')
[   20s]   File "/home/abuild/rpmbuild/BUILD/check-manifest-0.37/tests.py", line 984, in _add_submodule
[   20s]     self.vcs._run('git', 'submodule', 'add', subrepo, subdir)
[   20s]   File "/home/abuild/rpmbuild/BUILD/check-manifest-0.37/tests.py", line 854, in _run
[   20s]     raise subprocess.CalledProcessError(rc, command[0], output=stdout)
[   20s] subprocess.CalledProcessError: Command 'git' returned non-zero exit status 128.
[   20s] 
[   20s] ----------------------------------------------------------------------
[   20s] Ran 118 tests in 10.261s
[   20s] 
[   20s] FAILED (errors=1, skipped=20)
[   20s] Test failed: <unittest.runner.TextTestResult run=118 errors=1 failures=0>
[   20s] git submodule add ../repo3 sub3
[   20s] b"Cloning into '/tmp/test-mt2r5y7f-check-manifest/repo2/sub3'...\nfatal: transport 'file' not allowed\nfatal: clone of '/tmp/test-mt2r5y7f-check-manifest/repo3' into submodule path '/tmp/test-mt2r5y7f-check-manifest/repo2/sub3' failed\n"
[   20s] error: Test failed: <unittest.runner.TextTestResult run=118 errors=1 failures=0>
[   20s] error: Bad exit status from /var/tmp/rpm-tmp.M1F2eB (%check)


Index: check-manifest-0.37/tests.py
===================================================================
--- check-manifest-0.37.orig/tests.py
+++ check-manifest-0.37/tests.py
@@ -980,7 +980,7 @@ class TestGit(VCSMixin, unittest.TestCas
 
     def _add_submodule(self, repo, subdir, subrepo):
         os.chdir(repo)
-        self.vcs._run('git', 'submodule', 'add', subrepo, subdir)
+        self.vcs._run('git', '-c', 'protocol.file.allow=always', 'submodule', 'add', subrepo, subdir)
         self._commit()
         os.chdir(self.tmpdir)
 
@@ -1005,7 +1005,7 @@ class TestGit(VCSMixin, unittest.TestCas
         self._add_submodule('main', 'sub1', '../repo1')
         self._add_submodule('main', 'subdir/sub2', '../repo2')
         os.chdir('main')
-        self.vcs._run('git', 'submodule', 'update', '--init', '--recursive')
+        self.vcs._run('git', '-c', 'protocol.file.allow=always', 'submodule', 'update', '--init', '--recursive')
         self.assertEqual(
             get_vcs_files(),
             [fn.replace('/', os.path.sep) for fn in [
openSUSE Build Service is sponsored by