Re: [HACKERS] 0x1A in control file on Windows

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>, ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, pgsql-hackers(at)postgresql(dot)org, pgsql-bugs(at)postgresql(dot)org
Subject: Re: [HACKERS] 0x1A in control file on Windows
Date: 2008-09-24 13:35:33
Message-ID: 48DA4225.2060201@hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Andrew Dunstan wrote:
>
>
> Tom Lane wrote:
>>> The point being that the config files are opened with AllocateFile(),
>>> which in turn calls fopen(). It doesn't use open(). The proposal was
>>> only to make all *open()* calls do it binary. I was under the impression
>>> that on Unix, that's what open() did, so we should behave the same?
>>>
>>
>> That seems just weird. I do not think there's any correlation between
>> whether we use open or fopen and whether the file is text or binary.
>> Even if it happens to be true right now, depending on it would be
>> fragile.
>>
>>
>>
>
> I agree. If you really want something like that you should invent
> OpenConfigFile() or some such. But it hardly seems worth it.

Well, the AllocateFile() API already has the ability to specify if it's
a text file or not (using the fopen syntax).

And given that we have a way to specify it for open (PG_BINARY), we can
just leave it that way I guess. Even if we end up always specifying
PG_BINARY, that may keep things less fragile. As long as we remember to
specify it. (PG_BINARY is a no-op on all other platforms than Windows,
btw, because there is no way to specify anything other than binary mode
for open() on Unix)

//Magnus

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Chris Barnes 2008-09-24 14:08:01 Postgres won't start and doesn't generate any messages.
Previous Message Andrew Dunstan 2008-09-24 13:27:32 Re: [HACKERS] 0x1A in control file on Windows

Browse pgsql-hackers by date

  From Date Subject
Next Message KaiGai Kohei 2008-09-24 14:04:45 Re: Proposal of SE-PostgreSQL patches (for CommitFest:Sep)
Previous Message Aidan Van Dyk 2008-09-24 13:29:22 Re: Proposal of SE-PostgreSQL patches (for CommitFest:Sep)