{"id":381499,"date":"2024-06-29T03:42:08","date_gmt":"2024-06-29T03:42:08","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=381499"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=381499","title":{"rendered":"<span>A bug report&#8217;s adventure<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>We are often asked whether we send bug reports to developers of open-source projects. The answer is yes. More than that\u2014 we sometimes track the progress. This article is about one of the cases when this habit prevented a sloppy bug fix.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/7b9\/9fe\/998\/7b99fe9988fbab3ac04f914559293bf7.png\" alt=\"0921_destiny_of_a_bug_report\/image1.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/7b9\/9fe\/998\/7b99fe9988fbab3ac04f914559293bf7.png\"\/><\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"introduction\">Introduction<\/h2>\n<p>  <\/p>\n<p>We all know that it&#8217;s important to report bugs. Everybody likes when software works quickly, correctly, and stably. However, not everyone checks in on their bug report after sending one. But if you participate a bit more, you can hasten the bugfix or even help fix more than originally intended.<\/p>\n<p>  <\/p>\n<p>The point being \u2014 a couple of months ago we published an article with <a href=\"https:\/\/pvs-studio.com\/en\/blog\/posts\/cpp\/0893\/\">the Chromium project check<\/a> results. Then I sent a <a href=\"https:\/\/bugs.chromium.org\/p\/chromium\/issues\/detail?id=1275942\">bug report<\/a> to the developers. But it did not go as smoothly as I wanted it to \u2013 otherwise I wouldn&#8217;t have needed to write this note. So what went wrong?<\/p>\n<p>  <\/p>\n<blockquote><p><strong>Disclaimer:<\/strong><br \/>  everybody makes mistakes. I highly respect Chromium developers and the work they do. It was just an interesting case I used as an example \ud83d\ude42<\/p><\/blockquote>\n<p>I appreciate how quickly the developers fix the bugs detected. Despite the huge list of open issues, they processed my report the same day, and even committed a fix. <a href=\"https:\/\/pvs-studio.com\/en\/blog\/posts\/cpp\/0900\/\">Sometimes it happens differently<\/a>.<\/p>\n<p>  <\/p>\n<p>Before we start, let&#8217;s look at this error once again (case N8 from <a href=\"https:\/\/pvs-studio.com\/en\/blog\/posts\/cpp\/0893\/#ID9618F50563\">the original article<\/a>):<\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/pvs-studio.com\/en\/docs\/warnings\/v501\/\">V501<\/a> There are identical sub-expressions &#8216;file.MatchesExtension(L&#187;.xlsb&#187;)&#8217; to the left and to the right of the &#8216;||&#8217; operator. download_type_util.cc 60<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">ClientDownloadRequest::DownloadType GetDownloadType(const base::FilePath&amp; file) {   ....   if (file.MatchesExtension(FILE_PATH_LITERAL(\".apk\")))     return ClientDownloadRequest::ANDROID_APK;   ....   else if (file.MatchesExtension(FILE_PATH_LITERAL(\".pdf\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".doc\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".docx\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".docm\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".docb\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".dot\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".dotm\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".dotx\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".xls\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".xlsb\")) ||    \/\/ &lt;=            file.MatchesExtension(FILE_PATH_LITERAL(\".xlt\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".xlm\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".xlsx\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".xldm\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".xltx\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".xltm\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".xlsb\")) ||    \/\/ &lt;=            file.MatchesExtension(FILE_PATH_LITERAL(\".xla\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".xlam\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".xll\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".xlw\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".ppt\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".pot\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".pps\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".pptx\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".pptm\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".potx\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".potm\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".ppam\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".ppsx\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".ppsm\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".sldx\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".xldm\")) ||            file.MatchesExtension(FILE_PATH_LITERAL(\".rtf\")))     return ClientDownloadRequest::DOCUMENT;   .... }<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"lets-get-to-the-point\">Let&#8217;s get to the point<\/h2>\n<p>  <\/p>\n<p>When I checked my e-mail, I saw a notification that the developers made a commit for my bug report. Hm\u2026 In just one day? My curiosity made me look what was going on. And for good reason\u2026 <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/8b3\/9d4\/9f6\/8b39d49f6f2771c9db18fe387c4e5cdc.png\" alt=\"0921_destiny_of_a_bug_report\/image3.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/8b3\/9d4\/9f6\/8b39d49f6f2771c9db18fe387c4e5cdc.png\"\/><\/p>\n<p>  <\/p>\n<p>When describing one of the errors in that article, I covered the problem partly and left the rest for developers to figure out for themselves. My teammates had warned me about this situation and problems it might cause. You can see the result above \u2014 the fix that the developers applied is highlighted in red. Note the items highlighted in yellow \u2013 these are duplicate values the developers needed to find additionally.<\/p>\n<p>  <\/p>\n<p>Looks like the developers quickly fixed the code and had no extra time to delve into the article. Well, I need to take this into account next time\u2026 <\/p>\n<p>  <\/p>\n<p>Of course, I immediately <a href=\"https:\/\/bugs.chromium.org\/p\/chromium\/issues\/detail?id=1275942#c6\">contacted<\/a> the developers and pointed out the additional value to check\/remove.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/d91\/3a3\/8cd\/d913a38cd06e0c6d54639a0b4bcbe45f.png\" alt=\"0921_destiny_of_a_bug_report\/image4.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/d91\/3a3\/8cd\/d913a38cd06e0c6d54639a0b4bcbe45f.png\"\/><\/p>\n<p>  <\/p>\n<p>Well, now the bug is <a href=\"https:\/\/chromium.googlesource.com\/chromium\/src\/+\/d728320e\">correctly fixed<\/a> correctly and we can discuss whether it was possible to avoid this problem at all. <\/p>\n<p>  <\/p>\n<p>On the one hand, Chromium developers have enough work already. Carefully reading other people&#8217;s articles to find additional problems is probably not the thing they get paid for. On the other hand, the code quality suffers. It&#8217;s really hard to notice an error in the example above, even if you know it&#8217;s definitely there. Oh, if only there was a way to catch these errors\u2026 Wait, I know one! <\/p>\n<p>  <\/p>\n<p>I&#8217;m not sure about the classic code review (after all, the code got into the repository), but most static analyzers would have found this error. At least, they should, because that&#8217;s exactly the point of static code analysis \u2013 to search for errors in newly written or modified code.<\/p>\n<p>  <\/p>\n<p>Someone might say that you just need to pay more attention and structure the code well. The advice is good, but, unfortunately, in real projects it is not always possible. Maybe I didn&#8217;t mention some other options\u2026 Let&#8217;s discuss them in the comments!<\/p>\n<p>  <\/p>\n<p>By the way, we already had a similar case \u2014 with the <a href=\"https:\/\/github.com\/mrc-ide\/covid-sim\">CovidSim<\/a> project check. There, the developers also didn&#8217;t have enough time or resources to fix the code. You can read about this and another similar case in my teammate&#8217;s articles: &#171;<a href=\"https:\/\/pvs-studio.com\/en\/blog\/posts\/cpp\/0817\/\">How PVS-Studio prevents rash code changes<\/a>&#187; and &#171;<a href=\"https:\/\/pvs-studio.com\/en\/blog\/posts\/cpp\/0910\/\">How PVS-Studio prevents rash code changes, example N2<\/a>&#171;.<\/p>\n<p>  <\/p>\n<p>Do you track your bug reports to see what happens to them? How does this usually go for you? Please leave a comment below!<\/p>\n<p>  <\/p>\n<h2 id=\"additional-links\">Additional links<\/h2>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/pvs-studio.com\/en\/blog\/posts\/cpp\/0817\/\">How PVS-Studio prevents rash code changes<\/a>.<\/li>\n<li><a href=\"https:\/\/pvs-studio.com\/en\/blog\/posts\/0743\/\">How to introduce a static code analyzer in a legacy project and not to discourage the team<\/a>.<\/li>\n<li><a href=\"https:\/\/pvs-studio.com\/en\/blog\/posts\/0534\/\">Philosophy of static code analysis: we have 100 developers, the analyzer found few bugs, is analyzer useless?<\/a><\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><\/p>\n<div class=\"tm-article-poll-container\"><!--[--><\/p>\n<div class=\"tm-article-poll tm-article-poll_variant-bordered\">\n<div class=\"tm-notice tm-notice_positive tm-article-poll__notice\"><!----><\/p>\n<div class=\"tm-notice__inner\"><!----><\/p>\n<div class=\"tm-notice__content\" data-test-id=\"notice-content\"><!--[--><span>\u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u043f\u0440\u043e\u0441\u0435. <a rel=\"nofollow\" href=\"\/kek\/v1\/auth\/habrahabr\/?back=\/ru\/companies\/pvs-studio\/articles\/651889\/&#038;hl=ru\">\u0412\u043e\u0439\u0434\u0438\u0442\u0435<\/a>, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430.<\/span><!--]--><\/div>\n<\/div>\n<\/div>\n<p><!--[--><\/p>\n<div class=\"tm-article-poll__header\">Do you track your bug reports?<\/div>\n<div class=\"tm-article-poll__answers\"><!--[--><\/p>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">0% <\/span><span class=\"tm-article-poll__answer-label\">Yes<\/span><span class=\"tm-article-poll__answer-votes\">0<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 0%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent tm-article-poll__answer-percent_winning\">0% <\/span><span class=\"tm-article-poll__answer-label\">No, I just send<\/span><span class=\"tm-article-poll__answer-votes\">0<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress tm-article-poll__answer-progress_winning\" style=\"width: 0%\"><\/div>\n<\/div>\n<\/div>\n<p><!--]--><\/div>\n<div class=\"tm-article-poll__stats\"> \u041d\u0438\u043a\u0442\u043e \u0435\u0449\u0435 \u043d\u0435 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043b.   \u0412\u043e\u0437\u0434\u0435\u0440\u0436\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u043d\u0435\u0442. <\/div>\n<p><!--]--><\/div>\n<p><!--]--><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/651889\/\"> https:\/\/habr.com\/ru\/articles\/651889\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>We are often asked whether we send bug reports to developers of open-source projects. The answer is yes. More than that\u2014 we sometimes track the progress. This article is about one of the cases when this habit prevented a sloppy bug fix.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/7b9\/9fe\/998\/7b99fe9988fbab3ac04f914559293bf7.png\" alt=\"0921_destiny_of_a_bug_report\/image1.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/7b9\/9fe\/998\/7b99fe9988fbab3ac04f914559293bf7.png\"\/><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-381499","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/381499","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=381499"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/381499\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=381499"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=381499"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=381499"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}