Skip site navigation (1) Skip section navigation (2)

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 05:58:27
Message-ID: 48D9D703.8030506@hagander.net (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-hackers
Andrew Dunstan wrote:
> 
> 
> Tom Lane wrote:
>> Bruce Momjian <bruce(at)momjian(dot)us> writes:
>>  
>>> Tom Lane wrote:
>>>    
>>>> Well, why is that a bug?  If the platform is so silly as to define text
>>>> files that way, who are we to argue?
>>>>       
>>
>>  
>>> The problem is that our pg_controldata might have binary values that
>>> contain 0x1a that will be confused by the operating system as
>>> end-of-file.
>>>     
>>
>> pg_controldata is certainly already being read as binary. 
> 
> Umm, no, it is in the backend I believe but not in the utilities. Hence
> the original bug report. We need to add the binary flag in
> pg_controldata.c and pg_resetxlog.c.

Right.
I'll go ahead and put that part in (I find two locations - the one in
the original patch, and the extra one Heikki noticed).


>>  The
>> discussion here is about *text* files, particularly configuration
>> files.  Why should we not adhere to the platform standard about
>> what a text file is?
>>
>> If you need a positive reason why this might be a bad idea, consider the
>> idea that someone is examining postgresql.conf with a text editor that
>> stops reading at control-Z.  He might not be able to see items that the
>> postmaster is treating as valid.
>>
>>            
>>   
> 
> Yes, exactly right. We certainly can't just open everything in binary
> mode. Magnus did say that all the current config files are opened in
> text mode as far as he could see.

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?

//Magnus

In response to

Responses

pgsql-hackers by date

Next:From: Greg StarkDate: 2008-09-24 06:36:56
Subject: Re: Common Table Expressions (WITH RECURSIVE) patch
Previous:From: Magnus HaganderDate: 2008-09-24 05:40:03
Subject: Re: WIP patch: Collation support

pgsql-bugs by date

Next:From: Heikki LinnakangasDate: 2008-09-24 07:37:53
Subject: Re: BUG #4434: Error inserting into view - unrecognized node type: 313
Previous:From: Tom LaneDate: 2008-09-24 04:38:49
Subject: Re: BUG #4434: Error inserting into view - unrecognized node type: 313

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group