From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Subject: [RFC/PATCH] gitweb: Fail early
Date: Tue, 19 May 2009 22:40:31 +0200 [thread overview]
Message-ID: <200905192240.34199.jnareb@gmail.com> (raw)
Return HTTP 500 Internal Server Error if $GIT is not defined (which
would cause Perl error), or if "$GIT --version" failed to run. This
should not happen often, but I think this change would make diagnosing
misconfiguration easier.
---
Is "git version" in 'git --version' output ensured? How did other git
implementations and ports (like msysGit and jgit) output of --version
looks like?
Does it make sense to check whether output matches, and if it doesn't
match assume that $GIT points to something other, perhaps some other
git like GIT Interactive Tools or something?
Does it makes sense to try various other checks to make error message
more detailed like $GIT is not found, or is not executable?
diff --git i/gitweb/gitweb.perl w/gitweb/gitweb.perl
index 05702e4..0cb53ca 100755
--- i/gitweb/gitweb.perl
+++ w/gitweb/gitweb.perl
@@ -471,7 +471,13 @@ if (-e $GITWEB_CONFIG) {
}
# version of the core git binary
+if (!defined $GIT) {
+ die_error(500, "Undefined path to git binary");
+}
our $git_version = qx("$GIT" --version) =~ m/git version (.*)$/ ? $1 : "unknown";
+if ($?) {
+ die_error(500, "Error calling '$GIT --version': $?");
+}
$projects_list ||= $projectroot;
reply other threads:[~2009-05-19 20:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200905192240.34199.jnareb@gmail.com \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.