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 1mLvhZ-00083p-OI for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Sep 2021 23:00:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mLvhW-0007Cg-M6 for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Sep 2021 23:00:54 +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 1mLvhW-000791-E1 for pgsql-hackers@lists.postgresql.org; Thu, 02 Sep 2021 23:00:54 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mLvhT-00057X-TX for pgsql-hackers@lists.postgresql.org; Thu, 02 Sep 2021 23:00:53 +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 182N0ksn2440672; Thu, 2 Sep 2021 19:00:48 -0400 From: Tom Lane To: Mario Emmenlauer cc: pgsql-hackers@lists.postgresql.org Subject: Re: dup(0) fails on Ubuntu 20.04 and macOS 10.15 with 13.0 In-reply-to: References: <48bafc63-c30f-3962-2ded-f2e985d93e86@emmenlauer.de> <3ac84ee7-b4a0-aba5-ddb5-b7c0811fc754@emmenlauer.de> <1c4c2254-1812-2913-8630-18d4b9262a89@emmenlauer.de> <2071112.1630504486@sss.pgh.pa.us> Comments: In-reply-to Mario Emmenlauer message dated "Wed, 01 Sep 2021 17:49:57 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2440670.1630623646.1@sss.pgh.pa.us> Date: Thu, 02 Sep 2021 19:00:46 -0400 Message-ID: <2440671.1630623646@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Mario Emmenlauer writes: > The idea to switch to dup(2) sounds very good to me. I poked at this some more, and verified that adding "fclose(stdin);" at the head of PostmasterMain is enough to trigger the reported failure. However, after changing fd.c to dup stderr not stdin, we can pass check-world even with that in place. So that confirms that there is no very good reason for the postmaster to require stdin to be available. Hence, I pushed the fix to make fd.c use stderr here. I only back-patched to v14, because given the lack of other complaints, I couldn't quite justify touching stable branches for this. regards, tom lane