Re: New Defects reported by Coverity Scan for PostgreSQL

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: emre(at)hasegeli(dot)com, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Ning Yu <nyu(at)pivotal(dot)io>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: New Defects reported by Coverity Scan for PostgreSQL
Date: 2018-08-02 09:43:45
Message-ID: 611f2223-cf96-b26b-a58e-f8b76b156780@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On 08/01/2018 04:07 PM, Emre Hasegeli wrote:
>> I think there are three different things that need to be addressed:
>>
>> * Underspecified comments.
>
> I agree. My patch added comments, the next one with actual fixes adds
> more. I just didn't want to invest even more time on them while the
> code is its current shape.
>
>> * The function names and argument names are badly chosen IMO, because even
>> granted a convention such as the above, it's not very obvious what roles
>> "l1" and "l2" play. I'm not exactly sure what would be better, but if you
>> used names like "ofseg" and "otherseg" you'd at least be trying. I'd go
>> with an asymmetrical function name too, to make miswriting of calls less
>> likely.
>
> Good idea. I haven't though about that, but now such names makes more
> sense to me. I will prepare another patch to improve the naming and
> comments to be applied on top of my current patches.
>
>> * And lastly, are we sure there aren't actual *bugs* here? I'd initially
>> supposed that lseg_closept_lseg acted as Emre says above, but reading the
>> code makes me think it's the other way around. Its first two potential
>> assignments to *result are definitely assigning points on l2 not l1.
>
> Yes, it is wrong beyond understanding. The committed patch intended
> to keep answers as they were. The next one actually fixes those.
>

OK, so I think we should not do anything about the issues reported by
coverity until we commit all the patches. Which may resolve some of
those (pre-existing) issues, for example.

regards

--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Kapila 2018-08-03 05:15:54 pgsql: Match the buffer usage tracking for leader and worker backends.
Previous Message Thomas Munro 2018-08-02 00:24:36 pgsql: Add missing header include to pmsignal.h.

Browse pgsql-hackers by date

  From Date Subject
Next Message Geoff Winkless 2018-08-02 09:48:42 Re: Have an encrypted pgpass file
Previous Message Geoff Winkless 2018-08-02 09:41:52 Re: Have an encrypted pgpass file