{"thread":{"id":"53322","subject":"[PATCH] commit:fix use of uninitialized value [...] in server log","startedAt":"2020-04-25T20:43:21Z","lastAt":"2020-04-25T20:43:21Z","messageCount":1,"participants":["Raphaël Gertz via GitGitGadget"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"396268","messageId":"pull.617.git.1587847397970.gitgitgadget@gmail.com","threadId":"53322","inReplyTo":null,"subject":"[PATCH] commit:fix use of uninitialized value [...] in server log","fromName":"Raphaël Gertz via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-04-25T20:43:17Z","receivedAt":"2020-04-25T20:43:21Z","isPatch":true,"sender":{"key":"git@rapsys.eu","avatar":null},"body":"From: =?UTF-8?q?Rapha=C3=ABl=20Gertz?= <git@rapsys.eu>\n\nThis change fix the message about uninitialized value when trying to\naccess undefined hash indexes.\n\nThe error message fixed:\nUse of uninitialized value $params{\"action\"} in string eq at gitweb.cgi\nline 1377\n\nAdd myself as warning fix author.\n\nSigned-off-by: Raphaël Gertz <git@rapsys.eu>\n---\n    gitweb: fix tests on uninitialized hash indexes to avoid uninitialized\n    value warnings in server log\n    \n    It's happened that I tried to solve lots of meaningless warnings in web\n    server error log.\n    \n    I think it makes no sense to spam error log with warnings about\n    uninitialized value when trying to run careless tests on undefined hash\n    indexes.\n    \n    This is a simple fix that I did long ago that check carefully the index\n    before running tests on it.\n    \n    I added myself as warning fix author as well.\n    \n    My goal is to avoid re-applying the patch on each distribution update.\n    \n    The warning message fixed in web server error log : Use of uninitialized\n    value $params{\"action\"} in string eq at gitweb.cgi line 1377\n    \n    Raphaël Gertz: gitweb/README: add myself as warning fix author\n    gitweb/gitweb.perl: fix careless test on undefined hash indexes\n    \n     gitweb/README | 3 +++ gitweb/gitweb.perl | 4 ++-- 2 files changed, 5\n    insertions(+), 2 deletions(-)\n    \n    Signed-off-by: Raphaël Gertz git@rapsys.eu [git@rapsys.eu]\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-617%2Frapsys%2Fmaint-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-617/rapsys/maint-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/617\n\n gitweb/README      | 3 +++\n gitweb/gitweb.perl | 4 ++--\n 2 files changed, 5 insertions(+), 2 deletions(-)\n\ndiff --git a/gitweb/README b/gitweb/README\nindex 471dcfb691b..8964478a3fc 100644\n--- a/gitweb/README\n+++ b/gitweb/README\n@@ -66,5 +66,8 @@ AUTHORS\n Originally written by:\n   Kay Sievers <kay.sievers@vrfy.org>\n \n+Perl warning fix:\n+  Raphaël Gertz <git@rapsys.eu>\n+\n Any comment/question/concern to:\n   Git mailing list <git@vger.kernel.org>\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 65a3a9e62e8..76e71259824 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1406,7 +1406,7 @@ sub href {\n \n \t\t# since we destructively absorb parameters, we keep this\n \t\t# boolean that remembers if we're handling a snapshot\n-\t\tmy $is_snapshot = $params{'action'} eq 'snapshot';\n+\t\tmy $is_snapshot = defined $params{'action'} && $params{'action'} eq 'snapshot';\n \n \t\t# Summary just uses the project path URL, any other action is\n \t\t# added to the URL\n@@ -5998,7 +5998,7 @@ sub git_history_body {\n \t\t      $cgi->a({-href => href(action=>$ftype, hash_base=>$commit, file_name=>$file_name)}, $ftype) . \" | \" .\n \t\t      $cgi->a({-href => href(action=>\"commitdiff\", hash=>$commit)}, \"commitdiff\");\n \n-\t\tif ($ftype eq 'blob') {\n+\t\tif (defined $ftype && $ftype eq 'blob') {\n \t\t\tprint \" | \" .\n \t\t\t      $cgi->a({-href => href(action=>\"blob_plain\", hash_base=>$commit, file_name=>$file_name)}, \"raw\");\n \n\nbase-commit: af6b65d45ef179ed52087e80cb089f6b2349f4ec\n-- \ngitgitgadget\n"}]}