Re: pgsql: Allow concurrent-safe open() and fopen() in frontend code for Wi

2018-09-19 Thread Laurenz Albe
Michael Paquier wrote: > Thanks, I have pushed the solution from Laurenz to maintain pure > compatibility. Thanks for all the work! Yours, Laurenz Albe

Re: pgsql: Allow concurrent-safe open() and fopen() in frontend code for Wi

2018-09-19 Thread Michael Paquier
On Wed, Sep 19, 2018 at 11:55:01AM -0400, Tom Lane wrote: > I'm OK with this approach. I wonder though what happens if you take > away the "#ifdef FRONTEND" and just enforce that one or the other mode > is selected always. That would seem like a sensible solution rather > than a wart to me ... T

Re: pgsql: Allow concurrent-safe open() and fopen() in frontend code for Wi

2018-09-19 Thread Tom Lane
Michael Paquier writes: > I have spent a large portion of my morning trying to test all the > solutions proposed, and a winner shows up. ... > - win32-open-laurenz.patch, which enforces to text mode only if binary > mode is not defined, which maps strictly to what pre-11 is doing when > calling

Re: pgsql: Allow concurrent-safe open() and fopen() in frontend code for Wi

2018-09-18 Thread Michael Paquier
On Tue, Sep 18, 2018 at 06:04:58PM +0200, Laurenz Albe wrote: > That wouldn't influence pipes, which was what Michael said was a > problem for pg_dump. Yeah, the authentication blows up badly on that.. You can see all the tests using user and database names with all ASCII range turning red. > I

Re: pgsql: Allow concurrent-safe open() and fopen() in frontend code for Wi

2018-09-18 Thread Michael Paquier
On Tue, Sep 18, 2018 at 10:45:09AM -0400, Tom Lane wrote: > In the meantime, we might be well advised to revert this patch in > v11 and just continue to work on the problem in HEAD. I see now > that this wasn't something to cram in during late beta ... I can see that you have reverted the change

Re: pgsql: Allow concurrent-safe open() and fopen() in frontend code for Wi

2018-09-18 Thread Laurenz Albe
Tom Lane wrote: > Laurenz Albe writes: > > Would it be an option to have pgwin32_open default to text mode in > > frontend code and to binary mode in backend code? > > Well, the question is why Michael's latest proposed patch doesn't > accomplish that. I was thinking of something trivial like th

Re: pgsql: Allow concurrent-safe open() and fopen() in frontend code for Wi

2018-09-18 Thread Tom Lane
Laurenz Albe writes: > Would it be an option to have pgwin32_open default to text mode in > frontend code and to binary mode in backend code? Well, the question is why Michael's latest proposed patch doesn't accomplish that. regards, tom lane

Re: pgsql: Allow concurrent-safe open() and fopen() in frontend code for Wi

2018-09-18 Thread Laurenz Albe
Tom Lane wrote: > Well, we have to do something. I have a report from EDB's packagers > that in 11beta4, "initdb --pwfile" is failing on Windows (ie, one can't > connect afterwards using the specified password). It seems nearly > certain to me that the reason is that the file is read with > >

Re: pgsql: Allow concurrent-safe open() and fopen() in frontend code for Wi

2018-09-18 Thread Tom Lane
Michael Paquier writes: > On Tue, Sep 18, 2018 at 09:11:43AM +0900, Michael Paquier wrote: >> What I think I broke is that CreateFile ignores what _fmode uses, which >> has caused the breakage, while calling directly open() or fopen() does >> the work. There are also other things assuming that bi

Re: pgsql: Allow concurrent-safe open() and fopen() in frontend code for Wi

2018-09-17 Thread Michael Paquier
On Tue, Sep 18, 2018 at 09:11:43AM +0900, Michael Paquier wrote: > What I think I broke is that CreateFile ignores what _fmode uses, which > has caused the breakage, while calling directly open() or fopen() does > the work. There are also other things assuming that binary mode is > used, you can g

Re: pgsql: Allow concurrent-safe open() and fopen() in frontend code for Wi

2018-09-17 Thread Michael Paquier
On Mon, Sep 17, 2018 at 07:38:24PM -0400, Tom Lane wrote: > So we seem to be out of the woods in terms of 0ba06e0bf breaking the > regression tests, but I'm not very happy about the whole thing, because > that patch wasn't supposed to change the behavior of open/fopen in any > way other than allowi

Re: pgsql: Allow concurrent-safe open() and fopen() in frontend code for Wi

2018-09-17 Thread Tom Lane
So we seem to be out of the woods in terms of 0ba06e0bf breaking the regression tests, but I'm not very happy about the whole thing, because that patch wasn't supposed to change the behavior of open/fopen in any way other than allowing concurrent file access. Obviously, it did. After looking at s