git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: What's cooking in git.git (Dec 2010, #05; Thu, 16)

From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
Dec 18, 2010, 22:00 UTC
Message-ID
<4D0D2EFA.7060106@ramsay1.demon.co.uk>
In-Reply-To
<7vk4j8kfwy.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
Show 10 quoted lines
> 
> --------------------------------------------------
> [New Topics]
> 
> * rj/maint-difftool-cygwin-workaround (2010-12-14) 1 commit
>  - difftool: Fix failure on Cygwin
> 
> * rj/maint-test-fixes (2010-12-14) 5 commits
>  - t9501-*.sh: Fix a test failure on Cygwin
>  - lib-git-svn.sh: Add check for mis-configured web server variables
This lib-git-svn.sh patch (above) has a quite serious fault :(

I'm very annoyed with myself, because I was trying so hard to be conservative and safe! :-P

The original branch containing these lib-git-svn.sh patches (#3-5 in the original series) had another commit with the highly informative commit message: WIP. I could not remember what this commit was about, or if it was complete (but I thought not), so I didn't send it along with the others ... Well, this evening I remembered what it was about, along with the fact that it fixed a problem with the above and that I had intended to squash all of these patches into one.

The problem with the above is this: because lib-git-svn.sh is sourced by 57 test files, only four of which even remotely care about using apache, if SVN_HTTPD_PORT is set and your apache install cannot be found, then *all* 57 tests will be skipped.

Sorry about that ...

I've added a diff of the additional commit below (well, I changed a couple of "test ! -e" to "test ! -f", given your comment on patch 04/14) so you can see that the fix will involve moving the code used to check your apache installation into a separate function which will only be called from start_httpd; ie only tests that want to use the web-server will execute this code.

I'll send a proper patch soon. Again, I must apologize for messing up!

ATB, Ramsay Jones

--- >8 ---
diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
index 5acc0ec..d48fe6b 100644
--- a/t/lib-git-svn.sh
+++ b/t/lib-git-svn.sh
@@ -68,8 +68,7 @@ svn_cmd () {
 	svn "$orig_svncmd" --config-dir "$svnconf" "$@"
 }
 
-if test -n "$SVN_HTTPD_PORT"
-then
+prepare_httpd () {
 	for d in \
 		"$SVN_HTTPD_PATH" \
 		/usr/sbin/apache2 \
@@ -83,8 +82,8 @@ then
 	done
 	if test -z "$SVN_HTTPD_PATH"
 	then
-		skip_all='skipping git svn tests, Apache not found'
-		test_done
+		echo >&2 'Apache not found'
+		return 1
 	fi
 	for d in \
 		"$SVN_HTTPD_MODULE_PATH" \
@@ -99,10 +98,15 @@ then
 	done
 	if test -z "$SVN_HTTPD_MODULE_PATH"
 	then
-		skip_all='skipping git svn tests, Apache module dir not found'
-		test_done
+		echo >&2 'Apache module dir not found'
+		return 1
 	fi
-fi
+	if test ! -f "$SVN_HTTPD_MODULE_PATH/mod_dav_svn.so"
+	then
+		echo >&2 'Apache module "mod_dav_svn.so" not found'
+		return 1
+	fi
+}
 
 start_httpd () {
 	repo_base_path="$1"
@@ -111,11 +115,9 @@ start_httpd () {
 		echo >&2 'SVN_HTTPD_PORT is not defined!'
 		return
 	fi
-	if test ! -e "$SVN_HTTPD_MODULE_PATH/mod_dav_svn.so"
-	then
-		echo >&2 'Apache module "mod_dav_svn.so" not found'
-		return 1
-	fi
+
+	prepare_httpd || return 1
+
 	if test -z "$repo_base_path"
 	then
 		repo_base_path=svn
@@ -143,7 +145,7 @@ EOF
 
 stop_httpd () {
 	test -z "$SVN_HTTPD_PORT" && return
-	test ! -e "$GIT_DIR/httpd.conf" && return
+	test ! -f "$GIT_DIR/httpd.conf" && return
 	"$SVN_HTTPD_PATH" -f "$GIT_DIR"/httpd.conf -k stop
 }
 
--- 8< ---
Previous: Junio C Hamano
Message 4 of 4 in “What's cooking in git.git (Dec 2010, #05; Thu, 16)”
  1. Junio C HamanoDec 17, 2010
  2. conflict resolution of pd/bash-4-completion [Re: What's cooking in git.git (Dec 2010, #05; Thu, 16)]SZEDER Gábor, Dec 17, 2010
  3. Junio C HamanoDec 17, 2010
  4. Ramsay JonesDec 18, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.