Re: pg_dump/pg_restore: Fix stdin/stdout handling of custom format on Win32

Поиск
Список
Период
Сортировка
От Juan José Santamaría Flecha
Тема Re: pg_dump/pg_restore: Fix stdin/stdout handling of custom format on Win32
Дата
Msg-id CAC+AXB23S=JiFY9jFWq3FTHByNZZn37f9v3h=7j5UsbumqHKBw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: pg_dump/pg_restore: Fix stdin/stdout handling of custom format on Win32  (Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>)
Ответы Re: pg_dump/pg_restore: Fix stdin/stdout handling of custom format on Win32  (Michael Paquier <michael@paquier.xyz>)
Список pgsql-hackers

On Tue, Mar 7, 2023 at 1:36 PM Juan José Santamaría Flecha <juanjo.santamaria@gmail.com> wrote:

On Thu, Mar 2, 2023 at 8:01 AM Michael Paquier <michael@paquier.xyz> wrote:

The internal implementation of _pgstat64() is used in quite a few
places, so we'd better update this part first, IMO, and then focus on
the pg_dump part.  Anyway, it looks like you are right here: there is
nothing for FILE_TYPE_PIPE or FILE_TYPE_CHAR in this WIN32
implementation of fstat().

I am amazed to hear that both ftello64() and fseek64() actually
succeed if you use a pipe:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fseek.html
Could it be something we should try to make more portable by ourselves
with a wrapper for these on WIN32?  That would not be the first one to
accomodate our code with POSIX, and who knows what code could be broken
because of that, like external extensions that use fseek64() without
knowing it.

The error is reproducible in versions previous to win32stat.c, so that might work as bug fix.

I've broken the patch in two:
1. fixes the detection of unseekable files in checkSeek(), using logic that hopefully is backpatchable,
2. the improvements on file type detection for stat() proposed by the OP.

Regards,

Juan José Santamaría Flecha
Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Smith
Дата:
Сообщение: Add macros for ReorderBufferTXN toptxn
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Sub-millisecond [autovacuum_]vacuum_cost_delay broken