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

Re: pipe chunking vs Windows

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>,"korry(dot)douglas" <korry(dot)douglas(at)enterprisedb(dot)com>,PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pipe chunking vs Windows
Date: 2007-07-30 07:57:04
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Sun, Jul 29, 2007 at 07:43:34PM -0400, Andrew Dunstan wrote:
> Andreas Pflug wrote:
> >Andrew Dunstan wrote:
> >  
> >>I have no idea why that's done - it goes back to the origins of the
> >>syslogger - probably because someone mistakenly thinks all WIndows
> >>text files have to have CRLF line endings.
> >>
> >>I tried changing that to _O_BINARY, and calling _setmode on both the
> >>pipe before it's duped into stderr and stderr after the dup and both.
> >>Nothing seemed to work.
> >>    
> >AFAIR the flag has to be set again in each child process.
> >
> >  
> OK, this was the bit of info I was missing. I put a call in 
> SubPostmasterMain() like this:
>    _setmode(fileno(stderr), _O_BINARY);
> and one in the syslogger code the same, just after the pipe is dup'ed 
> into stderr.
> After that I saw no more corruption issues.

Seems right - for anything EXEC_BACKEND, if you change a state from the
default it won't be inherited, so you nede to explicitly add it in the

> However, the problem is that in backporting it we'd make a slight 
> behaviour change - the log file just gets LF instead of CRLF line 
> endings. I'm inclined to say that's a better result than living with the 
> bug, though.

Can't we add back the CRLF combo when writing the file out from the
syslogger process?


In response to


pgsql-hackers by date

Next:From: Andrew DunstanDate: 2007-07-30 11:48:45
Subject: Re: pipe chunking vs Windows
Previous:From: Magnus HaganderDate: 2007-07-30 07:50:27
Subject: Re: pipe chunking vs Windows

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