git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Cc: Eric Wong <normalperson@yhbt.net>
Subject: [PATCH 3/4] git-instaweb: Add checks that web server can be started and is started
Date: Wed, 29 Dec 2010 17:49:14 +0100	[thread overview]
Message-ID: <201012291749.14772.jnareb@gmail.com> (raw)
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

  parent reply	other threads:[~2010-12-29 16:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-29 16:43 [PATCH 0/4] git-instaweb: Three fixes and one improvement Jakub Narebski
2010-12-29 16:47 ` [BUGFIX PATCH 1/4] git-instaweb: Fix issue with static files for 'plackup' server Jakub Narebski
2010-12-29 23:24   ` Junio C Hamano
2010-12-29 23:52   ` Junio C Hamano
2010-12-30  0:40     ` Jakub Narebski
2010-12-29 16:48 ` [PATCH 2/4] git-instaweb: Static files are under "static/" in gitweb_conf Jakub Narebski
2010-12-29 16:49 ` Jakub Narebski [this message]
2010-12-29 16:50 ` [PATCH 4/4] git-instaweb: Use "git-instaweb" as sitename (for page titles) Jakub Narebski
2010-12-30  6:23   ` Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201012291749.14772.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=normalperson@yhbt.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).