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 1oTW94-0004cM-SG for pgsql-hackers@arkaria.postgresql.org; Wed, 31 Aug 2022 22:25:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oTW93-0004CK-P0 for pgsql-hackers@arkaria.postgresql.org; Wed, 31 Aug 2022 22:25:13 +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 1oTW93-0004CB-Fp for pgsql-hackers@lists.postgresql.org; Wed, 31 Aug 2022 22:25:13 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oTW90-0000F4-Ne for pgsql-hackers@lists.postgresql.org; Wed, 31 Aug 2022 22:25:13 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 27VMP1Ks165562; Wed, 31 Aug 2022 18:25:01 -0400 From: Tom Lane To: pgsql-hackers@lists.postgresql.org cc: Noah Misch , hofstetter@jomasoft.ch Subject: Solaris "sed" versus pre-v13 plpython tests MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <165560.1661984701.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 31 Aug 2022 18:25:01 -0400 Message-ID: <165561.1661984701@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I noticed that buildfarm member margay, which just recently started running tests on REL_12_STABLE, is failing the plpython tests in that branch [1], though it's happy in v13 and later. The failures appear due to syntax errors in Python "except" statements, and it's visible in some of the tests that we are failing to convert ancient Python "except" syntax to what Python 3 wants: diff -U3 /home/marcel/build-farm-14/buildroot/REL_12_STABLE/pgsql.build/sr= c/pl/plpython/expected/python3/plpython_types_3.out /home/marcel/build-far= m-14/buildroot/REL_12_STABLE/pgsql.build/src/pl/plpython/results/python3/p= lpython_types.out --- /home/marcel/build-farm-14/buildroot/REL_12_STABLE/pgsql.build/src/pl/= plpython/expected/python3/plpython_types_3.out 2022-08-31 22:29:51.0705973= 70 +0200 +++ /home/marcel/build-farm-14/buildroot/REL_12_STABLE/pgsql.build/src/pl/= plpython/results/python3/plpython_types.out 2022-08-31 22:29:53.053544840 = +0200 @@ -400,15 +400,16 @@ import marshal try: return marshal.loads(x) -except ValueError as e: +except ValueError, e: return 'FAILED: ' + str(e) $$ LANGUAGE plpython3u; +ERROR: could not compile PL/Python function "test_type_unmarshal" +DETAIL: SyntaxError: invalid syntax (, line 6) So it would seem that regress-python3-mangle.mk's sed command to perform this transformation isn't working on margay's sed. We've had to hack regress-python3-mangle.mk for Solaris "sed" before (cf commit c3556f6fa). This seems to be another instance of that same crummy implementation of '*' patterns. I suppose Noah missed this angle at the time because the problematic pattern had already been removed in v13 and up (45223fd9c). But it's still there in v12. I am not completely sure why buildfarm member wrasse isn't failing similarly, but a likely theory is that Noah has got some other sed in his search path there. I confirmed on the gcc farm's Solaris 11 box that the pattern doesn't work as expected with /usr/bin/sed: tgl@gcc-solaris11:~$ echo except foo, bar: | sed -e 's/except \([[:alpha:]= ][[:alpha:].]*\), *\([[:alpha:]][[:alpha:]]*\):/except \1 as \2:/g' except foo, bar: We could perhaps do this instead: $ echo except foo, bar: | sed -e '/^ *except.*,.*: *$/s/, / as /g' except foo as bar: It's a little bit more brittle, but Python doesn't allow any other commands on the same line does it? Another idea is to try to find some other sed to use. I see that configure already does that on most platforms, because ax_pthread.m4 has "AC_REQUIRE([AC_PROG_SED])". But if there's still someone out there using --disable-thread-safety, they might think this is an annoying movement of the build-requirements goalposts. regards, tom lane [1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=3Dmargay&dt=3D= 2022-08-31%2020%3A00%3A05