From: Jakub Narebski <jnareb@gmail.com>
To: "John 'Warthog9' Hawley" <warthog9@eaglescrag.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/3] gitweb: Add option to force version match
Date: Thu, 28 Oct 2010 02:52:44 -0700 (PDT) [thread overview]
Message-ID: <m3fwvqir0o.fsf@localhost.localdomain> (raw)
In-Reply-To: <1288226574-19068-2-git-send-email-warthog9@eaglescrag.net>
"John 'Warthog9' Hawley" <warthog9@eaglescrag.net> writes:
> This adds $git_versions_must_match variable, which is set to true,
> checks that we are running on the same version of git that we
> shipped with, and if not throw '500 Internal Server Error' error.
> What is checked is the version of gitweb (embedded in building
> gitweb.cgi), against version of runtime git binary used.
>
> Gitweb can usually run with a mismatched git install. This is more
> here to give an obvious warning as to whats going on vs. silently
> failing.
Were you bitten by mismatch between git version and gitweb version?
Just how serious is that (hypothetical?) situation?
Should it be warning, or erroring out?
>
> By default this feature is turned on.
I think last time this patch stalled on discussion whether this
feature should be turned on by default, where it can break some
setups; or be turned off by default, where it is much less useful
protecting against errors.
>
> Signed-off-by: John 'Warthog9' Hawley <warthog9@kernel.org>
> Signed-off-by: Jakub Narebski <jnareb@gmail.com>
> ---
> gitweb/README | 4 ++++
> gitweb/gitweb.perl | 27 +++++++++++++++++++++++++++
> 2 files changed, 31 insertions(+), 0 deletions(-)
For me, if $git_versions_must_match is to be on by default, I would
prefer also update to t/gitweb-lib.sh, so hat I don't have to
recompile git to test new version of gitweb...
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 8d7e4c5..215a4e9 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -232,6 +232,9 @@ our %avatar_size = (
> 'double' => 32
> );
>
> +# If it is true, exit if gitweb version and git binary version don't match
> +our $git_versions_must_match = 1;
> +
> # Used to set the maximum load that we will still respond to gitweb queries.
> # If server load exceed this value then return "503 server busy" error.
> # If gitweb cannot determined server load, it is taken to be 0.
> @@ -649,6 +652,29 @@ sub check_loadavg {
> }
> }
>
> +sub check_versionmatch {
> + # Throw an error if git versions does not match, if $git_versions_must_match is true.
> + if ($git_versions_must_match &&
> + $git_version ne $version) {
> + my $admin_contact =
> + defined $ENV{'SERVER_ADMIN'} ? ", $ENV{'SERVER_ADMIN'}," : '';
> + my $err_msg = <<EOT;
> +<h1 align="center">*** Warning ***</h1>
> +<p>
> +This version of gitweb was compiled for <b>@{[esc_html($version)]}</b>,
> +however git version <b>@{[esc_html($git_version)]}</b> was found on server,
> +and administrator requested strict version checking.
> +</p>
> +<p>
> +Please contact the server administrator${admin_contact} to either configure
> +gitweb to allow mismatched versions, or update git or gitweb installation.
> +</p>
> +EOT
> + die_error(500, 'Internal server error', $err_msg);
> + }
> +
> +}
Nice.
> +
> # ======================================================================
> # input validation and dispatch
>
> @@ -1075,6 +1101,7 @@ sub run_request {
> evaluate_uri();
> evaluate_gitweb_config();
> check_loadavg();
> + check_versionmatch();
Shouldn't it be before check_loadavg()?
--
Jakub Narebski
Poland
ShadeHawk on #git
next prev parent reply other threads:[~2010-10-28 9:53 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-28 0:42 [PATCH 0/3] Gitweb caching v7 John 'Warthog9' Hawley
2010-10-28 0:42 ` [PATCH 1/3] gitweb: Add option to force version match John 'Warthog9' Hawley
2010-10-28 9:52 ` Jakub Narebski [this message]
2010-10-28 22:08 ` Junio C Hamano
2010-10-28 0:42 ` [PATCH 2/3] gitweb: add output buffering and associated functions John 'Warthog9' Hawley
2010-10-28 9:56 ` Jakub Narebski
2010-10-28 0:42 ` [PATCH 3/3] gitweb: File based caching layer (from git.kernel.org) John 'Warthog9' Hawley
2010-10-28 16:10 ` Jakub Narebski
2010-10-28 22:29 ` [PATCH 0/3] Gitweb caching v7 Junio C Hamano
2010-10-29 22:25 ` Junio C Hamano
2010-10-30 8:58 ` Jakub Narebski
2010-10-31 4:24 ` Junio C Hamano
2010-10-31 9:21 ` Jakub Narebski
2010-11-01 10:24 ` [PATCHv7.1 0/4] Gitweb caching v7.1 Jakub Narebski
2010-11-12 23:35 ` [RFC/PATCHv7.2 0/4] Gitweb caching v7.2 Jakub Narebski
2010-11-12 23:41 ` [PATCHv7.2 1/4] gitweb: Prepare for splitting gitweb Jakub Narebski
2010-11-17 23:10 ` Junio C Hamano
2010-11-18 13:37 ` Jakub Narebski
2010-12-02 10:17 ` [PATCHv7.3 1/4 (bugfix)] " Jakub Narebski
2010-12-02 17:37 ` Junio C Hamano
2010-12-02 19:01 ` Jakub Narebski
2010-12-02 19:21 ` Junio C Hamano
2010-12-02 19:36 ` Jakub Narebski
2010-11-12 23:44 ` [PATCHv7.1 2/4] gitweb: add output buffering and associated functions Jakub Narebski
2010-11-12 23:56 ` [PATCHv7.1 3/4] gitweb: File based caching layer (from git.kernel.org) Jakub Narebski
2010-11-28 11:22 ` [PATCHv7.1 3/4 (amend)] " Jakub Narebski
2010-11-28 11:31 ` Jakub Narebski
2010-11-29 22:13 ` Junio C Hamano
2010-11-29 22:20 ` Junio C Hamano
2010-11-29 23:09 ` [PATCHv7.1 3/4 (amend v2)] " Jakub Narebski
2010-11-30 0:51 ` Junio C Hamano
2010-11-30 10:21 ` Jakub Narebski
2010-11-29 23:07 ` [PATCHv7.1 3/4] " demerphq
2010-11-29 23:26 ` demerphq
2010-11-29 23:54 ` Jakub Narebski
2010-11-13 0:01 ` [PATCHv7.2 4/4] gitweb: Minimal testing of gitweb caching Jakub Narebski
2010-11-17 22:37 ` Junio C Hamano
2010-11-17 23:12 ` Jakub Narebski
2010-11-01 10:24 ` [PATCHv7.1 1/4] gitweb: Prepare for splitting gitweb Jakub Narebski
2010-11-01 18:50 ` [PATCHv7.1b " Jakub Narebski
2010-11-01 10:24 ` [PATCHv7.1 2/4] gitweb: add output buffering and associated functions Jakub Narebski
2010-11-01 10:24 ` [PATCHv7.1 3/4] gitweb: File based caching layer (from git.kernel.org) Jakub Narebski
2010-11-01 10:24 ` [PATCHv7.1 4/4] gitweb: Minimal testing of gitweb caching Jakub Narebski
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=m3fwvqir0o.fsf@localhost.localdomain \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.org \
--cc=warthog9@eaglescrag.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 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.