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

[PATCH] instaweb: Minor cleanups and fixes for potential problems

From
Jonas Fonseca <fonseca@diku.dk>
Date
Nov 8, 2007, 15:49 UTC
Message-ID
<20071108154940.GA20988@diku.dk>

Fix path quoting and test of empty values that some shells do not like. Remove duplicate check and setting of $browser.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---
 git-instaweb.sh |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/git-instaweb.sh b/git-instaweb.sh
index f05884c..fbacfb1 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -44,7 +44,7 @@ start_httpd () {
 	httpd_only="`echo $httpd | cut -f1 -d' '`"
 	if case "$httpd_only" in /*) : ;; *) which $httpd_only >/dev/null;; esac
 	then
-		$httpd $fqgitdir/gitweb/httpd.conf
+		$httpd "$fqgitdir/gitweb/httpd.conf"
 	else
 		# many httpds are installed in /usr/sbin or /usr/local/sbin
 		# these days and those are not in most users $PATHs
@@ -158,7 +158,7 @@ EOF
 :DirectoryIndex: ["gitweb.cgi"]
 :PidFile: "$fqgitdir/pid"
 EOF
-	test "$local" = true && echo ':BindAddress: "127.0.0.1"' >> "$conf"
+	test x"$local" = xtrue && echo ':BindAddress: "127.0.0.1"' >> "$conf"
 }
 
 lighttpd_conf () {
@@ -171,14 +171,14 @@ server.pid-file = "$fqgitdir/pid"
 cgi.assign = ( ".cgi" => "" )
 mimetype.assign = ( ".css" => "text/css" )
 EOF
-	test "$local" = true && echo 'server.bind = "127.0.0.1"' >> "$conf"
+	test x"$local" = xtrue && echo 'server.bind = "127.0.0.1"' >> "$conf"
 }
 
 apache2_conf () {
 	test -z "$module_path" && module_path=/usr/lib/apache2/modules
 	mkdir -p "$GIT_DIR/gitweb/logs"
 	bind=
-	test "$local" = true && bind='127.0.0.1:'
+	test x"$local" = xtrue && bind='127.0.0.1:'
 	echo 'text/css css' > $fqgitdir/mime.types
 	cat > "$conf" <<EOF
 ServerName "git-instaweb"
@@ -271,6 +271,5 @@ webrick)
 esac
 
 start_httpd
-test -z "$browser" && browser=echo
 url=http://127.0.0.1:$port
-$browser $url || echo $url
+"$browser" $url || echo $url
-- 
1.5.3.5.1623.g4aab495-dirty

-- 
Jonas Fonseca
Next: Jonas Fonseca
Message 1 of 2 in “instaweb: Minor cleanups and fixes for potential problems”
  1. instaweb: Minor cleanups and fixes for potential problemsJonas Fonseca, Nov 8, 2007
  2. instaweb: Minor cleanups and fixes for potential problemsJonas Fonseca, Nov 8, 2007

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.