pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Dmitry Koval <d.koval@postgrespro.ru>
Cc: Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #17288: PSQL bug with COPY command (Windows)
Date: Fri, 19 Nov 2021 15:57:44 +0900
Message-ID: <YZdK6DjbtCT7rz9S@paquier.xyz> (raw)
In-Reply-To: <fe1cde9e-1e52-4f24-3ff7-d01f28a63790@postgrespro.ru>
References: <17288-6b58a91025a8a8a3@postgresql.org>
	<b95273fb-a51a-d0a9-e4a8-501e32e204e5@postgrespro.ru>
	<YZYDZwDtw/Ioojb4@paquier.xyz>
	<9e4efe29-0ff9-0808-fe32-d1d50e0be4fa@postgrespro.ru>
	<CAC+AXB3BKByL8O39qARu3XYMWmrNqMWhcHZZ_2ygqvrK-W6O1g@mail.gmail.com>
	<fe1cde9e-1e52-4f24-3ff7-d01f28a63790@postgrespro.ru>

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().
> 
> You are right. I wrote about stderr without inspecting code (
> 
> >I would keep the memset(buf, 0, sizeof(*buf)) for the members we
> >are not setting.
> 
> Of course. Original code (src/port/win32stat.c) contains line
> 
> memset(buf, 0, sizeof(*buf))
> 
> 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-fstat32-fstat64-fstati64-fsta...
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (29+ messages)  latest in thread

Message-ID: <YZdK6DjbtCT7rz9S@paquier.xyz>
Permalink:  ../YZdK6DjbtCT7rz9S@paquier.xyz/
Also on:    postgresql.org/message-id/YZdK6DjbtCT7rz9S@paquier.xyz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: michael@paquier.xyz, d.koval@postgrespro.ru, juanjo.santamaria@gmail.com
  Subject: Re: BUG #17288: PSQL bug with COPY command (Windows)
  In-Reply-To: <YZdK6DjbtCT7rz9S@paquier.xyz>
  References: <17288-6b58a91025a8a8a3@postgresql.org> <b95273fb-a51a-d0a9-e4a8-501e32e204e5@postgrespro.ru> <YZYDZwDtw/Ioojb4@paquier.xyz> <9e4efe29-0ff9-0808-fe32-d1d50e0be4fa@postgrespro.ru> <CAC+AXB3BKByL8O39qARu3XYMWmrNqMWhcHZZ_2ygqvrK-W6O1g@mail.gmail.com> <fe1cde9e-1e52-4f24-3ff7-d01f28a63790@postgrespro.ru> <YZdK6DjbtCT7rz9S@paquier.xyz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox