Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wASMS-002Oua-2D for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Apr 2026 12:50:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wASMQ-0073cw-39 for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Apr 2026 12:50:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wASMQ-0073cl-1c for pgsql-hackers@lists.postgresql.org; Wed, 08 Apr 2026 12:50:23 +0000 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wASMO-000000000ER-0iqN for pgsql-hackers@lists.postgresql.org; Wed, 08 Apr 2026 12:50:22 +0000 Received: by mail-qt1-x844.google.com with SMTP id d75a77b69052e-50d876329bbso40641891cf.2 for ; Wed, 08 Apr 2026 05:50:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dunslane-net.20251104.gappssmtp.com; s=20251104; t=1775652617; x=1776257417; darn=lists.postgresql.org; h=in-reply-to:autocrypt:content-language:from:references:cc:to :subject:user-agent:mime-version:date:message-id:from:to:cc:subject :date:message-id:reply-to; bh=o77DGutfHhvTAdGtItWxkUj9h6CrSE3GdsVxYssNEtQ=; b=BiPUn2YFzhAs1LeNH3RbNFFum3saZxVJviTxPDl1RSiyHyoTXdsNDfbanq6WGAfqJs 8PyFMBV58UjpVpud8kc5ZQYaNZyk5VIm0vyM+xlkkZiu0HWjQVaSXx1nl2bVEOABC3vw 1Bua8DvQCsW1HCSaTFY3PoLQFgoIjnkLa0SkmB9iqrfsQAbpTQa9opApL73yMdwTXgzh I2ILexP10eFhATSaB4PLrKnW2Gj9uFF7UAQ7jY/M/xVFtW4IJBdoCfyGZ9dypWaEUigG MHY6FrN0cXKeTdln7ug013c3Q9vZ4m+RexqBIdqd55NvkIFlDQr1jUM0pczPRYLVwszQ cHRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775652617; x=1776257417; h=in-reply-to:autocrypt:content-language:from:references:cc:to :subject:user-agent:mime-version:date:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=o77DGutfHhvTAdGtItWxkUj9h6CrSE3GdsVxYssNEtQ=; b=W8BjhzyNOkIt9mXVB6ypxpfYjwaQmdbjCzQCCePpyJx7u2v6KjdzjVg5UPcbB+5JDt NqTjsI55m9w/Kj/08YzlhWXgAVVLs6uLMeKmSQtgZFnrvM4yzYEVd9BCKsV3lNzDwxv2 B1ykCEu+M8Uym3V7FPue5j6jMBHP8AzmgjTaj8iiffAqvClN7NgU0fowem6mgj/+ZR5+ TYHyS7hEC6hdB8I7QxdvN92+rxDIrny/6CQbTOHwakeyhui4LjqXoleYxQbhP+LRNOhz Y6O8hLUJxfqe+MB7QpNAOkAlhE4XHvOXRLdIoCKaO4jOuU4jaXt8WFbQJtPt6ux002vg WNLw== X-Gm-Message-State: AOJu0YwSHdHkFAg9bfYqEn7zX2FQkT90CWli1vnDr6JoVuu0KNXvUx3k 7DoVrP6AsCALsqeSHN5vWiCdKBRHc/KzIRrv4hfsB8/z7HmGp18E+roUgucKTF4o/t8iiFFl2P+ UUCW3n+H25A== X-Gm-Gg: AeBDietHSyS5pfiDtRcFI0WCrPnw0S1r2Atg6vMTepKFY0jL4Av3NW/SGTCRpHlSvqH kpzGXSy5+6mDb2lQg5q+uBSOSXXp/Tx5S9VzrMoqtsupOH2CQB4R8ggGm6srVQhSCHkFaGyd9Q9 bJHU77T3lGKqB3AqRuJMzFeD00efh/b9iqpS3AlDyW5YWS9nCV61GmkhLw2bjW2r7NZA1QHka+P uePe2dXf9JHrgx0Ezk50E3Bi68Qvz7+z0ZeIUzqbzZWaLcRp/wFvKUKjAQD3glyYfXhRrWlf1tT hs8V5NS3ORhknt7FD4f2oXBvVsRFpTveX5H2MxEZT9juUVnIgbJBWtj+1RbnR5QhuwryJBcmAtn gt5LzYmeHAribYq3ugCOx92B6def+i1+KLKgXwAAbxjHw2afoUPowmbOIylirG3i04pU1y3SAUc HtXZBMrpzeMXyzMwVpPX3qiAbJ0a+TL6hJgAISoQ6r X-Received: by 2002:a05:622a:2b4b:b0:50d:8727:b1da with SMTP id d75a77b69052e-50d8727b7f2mr217325311cf.39.1775652613199; Wed, 08 Apr 2026 05:50:13 -0700 (PDT) Received: from ?IPV6:2605:a601:a6b0:500::1cb? ([2605:a601:a6b0:500::1cb]) by smtp.googlemail.com with ESMTPSA id d75a77b69052e-50d521952c4sm153241161cf.4.2026.04.08.05.50.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 Apr 2026 05:50:12 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------gH3YykWQam39laJHDPkS6FGP" Message-ID: <20eef65a-b6df-4e22-be2a-6869a445fee7@dunslane.net> Date: Wed, 8 Apr 2026 08:50:11 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Buildfarm misses running some contrib TAP tests To: Tom Lane Cc: pgsql-hackers@lists.postgresql.org References: <2824159.1775603314@sss.pgh.pa.us> <2828027.1775605579@sss.pgh.pa.us> From: Andrew Dunstan Content-Language: en-US Autocrypt: addr=andrew@dunslane.net; keydata= xsBNBE7KWFkBCAClridxur2AIc7eW2AR7izbfp3EnNefie2HbLF0izW5Ik5UjX2HBXBx4syI gY6b0ugohXrr274+baoAlvSbq6cAoQuEVrk5IZFzt20b1Xkx65FwGSEj526yi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AaYL++LAEOqrlvm2Tvq QqZRtnEAEQEAAcLAfAQYAQgAJgIbDBYhBOQ+WEYd/Hy/RGkVpZn6f8tZ/DuBBQJoGNI2BQkd EODdAAoJEJn6f8tZ/DuBfw0IAKTsfD40teP/pp+bsLLMSxPXUYrrprTj7WFB5v61p6dkpSr/ qXmMlyahdxQFaPmfVgVirB1Vk/kHiWNnnGjfUV9nB2Zg9LI0Xb9/ts3LsUiRWXzG3tkMY6XL vsVOxW4XFRND9l2q+WW93aZ1DZl+fqWfYgMvsusFRhmGFOKTRfKPta2Pkv+AhA24N4+PrR5p bU4k2MO8PAGiK8eaYKGFG1bHKuAvoDoF7WXJ3FHxuWqLnKEt4dfOLm5pAe3zq1Lt6q8azT9i QWGpSAK5vQUWQHBHpiDjdPeqKZ6HiAXIIKfSmb+jrvXBqoP+D6/K7rUjG2aXiRtTIAXms9sm VRu7cmw= In-Reply-To: <2828027.1775605579@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------gH3YykWQam39laJHDPkS6FGP Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2026-04-07 Tu 7:46 PM, Tom Lane wrote: > I wrote: >> I'm not entirely sure what "iterates" means in this context, but >> what seems to be happening on my Linux box is that you get undef >> unless there is exactly one file matching the glob pattern. >> I can't explain why we're not seeing more consistent behavior >> out of the buildfarm, like never running postgres_fdw at all. >> I wonder if the glob() infrastructure has some buggy internal state. > Oh ... apparently, what it thinks that means is that successive > calls will return file names out of the previous "scalar glob" > call, until it finally returns undef, and then the next call > starts a new scan. This simple test program: > > use strict; > use warnings; > > my $pgsql = '/home/postgres/pgsql'; > > foreach my $testdir (glob("$pgsql/contrib/*")) > { > next unless -d "$testdir/t"; > print "examining $testdir\n"; > > my @gresult = glob("$testdir/*.o $testdir/*.obj"); > print 'sizeof glob = ' . scalar @gresult . "\n"; > > # can't test it if we haven't built it > my $scal = scalar glob("$testdir/*.o $testdir/*.obj"); > $scal = '' if not defined($scal); > print 'scalar glob = ' . $scal . "\n"; > } > > 1; > > gives me > > examining /home/postgres/pgsql/contrib/amcheck > sizeof glob = 4 > scalar glob = /home/postgres/pgsql/contrib/amcheck/verify_common.o > examining /home/postgres/pgsql/contrib/auto_explain > sizeof glob = 1 > scalar glob = /home/postgres/pgsql/contrib/amcheck/verify_gin.o > examining /home/postgres/pgsql/contrib/basebackup_to_shell > sizeof glob = 1 > scalar glob = /home/postgres/pgsql/contrib/amcheck/verify_heapam.o > examining /home/postgres/pgsql/contrib/bloom > sizeof glob = 6 > scalar glob = /home/postgres/pgsql/contrib/amcheck/verify_nbtree.o > examining /home/postgres/pgsql/contrib/dblink > sizeof glob = 1 > scalar glob = > examining /home/postgres/pgsql/contrib/oid2name > sizeof glob = 1 > scalar glob = /home/postgres/pgsql/contrib/oid2name/oid2name.o > examining /home/postgres/pgsql/contrib/pg_prewarm > sizeof glob = 2 > scalar glob = > examining /home/postgres/pgsql/contrib/pg_stash_advice > sizeof glob = 3 > scalar glob = /home/postgres/pgsql/contrib/pg_stash_advice/pg_stash_advice.o > examining /home/postgres/pgsql/contrib/pg_stat_statements > sizeof glob = 1 > scalar glob = /home/postgres/pgsql/contrib/pg_stash_advice/stashfuncs.o > examining /home/postgres/pgsql/contrib/pg_visibility > sizeof glob = 1 > scalar glob = /home/postgres/pgsql/contrib/pg_stash_advice/stashpersist.o > examining /home/postgres/pgsql/contrib/postgres_fdw > sizeof glob = 5 > scalar glob = > examining /home/postgres/pgsql/contrib/sepgsql > sizeof glob = 0 > scalar glob = > examining /home/postgres/pgsql/contrib/test_decoding > sizeof glob = 1 > scalar glob = /home/postgres/pgsql/contrib/test_decoding/test_decoding.o > examining /home/postgres/pgsql/contrib/vacuumlo > sizeof glob = 1 > scalar glob = > > So we are getting results that depend mainly on how many .o files > there were in some previous contrib directory. That explains how > come pg_stash_advice managed to change the behavior of later > modules. > > Ugh. That's slightly embarrassing. So I guess the solution is not to use glob in scalar context here. Will fix. cheers andrew -- Andrew Dunstan EDB:https://www.enterprisedb.com --------------gH3YykWQam39laJHDPkS6FGP Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit


On 2026-04-07 Tu 7:46 PM, Tom Lane wrote:
I wrote:
I'm not entirely sure what "iterates" means in this context, but
what seems to be happening on my Linux box is that you get undef
unless there is exactly one file matching the glob pattern.
I can't explain why we're not seeing more consistent behavior
out of the buildfarm, like never running postgres_fdw at all.
I wonder if the glob() infrastructure has some buggy internal state.
Oh ... apparently, what it thinks that means is that successive
calls will return file names out of the previous "scalar glob"
call, until it finally returns undef, and then the next call
starts a new scan.  This simple test program:

use strict;
use warnings;

my $pgsql = '/home/postgres/pgsql';

	foreach my $testdir (glob("$pgsql/contrib/*"))
	{
		next unless -d "$testdir/t";
		print "examining $testdir\n";

		my @gresult = glob("$testdir/*.o $testdir/*.obj");
		print 'sizeof glob = ' . scalar @gresult . "\n";

		# can't test it if we haven't built it
		my $scal = scalar glob("$testdir/*.o $testdir/*.obj");
		$scal = '<undefined>' if not defined($scal);
		print 'scalar glob = ' . $scal . "\n";
	}

1;

gives me

examining /home/postgres/pgsql/contrib/amcheck
sizeof glob = 4
scalar glob = /home/postgres/pgsql/contrib/amcheck/verify_common.o
examining /home/postgres/pgsql/contrib/auto_explain
sizeof glob = 1
scalar glob = /home/postgres/pgsql/contrib/amcheck/verify_gin.o
examining /home/postgres/pgsql/contrib/basebackup_to_shell
sizeof glob = 1
scalar glob = /home/postgres/pgsql/contrib/amcheck/verify_heapam.o
examining /home/postgres/pgsql/contrib/bloom
sizeof glob = 6
scalar glob = /home/postgres/pgsql/contrib/amcheck/verify_nbtree.o
examining /home/postgres/pgsql/contrib/dblink
sizeof glob = 1
scalar glob = <undefined>
examining /home/postgres/pgsql/contrib/oid2name
sizeof glob = 1
scalar glob = /home/postgres/pgsql/contrib/oid2name/oid2name.o
examining /home/postgres/pgsql/contrib/pg_prewarm
sizeof glob = 2
scalar glob = <undefined>
examining /home/postgres/pgsql/contrib/pg_stash_advice
sizeof glob = 3
scalar glob = /home/postgres/pgsql/contrib/pg_stash_advice/pg_stash_advice.o
examining /home/postgres/pgsql/contrib/pg_stat_statements
sizeof glob = 1
scalar glob = /home/postgres/pgsql/contrib/pg_stash_advice/stashfuncs.o
examining /home/postgres/pgsql/contrib/pg_visibility
sizeof glob = 1
scalar glob = /home/postgres/pgsql/contrib/pg_stash_advice/stashpersist.o
examining /home/postgres/pgsql/contrib/postgres_fdw
sizeof glob = 5
scalar glob = <undefined>
examining /home/postgres/pgsql/contrib/sepgsql
sizeof glob = 0
scalar glob = <undefined>
examining /home/postgres/pgsql/contrib/test_decoding
sizeof glob = 1
scalar glob = /home/postgres/pgsql/contrib/test_decoding/test_decoding.o
examining /home/postgres/pgsql/contrib/vacuumlo
sizeof glob = 1
scalar glob = <undefined>

So we are getting results that depend mainly on how many .o files
there were in some previous contrib directory.  That explains how
come pg_stash_advice managed to change the behavior of later
modules.

			


Ugh. That's slightly embarrassing. So I guess the solution is not to use glob in scalar context here.

Will fix.


cheers


andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com
--------------gH3YykWQam39laJHDPkS6FGP--