Skip to contentSkip to conversation

lib-git-svn.sh: Add check for missing mod_dav_svn module

PATCH In review Ramsay Jones 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 4/14 lib-git-svn.sh: Add check for missing mod_dav_svn module

---
 t/lib-git-svn.sh |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
t/lib-git-svn.sh +6 -0
index 919d45a..154f3d3 100644
@@ -101,6 +101,11 @@ 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
 	if test -z "$repo_base_path"
 	then
 		repo_base_path=svn
@@ -128,6 +133,7 @@ EOF
 
 stop_httpd () {
 	test -z "$SVN_HTTPD_PORT" && return
+	test ! -e "$GIT_DIR/httpd.conf" && return
 	"$SVN_HTTPD_PATH" -f "$GIT_DIR"/httpd.conf -k stop
 }
 
Signature · 1 line
1.7.3
#1 lore raw
Quoted 10 lines · Ramsay Jones
---
 t/lib-git-svn.sh |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
t/lib-git-svn.sh +0 -0
index 919d45a..154f3d3 100644

t/lib-git-svn.sh start_httpd () { · line 108

Quoted 8 lines
t/lib-git-svn.sh +5 -0
@@ -101,6 +101,11 @@ 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

Others seem to check with "test -f" for things like this. Also why "return 1" only on this codepath?

Quoted 13 lines
t/lib-git-svn.sh +1 -0
 	if test -z "$repo_base_path"
 	then
 		repo_base_path=svn
@@ -128,6 +133,7 @@ EOF
 
 stop_httpd () {
 	test -z "$SVN_HTTPD_PORT" && return
+	test ! -e "$GIT_DIR/httpd.conf" && return
 	"$SVN_HTTPD_PATH" -f "$GIT_DIR"/httpd.conf -k stop
 }
 
Signature · 1 line
1.7.3
#2 lore raw
Quoted 16 lines · Junio C Hamano

t/lib-git-svn.sh start_httpd () { · line 108

Quoted 13 lines · Ramsay Jones
t/lib-git-svn.sh +5 -0
index 919d45a..154f3d3 100644
@@ -101,6 +101,11 @@ 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

Others seem to check with "test -f" for things like this.

OK, do you want me to send an updated patch?

Quoted 1 line

Also why "return 1" only on this codepath?

This test, along with t9115-*.sh, t9118-*.sh and t9120-*.sh, have been written in such a way that it can access the svn repo using either file or http urls. By default (SVN_HTTPD_PORT not set), it uses file urls so that, despite it noisily printing to stderr that "SVN_HTTPD_PORT is not defined!", lack of an Apache installation is not a problem. (In fact, I suspect very few people run it with SVN_HTTPD_PORT defined).

So, the initial test (of SVN_HTTPD_PORT) and return is not particularly noteworthy, let alone an error. (Yes I have a patch to remove the message, see below). However, *if* the user requests the test be run with http urls and the mod_sav_svn.so module is missing, then we want to fail the test noisily; thus we return 1.

Note that we could easily reset SVN_HTTPD_PORT and return, thus silently converting to the "use file urls" case, but I don't think that would be acceptable.

The reason I didn't submit the patch to remove the above message is because I felt I should add a note about how/why you would use the SVN_HTTPD_PORT variable to the t/README file. However, that started me thinking about other similar variables like:

    SVN_HTTPD_{PATH,MODULE_PATH}, LIB_HTTPD_{PATH,PORT,SSL,DAV,SVN},
    GIT_SVN_NO_OPTIMIZE_COMMITS, GIT_TEST_HTTPD, .....

So, that patch never got finished! :-P

ATB,
Ramsay Jones