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

[PATCH 3/4] git-instaweb: Add checks that web server can be started and is started

From
Jakub Narebski <jnareb@gmail.com>
Date
Dec 29, 2010, 16:49 UTC
Message-ID
<201012291749.14772.jnareb@gmail.com>
In-Reply-To
<201012291743.41213.jnareb@gmail.com>

Better to check that "$root/gitweb.cgi" exists, and that web server started, rather than have (for example) the following error message

  $ git instaweb --httpd=plackup --browser=mozilla
  Waiting for 'plackup' to start .../usr/share/gitweb/gitweb.cgi:
  No such file or directory at <somewhere>/perl5/CGI/Compile.pm line 97.
  ........
and keep waiting in httpd_is_ready for gitweb.cgi which would not start.

Note that the first check is not strictly necessary, but checking separately that gitweb.cgi script can be found at expected place leads to better error message.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
It can be considered bugfix, or it can be considered hardening of
git-instaweb (making it more resilent).
 git-instaweb.sh |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/git-instaweb.sh b/git-instaweb.sh
index da569f2..94f8b07 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -41,6 +41,9 @@ test -z "$root" && root='@@GITWEBDIR@@'
 # any untaken local port will do...
 test -z "$port" && port=1234
 
+# Sanity check
+test -e "$root/gitweb.cgi" || die "gitweb.cgi not found at '$root'"
+
 resolve_full_httpd () {
 	case "$httpd" in
 	*apache2*|*lighttpd*|*httpd*)
@@ -617,7 +620,7 @@ webrick)
 	;;
 esac
 
-start_httpd
+start_httpd || die "Could not start '$httpd'"
 url=http://127.0.0.1:$port
 
 if test -n "$browser"; then
-- 
1.7.3
Previous: Jakub NarebskiNext: Jakub Narebski
Message 7 of 9 in “git-instaweb: Three fixes and one improvement”
  1. 0/4 git-instaweb: Three fixes and one improvementJakub Narebski, Dec 29, 2010
  2. 1/4 git-instaweb: Fix issue with static files for 'plackup' serverJakub Narebski, Dec 29, 2010
  3. Junio C HamanoDec 29, 2010
  4. Junio C HamanoDec 29, 2010
  5. Jakub NarebskiDec 30, 2010
  6. 2/4 git-instaweb: Static files are under "static/" in gitweb_confJakub Narebski, Dec 29, 2010
  7. 3/4 git-instaweb: Add checks that web server can be started and is startedJakub Narebski, Dec 29, 2010
  8. 4/4 git-instaweb: Use "git-instaweb" as sitename (for page titles)Jakub Narebski, Dec 29, 2010
  9. Eric WongDec 30, 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.