{"thread":{"id":"22557","subject":"[PATCH] gitweb: Die if there are parsing errors in config file","startedAt":"2010-02-07T09:40:16Z","lastAt":"2010-02-14T21:46:28Z","messageCount":6,"participants":["Jakub Narebski","J.H.","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"133860","messageId":"20100207093744.29846.6468.stgit@localhost.localdomain","threadId":"22557","inReplyTo":null,"subject":"[PATCH] gitweb: Die if there are parsing errors in config file","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-02-07T09:40:16Z","receivedAt":"2010-02-07T09:40:16Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Otherwise the errors can propagate, and show in damnest places, and\nyou would spend your time chasing ghosts instead of debugging real\nproblem (yes, it is from personal experience).\n\nThis follows (parts of) advice in `perldoc -f do` documentation.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nThis is fallout from my work on [split] \"Gitweb output caching\" series.\nBefore I used `die $@ if $@;' in t/t9503/test_cache_interface.pl, tests\nfailed for no discernable reason...\n\nSo I think the same should be done for the gitweb config file.\n\n gitweb/gitweb.perl |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 1f6978a..a5bc359 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -556,6 +556,8 @@ if (-e $GITWEB_CONFIG) {\n \tour $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || \"++GITWEB_CONFIG_SYSTEM++\";\n \tdo $GITWEB_CONFIG_SYSTEM if -e $GITWEB_CONFIG_SYSTEM;\n }\n+# die if there are errors parsing config file\n+die $@ if $@;\n \n # Get loadavg of system, to compare against $maxload.\n # Currently it requires '/proc/loadavg' present to get loadavg;\n"},{"id":"133864","messageId":"4B6E9BBB.4000904@eaglescrag.net","threadId":"22557","inReplyTo":"20100207093744.29846.6468.stgit@localhost.localdomain","subject":"Re: [PATCH] gitweb: Die if there are parsing errors in config file","fromName":"J.H.","fromEmail":"warthog19@eaglescrag.net","sentAt":"2010-02-07T10:53:47Z","receivedAt":"2010-02-07T10:53:47Z","isPatch":true,"sender":{"key":"warthog19@eaglescrag.net","avatar":null},"body":"I'd sign-off that, I've probably run into it a couple of times myself.\n\n- John 'Warthog9' Hawley\n\nOn 02/07/2010 01:40 AM, Jakub Narebski wrote:\n> Otherwise the errors can propagate, and show in damnest places, and\n> you would spend your time chasing ghosts instead of debugging real\n> problem (yes, it is from personal experience).\n> \n> This follows (parts of) advice in `perldoc -f do` documentation.\n> \n> Signed-off-by: Jakub Narebski <jnareb@gmail.com>\n> ---\n> This is fallout from my work on [split] \"Gitweb output caching\" series.\n> Before I used `die $@ if $@;' in t/t9503/test_cache_interface.pl, tests\n> failed for no discernable reason...\n> \n> So I think the same should be done for the gitweb config file.\n> \n>  gitweb/gitweb.perl |    2 ++\n>  1 files changed, 2 insertions(+), 0 deletions(-)\n> \n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index 1f6978a..a5bc359 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -556,6 +556,8 @@ if (-e $GITWEB_CONFIG) {\n>  \tour $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || \"++GITWEB_CONFIG_SYSTEM++\";\n>  \tdo $GITWEB_CONFIG_SYSTEM if -e $GITWEB_CONFIG_SYSTEM;\n>  }\n> +# die if there are errors parsing config file\n> +die $@ if $@;\n>  \n>  # Get loadavg of system, to compare against $maxload.\n>  # Currently it requires '/proc/loadavg' present to get loadavg;\n> \n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"133916","messageId":"201002080948.27094.jnareb@gmail.com","threadId":"22557","inReplyTo":"4B6E9BBB.4000904@eaglescrag.net","subject":"Re: [PATCH] gitweb: Die if there are parsing errors in config file","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-02-08T08:48:26Z","receivedAt":"2010-02-08T08:48:26Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Sun, 7 Feb 2010, J.H. wrote:\n\n> I'd sign-off that, I've probably run into it a couple of times myself.\n> \n> - John 'Warthog9' Hawley\n\nI think you meant ACK, not sign-off...\n \n> On 02/07/2010 01:40 AM, Jakub Narebski wrote:\n> > Otherwise the errors can propagate, and show in damnest places, and\n> > you would spend your time chasing ghosts instead of debugging real\n> > problem (yes, it is from personal experience).\n> > \n> > This follows (parts of) advice in `perldoc -f do` documentation.\n> > \n> > Signed-off-by: Jakub Narebski <jnareb@gmail.com>\n> > ---\n> > This is fallout from my work on [split] \"Gitweb output caching\" series.\n> > Before I used `die $@ if $@;' in t/t9503/test_cache_interface.pl, tests\n> > failed for no discernable reason...\n> > \n> > So I think the same should be done for the gitweb config file.\n[...]\n\n-- \nJakub Narebski\nPoland\n"},{"id":"134404","messageId":"201002130346.51968.jnareb@gmail.com","threadId":"22557","inReplyTo":"20100207093744.29846.6468.stgit@localhost.localdomain","subject":"Re: [PATCH] gitweb: Die if there are parsing errors in config file","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-02-13T02:46:49Z","receivedAt":"2010-02-13T02:46:49Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Ping!\n\nI didn't want to push for it before 1.7.0, but now that 1.7.0\nis out...\n\nOn Sun, 7 Feb 2010, Jakub Narebski wrote:\n> Otherwise the errors can propagate, and show in damnest places, and\n> you would spend your time chasing ghosts instead of debugging real\n> problem (yes, it is from personal experience).\n> \n> This follows (parts of) advice in `perldoc -f do` documentation.\n> \n> Signed-off-by: Jakub Narebski <jnareb@gmail.com>\n  Acked-by: John 'Warthog9' Hawley <warthog9@kernel.org>\n\nhttp://thread.gmane.org/gmane.comp.version-control.git/139226/focus=139230\n\n> ---\n> This is fallout from my work on [split] \"Gitweb output caching\" series.\n> Before I used `die $@ if $@;' in t/t9503/test_cache_interface.pl, tests\n> failed for no discernable reason...\n> \n> So I think the same should be done for the gitweb config file.\n> \n>  gitweb/gitweb.perl |    2 ++\n>  1 files changed, 2 insertions(+), 0 deletions(-)\n> \n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index 1f6978a..a5bc359 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -556,6 +556,8 @@ if (-e $GITWEB_CONFIG) {\n>  \tour $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || \"++GITWEB_CONFIG_SYSTEM++\";\n>  \tdo $GITWEB_CONFIG_SYSTEM if -e $GITWEB_CONFIG_SYSTEM;\n>  }\n> +# die if there are errors parsing config file\n> +die $@ if $@;\n>  \n>  # Get loadavg of system, to compare against $maxload.\n>  # Currently it requires '/proc/loadavg' present to get loadavg;\n> \n> \n\n-- \nJakub Narebski\nPoland\n"},{"id":"134569","messageId":"7v8wava55y.fsf@alter.siamese.dyndns.org","threadId":"22557","inReplyTo":"20100207093744.29846.6468.stgit@localhost.localdomain","subject":"Re: [PATCH] gitweb: Die if there are parsing errors in config file","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-02-14T21:17:13Z","receivedAt":"2010-02-14T21:17:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index 1f6978a..a5bc359 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -556,6 +556,8 @@ if (-e $GITWEB_CONFIG) {\n>  \tour $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || \"++GITWEB_CONFIG_SYSTEM++\";\n>  \tdo $GITWEB_CONFIG_SYSTEM if -e $GITWEB_CONFIG_SYSTEM;\n>  }\n> +# die if there are errors parsing config file\n> +die $@ if $@;\n\nI cannot figure out $@ from which command this if statement modifier is\nchecking when none of GITWEB_CONFIG or GITWEB_CONFIG_SYSTEM candidates is\npresent.  Neither of the \"do\" executes in such a case.  Do you end up\nchecking the result from the very first eval that checks if Time::HiRes\ncan be \"require\"d successfully?\n"},{"id":"134575","messageId":"201002142246.29478.jnareb@gmail.com","threadId":"22557","inReplyTo":"7v8wava55y.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] gitweb: Die if there are parsing errors in config file","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-02-14T21:46:28Z","receivedAt":"2010-02-14T21:46:28Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Dnia niedziela 14. lutego 2010 22:17, Junio C Hamano napisał:\n> Jakub Narebski <jnareb@gmail.com> writes:\n> \n> > diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> > index 1f6978a..a5bc359 100755\n> > --- a/gitweb/gitweb.perl\n> > +++ b/gitweb/gitweb.perl\n> > @@ -556,6 +556,8 @@ if (-e $GITWEB_CONFIG) {\n> >  \tour $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || \"++GITWEB_CONFIG_SYSTEM++\";\n> >  \tdo $GITWEB_CONFIG_SYSTEM if -e $GITWEB_CONFIG_SYSTEM;\n> >  }\n> > +# die if there are errors parsing config file\n> > +die $@ if $@;\n> \n> I cannot figure out $@ from which command this if statement modifier is\n> checking when none of GITWEB_CONFIG or GITWEB_CONFIG_SYSTEM candidates is\n> present.  Neither of the \"do\" executes in such a case.  Do you end up\n> checking the result from the very first eval that checks if Time::HiRes\n> can be \"require\"d successfully?\n\nGood catch.  There is corrected patch.\n\n-- >8 --\nSubject: [PATCH] gitweb: Die if there are parsing errors in config file\n\nOtherwise the errors can propagate, and show in damnest places, and\nyou would spend your time chasing ghosts instead of debugging real\nproblem (yes, it is from personal experience).\n\nThis follows (parts of) advice in `perldoc -f do` documentation.\n\nThis required restructoring code a bit, so we die only if we are reading\n(executing) config file.  As a side effect $GITWEB_CONFIG_SYSTEM is always\navailable, even when we use $GITWEB_CONFIG.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nProbably-Acked-by: John 'Warthog9' Hawley <warthog9@kernel.org>\n\n gitweb/gitweb.perl |    9 ++++++---\n 1 files changed, 6 insertions(+), 3 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 1f6978a..20106a4 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -550,11 +550,14 @@ 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+# die if there are errors parsing config file\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+\tdie $@ if $@;\n+} elsif (-e $GITWEB_CONFIG_SYSTEM) {\n+\tdo $GITWEB_CONFIG_SYSTEM;\n+\tdie $@ if $@;\n }\n \n # Get loadavg of system, to compare against $maxload.\n-- \n1.6.6.1\n"}]}