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

>
> On Thu, Mar 2, 2023 at 8:01 AM Michael Paquier <mich...@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

Attachment: v2-0002-improve-detection-file-type-for-WIN32-stat.patch
Description: Binary data

Attachment: v2-0001-fix-chechSeek-for-WIN32.patch
Description: Binary data

Reply via email to