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

[RFC/PATCH] Split resolve_full_httpd to prevent bug.

From
Jared Hance <jaredhance@gmail.com>
Date
Aug 3, 2010, 22:34 UTC
Message-ID
<c14fac3f8bedfe451e7b06b626632e724c993c52.1280874664.git.jaredhance@gmail.com>
In-Reply-To
<m34ofbpcyr.fsf@localhost.localdomain>

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@gmail.com>
---
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
Previous: Jakub NarebskiNext: Eric Wong
Message 3 of 5 in “git instaweb + webrick does not work”
  1. Michael DipperyAug 3, 2010
  2. Jakub NarebskiAug 3, 2010
  3. Split resolve_full_httpd to prevent bug.Jared Hance, Aug 3, 2010
  4. Eric WongAug 4, 2010
  5. 0/3 instaweb: fix and improve WEBrick supportEric Wong, Aug 5, 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.