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 1mnxqP-0004qE-Sz for pgsql-bugs@arkaria.postgresql.org; Fri, 19 Nov 2021 06:57:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mnxqO-0003J7-Lf for pgsql-bugs@arkaria.postgresql.org; Fri, 19 Nov 2021 06:57:56 +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 1mnxqN-0003Ix-5U for pgsql-bugs@lists.postgresql.org; Fri, 19 Nov 2021 06:57:56 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mnxqK-0006IP-Bi for pgsql-bugs@lists.postgresql.org; Fri, 19 Nov 2021 06:57:54 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 7E8973201CCC; Fri, 19 Nov 2021 01:57:50 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Fri, 19 Nov 2021 01:57:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=OLGvBIa4gEX+E1o5dfnZycFhdqp pcyTYWfqXneC4J/E=; b=WC+YS1x20rPKf2tOHRJQ0rxew0NPHZ9ySMvLUKBHUHa oPwa9ZmYBpTv2oXZnFNQ/deph8QWxg5bVtLfuWdeAiMddr0/xMG5I50PS8Xz9hBd RfrUxFCCyviThoMJkcAKfV6dpqm0/casz9qMdhdw9QGn27jWcjuKhtdK1Gz2pI/D bhwfYH/PhY41vPudY5BUeZADXnPM69mJeQ2dUO79Nymrn4vRlZEVrnVA2ozwp+t4 5b/R61isJnNtAc/wiom8+4GMa1LjRINU0GnMRseg3U38fVVZC/RTnU+Lous89KBx MusQPVRhlaXFJvuCKnT4J99ULg2wgpuSAidnzEqnpGg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=OLGvBI a4gEX+E1o5dfnZycFhdqppcyTYWfqXneC4J/E=; b=acSOXElOkQ7AZ+KIyFDzR4 o7DZsxC7jbHtAaNhI0mOqxgPUiurff+nFrd8KM1kYU11Xez5Kvd0TaYb5Ng6hJ8H CDY7IVAK3Z1D0Gfv8m7J7qHDfi9Eq/VplL7yRrra5YDCBfOt53Rp0rO8umf3PeUx gKRk5oGSDkTrjNfKnYXRJQpAldhLlB1PrtiDp9AqukgBwmx6asfDHRqJMgVwcMvG cz8P9QGmnWFOCHLTpHxhQkDZwodnKjWZIfULodva77VngdB7bZxuU3DbrZfclY1V rDIcAFxEJxagSPKGHJanNGljK5tUcZBskKBusIqFGsAKfPV6UFLhUJy9Zq/CTWWw == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrfeejgddutddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdlfeehmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddt vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpeelueehtdejfeeflefgieegveej geffledvteevgeefvdefueegueelfedvueevfeenucffohhmrghinhepmhhitghrohhsoh hfthdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhr ohhmpehmihgthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 19 Nov 2021 01:57:46 -0500 (EST) Date: Fri, 19 Nov 2021 15:57:44 +0900 From: Michael Paquier To: Dmitry Koval Cc: Juan =?iso-8859-1?Q?Jos=E9_Santamar=EDa?= Flecha , PostgreSQL mailing lists Subject: Re: BUG #17288: PSQL bug with COPY command (Windows) Message-ID: References: <17288-6b58a91025a8a8a3@postgresql.org> <9e4efe29-0ff9-0808-fe32-d1d50e0be4fa@postgrespro.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="7urjZv/mAcj4SB+K" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --7urjZv/mAcj4SB+K Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 18, 2021 at 09:48:55PM +0300, Dmitry Koval wrote: > >You are right about freopen(), but stderr works just because it's being > >parsed as a file, not a stream, by parse_slash_copy(). >=20 > You are right. I wrote about stderr without inspecting code ( >=20 > >I would keep the memset(buf, 0, sizeof(*buf)) for the members we > >are not setting. >=20 > Of course. Original code (src/port/win32stat.c) contains line >=20 > memset(buf, 0, sizeof(*buf)) >=20 > before call GetFileInformationByHandle(). I still think that we should not call GetFileInformationByHandle() when it comes to an argument that we know will fail, so I would agree with Juan's approach in v2 to just patch _pgfstat64() rather than messing with the code paths in charge of checking handles pending for deletion. Each fileno is going to be 0, 1 or 2 in those cases, still it would be better to rely on the result of fileno() as v3 is doing? It looks like you are right about _S_IFCHR for st_mode, as of this part of the docs: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/fstat-fsta= t32-fstat64-fstati64-fstat32i64-fstat64i32?view=3Dmsvc-170 -- Michael --7urjZv/mAcj4SB+K Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmGXSucACgkQnvQgOdby QH06kA/+O27XQfQcdG1QJ9kSzK1Hww5LeiZ7b3BIjBJ4zFZKnarssEihxH/ISN69 AS3tbrlRprc/Ul34EuVuOkstutKASk3/cKC+B06tY/iesvHZlXkjr1yBXpVV3ukU qu8VcGa/28IgLJPbQx6cakjZSm8gtFbKjWhCytSltGs3gB59VI3lebkPlItaeuj/ O2cGFJGTs4AR4yznJ15HnjXwzfuoeIoVNzQxb9XMPBrdTnvjIvKx/B2I1dQA6B3T ZZvBFby8/J65oLE/qrMHYw1Ytvg67Ub9U1sxLKwYIjFmshAkqcFK0kYvbZPGIyZV 7SRGLa0NTCwdIo0qq1zR6/64NRtT/sQ2vKsVqJ+HD/g19THsJJuR09je5jB2hJYt pF5MKDT5EBwml1CQO6qO5BFIKEGTgt5jlP376Melwe2ZSTEBFsFMiumA7RZTzYR4 0uFirZHCozn1999JWroAzl3maNkWjZ8d07uFN6m1PAHSZopUa1oTmweEILxSY9Ab UOgflpyU8LAXzMLu3kOS39Y70eiA17eIs/PnhFh9AKJN4ASBou9trWW9B9j7beAx jr8qViYCNNKyFA6eH1cuMbWEQSgkhEmzBVk+OuhTogXcqy4XB1ZCmlC08k9aKdmF i5xFofsbkirXaMVUK6z3Prwc5RbBinnlCIjOfhAXwnoq703iU64= =DvrQ -----END PGP SIGNATURE----- --7urjZv/mAcj4SB+K--