Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1flA9G-0005o6-AJ for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Aug 2018 09:43:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1flA9E-0004Hp-OV for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Aug 2018 09:43:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1flA9E-0004Hi-DJ for pgsql-hackers@lists.postgresql.org; Thu, 02 Aug 2018 09:43:56 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1flA9A-0000dn-Ho for pgsql-hackers@postgresql.org; Thu, 02 Aug 2018 09:43:55 +0000 Received: by mail-wr1-x444.google.com with SMTP id c13-v6so1459790wrt.1 for ; Thu, 02 Aug 2018 02:43:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ceWazubmfb3kURaCIBf1KN7Gp4PJqRmIsLlwZPjwI8k=; b=dcSlohggehSWkv804YinNDJ1rPEPWDoctaGPQmAPvV0yrq8mhqmZtDDFz+iEEQVoJ3 ytbu0B8BHnk/ZRczLRjxey4W6GTbrfYGvbxJBSxLr7UOOSmhIQ3lWdny1mJ7K8NLFanH q77W8tye/XrqxgR88P05+iWtcDaiTjjQpyEL0IoHZ6j+rP2/XQd+qA0j/TRCZAQ/4NQa WIe5Wt1djEg48sk6BXPsggDdwWMiG38Lo/HG0RXZt4w4DH53oJlINUgknFA4MSLED8rn xYXYTuf2rgI7Qu0e2U//dMVOz2cszn7Rx7745O5NQ7ObPZ9PYvB2kpUcepRZW1vfLngh Pe9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ceWazubmfb3kURaCIBf1KN7Gp4PJqRmIsLlwZPjwI8k=; b=GPJpNv2XNqVpe+PngI1RzG1TgTBqsnpptRc6BVT4LVGTBFMdjQscP/A1MaF+7NwIt4 sYM3wTwe+S5w7zBzXM5hOFKMFlNNMUcrOB3sEM3k2m7Qw6cN2FUZ/zhNaFkmHrP88ruv IRvGMp9rwXi7EK8LxvEdoZ6nvWFNGWNVuqXuLvK5MCcfN1EnyhkrxIToo+S3iEqKdIcI XfRn9ldG5ki/bq0GQ5iOdfv7PiUv9CnwJwTpNDyJA05oiKKlRRxP4lB8bx0NH0XVZlcs 0MDk+AtItuxaeWcGTMtO7IeoD4eJYwVrpBJl9Ul1CCoWGv9EfCEH3sFctZqqtSRKYETR 528Q== X-Gm-Message-State: AOUpUlGGJNw/cX8Frb4rSCiEUuob8oAJwr0dFv9L9gqIKkd5nSVdwDuo ZGmfw3UPVq2qmQWr29TTaRIFGzOjoSmjJckT9SLcQshMfZHLUp7igLrzMIKJw392jBcuvXo44xO y6tlHNqVbmG/nDpS53VIrf+lkSUhc0FxptqGyY/rfXcPvPJoQLb/eKL4NxAudjvEMnvYBntHOSN GCSiH79ANXCCM= X-Google-Smtp-Source: AAOMgpdGLEadw0rhu5Q99P4jP3ipzkXf4JUHz0FnWGmHUMkoskaBx0foY+lV3cXrBnTfClBbog91eA== X-Received: by 2002:adf:82f0:: with SMTP id 103-v6mr1369220wrc.131.1533203031116; Thu, 02 Aug 2018 02:43:51 -0700 (PDT) Received: from [10.137.2.21] (static-84-42-175-93.net.upcbroadband.cz. [84.42.175.93]) by smtp.gmail.com with ESMTPSA id 2-v6sm1583863wmi.17.2018.08.02.02.43.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Aug 2018 02:43:49 -0700 (PDT) Subject: Re: New Defects reported by Coverity Scan for PostgreSQL To: emre@hasegeli.com, Tom Lane Cc: Ning Yu , Alvaro Herrera , Pg Hackers References: <20180731172149.kdjl3xdjjtwxaj4s@alvherre.pgsql> <26769.1533090136@sss.pgh.pa.us> <5fece6c5-6a80-9694-1a24-3ae245ae2cba@2ndquadrant.com> <26723.1533131824@sss.pgh.pa.us> From: Tomas Vondra Message-ID: <611f2223-cf96-b26b-a58e-f8b76b156780@2ndquadrant.com> Date: Thu, 2 Aug 2018 11:43:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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