{"thread":{"id":"53311","subject":"gitweb:fix tests on uninitialized hash indexes to avoid uninitialized value warnings in server log","startedAt":"2020-04-24T22:18:44Z","lastAt":"2020-04-24T22:18:44Z","messageCount":1,"participants":["Raphaël Gertz"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"396195","messageId":"faf4b0a3988513f0ca3745bd0564fb94@rapsys.eu","threadId":"53311","inReplyTo":null,"subject":"gitweb:fix tests on uninitialized hash indexes to avoid uninitialized value warnings in server log","fromName":"Raphaël Gertz","fromEmail":"git@rapsys.eu","sentAt":"2020-04-24T21:59:52Z","receivedAt":"2020-04-24T22:18:44Z","isPatch":false,"sender":{"key":"git@rapsys.eu","avatar":null},"body":"Hi,\n\nIt's happened that I tried to solve lots of meaningless warnings\nin web server error log.\n\nI think it makes no sense to spam error log with warnings about\nuninitialized value when trying to run careless tests on undefined\nhash indexes.\n\nThis is a simple fix that I did long ago that check carefully the\nindex before running tests on it.\n\nI added myself as warning fix author as well.\n\nMy goal is to avoid re-applying the patch on each distribution update.\n\nThe warning message fixed in web server error log :\nUse of uninitialized value $params{\"action\"} in string eq at gitweb.cgi\nline 1377\n\nPull request was done here against \"maint\" branch :\nhttps://github.com/gitgitgadget/git/pull/617\n\nPull request was done here against \"master\" branch if required :\nhttps://github.com/git/git/pull/767\n\nThe change patch is attached if required.\n\nMay you plz merge my change ?\n\nBest regards\n\nRaphaël Gertz <git@rapsys.eu>:\n  gitweb/README: add myself as warning fix author\n  gitweb/gitweb.perl: fix careless test on undefined hash indexes\n\n  gitweb/README      | 3 +++\n  gitweb/gitweb.perl | 4 ++--\n  2 files changed, 5 insertions(+), 2 deletions(-)\n\nSigned-off-by: Raphaël Gertz <git@rapsys.eu>\n\ndiff -urNp gitweb/gitweb.perl.orig gitweb/gitweb.perl\n--- gitweb/gitweb.perl.orig\t2019-11-14 07:39:24.244704744 +0100\n+++ gitweb/gitweb.perl\t2019-11-14 07:33:50.641602829 +0100\n@@ -1374,7 +1374,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@@ -5959,7 +5959,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 \ndiff -urNp gitweb/README.orig gitweb/README\n--- gitweb/README.orig\t2019-11-14 07:39:24.244704744 +0100\n+++ gitweb/README\t2019-11-14 07:33:50.641602829 +0100\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>\n"}]}