Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1md9E0-0005K5-2a for pgsql-committers@arkaria.postgresql.org; Wed, 20 Oct 2021 10:53:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1md9Dy-0004H8-PX for pgsql-committers@arkaria.postgresql.org; Wed, 20 Oct 2021 10:53:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1md9Dy-0004FS-Iz for pgsql-committers@lists.postgresql.org; Wed, 20 Oct 2021 10:53:34 +0000 Received: from smtp.outgoing.loopia.se ([93.188.3.37]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1md9Du-0006Fo-MA for pgsql-committers@lists.postgresql.org; Wed, 20 Oct 2021 10:53:34 +0000 Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id 2435F2EADC68 for ; Wed, 20 Oct 2021 12:53:28 +0200 (CEST) Received: from s645.loopia.se (unknown [172.22.191.6]) by s807.loopia.se (Postfix) with ESMTP id 152EE2E27C5A; Wed, 20 Oct 2021 12:53:28 +0200 (CEST) Received: from s475.loopia.se (unknown [172.22.191.6]) by s645.loopia.se (Postfix) with ESMTP id 07DE21570455; Wed, 20 Oct 2021 12:53:28 +0200 (CEST) X-Virus-Scanned: amavisd-new at amavis.loopia.se X-Spam-Flag: NO X-Spam-Score: -1 X-Spam-Level: X-Spam-Status: No, score=-1 tagged_above=-999 required=6.2 tests=[ALL_TRUSTED=-1] autolearn=disabled Received: from s499.loopia.se ([172.22.191.5]) by s475.loopia.se (s475.loopia.se [172.22.190.15]) (amavisd-new, port 10024) with LMTP id VR2k-xgAnKJf; Wed, 20 Oct 2021 12:53:27 +0200 (CEST) X-Loopia-Auth: user X-Loopia-User: daniel@yesql.se X-Loopia-Originating-IP: 89.255.232.193 Received: from [192.168.72.144] (customer-89-255-232-193.stosn.net [89.255.232.193]) (Authenticated sender: daniel@yesql.se) by s499.loopia.se (Postfix) with ESMTPSA id 741C81CE05CC; Wed, 20 Oct 2021 12:53:27 +0200 (CEST) From: Daniel Gustafsson Content-Type: multipart/mixed; boundary="Apple-Mail=_E914E070-2018-4154-84A7-3D6841546DFF" Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Subject: Re: pgsql: Refactor the sslfiles Makefile target for ease of use Date: Wed, 20 Oct 2021 12:53:26 +0200 References: To: pgsql-committers@lists.postgresql.org, Andrew Dunstan , Tom Lane In-Reply-To: Message-Id: <0D295F43-806D-4B3F-AB98-F941A19E0271@yesql.se> X-Mailer: Apple Mail (2.3608.120.23.2.7) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_E914E070-2018-4154-84A7-3D6841546DFF Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On 19 Oct 2021, at 20:17, Daniel Gustafsson = wrote: >=20 > Refactor the sslfiles Makefile target for ease of use This made prairiedog fall over in the SSL tests [0], with what seems a = pretty straightforward reason: 32- vs 64-bit Perl. Integer overflow in hexadecimal number at t/001_ssltests.pl line 493. Illegal hexadecimal digit ' ' ignored at t/001_ssltests.pl line 493. Hexadecimal number > 0xffffffff non-portable at t/001_ssltests.pl line = 493. The conversion of the serialnumber from hex to base10 requires a 64-bit = capable Perl, and my guess is that prairiedog has a 32-bit Perl. I installed = 5.8.3 in 64-bit mode and verified that it does work there (using the perlbrew = recipe in 3eb1f4d097454 which is fantastic). Attached diff passes tests for me, but I don't have a 32-bit system = handy so I prefer some more eyes on it before pushing. The most portable way I = could find to determine 32/64 bit in Perl was to use Config and check ivsize. It = works in my 5.8.3 installation, but adding Andrew on CC to get a Perl expert = opinion on that. -- Daniel Gustafsson https://vmware.com/ [0] = https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=3Dprairiedog&dt=3D= 2021-10-20%2005%3A32%3A46 --Apple-Mail=_E914E070-2018-4154-84A7-3D6841546DFF Content-Disposition: attachment; filename=ssltests_32bit.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="ssltests_32bit.diff" Content-Transfer-Encoding: 7bit diff --git a/src/test/ssl/t/001_ssltests.pl b/src/test/ssl/t/001_ssltests.pl index a901077469..228f611758 100644 --- a/src/test/ssl/t/001_ssltests.pl +++ b/src/test/ssl/t/001_ssltests.pl @@ -3,6 +3,7 @@ use strict; use warnings; +use Config qw ( %Config ); use PostgresNode; use TestLib; use Test::More; @@ -489,8 +490,18 @@ TODO: my $serialno = `openssl x509 -serial -noout -in ssl/client.crt`; if ($? == 0) { - $serialno =~ s/^serial=//; - $serialno = hex($serialno); # OpenSSL prints serial numbers in hexadecimal + # OpenSSL prints serial numbers in hexadecimal and converting the serial + # from hex requires a 64-bit capable Perl. On 32-bit fall back to checking + # for it being a number like how we do when grabbing the serial fails. + if ($Config{ivsize} == 8) + { + $serialno =~ s/^serial=//; + $serialno = hex($serialno); + } + else + { + $serialno = '\d+'; + } } else { --Apple-Mail=_E914E070-2018-4154-84A7-3D6841546DFF--