pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Gustafsson <daniel@yesql.se>
To: pgsql-committers@lists.postgresql.org, Andrew Dunstan <andrew@dunslane.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Subject: Re: pgsql: Refactor the sslfiles Makefile target for ease of use
Date: Wed, 20 Oct 2021 12:53:26 +0200
Message-ID: <0D295F43-806D-4B3F-AB98-F941A19E0271@yesql.se> (raw)
In-Reply-To: <E1mctg6-0002lC-7l@gemulon.postgresql.org>
References: <E1mctg6-0002lC-7l@gemulon.postgresql.org>

> On 19 Oct 2021, at 20:17, Daniel Gustafsson <dgustafsson@postgresql.org> wrote:
> 
> 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=prairiedog&dt=2021-10-20%2005%3A32%3A46

Attachments:

ssltests_32bit.diff (application/octet-stream, 897B) download 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 {

view thread (9+ messages)  latest in thread

Message-ID: <0D295F43-806D-4B3F-AB98-F941A19E0271@yesql.se>
Permalink:  ../0D295F43-806D-4B3F-AB98-F941A19E0271@yesql.se/
Also on:    postgresql.org/message-id/0D295F43-806D-4B3F-AB98-F941A19E0271@yesql.se

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: daniel@yesql.se, andrew@dunslane.net, tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Refactor the sslfiles Makefile target for ease of use
  In-Reply-To: <0D295F43-806D-4B3F-AB98-F941A19E0271@yesql.se>
  References: <E1mctg6-0002lC-7l@gemulon.postgresql.org> <0D295F43-806D-4B3F-AB98-F941A19E0271@yesql.se>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox