{"thread":{"id":"12032","subject":"gitweb bug: broken \"next\" and other links","startedAt":"2008-02-11T12:51:13Z","lastAt":"2008-02-19T00:23:13Z","messageCount":16,"participants":["Wincent Colaiuta","Jakub Narebski","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"68384","messageId":"B0EC9FB3-DDDE-4BC5-92D8-20487CBD6725@wincent.com","threadId":"12032","inReplyTo":null,"subject":"gitweb bug: broken \"next\" and other links","fromName":"Wincent Colaiuta","fromEmail":"win@wincent.com","sentAt":"2008-02-11T12:51:13Z","receivedAt":"2008-02-11T12:51:13Z","isPatch":false,"sender":{"key":"greg@hurrell.net","avatar":"https://avatars.githubusercontent.com/u/7074?v=4"},"body":"Just noticed a bug (possibly bugs) in gitweb.\n\nLook at a shortlog page like this one:\n\nhttp://repo.or.cz/w/git.git?a=shortlog\n\nMouse over the \"next\" link at the bottom and you'll see this is the URL:\n\nhttp://repo.or.cz/w/ARRAY(0x85a5318)?a=shortlog;pg=1\n\nWhich obviously won't work...\n\nSame if you look at the \"log\" view:\n\nhttp://repo.or.cz/w/git.git?a=log\n\nThere the \"next\" links point at URLs like:\n\nhttp://repo.or.cz/w/ARRAY(0x85e87b8)?a=log;pg=1\n\nBut it's not only \"next\" links that are broken. Some random clicking  \naround discovered ones like this:\n\nLooking at a commitdiff, eg:\n\nhttp://repo.or.cz/w/git.git?a=commitdiff;h=94bf9f7c37cca0241785a5f4e54e5cc98e175244\n\nThe \"raw\" link is:\n\nhttp://repo.or.cz/w/ARRAY(0x8579c0c)?a=commitdiff_plain;h=94bf9f7c37cca0241785a5f4e54e5cc98e175244\n\nThere may be others, but that's what I've found so far.\n\nCheers,\nWincent\n"},{"id":"68386","messageId":"m3ve4vejdr.fsf@localhost.localdomain","threadId":"12032","inReplyTo":"B0EC9FB3-DDDE-4BC5-92D8-20487CBD6725@wincent.com","subject":"Re: gitweb bug: broken \"next\" and other links","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-02-11T13:02:31Z","receivedAt":"2008-02-11T13:02:31Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Wincent Colaiuta <win@wincent.com> writes:\n\n> Just noticed a bug (possibly bugs) in gitweb.\n> \n> Look at a shortlog page like this one:\n> \n>   http://repo.or.cz/w/git.git?a=shortlog\n> \n> Mouse over the \"next\" link at the bottom and you'll see this is the URL:\n> \n>   http://repo.or.cz/w/ARRAY(0x85a5318)?a=shortlog;pg=1\n> \n> Which obviously won't work...\n\nThis is bug in repo.or.cz version of gitweb, which is slightly\nmodified as compared to the \"stock\" version. Such error would be\ncatched by the gitweb 'run as standalone script and check stderr'\ntest script.\n\nI have CC-ed Pasky.\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"68389","messageId":"0811044D-4929-494F-8189-B0B4AFE2D373@wincent.com","threadId":"12032","inReplyTo":"m3ve4vejdr.fsf@localhost.localdomain","subject":"Re: gitweb bug: broken \"next\" and other links","fromName":"Wincent Colaiuta","fromEmail":"win@wincent.com","sentAt":"2008-02-11T13:33:06Z","receivedAt":"2008-02-11T13:33:06Z","isPatch":false,"sender":{"key":"greg@hurrell.net","avatar":"https://avatars.githubusercontent.com/u/7074?v=4"},"body":"El 11/2/2008, a las 14:02, Jakub Narebski escribió:\n\n> Wincent Colaiuta <win@wincent.com> writes:\n>\n>> Just noticed a bug (possibly bugs) in gitweb.\n>>\n>> Look at a shortlog page like this one:\n>>\n>>  http://repo.or.cz/w/git.git?a=shortlog\n>>\n>> Mouse over the \"next\" link at the bottom and you'll see this is the  \n>> URL:\n>>\n>>  http://repo.or.cz/w/ARRAY(0x85a5318)?a=shortlog;pg=1\n>>\n>> Which obviously won't work...\n>\n> This is bug in repo.or.cz version of gitweb, which is slightly\n> modified as compared to the \"stock\" version. Such error would be\n> catched by the gitweb 'run as standalone script and check stderr'\n> test script.\n\nHmm. I don't know. I can reproduce all three of those bugs on my own  \nunmodified gitweb installation from 1.5.4.\n\nCheers,\nWincent\n"},{"id":"68398","messageId":"200802111630.29159.jnareb@gmail.com","threadId":"12032","inReplyTo":"0811044D-4929-494F-8189-B0B4AFE2D373@wincent.com","subject":"Re: gitweb bug: broken \"next\" and other links","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-02-11T15:30:28Z","receivedAt":"2008-02-11T15:30:28Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Dnia poniedziałek 11. lutego 2008 14:33, Wincent Colaiuta napisał:\n> El 11/2/2008, a las 14:02, Jakub Narebski escribió:\n>> Wincent Colaiuta <win@wincent.com> writes:\n>>\n>>> Just noticed a bug (possibly bugs) in gitweb.\n>>>\n>>> Look at a shortlog page like this one:\n>>>\n>>>  http://repo.or.cz/w/git.git?a=shortlog\n>>>\n>>> Mouse over the \"next\" link at the bottom and you'll see this is the  \n>>> URL:\n>>>\n>>>  http://repo.or.cz/w/ARRAY(0x85a5318)?a=shortlog;pg=1\n>>>\n>>> Which obviously won't work...\n>>\n>> This is bug in repo.or.cz version of gitweb, which is slightly\n>> modified as compared to the \"stock\" version. Such error would be\n>> catched by the gitweb 'run as standalone script and check stderr'\n>> test script.\n> \n> Hmm. I don't know. I can reproduce all three of those bugs on my own  \n> unmodified gitweb installation from 1.5.4.\n\nI'm sorry. You are right. I haven't seen breakage because it shows\nonly when you use 'pathinfo' feature and pathinfo URLs.\n\nBelow there is a fix for that; actully only second part mentioned\n(and first in patch) is needed, i.e. moving setting $params{'project'}\nbefore dealing with -replay is needed I think to fix this bug.\n\nCould you test it please?\n-- >8 --\nFrom: Jakub Narebski <jnareb@gmail.com>\nSubject: [PATCH] gitweb: Fix bug in href(..., -replay=>1) when 'pathinfo' feature used\n\nURLs generated by href(..., -replay=>1) (which includes 'next page'\nlinks and alternate view links) were not created correctly when using\n'pathinfo' feature (i.e. using pathinfo instead of query string to\ndenote project / git repository used).\n\nThis resulted in broken links such like:\n  http://www.example.com/w/ARRAY(0x85a5318)?a=shortlog;pg=1\ninstead of:\n  http://www.example.com/w/project.git?a=shortlog;pg=1\n\nThis was caused by the fact that href() always replayed params in the\narrayref form, were they multivalued or singlevalued, and the code\ndealing with 'pathinfo' feature didn't deal with $params{'project'}\nbeing arrayref.  The code was improved to use arrayref only when\nneeded; because 'project' parameter should be always single-valued\nthis fixes this bug.\n\nAdditionally setting $params{'project'} is moved before replaying\nparams, just in case somebody handcraft evil URL like the one below:\n  http://www.example.com/w/project.git?p=otherproject.git ...\n\nNoticed-by: Peter Oberndorfer <kumbayo84@arcor.de>\nNoticed-by: Wincent Colaiuta <win@wincent.com>\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n gitweb/gitweb.perl |   13 +++++++++----\n 1 files changed, 9 insertions(+), 4 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 5e88637..648ee13 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -611,17 +611,22 @@ sub href(%) {\n \t);\n \tmy %mapping = @mapping;\n \n+\t$params{'project'} = $project unless exists $params{'project'};\n+\n \tif ($params{-replay}) {\n \t\twhile (my ($name, $symbol) = each %mapping) {\n \t\t\tif (!exists $params{$name}) {\n-\t\t\t\t# to allow for multivalued params we use arrayref form\n-\t\t\t\t$params{$name} = [ $cgi->param($symbol) ];\n+\t\t\t\t# for multivalued params we use arrayref form\n+\t\t\t\tmy @par = $cgi->param($symbol);\n+\t\t\t\tif (@par > 1) {\n+\t\t\t\t\t$params{$name} = [ @par ];\n+\t\t\t\t} else {\n+\t\t\t\t\t$params{$name} = $par[0];\n+\t\t\t\t}\n \t\t\t}\n \t\t}\n \t}\n \n-\t$params{'project'} = $project unless exists $params{'project'};\n-\n \tmy ($use_pathinfo) = gitweb_check_feature('pathinfo');\n \tif ($use_pathinfo) {\n \t\t# use PATH_INFO for project name\n-- \n1.5.4\n"},{"id":"68510","messageId":"200802121239.06287.jnareb@gmail.com","threadId":"12032","inReplyTo":"200802111630.29159.jnareb@gmail.com","subject":"Re: gitweb bug: broken \"next\" and other links","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-02-12T11:39:05Z","receivedAt":"2008-02-12T11:39:05Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Mon, 11 Feb 2008, Jakub Narebski wrote:\n\n> I'm sorry. You are right. I haven't seen breakage because it shows\n> only when you use 'pathinfo' feature and pathinfo URLs.\n> \n> Below there is a fix for that; actully only second part mentioned\n> (and first in patch) is needed, i.e. moving setting $params{'project'}\n> before dealing with -replay is needed I think to fix this bug.\n> \n> Could you test it please?\n> -->8 --\n> From: Jakub Narebski <jnareb@gmail.com>\n> Subject: [PATCH] gitweb: Fix bug in href(..., -replay=>1) when 'pathinfo' feature used\n> \n> URLs generated by href(..., -replay=>1) (which includes 'next page'\n> links and alternate view links) were not created correctly when using\n> 'pathinfo' feature (i.e. using pathinfo instead of query string to\n> denote project / git repository used).\n> \n> This resulted in broken links such like:\n>   http://www.example.com/w/ARRAY(0x85a5318)?a=shortlog;pg=1\n> instead of:\n>   http://www.example.com/w/project.git?a=shortlog;pg=1\n\nActually the error is there even without using 'pathinfo' feature,\nnamely if you use pathinfo to provide project, for example:\n  http://www.example.com/w/project.git?a=shortlog\nthen 'next' link on the page lacks project (instead of having\ndereferenced anonymous array reference, i.e. ARRAY(sth)), like below\n  http://www.example.com/w/?a=shortlog;pg=1\n\nBut I could not come up with automated test which would _fail_\non this error. So please check, and reply if this patch helps.\n\n\nBelow there is hand-crafted minimal fixing patch.\n\n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index 5e88637..648ee13 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -611,17 +611,17 @@ sub href(%) {\n>  \t);\n>  \tmy %mapping = @mapping;\n>  \n> +\t$params{'project'} = $project unless exists $params{'project'};\n> +\n>  \tif ($params{-replay}) {\n>  \t\twhile (my ($name, $symbol) = each %mapping) {\n>  \t\t\tif (!exists $params{$name}) {\n>  \t\t\t\t# to allow for multivalued params we use arrayref form\n>  \t\t\t\t$params{$name} = [ $cgi->param($symbol) ];\n>  \t\t\t}\n>  \t\t}\n>  \t}\n>  \n> -\t$params{'project'} = $project unless exists $params{'project'};\n> -\n>  \tmy ($use_pathinfo) = gitweb_check_feature('pathinfo');\n>  \tif ($use_pathinfo) {\n>  \t\t# use PATH_INFO for project name\n> -- \n> 1.5.4\n> \n> \n\n-- \nJakub Narebski\nPoland\n"},{"id":"68511","messageId":"200802121248.49002.jnareb@gmail.com","threadId":"12032","inReplyTo":"200802121239.06287.jnareb@gmail.com","subject":"Re: gitweb bug: broken \"next\" and other links","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-02-12T11:48:48Z","receivedAt":"2008-02-12T11:48:48Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Jakub Narebski wrote:\n> Actually the error is there even without using 'pathinfo' feature,\n> namely if you use pathinfo to provide project, for example:\n>   http://www.example.com/w/project.git?a=shortlog\n> then 'next' link on the page lacks project (instead of having\n> dereferenced anonymous array reference, i.e. ARRAY(sth)), like below\n>   http://www.example.com/w/?a=shortlog;pg=1\n\nErrr... what I forgot to write here is that I have checked that\nthe patch send (the first version) fixes this bug, as checked\n\"by hand\", i.e. by examining gitweb running as Apache CGI module.\n\n> But I could not come up with automated test which would _fail_\n> on this error. So please check, and reply if this patch helps.\n\n-- \nJakub Narebski\nPoland\n"},{"id":"68514","messageId":"E16BED2E-C146-44D8-BD90-ECF0DF89CA35@wincent.com","threadId":"12032","inReplyTo":"200802111630.29159.jnareb@gmail.com","subject":"Re: gitweb bug: broken \"next\" and other links","fromName":"Wincent Colaiuta","fromEmail":"win@wincent.com","sentAt":"2008-02-12T12:24:29Z","receivedAt":"2008-02-12T12:24:29Z","isPatch":false,"sender":{"key":"greg@hurrell.net","avatar":"https://avatars.githubusercontent.com/u/7074?v=4"},"body":"El 11/2/2008, a las 16:30, Jakub Narebski escribió:\n\n> Dnia poniedziałek 11. lutego 2008 14:33, Wincent Colaiuta napisał:\n>> El 11/2/2008, a las 14:02, Jakub Narebski escribió:\n>>> Wincent Colaiuta <win@wincent.com> writes:\n>>>\n>>>> Just noticed a bug (possibly bugs) in gitweb.\n>>>>\n>>>> Look at a shortlog page like this one:\n>>>>\n>>>> http://repo.or.cz/w/git.git?a=shortlog\n>>>>\n>>>> Mouse over the \"next\" link at the bottom and you'll see this is the\n>>>> URL:\n>>>>\n>>>> http://repo.or.cz/w/ARRAY(0x85a5318)?a=shortlog;pg=1\n>>>>\n>>>> Which obviously won't work...\n>>>\n>>> This is bug in repo.or.cz version of gitweb, which is slightly\n>>> modified as compared to the \"stock\" version. Such error would be\n>>> catched by the gitweb 'run as standalone script and check stderr'\n>>> test script.\n>>\n>> Hmm. I don't know. I can reproduce all three of those bugs on my own\n>> unmodified gitweb installation from 1.5.4.\n>\n> I'm sorry. You are right. I haven't seen breakage because it shows\n> only when you use 'pathinfo' feature and pathinfo URLs.\n>\n> Below there is a fix for that; actully only second part mentioned\n> (and first in patch) is needed, i.e. moving setting $params{'project'}\n> before dealing with -replay is needed I think to fix this bug.\n>\n> Could you test it please?\n\nYour patch fixes the \"next\" links in the shortlog and log views.\n\nIt doesn't fix the broken \"raw\" links in the commitdiff view. I'm  \nstill seeing links like:\n\nhttp://example.com/ARRAY(0x8c97f64)?a=commitdiff_plain;h=f29d56269a1c3bd4a970897397470f41553a64f9\n\nCheers,\nWincent\n"},{"id":"68516","messageId":"200802121410.58208.jnareb@gmail.com","threadId":"12032","inReplyTo":"E16BED2E-C146-44D8-BD90-ECF0DF89CA35@wincent.com","subject":"Re: gitweb bug: broken \"next\" and other links","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-02-12T13:10:57Z","receivedAt":"2008-02-12T13:10:57Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Dnia wtorek 12. lutego 2008 13:24, Wincent Colaiuta napisał:\n> El 11/2/2008, a las 16:30, Jakub Narebski escribió:\n>>\n>> I'm sorry. You are right. I haven't seen breakage because it shows\n>> only when you use 'pathinfo' feature and pathinfo URLs.\n>>\n>> Below there is a fix for that; actully only second part mentioned\n>> (and first in patch) is needed, i.e. moving setting $params{'project'}\n>> before dealing with -replay is needed I think to fix this bug.\n>>\n>> Could you test it please?\n> \n> Your patch fixes the \"next\" links in the shortlog and log views.\n> \n> It doesn't fix the broken \"raw\" links in the commitdiff view. I'm  \n> still seeing links like:\n> \n> http://example.com/ARRAY(0x8c97f64)?a=commitdiff_plain;h=f29d56269a1c3bd4a970897397470f41553a64f9\n\nCould yu please give an URL for the page containing broken\nlink, relevant parts of gitweb configuration (gitweb_config.perl),\nand gitweb parts of repository configuration, if there are any?\n\nThis would help in reproducing this bug, and correcting it.\n-- \nJakub Narebski\nPoland\n"},{"id":"68517","messageId":"2BAB20FB-3FDF-4133-A41A-55BB2AB32603@wincent.com","threadId":"12032","inReplyTo":"200802121410.58208.jnareb@gmail.com","subject":"Re: gitweb bug: broken \"next\" and other links","fromName":"Wincent Colaiuta","fromEmail":"win@wincent.com","sentAt":"2008-02-12T13:34:49Z","receivedAt":"2008-02-12T13:34:49Z","isPatch":false,"sender":{"key":"greg@hurrell.net","avatar":"https://avatars.githubusercontent.com/u/7074?v=4"},"body":"El 12/2/2008, a las 14:10, Jakub Narebski escribió:\n\n> Dnia wtorek 12. lutego 2008 13:24, Wincent Colaiuta napisał:\n>> El 11/2/2008, a las 16:30, Jakub Narebski escribió:\n>>>\n>>> I'm sorry. You are right. I haven't seen breakage because it shows\n>>> only when you use 'pathinfo' feature and pathinfo URLs.\n>>>\n>>> Below there is a fix for that; actully only second part mentioned\n>>> (and first in patch) is needed, i.e. moving setting  \n>>> $params{'project'}\n>>> before dealing with -replay is needed I think to fix this bug.\n>>>\n>>> Could you test it please?\n>>\n>> Your patch fixes the \"next\" links in the shortlog and log views.\n>>\n>> It doesn't fix the broken \"raw\" links in the commitdiff view. I'm\n>> still seeing links like:\n>>\n>> http://example.com/ARRAY(0x8c97f64)?a=commitdiff_plain;h=f29d56269a1c3bd4a970897397470f41553a64f9\n>\n> Could yu please give an URL for the page containing broken\n> link\n\nAny commitdiff page on repo.or.cz:\n\neg.\n\nhttp://repo.or.cz/w/git.git?a=commitdiff;h=94bf9f7c37cca0241785a5f4e54e5cc98e175244\n\nAny commitdiff page on my own gitweb install:\n\neg.\n\nhttp://git.wincent.com/wikitext.git?a=commitdiff;h=f29d56269a1c3bd4a970897397470f41553a64f9\n\n> relevant parts of gitweb configuration (gitweb_config.perl),\n> and gitweb parts of repository configuration, if there are any?\n\nObviously I can't comment about the repo.or.cz config, but in my local  \ninstall gitweb was built with:\n\nmake prefix=/usr/local \\\n  GITWEB_PROJECTROOT=/pub/git/path_to_public_repos \\\n  GITWEB_LIST=/pub/git/conf/gitweb-projects \\\n  GITWEB_STRICT_EXPORT=1 \\\n  GITWEB_CSS=\"/gitweb.css\" \\\n  GITWEB_LOGO=\"/git-logo.png\" \\\n  GITWEB_FAVICON=\"/git-favicon.png\" \\\n  GITWEB_CONFIG=\"/pub/git/conf/gitweb.conf\" \\\n  gitweb/gitweb.cgi\n\nAnd gitweb.conf contains:\n\n$feature{'search'}{'default'} = [undef];\n$feature{'blame'}{'default'} = [undef];\n$feature{'pickaxe'}{'default'} = [undef];\n$feature{'grep'}{'default'} = [undef];\n$feature{'pathinfo'}{'default'} = [1];\n$my_uri = \"http://git.wincent.com\";\n$home_link = \"http://git.wincent.com/\";\n$site_name = \"git.wincent.com\";\n\nSo all pretty stock standard, I think.\n\nCheers,\nWincent\n"},{"id":"68839","messageId":"200802152216.42533.jnareb@gmail.com","threadId":"12032","inReplyTo":"E16BED2E-C146-44D8-BD90-ECF0DF89CA35@wincent.com","subject":"Re: gitweb bug: broken \"next\" and other links","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-02-15T21:16:41Z","receivedAt":"2008-02-15T21:16:41Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Tue, 12 Feb 2008, Wincent Colaiuta wrote:\n> El 11/2/2008, a las 16:30, Jakub Narebski escribió:\n\n>> Below there is a fix for that; actully only second part mentioned\n>> (and first in patch) is needed, i.e. moving setting $params{'project'}\n>> before dealing with -replay is needed I think to fix this bug.\n\nBelow there is minimal patch which I am using, which only\nmoves setting $params{'project'}, and does not affect replay.\n\n>> Could you test it please?\n> \n> Your patch fixes the \"next\" links in the shortlog and log views.\n> \n> It doesn't fix the broken \"raw\" links in the commitdiff view. I'm  \n> still seeing links like:\n> \n> http://example.com/ARRAY(0x8c97f64)?a=commitdiff_plain;h=f29d56269a1c3bd4a970897397470f41553a64f9\n\nWORKSFORME. I could not reproduce this error with the patch\nbelow applied. I think that the previous version of patch should\ngive the same result; should also fix this bug.\n\nBesides, both \"next\" and \"raw\" links are generated using the same\nmechanism. It would be strange if one of them broke and other didn't.\n\n-- >8 --\nFrom: Jakub Narebski <jnareb@gmail.com>\nDate: Thu, 14 Feb 2008 09:22:30 +0100\nSubject: [PATCH] gitweb: Fix bug in href(..., -replay=>1) when using 'pathinfo' form\n\nURLs generated by href(..., -replay=>1) (which includes 'next page'\nlinks and alternate view links) didn't set project info correctly\nwhen current page URL is in pathinfo form.\n\nThis resulted in broken links such like:\n  http://www.example.com/w/ARRAY(0x85a5318)?a=shortlog;pg=1\nif the 'pathinfo' feature was used, or\n  http://www.example.com/w/?a=shortlog;pg=1\nif it wasn't, instead of correct:\n  http://www.example.com/w/project.git?a=shortlog;pg=1\n\nThis was caused by the fact that href() always replays params in the\narrayref form, were they multivalued or singlevalued, and the code\ndealing with 'pathinfo' feature couldn't deal with $params{'project'}\nbeing arrayref.\n\nSetting $params{'project'} is moved before replaying params; this\nensures that 'project' parameter is processed correctly.\n\nNoticed-by: Peter Oberndorfer <kumbayo84@arcor.de>\nNoticed-by: Wincent Colaiuta <win@wincent.com>\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n gitweb/gitweb.perl |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 5e88637..a89b478 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -611,6 +611,8 @@ sub href(%) {\n \t);\n \tmy %mapping = @mapping;\n \n+\t$params{'project'} = $project unless exists $params{'project'};\n+\n \tif ($params{-replay}) {\n \t\twhile (my ($name, $symbol) = each %mapping) {\n \t\t\tif (!exists $params{$name}) {\n@@ -620,8 +622,6 @@ sub href(%) {\n \t\t}\n \t}\n \n-\t$params{'project'} = $project unless exists $params{'project'};\n-\n \tmy ($use_pathinfo) = gitweb_check_feature('pathinfo');\n \tif ($use_pathinfo) {\n \t\t# use PATH_INFO for project name\n-- \n1.5.4\n"},{"id":"68974","messageId":"C8D96592-DD9C-47D3-93AB-3F74719F4D46@wincent.com","threadId":"12032","inReplyTo":"200802152216.42533.jnareb@gmail.com","subject":"Re: gitweb bug: broken \"next\" and other links","fromName":"Wincent Colaiuta","fromEmail":"win@wincent.com","sentAt":"2008-02-17T10:51:17Z","receivedAt":"2008-02-17T10:51:17Z","isPatch":false,"sender":{"key":"greg@hurrell.net","avatar":"https://avatars.githubusercontent.com/u/7074?v=4"},"body":"El 15/2/2008, a las 22:16, Jakub Narebski escribió:\n\n> On Tue, 12 Feb 2008, Wincent Colaiuta wrote:\n>> El 11/2/2008, a las 16:30, Jakub Narebski escribió:\n>\n>>> Below there is a fix for that; actully only second part mentioned\n>>> (and first in patch) is needed, i.e. moving setting  \n>>> $params{'project'}\n>>> before dealing with -replay is needed I think to fix this bug.\n>\n> Below there is minimal patch which I am using, which only\n> moves setting $params{'project'}, and does not affect replay.\n>\n>>> Could you test it please?\n>>\n>> Your patch fixes the \"next\" links in the shortlog and log views.\n>>\n>> It doesn't fix the broken \"raw\" links in the commitdiff view. I'm\n>> still seeing links like:\n>>\n>> http://example.com/ARRAY(0x8c97f64)?a=commitdiff_plain;h=f29d56269a1c3bd4a970897397470f41553a64f9\n>\n> WORKSFORME. I could not reproduce this error with the patch\n> below applied. I think that the previous version of patch should\n> give the same result; should also fix this bug.\n>\n> Besides, both \"next\" and \"raw\" links are generated using the same\n> mechanism. It would be strange if one of them broke and other didn't.\n\nJust re-tested again, this time applying on top of 1.5.4.2 and  \ndefinitely doesn't work for me.\n\nThe \"next\" links are fixed, the \"raw\" links still exhibit the same  \nproblem.\n\neg. here's a commitdiff page with a broken \"raw\" link from my  \ninstallation:\n\nhttp://git.wincent.com/wikitext.git?a=commitdiff;h=03b8fda6594aa7e6fab3b95b66a4f3c178d6a156\n\nAnd here's a shortlog page with now-working \"next\" links:\n\nhttp://git.wincent.com/wikitext.git?a=shortlog;h=03b8fda6594aa7e6fab3b95b66a4f3c178d6a156\n\nCheers,\nWincent\n"},{"id":"68975","messageId":"7vtzk7268o.fsf@gitster.siamese.dyndns.org","threadId":"12032","inReplyTo":"C8D96592-DD9C-47D3-93AB-3F74719F4D46@wincent.com","subject":"Re: gitweb bug: broken \"next\" and other links","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-02-17T11:05:11Z","receivedAt":"2008-02-17T11:05:11Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Wincent Colaiuta <win@wincent.com> writes:\n\n> ...\n> Just re-tested again, this time applying on top of 1.5.4.2 and  \n> definitely doesn't work for me.\n\n<tongue-in-cheek>\n\nGee, don't you people have anything better to do than tracking\njust-off-the-press git updates?\n\n</tongue-in-cheek>\n\nThanks for your continued support and bug reports ;-).\n"},{"id":"69214","messageId":"200802190032.36712.jnareb@gmail.com","threadId":"12032","inReplyTo":"C8D96592-DD9C-47D3-93AB-3F74719F4D46@wincent.com","subject":"Re: gitweb bug: broken \"next\" and other links","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-02-18T23:32:36Z","receivedAt":"2008-02-18T23:32:36Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Dnia niedziela 17. lutego 2008 11:51, Wincent Colaiuta napisał:\n> El 15/2/2008, a las 22:16, Jakub Narebski escribió:\n> >\n> > WORKSFORME. I could not reproduce this error with the patch\n> > below applied. I think that the previous version of patch should\n> > give the same result; should also fix this bug.\n> >\n> > Besides, both \"next\" and \"raw\" links are generated using the same\n> > mechanism. It would be strange if one of them broke and other didn't.\n> \n> Just re-tested again, this time applying on top of 1.5.4.2 and  \n> definitely doesn't work for me.\n> \n> The \"next\" links are fixed, the \"raw\" links still exhibit the same  \n> problem.\n> \n> eg. here's a commitdiff page with a broken \"raw\" link from my  \n> installation:\n> \n> http://git.wincent.com/wikitext.git?a=commitdiff;h=03b8fda6594aa7e6fab3b95b66a4f3c178d6a156\n> \n> And here's a shortlog page with now-working \"next\" links:\n> \n> http://git.wincent.com/wikitext.git?a=shortlog;h=03b8fda6594aa7e6fab3b95b66a4f3c178d6a156\n\nCould you reproduce this error with git.git repository (after any of\nthe two patches, but please tell which)? Please provide an URL to the\npage, and fragment of HTML with wrong link.\n\nBTW. I have just checked above link, and the \"raw\" link is most\ncertainly not broken. Were you using updated gitweb (with patch),\nand reloaded page?\n\n\nJunio, would you consider applying one of those patches? Any of them\nshould fix the bug; the second one is less intrusive.\n-- \nJakub Narebski\nPoland\n"},{"id":"69215","messageId":"7v8x1hom3n.fsf@gitster.siamese.dyndns.org","threadId":"12032","inReplyTo":"200802190032.36712.jnareb@gmail.com","subject":"Re: gitweb bug: broken \"next\" and other links","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-02-18T23:56:12Z","receivedAt":"2008-02-18T23:56:12Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n> Junio, would you consider applying one of those patches? Any of them\n> should fix the bug; the second one is less intrusive.\n\nSurely.\n\nBy \"the second one\" do you mean this one?\n\n    Subject: [PATCH] gitweb: Add new option -nohtml to quot_xxx subroutines\n    Date: Sun, 17 Feb 2008 18:48:13 +0100\n    Message-ID: <20080217174812.30454.86822.stgit@localhost.localdomain>\n"},{"id":"69218","messageId":"FFA9B31C-F8B1-4844-8247-8AAACD547BE1@wincent.com","threadId":"12032","inReplyTo":"200802190032.36712.jnareb@gmail.com","subject":"Re: gitweb bug: broken \"next\" and other links","fromName":"Wincent Colaiuta","fromEmail":"win@wincent.com","sentAt":"2008-02-19T00:23:04Z","receivedAt":"2008-02-19T00:23:04Z","isPatch":false,"sender":{"key":"greg@hurrell.net","avatar":"https://avatars.githubusercontent.com/u/7074?v=4"},"body":"El 19/2/2008, a las 0:32, Jakub Narebski escribió:\n\n> Dnia niedziela 17. lutego 2008 11:51, Wincent Colaiuta napisał:\n>> El 15/2/2008, a las 22:16, Jakub Narebski escribió:\n>>>\n>>> WORKSFORME. I could not reproduce this error with the patch\n>>> below applied. I think that the previous version of patch should\n>>> give the same result; should also fix this bug.\n>>>\n>>> Besides, both \"next\" and \"raw\" links are generated using the same\n>>> mechanism. It would be strange if one of them broke and other  \n>>> didn't.\n>>\n>> Just re-tested again, this time applying on top of 1.5.4.2 and\n>> definitely doesn't work for me.\n>>\n>> The \"next\" links are fixed, the \"raw\" links still exhibit the same\n>> problem.\n>>\n>> eg. here's a commitdiff page with a broken \"raw\" link from my\n>> installation:\n>>\n>> http://git.wincent.com/wikitext.git?a=commitdiff;h=03b8fda6594aa7e6fab3b95b66a4f3c178d6a156\n>>\n>> And here's a shortlog page with now-working \"next\" links:\n>>\n>> http://git.wincent.com/wikitext.git?a=shortlog;h=03b8fda6594aa7e6fab3b95b66a4f3c178d6a156\n>\n> Could you reproduce this error with git.git repository (after any of\n> the two patches, but please tell which)? Please provide an URL to the\n> page, and fragment of HTML with wrong link.\n>\n> BTW. I have just checked above link, and the \"raw\" link is most\n> certainly not broken. Were you using updated gitweb (with patch),\n> and reloaded page?\n\nWell I'll be darned. Looks like my browser (Safari) was showing me an  \nolder version of the commitdiff page. Crazy browser.\n\nI had confirmed that both links were not working, then applied your  \npatch, then reloaded both pages (or so I thought) and saw that the  \ncommitdiff page was still broken.\n\nI went through this cycle at least twice (once when you first the  \npatch, and again days later when I reapplied and retested) and both  \ntimes got the same results.\n\nBut now having left the server alone (patch still applied) I revisit  \nthe link and you're right: it works.\n\nSorry for the confusion and thanks for fixing the bug. Darn browser.\n\nCheers,\nWincent\n"},{"id":"69217","messageId":"200802190123.14112.jnareb@gmail.com","threadId":"12032","inReplyTo":"7v8x1hom3n.fsf@gitster.siamese.dyndns.org","subject":"Re: gitweb bug: broken \"next\" and other links","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-02-19T00:23:13Z","receivedAt":"2008-02-19T00:23:13Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Junio C Hamano wrote:\n> Jakub Narebski <jnareb@gmail.com> writes:\n> \n> > Junio, would you consider applying one of those patches? Any of them\n> > should fix the bug; the second one is less intrusive.\n> \n> Surely.\n> \n> By \"the second one\" do you mean this one?\n> \n>     Subject: [PATCH] gitweb: Add new option -nohtml to quot_xxx subroutines\n>     Date: Sun, 17 Feb 2008 18:48:13 +0100\n>     Message-ID: <20080217174812.30454.86822.stgit@localhost.localdomain>\n\nThe above is purely meant to further enhance 850b90a51d5\n  gitweb: Fix displaying unchopped argument in chop_and_escape_str\n\n\nNo, I meant:\n  Subject: [PATCH] gitweb: Fix bug in href(..., -replay=>1) when 'pathinfo' feature used\n  Date: Thu, 14 Feb 2008 09:22:30 +0100\n  Message-Id: <200802152216.42533.jnareb@gmail.com>\n\nIt is inside other email (Re: gitweb bug: broken \"next\" and other links),\nso I can resend it...\n\n-- \nJakub Narebski\nPoland\n"}]}