Bypass git submodule test failure on Git >= 2.38.1.

This commit was cherry-picked from Fedora rawhide
<79d75fdcdd?branch=rawhide>.
This fixes the following test failure.

```
  1) Failure:
TestGemSourceGit#test_checkout_submodules [/builddir/build/BUILD/ruby-3.0.4/test/rubygems/test_gem_source_git.rb:72]:
fatal: transport 'file' not allowed
fatal: clone of '/builddir/build/BUILD/ruby-3.0.4/tmp/test_rubygems_20230627-4031323-yppcjj/git/b' into submodule path '/builddir/build/BUILD/ruby-3.0.4/tmp/test_rubygems_20230627-4031323-yppcjj/git/a/b' failed
```

Related: RHEL-5590
This commit is contained in:
Jun Aruga 2023-10-09 15:26:37 +02:00
parent 20188a8a3f
commit f35ee62ca8
2 changed files with 35 additions and 1 deletions

View File

@ -0,0 +1,27 @@
From dae843f6b7502f921a7e66f39e3714a39d860181 Mon Sep 17 00:00:00 2001
From: Hiroshi SHIBATA <hsbt@ruby-lang.org>
Date: Wed, 19 Oct 2022 19:40:00 +0900
Subject: [PATCH] Bypass git submodule add/update with git config
protocol.file.allow=always option.
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
---
test/rubygems/test_gem_source_git.rb | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/test/rubygems/test_gem_source_git.rb b/test/rubygems/test_gem_source_git.rb
index 5702da05974b6..c3b324771fa4d 100644
--- a/test/rubygems/test_gem_source_git.rb
+++ b/test/rubygems/test_gem_source_git.rb
@@ -63,6 +63,11 @@ def test_checkout_local_cached
end
def test_checkout_submodules
+ # We need to allow to checkout submodules with file:// protocol
+ # CVE-2022-39253
+ # https://lore.kernel.org/lkml/xmqq4jw1uku5.fsf@gitster.g/
+ system(@git, *%W"config --global protocol.file.allow always")
+
source = Gem::Source::Git.new @name, @repository, 'master', true
git_gem 'b'

View File

@ -22,7 +22,7 @@
%endif
%global release 141
%global release 142
%{!?release_string:%define release_string %{?development_release:0.}%{release}%{?development_release:.%{development_release}}%{?dist}}
# The RubyGems library has to stay out of Ruby directory tree, since the
@ -196,6 +196,9 @@ Patch25: ruby-3.2.0-define-unsupported-gc-compaction-methods_generated-files.pat
# https://github.com/ruby/ruby/pull/6019
# https://github.com/ruby/ruby/commit/2c190863239bee3f54cfb74b16bb6ea4cae6ed20
Patch26: ruby-3.2.0-Detect-compaction-support-during-runtime.patch
# Bypass git submodule test failure on Git >= 2.38.1.
# https://github.com/ruby/ruby/pull/6587
Patch27: ruby-3.2.0-git-2.38.1-fix-rubygems-test.patch
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Suggests: rubypick
@ -663,6 +666,7 @@ find .bundle/gems -name '*-[0-9]*.gemspec' -exec cp -t .bundle/specifications/ {
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
# Provide an example of usage of the tapset:
cp -a %{SOURCE3} .
@ -1531,6 +1535,9 @@ mv test/fiddle/test_import.rb{,.disable}
%changelog
* Mon Oct 09 2023 Jun Aruga <jaruga@redhat.com> - 3.1.2-142
- Bypass git submodule test failure on Git >= 2.38.1.
* Fri Jun 03 2022 Jarek Prokop <jprokop@redhat.com> - 3.1.2-141
- Upgrade to Ruby 3.1.2 by merging Fedora Rawhide branch (commit: b7b5473).
Resolves: rhbz#2063773