{"thread":{"id":"22496","subject":"[PATCH 2/2] gitweb: Fix chop_str to allow for & characters in strings","startedAt":"2010-02-02T21:56:52Z","lastAt":"2010-02-03T18:25:08Z","messageCount":9,"participants":["John 'Warthog9' Hawley","Junio C Hamano","Jakub Narebski","J.H."],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"133401","messageId":"1265147814-13284-1-git-send-email-warthog9@eaglescrag.net","threadId":"22496","inReplyTo":null,"subject":"[PATCH 0/2] gitweb misc fixes mkII","fromName":"John 'Warthog9' Hawley","fromEmail":"warthog9@eaglescrag.net","sentAt":"2010-02-02T21:56:52Z","receivedAt":"2010-02-02T21:56:52Z","isPatch":true,"sender":{"key":"warthog9@kernel.org","avatar":"https://avatars.githubusercontent.com/u/2334704?v=4"},"body":"This is a new patch series dealing with the slightly controversial\noption to force version matching, and this adds a new patch that solves \na minor issue discovered on kernel.org.\n\nJohn 'Warthog9' Hawley (2):\n  gitweb: Add an option to force version match\n  gitweb: Fix chop_str to allow for & characters in strings\n\n gitweb/README                            |    5 ++++\n gitweb/gitweb.perl                       |   33 ++++++++++++++++++++++++++++-\n t/gitweb-lib.sh                          |    1 +\n t/t9501-gitweb-standalone-http-status.sh |   27 ++++++++++++++++++++++++\n 4 files changed, 64 insertions(+), 2 deletions(-)\n"},{"id":"133402","messageId":"1265147814-13284-2-git-send-email-warthog9@eaglescrag.net","threadId":"22496","inReplyTo":"1265147814-13284-1-git-send-email-warthog9@eaglescrag.net","subject":"[PATCH 1/2] gitweb: Add an option to force version match","fromName":"John 'Warthog9' Hawley","fromEmail":"warthog9@eaglescrag.net","sentAt":"2010-02-02T21:56:53Z","receivedAt":"2010-02-02T21:56:53Z","isPatch":true,"sender":{"key":"warthog9@kernel.org","avatar":"https://avatars.githubusercontent.com/u/2334704?v=4"},"body":"From: John 'Warthog9' Hawley <warthog9@kernel.org>\n\nThis adds $git_versions_must_match variable, which if set to true,\nchecks that we are running on the same version of git that we\nshipped with, and if not throw '500 Internal Server Error' error.\nWhat is checked is the version of gitweb (embedded in building\ngitweb.cgi), against version of runtime git binary used.\n\nGitweb can usually run with a mismatched git install.  This is more\nhere to give an obvious warning as to what's going on vs. silently\nfailing.\n\nBy default this feature is turned on.\n\nAdd tests to t9501-gitweb-standalone-http-status.sh that this feature\nworks correctly (as expected) if turned on, both in match and no match\ncase.\n\nSigned-off-by: John 'Warthog9' Hawley <warthog9@kernel.org>\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n gitweb/README                            |    5 ++++\n gitweb/gitweb.perl                       |   32 +++++++++++++++++++++++++++++-\n t/gitweb-lib.sh                          |    1 +\n t/t9501-gitweb-standalone-http-status.sh |   27 +++++++++++++++++++++++++\n 4 files changed, 64 insertions(+), 1 deletions(-)\n\ndiff --git a/gitweb/README b/gitweb/README\nindex 6c2c8e1..ec93da6 100644\n--- a/gitweb/README\n+++ b/gitweb/README\n@@ -233,6 +233,11 @@ not include variables usually directly set during build):\n    If server load exceed this value then return \"503 Service Unavaliable\" error.\n    Server load is taken to be 0 if gitweb cannot determine its value.  Set it to\n    undefined value to turn it off.  The default is 300.\n+ * $git_versions_must_match\n+   If set to true value, gitweb fails with \"500 Internal Server Error\" error\n+   if the version of the gitweb doesn't match version of the git binary.\n+   Gitweb can usually run with a mismatched git install.   The default is 1\n+   (true).\n \n \n Projects list file format\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex d0c3ff2..57771a0 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -221,6 +221,9 @@ our %avatar_size = (\n \t'double'  => 32\n );\n \n+# If it is true, exit if gitweb version and git binary version don't match\n+our $git_versions_must_match = 1;\n+\n # Used to set the maximum load that we will still respond to gitweb queries.\n # If server load exceed this value then return \"503 server busy\" error.\n # If gitweb cannot determined server load, it is taken to be 0.\n@@ -550,10 +553,10 @@ sub filter_snapshot_fmts {\n }\n \n our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || \"++GITWEB_CONFIG++\";\n+our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || \"++GITWEB_CONFIG_SYSTEM++\";\n if (-e $GITWEB_CONFIG) {\n \tdo $GITWEB_CONFIG;\n } else {\n-\tour $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || \"++GITWEB_CONFIG_SYSTEM++\";\n \tdo $GITWEB_CONFIG_SYSTEM if -e $GITWEB_CONFIG_SYSTEM;\n }\n \n@@ -583,6 +586,33 @@ sub get_loadavg {\n our $git_version = qx(\"$GIT\" --version) =~ m/git version (.*)$/ ? $1 : \"unknown\";\n $number_of_git_cmds++;\n \n+# Throw an error if git versions does not match, if $git_versions_must_match is true.\n+if ($git_versions_must_match &&\n+    $git_version ne $version) {\n+\tmy $admin_contact =\n+\t\tdefined $ENV{'SERVER_ADMIN'} ? \", $ENV{'SERVER_ADMIN'},\" : '';\n+\tmy $err_msg = <<EOT;\n+<h1 align=\"center\">*** Warning ***</h1>\n+<p>\n+This version of gitweb was compiled for <b>@{[esc_html($version)]}</b>,\n+however git version <b>@{[esc_html($git_version)]}</b> was found on server.\n+Running an instance of gitweb that is not matched to the git binaries may\n+result in unexpected behavior of gitweb, and loss of functionality or\n+incorrect data on displayed pages.\n+</p>\n+<p>\n+Please update the git or gitweb installation so that their versions match, or\n+if you feel you are sure that you wish to proceed with running gitweb\n+with unmatched versions please contact the server administrator${admin_contact}\n+to configure gitweb to allow mismatched versions.  This can be done by\n+setting \\$git_versions_must_match to @{[esc_html($git_versions_must_match)]}\n+(false value) in gitweb configuration file,\n+'@{[esc_path(-e $GITWEB_CONFIG ? $GITWEB_CONFIG : $GITWEB_CONFIG_SYSTEM)]}'.\n+</p>\n+EOT\n+\tdie_error(500, 'Internal server error', $err_msg);\n+}\n+\n $projects_list ||= $projectroot;\n \n if (defined $maxload && get_loadavg() > $maxload) {\ndiff --git a/t/gitweb-lib.sh b/t/gitweb-lib.sh\nindex 5a734b1..66a3e2d 100644\n--- a/t/gitweb-lib.sh\n+++ b/t/gitweb-lib.sh\n@@ -26,6 +26,7 @@ our \\$projects_list = '';\n our \\$export_ok = '';\n our \\$strict_export = '';\n our \\$maxload = undef;\n+our \\$git_versions_must_match = 0;\n \n EOF\n \ndiff --git a/t/t9501-gitweb-standalone-http-status.sh b/t/t9501-gitweb-standalone-http-status.sh\nindex 7590f10..e195f97 100755\n--- a/t/t9501-gitweb-standalone-http-status.sh\n+++ b/t/t9501-gitweb-standalone-http-status.sh\n@@ -133,5 +133,32 @@ cat >>gitweb_config.perl <<\\EOF\n our $maxload = undef;\n EOF\n \n+# ======================================================================\n+# check $git_versions_must_match feature\n+# should be last section, just in case\n+cp -f gitweb_config.perl gitweb_config.perl.bak\n+echo 'our $git_versions_must_match = 1;' >>gitweb_config.perl\n+\n+cat <<\\EOF >>gitweb_config.perl\n+our $version = \"current\";\n+EOF\n+test_expect_success 'force version match: no match' '\n+\tgitweb_run \"p=.git\" &&\n+\tgrep \"Status: 500 Internal Server Error\" gitweb.headers &&\n+\tgrep \"500 - Internal server error\" gitweb.body\n+'\n+test_debug 'cat gitweb.headers'\n+\n+cat <<\\EOF >>gitweb_config.perl\n+# must be kept in sync with code in gitweb/gitweb.perl\n+our $version = qx(\"$GIT\" --version) =~ m/git version (.*)$/ ? $1 : \"unknown\";\n+EOF\n+test_expect_success 'force version match: match' '\n+\tgitweb_run \"p=.git\" &&\n+\tgrep \"Status: 200 OK\" gitweb.headers\n+'\n+test_debug 'cat gitweb.headers'\n+\n+mv -f gitweb_config.perl.bak gitweb_config.perl\n \n test_done\n-- \n1.6.6\n"},{"id":"133400","messageId":"1265147814-13284-3-git-send-email-warthog9@eaglescrag.net","threadId":"22496","inReplyTo":"1265147814-13284-2-git-send-email-warthog9@eaglescrag.net","subject":"[PATCH 2/2] gitweb: Fix chop_str to allow for & characters in strings","fromName":"John 'Warthog9' Hawley","fromEmail":"warthog9@eaglescrag.net","sentAt":"2010-02-02T21:56:54Z","receivedAt":"2010-02-02T21:56:54Z","isPatch":true,"sender":{"key":"warthog9@kernel.org","avatar":"https://avatars.githubusercontent.com/u/2334704?v=4"},"body":"I'm unsure why this was placed in their originally, and it seems to\nultimately stem from code from before gitweb was merged into git core,\nbut there's an instance where git chops a string incorrectly based on\nthis.\n\nSpecifically:\n\n\tAPI & protocol: support option to force written data immediately to disk\n\nfrom http://git.kernel.org/?p=daemon/distsrv/chunkd.git;a=commit;h=3b02f749df2cb1288f345a689d85e7061f507e54\n\nThe short version of the title gets chopped to\n\n\tAPI ...\n\nwhere it should be\n\n\tAPI & protocol: support option to force written data...\n\nThis reverts that specific problem.\n---\n gitweb/gitweb.perl |    1 -\n 1 files changed, 0 insertions(+), 1 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 57771a0..4cc6d19 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1382,7 +1382,6 @@ sub chop_str {\n \t\tmy $body = $1;\n \t\tmy $tail = $2;\n \t\tif (length($tail) > 4) {\n-\t\t\t$body =~ s/&[^;]*$//;\n \t\t\t$tail = \"... \";\n \t\t}\n \t\treturn \"$body$tail\";\n-- \n1.6.6\n"},{"id":"133413","messageId":"7vvdef1by2.fsf@alter.siamese.dyndns.org","threadId":"22496","inReplyTo":"1265147814-13284-2-git-send-email-warthog9@eaglescrag.net","subject":"Re: [PATCH 1/2] gitweb: Add an option to force version match","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-02-02T22:59:17Z","receivedAt":"2010-02-02T22:59:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"John 'Warthog9' Hawley\" <warthog9@eaglescrag.net> writes:\n\nJohn, I'm sorry but I have to say this is somewhat incoherent.\n\n> + * $git_versions_must_match\n> +   If set to true value, gitweb fails with \"500 Internal Server Error\" error\n> +   if the version of the gitweb doesn't match version of the git binary.\n> +   Gitweb can usually run with a mismatched git install.   The default is 1\n> +   (true).\n\nI would understand that it if this were \"Gitweb seldom runs correctly with\nunmatched version of git, so this defaults to true\".  If it can _usually_\nrun just fine, why should everybody need to flip this off?  This doesn't\nmake any sense to me.\n\n> @@ -583,6 +586,33 @@ sub get_loadavg {\n>  our $git_version = qx(\"$GIT\" --version) =~ m/git version (.*)$/ ? $1 : \"unknown\";\n>  $number_of_git_cmds++;\n>  \n> +# Throw an error if git versions does not match, if $git_versions_must_match is true.\n> +if ($git_versions_must_match &&\n> +    $git_version ne $version) {\n> +\tmy $admin_contact =\n> +\t\tdefined $ENV{'SERVER_ADMIN'} ? \", $ENV{'SERVER_ADMIN'},\" : '';\n> +\tmy $err_msg = <<EOT;\n> +<h1 align=\"center\">*** Warning ***</h1>\n> +<p>\n> +This version of gitweb was compiled for <b>@{[esc_html($version)]}</b>,\n> +however git version <b>@{[esc_html($git_version)]}</b> was found on server.\n> +Running an instance of gitweb that is not matched to the git binaries may\n> +result in unexpected behavior of gitweb, and loss of functionality or\n> +incorrect data on displayed pages.\n> +</p>\n> +<p>\n> +Please update the git or gitweb installation so that their versions match, or\n> +if you feel you are sure that you wish to proceed with running gitweb\n> +with unmatched versions please contact the server administrator${admin_contact}\n> +to configure gitweb to allow mismatched versions.  This can be done by\n> +setting \\$git_versions_must_match to @{[esc_html($git_versions_must_match)]}\n> +(false value) in gitweb configuration file,\n> +'@{[esc_path(-e $GITWEB_CONFIG ? $GITWEB_CONFIG : $GITWEB_CONFIG_SYSTEM)]}'.\n> +</p>\n> +EOT\n> +\tdie_error(500, 'Internal server error', $err_msg);\n\nWhy, why, why?\n\nThis is not even a \"*** Warning ***\".  You are refusing to let them do\nanything useful until they either flip the bit off or reinstall git and/or\ngitweb.  It is a _fatal error_ message.\n\nTo whom are you giving this _warning_?  Please read the message yourself\nagain.\n\nThe message tells _you_ to consider using matching versions (as if _you_\nhave the choice and authority to do so), hints _you_ to decide if you are\nOk with running an unmatched combination (again, as if _you_ have the\nauthority to make that decision), and then instructs _you_ to contact the\nserver administrator (who presumably can flip the bit).\n\nThat doesn't make _any_ sense to me.  Hopefully anybody who installs or\nupgrades gitweb/git will hit his gitweb installation at least once before\nend users start hitting, so I would understand it if you wrote the above\nmessage addressed to the server administrator.\n\nIf somebody updates his git without bothering to update gitweb, on the\nother hand, the end user may see the message before the administrator\ndoes.  If git and gitweb might be managed by different people at a\nparticular site (k.org?), I would understand that the administrator of the\ngitweb side _might_ want to be told about it by the end user, and the\nabove might be an attempt to make that happen.\n\nBut even in that case, out of the three instructions, only the last one is\nfor the end user, and telling him to be certain the combinations do work\nbefore bugging the gitweb administrator doesn't make much sense to me.\n\nSo I have to ask a basic question I asked (at least I tried to) last night\nagain.  Whom are you trying to help?\n\nEven if it is to help a gitweb administrator who is not in charge of other\npeople in the administrator group who would install unmatching versions of\ngit without telling him, would this really be the best solution?  You'd be\nthe first to suffer from this when HPA or whoever installs a new version\nof git at k.org.  There should be a better way to help communication\nbetween the people in the administration group, without involving or\ninconveniencing the end users like this patch seems to do.\n"},{"id":"133420","messageId":"m3mxzr9pcz.fsf@localhost.localdomain","threadId":"22496","inReplyTo":"1265147814-13284-3-git-send-email-warthog9@eaglescrag.net","subject":"Re: [PATCH 2/2] gitweb: Fix chop_str to allow for & characters in strings","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-02-02T23:43:01Z","receivedAt":"2010-02-02T23:43:01Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"\"John 'Warthog9' Hawley\" <warthog9@eaglescrag.net> writes:\n\n> I'm unsure why this was placed in their originally, and it seems to\n> ultimately stem from code from before gitweb was merged into git core,\n> but there's an instance where git chops a string incorrectly based on\n> this.\n> \n> Specifically:\n> \n> \tAPI & protocol: support option to force written data immediately to disk\n> \n> from http://git.kernel.org/?p=daemon/distsrv/chunkd.git;a=commit;h=3b02f749df2cb1288f345a689d85e7061f507e54\n> \n> The short version of the title gets chopped to\n> \n> \tAPI ...\n> \n> where it should be\n> \n> \tAPI & protocol: support option to force written data...\n> \n> This reverts that specific problem.\n> ---\n>  gitweb/gitweb.perl |    1 -\n>  1 files changed, 0 insertions(+), 1 deletions(-)\n> \n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index 57771a0..4cc6d19 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -1382,7 +1382,6 @@ sub chop_str {\n>  \t\tmy $body = $1;\n>  \t\tmy $tail = $2;\n>  \t\tif (length($tail) > 4) {\n> -\t\t\t$body =~ s/&[^;]*$//;\n>  \t\t\t$tail = \"... \";\n>  \t\t}\n>  \t\treturn \"$body$tail\";\n\nI think it is a good change.  chop_str is meant to be used _before_\nHTML escaping (esc_html or equivalent) is to be applied; removed line\nlooks like it was meant (badly) to always remove HTML entities\nfully... but those entities are only added later.\n\nSo now what is left is to come up with proper commit message, and add\n\nSigned-off-by: John 'Warthog9' Hawley\" <warthog9@kernel.org>\nAcked-by: Jakub Narebski <jnareb@gmail.com>\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"133425","messageId":"4B68BB4D.20105@eaglescrag.net","threadId":"22496","inReplyTo":"m3mxzr9pcz.fsf@localhost.localdomain","subject":"Re: [PATCH 2/2] gitweb: Fix chop_str to allow for & characters in strings","fromName":"J.H.","fromEmail":"warthog9@eaglescrag.net","sentAt":"2010-02-02T23:54:53Z","receivedAt":"2010-02-02T23:54:53Z","isPatch":true,"sender":{"key":"warthog9@kernel.org","avatar":"https://avatars.githubusercontent.com/u/2334704?v=4"},"body":"On 02/02/2010 03:43 PM, Jakub Narebski wrote:\n> \"John 'Warthog9' Hawley\" <warthog9@eaglescrag.net> writes:\n> \n>> I'm unsure why this was placed in their originally, and it seems to\n>> ultimately stem from code from before gitweb was merged into git core,\n>> but there's an instance where git chops a string incorrectly based on\n>> this.\n>>\n>> Specifically:\n>>\n>> \tAPI & protocol: support option to force written data immediately to disk\n>>\n>> from http://git.kernel.org/?p=daemon/distsrv/chunkd.git;a=commit;h=3b02f749df2cb1288f345a689d85e7061f507e54\n>>\n>> The short version of the title gets chopped to\n>>\n>> \tAPI ...\n>>\n>> where it should be\n>>\n>> \tAPI & protocol: support option to force written data...\n>>\n>> This reverts that specific problem.\n>> ---\n>>  gitweb/gitweb.perl |    1 -\n>>  1 files changed, 0 insertions(+), 1 deletions(-)\n>>\n>> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n>> index 57771a0..4cc6d19 100755\n>> --- a/gitweb/gitweb.perl\n>> +++ b/gitweb/gitweb.perl\n>> @@ -1382,7 +1382,6 @@ sub chop_str {\n>>  \t\tmy $body = $1;\n>>  \t\tmy $tail = $2;\n>>  \t\tif (length($tail) > 4) {\n>> -\t\t\t$body =~ s/&[^;]*$//;\n>>  \t\t\t$tail = \"... \";\n>>  \t\t}\n>>  \t\treturn \"$body$tail\";\n> \n> I think it is a good change.  chop_str is meant to be used _before_\n> HTML escaping (esc_html or equivalent) is to be applied; removed line\n> looks like it was meant (badly) to always remove HTML entities\n> fully... but those entities are only added later.\n> \n> So now what is left is to come up with proper commit message, and add\n> \n> Signed-off-by: John 'Warthog9' Hawley\" <warthog9@kernel.org>\n> Acked-by: Jakub Narebski <jnareb@gmail.com>\n> \n\nThere's a couple more lines, similar to that, ins chop_str.  The bug I\nneeded to fix didn't tickle those, so I made the smallest change\npossible.  But those should probably be looked at as well.\n\n- John 'Warthog9' Hawley\n"},{"id":"133426","messageId":"m3iqaf9oqu.fsf@localhost.localdomain","threadId":"22496","inReplyTo":"7vvdef1by2.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 1/2] gitweb: Add an option to force version match","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-02-02T23:56:36Z","receivedAt":"2010-02-02T23:56:36Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> \"John 'Warthog9' Hawley\" <warthog9@eaglescrag.net> writes:\n\n> > @@ -583,6 +586,33 @@ sub get_loadavg {\n> >  our $git_version = qx(\"$GIT\" --version) =~ m/git version (.*)$/ ? $1 : \"unknown\";\n> >  $number_of_git_cmds++;\n> >  \n> > +# Throw an error if git versions does not match, if $git_versions_must_match is true.\n> > +if ($git_versions_must_match &&\n> > +    $git_version ne $version) {\n> > +\tmy $admin_contact =\n> > +\t\tdefined $ENV{'SERVER_ADMIN'} ? \", $ENV{'SERVER_ADMIN'},\" : '';\n> > +\tmy $err_msg = <<EOT;\n> > +<h1 align=\"center\">*** Warning ***</h1>\n> > +<p>\n> > +This version of gitweb was compiled for <b>@{[esc_html($version)]}</b>,\n> > +however git version <b>@{[esc_html($git_version)]}</b> was found on server.\n> > +Running an instance of gitweb that is not matched to the git binaries may\n> > +result in unexpected behavior of gitweb, and loss of functionality or\n> > +incorrect data on displayed pages.\n> > +</p>\n> > +<p>\n> > +Please update the git or gitweb installation so that their versions match, or\n> > +if you feel you are sure that you wish to proceed with running gitweb\n> > +with unmatched versions please contact the server administrator${admin_contact}\n> > +to configure gitweb to allow mismatched versions.  This can be done by\n> > +setting \\$git_versions_must_match to @{[esc_html($git_versions_must_match)]}\n\nErrr... the above line does not makes sense, as $git_versions_must_match\nis true (true value), and not false (false value). so you would get something\nlike:\n\n  'setting $git_versions_must_match to 1 (false value) [...]'\n\n> > +(false value) in gitweb configuration file,\n> > +'@{[esc_path(-e $GITWEB_CONFIG ? $GITWEB_CONFIG : $GITWEB_CONFIG_SYSTEM)]}'.\n> > +</p>\n> > +EOT\n> > +\tdie_error(500, 'Internal server error', $err_msg);\n\nAs I wrote in my earlier response, this is not enough.  If this error\nmessage (description of this situation) is meant to describe how to turn\nthis feature off, it has to deal with situation where config file does\nnot exist.  With this feature off by default we knew that it had to be\nchanged in some gitweb config file, so one of $GITWEB_CONFIG and\n$GITWEB_CONFIG_SYSTEM must exists.  This is not true if this feature is\nturned on by default.\n\nYou need to describe how to deal with the following situations:\n\n* Both $GITWEB_CONFIG and $GITWEB_CONFIG_SYSTEM are empty or undefined.\n  You might skip this situation, as by default both are set by\n  gitweb/Makefile, $GITWEB_CONFIG to gitweb_config.perl and\n  $GITWEB_CONFIG_SYSTEM to /etc/gitweb.conf\n \n* Both $GITWEB_CONFIG and $GITWEB_CONFIG_SYSTEM are set and non-empty,\n  but neither file exists (this means that $projects_list is set during\n  build stage).\n\nCurrent code deals correctly only with situation where either\n$GITWEB_CONFIG or $GITWEB_CONFIG_SYSTEM exists, and it further assumes\nthat neither is undefined (you would get perl errors in case if either\nis undefined).\n\n> Why, why, why?\n> \n> This is not even a \"*** Warning ***\".  You are refusing to let them do\n> anything useful until they either flip the bit off or reinstall git and/or\n> gitweb.  It is a _fatal error_ message.\n\nOoops.\n\n> \n> To whom are you giving this _warning_?  Please read the message yourself\n> again.\n\nThe original message (from \"Gitweb caching v2\" thread) was ment purely\nfor server administrator.  Current version tries to address both\nordinary user (which has to contact gitweb administrator) and gitweb\nadministrator (who needs to know how to remote error condition, either\nby bringing git and gitweb versions in sync, or by changing\nconfiguration).  And does it badly...\n\n[...]\n> So I have to ask a basic question I asked (at least I tried to) last night\n> again.  Whom are you trying to help?\n[...]\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"133465","messageId":"201002031228.31324.jnareb@gmail.com","threadId":"22496","inReplyTo":"4B68BB4D.20105@eaglescrag.net","subject":"[PATCH] gitweb: Simplify (and fix) chop_str","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-02-03T11:28:28Z","receivedAt":"2010-02-03T11:28:28Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"From: John 'Warthog9' Hawley <warthog9@kernel.org>\n\nThe chop_str subroutine is meant to be used on strings (such as commit\ndescription / title) *before* HTML escaping, which means before\napplying esc_html or equivalent.\n\nTherefore get rid of the failed attempt to always remove full HTML\nentities (like e.g. &amp; or &nbsp;).  It is not necessary (HTML\nentities gets added later), and it can cause chop_str to chop a string\nincorrectly.\n\nSpecifically:\n\n     API & protocol: support option to force written data immediately to disk\n\nfrom http://git.kernel.org/?p=daemon/distsrv/chunkd.git;a=commit;h=3b02f749df2cb1288f345a689d85e7061f507e54\n\nThe short version of the title gets chopped to\n\n     API ...\n\nwhere it should be\n\n     API & protocol: support option to force written data...\n\nNoticed-by: John 'Warthog9' Hawley <warthog9@kernel.org>\nSigned-off-by: John 'Warthog9' Hawley <warthog9@kernel.org>\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nI have retained J.H. authorship of this patch.  I have rewritten\ncommit message, added signoffs, and removed all instances of failed\nattempt of removing HTML entities whole, even though only one of them\nis used.\n\n gitweb/gitweb.perl |    4 ----\n 1 files changed, 0 insertions(+), 4 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex d0c3ff2..1f6978a 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1330,7 +1330,6 @@ sub chop_str {\n \t\t$str =~ m/^(.*?)($begre)$/;\n \t\tmy ($lead, $body) = ($1, $2);\n \t\tif (length($lead) > 4) {\n-\t\t\t$body =~ s/^[^;]*;// if ($lead =~ m/&[^;]*$/);\n \t\t\t$lead = \" ...\";\n \t\t}\n \t\treturn \"$lead$body\";\n@@ -1341,8 +1340,6 @@ sub chop_str {\n \t\t$str =~ m/^(.*?)($begre)$/;\n \t\tmy ($mid, $right) = ($1, $2);\n \t\tif (length($mid) > 5) {\n-\t\t\t$left  =~ s/&[^;]*$//;\n-\t\t\t$right =~ s/^[^;]*;// if ($mid =~ m/&[^;]*$/);\n \t\t\t$mid = \" ... \";\n \t\t}\n \t\treturn \"$left$mid$right\";\n@@ -1352,7 +1349,6 @@ sub chop_str {\n \t\tmy $body = $1;\n \t\tmy $tail = $2;\n \t\tif (length($tail) > 4) {\n-\t\t\t$body =~ s/&[^;]*$//;\n \t\t\t$tail = \"... \";\n \t\t}\n \t\treturn \"$body$tail\";\n-- \n1.6.6.1\n"},{"id":"133490","messageId":"4B69BF84.8010400@eaglescrag.net","threadId":"22496","inReplyTo":"201002031228.31324.jnareb@gmail.com","subject":"Re: [PATCH] gitweb: Simplify (and fix) chop_str","fromName":"J.H.","fromEmail":"warthog9@eaglescrag.net","sentAt":"2010-02-03T18:25:08Z","receivedAt":"2010-02-03T18:25:08Z","isPatch":true,"sender":{"key":"warthog9@kernel.org","avatar":"https://avatars.githubusercontent.com/u/2334704?v=4"},"body":"This looks good to me.\n\n- John 'Warthog9' Hawley\n\nOn 02/03/2010 03:28 AM, Jakub Narebski wrote:\n> From: John 'Warthog9' Hawley <warthog9@kernel.org>\n> \n> The chop_str subroutine is meant to be used on strings (such as commit\n> description / title) *before* HTML escaping, which means before\n> applying esc_html or equivalent.\n> \n> Therefore get rid of the failed attempt to always remove full HTML\n> entities (like e.g. &amp; or &nbsp;).  It is not necessary (HTML\n> entities gets added later), and it can cause chop_str to chop a string\n> incorrectly.\n> \n> Specifically:\n> \n>      API & protocol: support option to force written data immediately to disk\n> \n> from http://git.kernel.org/?p=daemon/distsrv/chunkd.git;a=commit;h=3b02f749df2cb1288f345a689d85e7061f507e54\n> \n> The short version of the title gets chopped to\n> \n>      API ...\n> \n> where it should be\n> \n>      API & protocol: support option to force written data...\n> \n> Noticed-by: John 'Warthog9' Hawley <warthog9@kernel.org>\n> Signed-off-by: John 'Warthog9' Hawley <warthog9@kernel.org>\n> Signed-off-by: Jakub Narebski <jnareb@gmail.com>\n> ---\n> I have retained J.H. authorship of this patch.  I have rewritten\n> commit message, added signoffs, and removed all instances of failed\n> attempt of removing HTML entities whole, even though only one of them\n> is used.\n> \n>  gitweb/gitweb.perl |    4 ----\n>  1 files changed, 0 insertions(+), 4 deletions(-)\n> \n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index d0c3ff2..1f6978a 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -1330,7 +1330,6 @@ sub chop_str {\n>  \t\t$str =~ m/^(.*?)($begre)$/;\n>  \t\tmy ($lead, $body) = ($1, $2);\n>  \t\tif (length($lead) > 4) {\n> -\t\t\t$body =~ s/^[^;]*;// if ($lead =~ m/&[^;]*$/);\n>  \t\t\t$lead = \" ...\";\n>  \t\t}\n>  \t\treturn \"$lead$body\";\n> @@ -1341,8 +1340,6 @@ sub chop_str {\n>  \t\t$str =~ m/^(.*?)($begre)$/;\n>  \t\tmy ($mid, $right) = ($1, $2);\n>  \t\tif (length($mid) > 5) {\n> -\t\t\t$left  =~ s/&[^;]*$//;\n> -\t\t\t$right =~ s/^[^;]*;// if ($mid =~ m/&[^;]*$/);\n>  \t\t\t$mid = \" ... \";\n>  \t\t}\n>  \t\treturn \"$left$mid$right\";\n> @@ -1352,7 +1349,6 @@ sub chop_str {\n>  \t\tmy $body = $1;\n>  \t\tmy $tail = $2;\n>  \t\tif (length($tail) > 4) {\n> -\t\t\t$body =~ s/&[^;]*$//;\n>  \t\t\t$tail = \"... \";\n>  \t\t}\n>  \t\treturn \"$body$tail\";\n"}]}