Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jA0vN-0006GL-Tj for pgsql-committers@arkaria.postgresql.org; Fri, 06 Mar 2020 00:33:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jA0vL-0007cg-Qi for pgsql-committers@arkaria.postgresql.org; Fri, 06 Mar 2020 00:33:07 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1jA0vL-0007b1-Iy for pgsql-committers@lists.postgresql.org; Fri, 06 Mar 2020 00:33:07 +0000 Received: from mail.thelabyrinth.net ([45.56.70.56]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jA0vG-0005mH-TJ for pgsql-committers@lists.postgresql.org; Fri, 06 Mar 2020 00:33:07 +0000 Received: from Davids-MacBook-Pro.local (c-73-39-102-148.hsd1.md.comcast.net [73.39.102.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dsteele) by mail.thelabyrinth.net (Postfix) with ESMTPSA id 263235465C; Fri, 6 Mar 2020 00:33:00 +0000 (UTC) Subject: Re: pgsql: Avoid -Wconversion warnings when using checksum_impl.h To: Magnus Hagander , Michael Paquier Cc: pgsql-committers References: <1cf30561-7dad-dc6e-9fc3-5c456948cfeb@pgmasters.net> <20200305233014.GA2501@paquier.xyz> From: David Steele Message-ID: <7916219a-96c6-4298-cb36-c97c6bd3930c@pgmasters.net> Date: Thu, 5 Mar 2020 19:32:59 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 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 3/5/20 7:14 PM, Magnus Hagander wrote: > On Thu, Mar 5, 2020 at 3:30 PM Michael Paquier wrote: >> >> On Thu, Mar 05, 2020 at 12:51:50PM -0500, David Steele wrote: >>> Looks like you changed 65535 -> 65536 before commit. I checked the original >>> patch and it has 65535. >> >> That's my fault, thanks. I have been playing with the surroundings >> while looking at your patch. > > :/ > > That's a pretty dangerous mistake, and moreso because we don't have a > test around it. We should really find a way to add such a test -- just > a hardcoded page calculation that should always return the same value > perhaps? FWIW, we use static values in our unit tests (which are written in C), then test against packaged versions of Postgres for integration tests. When I saw the commit I pulled it in so I could remove instructions for the manual step to add the cast. So in this case the issue was apparent really quickly. Normally we only pull in new code from PostgreSQL once a year. We think our unit tests against static values may have endianess issues but we have not verified that one way or the other. Here's what they look like: https://github.com/pgbackrest/pgbackrest/blob/e55443c890181ea63a350275447885331c8254e4/test/src/module/postgres/interfaceTest.c#L182 Regards, -- -David david@pgmasters.net