Skip to content
Snippets Groups Projects
Commit 75d4b854 authored by Rocky Automation's avatar Rocky Automation :tv:
Browse files

import git-2.31.1-3.el9_1

parent e3d8c1e3
No related branches found
No related tags found
No related merge requests found
From aedeaaf788bd8a7fc5a1887196b6f6d8a5c31362 Mon Sep 17 00:00:00 2001
From: Todd Zullinger <tmz@pobox.com>
Date: Sun, 21 Aug 2022 13:49:57 -0400
Subject: [PATCH] t/lib-httpd: try harder to find a port for apache
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When running multiple builds concurrently, tests which run daemons, like
apache httpd, sometimes conflict with each other, leading to spurious
failures:
++ /usr/sbin/httpd -d '/tmp/git-t.ck9I/trash directory.t9118-git-svn-funky-branch-names/httpd' \
-f /builddir/build/BUILD/git-2.37.2/t/lib-httpd/apache.conf -DDAV -DSVN -c 'Listen 127.0.0.1:9118' \
-k start
(98)Address already in use: AH00072: make_sock: could not bind to address 127.0.0.1:9118
no listening sockets available, shutting down
AH00015: Unable to open logs
++ test 1 -ne 0
Try a bit harder to find an open port to use to avoid these intermittent
failures. If we fail to start httpd, increment the port number and try
again. By default, we make 3 attempts. This may be overridden by
setting GIT_TEST_START_HTTPD_TRIES to a different value.
Helped-by: Ondřej Pohořelský <opohorel@redhat.com>
Signed-off-by: Todd Zullinger <tmz@pobox.com>
---
t/lib-httpd.sh | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
index 1f6b9b08d1..9279dcd659 100644
--- a/t/lib-httpd.sh
+++ b/t/lib-httpd.sh
@@ -175,19 +175,26 @@ prepare_httpd() {
}
start_httpd() {
- prepare_httpd >&3 2>&4
-
test_atexit stop_httpd
- "$LIB_HTTPD_PATH" -d "$HTTPD_ROOT_PATH" \
- -f "$TEST_PATH/apache.conf" $HTTPD_PARA \
- -c "Listen 127.0.0.1:$LIB_HTTPD_PORT" -k start \
- >&3 2>&4
- if test $? -ne 0
- then
- cat "$HTTPD_ROOT_PATH"/error.log >&4 2>/dev/null
- test_skip_or_die GIT_TEST_HTTPD "web server setup failed"
- fi
+ i=0
+ while test $i -lt ${GIT_TEST_START_HTTPD_TRIES:-3}
+ do
+ i=$(($i + 1))
+ prepare_httpd >&3 2>&4
+ say >&3 "Starting httpd on port $LIB_HTTPD_PORT"
+ "$LIB_HTTPD_PATH" -d "$HTTPD_ROOT_PATH" \
+ -f "$TEST_PATH/apache.conf" $HTTPD_PARA \
+ -c "Listen 127.0.0.1:$LIB_HTTPD_PORT" -k start \
+ >&3 2>&4
+ test $? -eq 0 && return
+ LIB_HTTPD_PORT=$(($LIB_HTTPD_PORT + 1))
+ export LIB_HTTPD_PORT
+ # clean up modules symlink, prepare_httpd will re-create it
+ rm -f "$HTTPD_ROOT_PATH/modules"
+ done
+ cat "$HTTPD_ROOT_PATH"/error.log >&4 2>/dev/null
+ test_skip_or_die GIT_TEST_HTTPD "web server setup failed"
}
stop_httpd() {
From 16750d024ce038b019ab2e9ee5639901e445af37 Mon Sep 17 00:00:00 2001
From: Todd Zullinger <tmz@pobox.com>
Date: Fri, 26 Aug 2022 18:28:44 -0400
Subject: [PATCH] t/lib-git-daemon: try harder to find a port
As with the previous commit, try harder to find an open port to avoid
intermittent failures on busy/shared build systems.
By default, we make 3 attempts. This may be overridden by setting
GIT_TEST_START_GIT_DAEMON_TRIES to a different value.
Signed-off-by: Todd Zullinger <tmz@pobox.com>
---
t/lib-git-daemon.sh | 60 ++++++++++++++++++++++++++++-----------------
1 file changed, 37 insertions(+), 23 deletions(-)
diff --git a/t/lib-git-daemon.sh b/t/lib-git-daemon.sh
index e62569222b..c3e8dda9ff 100644
--- a/t/lib-git-daemon.sh
+++ b/t/lib-git-daemon.sh
@@ -51,30 +51,44 @@ start_git_daemon() {
registered_stop_git_daemon_atexit_handler=AlreadyDone
fi
- say >&3 "Starting git daemon ..."
- mkfifo git_daemon_output
- ${LIB_GIT_DAEMON_COMMAND:-git daemon} \
- --listen=127.0.0.1 --port="$LIB_GIT_DAEMON_PORT" \
- --reuseaddr --verbose --pid-file="$GIT_DAEMON_PIDFILE" \
- --base-path="$GIT_DAEMON_DOCUMENT_ROOT_PATH" \
- "$@" "$GIT_DAEMON_DOCUMENT_ROOT_PATH" \
- >&3 2>git_daemon_output &
- GIT_DAEMON_PID=$!
- {
- read -r line <&7
- printf "%s\n" "$line" >&4
- cat <&7 >&4 &
- } 7<git_daemon_output &&
+ i=0
+ while test $i -lt ${GIT_TEST_START_GIT_DAEMON_TRIES:-3}
+ do
+ say >&3 "Starting git daemon on port $LIB_GIT_DAEMON_PORT ..."
+ mkfifo git_daemon_output
+ ${LIB_GIT_DAEMON_COMMAND:-git daemon} \
+ --listen=127.0.0.1 --port="$LIB_GIT_DAEMON_PORT" \
+ --reuseaddr --verbose --pid-file="$GIT_DAEMON_PIDFILE" \
+ --base-path="$GIT_DAEMON_DOCUMENT_ROOT_PATH" \
+ "$@" "$GIT_DAEMON_DOCUMENT_ROOT_PATH" \
+ >&3 2>git_daemon_output &
+ GIT_DAEMON_PID=$!
+ {
+ read -r line <&7
+ printf "%s\n" "$line" >&4
+ cat <&7 >&4 &
+ } 7<git_daemon_output &&
- # Check expected output
- if test x"$(expr "$line" : "\[[0-9]*\] \(.*\)")" != x"Ready to rumble"
- then
- kill "$GIT_DAEMON_PID"
- wait "$GIT_DAEMON_PID"
- unset GIT_DAEMON_PID
- test_skip_or_die GIT_TEST_GIT_DAEMON \
- "git daemon failed to start"
- fi
+ # Check expected output
+ output="$(expr "$line" : "\[[0-9]*\] \(.*\)")"
+ # Return if found
+ test x"$output" = x"Ready to rumble" && return
+ # Increment port for retry if not found
+ LIB_GIT_DAEMON_PORT=$(($LIB_GIT_DAEMON_PORT + 1))
+ export LIB_GIT_DAEMON_PORT
+ GIT_DAEMON_HOST_PORT=127.0.0.1:$LIB_GIT_DAEMON_PORT
+ GIT_DAEMON_URL=git://$GIT_DAEMON_HOST_PORT
+ # unset GIT_DAEMON_PID; remove the fifo & pid file
+ GIT_DAEMON_PID=
+ rm -f git_daemon_output "$GIT_DAEMON_PIDFILE"
+ done
+
+ # Clean up and return failure
+ kill "$GIT_DAEMON_PID"
+ wait "$GIT_DAEMON_PID"
+ unset GIT_DAEMON_PID
+ test_skip_or_die GIT_TEST_GIT_DAEMON \
+ "git daemon failed to start"
}
stop_git_daemon() {
This diff is collapsed.
diff -ur b/t/lib-git-svn.sh c/t/lib-git-svn.sh
--- b/t/lib-git-svn.sh 2021-03-26 23:03:34.000000000 +0100
+++ c/t/lib-git-svn.sh 2023-01-26 13:39:32.822183929 +0100
@@ -13,6 +13,7 @@
GIT_DIR=$PWD/.git
GIT_SVN_DIR=$GIT_DIR/svn/refs/remotes/git-svn
SVN_TREE=$GIT_SVN_DIR/svn-tree
+SVNSERVE_PIDFILE="$PWD"/daemon.pid
test_set_port SVNSERVE_PORT
svn >/dev/null 2>&1
@@ -115,10 +116,35 @@
}
start_svnserve () {
- svnserve --listen-port $SVNSERVE_PORT \
- --root "$rawsvnrepo" \
- --listen-once \
- --listen-host 127.0.0.1 &
+ test_atexit stop_svnserve
+
+ i=0
+ while test $i -lt ${GIT_TEST_START_SVNSERVE_TRIES:-3}
+ do
+ say >&3 "Starting svnserve on port $SVNSERVE_PORT ..."
+ svnserve --listen-port $SVNSERVE_PORT \
+ --root "$rawsvnrepo" \
+ --daemon --pid-file="$SVNSERVE_PIDFILE" \
+ --listen-host 127.0.0.1
+ ret=$?
+ # increment port and retry if unsuccessful
+ if test $ret -ne 0
+ then
+ SVNSERVE_PORT=$(($SVNSERVE_PORT + 1))
+ export SVNSERVE_PORT
+ else
+ break
+ fi
+ done
+}
+
+stop_svnserve () {
+ say >&3 "Stopping svnserve ..."
+ SVNSERVE_PID="$(cat "$SVNSERVE_PIDFILE")"
+ if test -n "$SVNSERVE_PID"
+ then
+ kill "$SVNSERVE_PID" 2>/dev/null
+ fi
}
prepare_a_utf8_locale () {
diff -ur b/t/t9113-git-svn-dcommit-new-file.sh c/t/t9113-git-svn-dcommit-new-file.sh
--- b/t/t9113-git-svn-dcommit-new-file.sh 2021-03-26 23:03:34.000000000 +0100
+++ c/t/t9113-git-svn-dcommit-new-file.sh 2023-01-26 13:39:30.314168109 +0100
@@ -28,7 +28,6 @@
echo hello > git-new-dir/world &&
git update-index --add git-new-dir/world &&
git commit -m hello &&
- start_svnserve &&
git svn dcommit
"
......@@ -97,7 +97,7 @@
Name: git
Version: 2.31.1
Release: 2%{?rcrev}%{?dist}.2
Release: 3%{?rcrev}%{?dist}
Summary: Fast Version Control System
License: GPLv2
URL: https://git-scm.com/
......@@ -129,7 +129,19 @@ Source99: print-failed-test-output
# https://bugzilla.redhat.com/490602
Patch0: git-cvsimport-Ignore-cvsps-2.2b1-Branches-output.patch
# https://bugzilla.redhat.com/1956345
Patch1: git-2.27.0-core-crypto-hmac.patch
Patch1: git-2.27.0-core-crypto-hmac.patch
# https://bugzilla.redhat.com/2162069
Patch2: git-2.31.1-cve-2022-23521-cve-2022-41903.patch
# https://bugzilla.redhat.com/2114531
# tests: try harder to find open ports for apache, git, and svn
#
# https://github.com/tmzullinger/git/commit/aedeaaf788
Patch3: 0001-t-lib-httpd-try-harder-to-find-a-port-for-apache.patch
# https://github.com/tmzullinger/git/commit/16750d024c
Patch4: 0002-t-lib-git-daemon-try-harder-to-find-a-port.patch
# https://github.com/tmzullinger/git/commit/aa5105dc11
Patch5: t-lib-git-svn-try-harder-to-find-a-port-2.31.1.patch
%if %{with docs}
# pod2man is needed to build Git.3pm
......@@ -1072,6 +1084,11 @@ rmdir --ignore-fail-on-non-empty "$testdir"
%{?with_docs:%{_pkgdocdir}/git-svn.html}
%changelog
* Wed Jan 25 2023 Ondřej Pohořelský <opohorel@redhat.com> - 2.31.1-3
- Fixes CVE-2022-23521 and CVE-2022-41903
- Tests: try harder to find open ports for apache, git, and svn
- Resolves: #2162069
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 2.31.1-2.2
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment