[RFC/PATCH] Split resolve_full_httpd to prevent bug.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



resolve_full_httpd tries to find the httpd path, which can break if the
httpd configuration hasn't happened. Specifically, this occurs with
webrick.

Signed-off-by: Jared Hance <jaredhance@xxxxxxxxx>
---

WARNING: I haven't tested this patch, as I don't use git-instaweb. I
also don't have webrick, so I can't be sure this actually works.
Hopefully this can be used as a foundation for a real fix.

 git-instaweb.sh |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/git-instaweb.sh b/git-instaweb.sh
index b7342e2..b7950ac 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -41,7 +41,7 @@ test -z "$root" && root='@@GITWEBDIR@@'
 # any untaken local port will do...
 test -z "$port" && port=1234
 
-resolve_full_httpd () {
+resolve_httpd () {
 	case "$httpd" in
 	*apache2*|*lighttpd*|*httpd*)
 		# yes, *httpd* covers *lighttpd* above, but it is there for clarity
@@ -52,14 +52,21 @@ resolve_full_httpd () {
 		fi
 		;;
 	*plackup*)
-		# server is started by running via generated gitweb.psgi in $fqgitdir/gitweb
-		full_httpd="$fqgitdir/gitweb/gitweb.psgi"
 		httpd_only="${httpd%% *}" # cut on first space
 		return
 		;;
 	esac
 
 	httpd_only="$(echo $httpd | cut -f1 -d' ')"
+}
+
+# please run resolve_httpd first
+resolve_full_httpd() {
+	if test $httpd = "plackup"; then
+		# server is started by running via generated gitweb.psgi in $fqgitdir/gitweb
+		full_httpd="$fqgitdir/gitweb/gitweb.psgi"
+	fi
+
 	if case "$httpd_only" in /*) : ;; *) which $httpd_only >/dev/null 2>&1;; esac
 	then
 		full_httpd=$httpd
@@ -90,6 +97,7 @@ start_httpd () {
 	fi
 
 	# here $httpd should have a meaningful value
+	resolve_httpd
 	resolve_full_httpd
 
 	# don't quote $full_httpd, there can be arguments to it (-f)
@@ -354,6 +362,7 @@ PerlPassEnv GITWEB_CONFIG
 EOF
 	else
 		# plain-old CGI
+		resolve_httpd
 		resolve_full_httpd
 		list_mods=$(echo "$full_httpd" | sed 's/-f$/-l/')
 		$list_mods | sane_grep 'mod_cgi\.c' >/dev/null 2>&1 || \
@@ -565,7 +574,7 @@ EOF
 
 gitweb_conf
 
-resolve_full_httpd
+resolve_httpd
 mkdir -p "$fqgitdir/gitweb/$httpd_only"
 
 case "$httpd" in
@@ -590,6 +599,7 @@ webrick)
 	;;
 esac
 
+
 start_httpd
 url=http://127.0.0.1:$port
 
-- 
1.7.2

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]