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 1pye1c-0000kr-Tl for pgsql-hackers@arkaria.postgresql.org; Mon, 15 May 2023 19:38:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pye1b-0005g4-EG for pgsql-hackers@arkaria.postgresql.org; Mon, 15 May 2023 19:38:27 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pye1Z-0005fs-Ps for pgsql-hackers@lists.postgresql.org; Mon, 15 May 2023 19:38:27 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pye1W-002VtP-6E for pgsql-hackers@lists.postgresql.org; Mon, 15 May 2023 19:38:24 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id F13A732009FC; Mon, 15 May 2023 15:38:19 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 15 May 2023 15:38:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1684179499; x=1684265899; bh=lD T65Fqf+zaZmpXVLo2M2ewclXSUb5O3SdHOKttnC5A=; b=fgBoQ1mMrfNHMSXnp2 SrP7yIF3HUr7VDrmzawQdWISa1ja8Il/Dr0l5GmMMCt9E9Y5BWW1kga+rJYw3NmG RTmPaPH1IMN1/g/C7UMuCCit7kqMvcYk4cwrGwlOF4n/UlJlZap1N6NDV77ZIfzD Cuhuio3dVA9jpwjjKvszj9+MxOP8m864F7uyEmjD3oRU0Po3aozdfzGy+bs/4IlO csTlBD0XQUHk2pgEr8DCzNqIssRsXtYynbbZX53r7Ly/Z8sKTK1erVBfDVyp+2os ZQ/SeI31Ia8WzP8RRzZ0a0nM3l/RztGqFVlIFPcHK6ShlU+V/J+gzQ/y3EqICMxu AkgA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1684179499; x=1684265899; bh=lDT65Fqf+zaZm pXVLo2M2ewclXSUb5O3SdHOKttnC5A=; b=cbbcbNZZb8ynNQ/9B3+UbopEAP5I2 bzd9mIpwlorBZQ3X8j91jYD1fV38FP3WSLGAJIoaqeEtTdHhOHMRIThSAilG6+Ah Z9z2UIPP7XYji43JntXi5EVWO8NwBRB45qwU5L/Gc3U7MPTudAqKAtRDZ2Ad+yKM XVulLke9r+/nEHuWodZiy7Q6K0PoUD0SVYN7FYIgztMoH7nmm3C+Ac8+ZvdiAG8y iabY6GvWykbNMi2zaxe++MqYwg5qmrkAO8VGE3Ax3aONH0gxEHQFWL/NGIgXx7/i zCvlrQ7aUMdh8S+MeCpLaZhcfJLu0VKbYM8LX/nI2FrLywISEqL47pgzA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeehjedgudegudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgu rhgvshcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtf frrghtthgvrhhnpeekueeggeegffffhffggfeffedvfeekveeuheevleegvedtffdtfefg tefgffehveenucffohhmrghinhepphgvrhhlrdhorhhgnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomheprghnughrvghssegrnhgrrhgriigvlhdr uggv X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 15 May 2023 15:38:19 -0400 (EDT) Date: Mon, 15 May 2023 12:38:17 -0700 From: Andres Freund To: Andrew Dunstan Cc: Tom Lane , pgsql-hackers@lists.postgresql.org Subject: Re: issue with meson builds on msys2 Message-ID: <20230515193817.ttx4qf3ceqeufls2@awork3.anarazel.de> References: <08dd6053-deee-52e9-954b-eb69232905c9@dunslane.net> <2506819.1681761221@sss.pgh.pa.us> <7d7dcc20-ba19-5340-9be8-f255e8b42edc@dunslane.net> <20230420150652.jciazjap223iznjp@awork3.anarazel.de> <5bddd941-9819-6655-7a71-3f346050583e@dunslane.net> <6efeb45a-07f9-2291-c8f8-9fb4abbb6ebc@dunslane.net> <20230427221828.2qo7z4xb4f7islln@awork3.anarazel.de> <236c0354-62b1-0ae1-a252-4c866bc1c5d6@dunslane.net> <20230504235413.eibaxlxslo76ipjl@awork3.anarazel.de> <2ff71af4-cdee-37b8-525a-2b25afd1769a@dunslane.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2ff71af4-cdee-37b8-525a-2b25afd1769a@dunslane.net> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2023-05-05 07:08:39 -0400, Andrew Dunstan wrote: > If you want to play I can arrange access. Andrew did - thanks! A first observeration is that making the shell command slightly more complicated, by echoing $? after pg_ctl, prevents the error: /usr/bin/perl -e 'system(qq{"bin/pg_ctl" -D data-C -w -l logfile start > startlog 2>&1}) ;system(qq{"bin/pg_ctl" -D data-C -w -l logfile stop > stoplog 2>&1;}) ; print $? ? "BANG: $?\n" : "OK\n";' BANG: 33280 /usr/bin/perl -e 'system(qq{"bin/pg_ctl" -D data-C -w -l logfile start > startlog 2>&1}) ;system(qq{"bin/pg_ctl" -D data-C -w -l logfile stop > stoplog 2>&1; echo $?}) ; print $? ? "BANG: $?\n" : "OK\n";' 0 OK So does manually or or via a subshell adding another layer of shell. As Andrew observed earlier, the issue does not occur when not performing redirection of the output. One interesting bit there is that the perl docs for system include: https://perldoc.perl.org/functions/system > If there are no shell metacharacters in the argument, it is split into words > and passed directly to execvp, which is more efficient. On Windows, only the > system PROGRAM LIST syntax will reliably avoid using the shell; system LIST, > even with more than one element, will fall back to the shell if the first > spawn fails. My guesss is that the issue somehow is triggered around the shell handling. One relevant bit: If I use strace (from msys) within system, the subprograms (shell and pg_ctl) actually exit with 0, from what I can tell - but 33280 still is returned. Unfortunately, if I use strace for all of perl, the error vanishes. Perhaps are some odd interactions with the stuff that InheritstdHandles() does? Andrew, is it ok if modify pg_ctl.c and rebuild? I don't know how "detached" from the actual buildfarm animal the system you gave me access to is... Greetings, Andres Freund