Re: pgsql: Allow concurrent-safe open() and fopen() in frontend code for Wi
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael@paquier.xyz>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2018-09-17T23:38:24Z
Lists: pgsql-hackers
Attachments
- force-either-binary-or-text-open-mode.patch (text/x-diff) patch
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 src/port/open.c a bit, it seems like the problem is that our fopen() requires a nonstandard "t" option to select text mode. I'd always supposed that you got binary mode with "b" and text mode otherwise; is there some third possibility on Windows? Anyway, I'm inclined to propose that we ought to do something like the attached in HEAD and v11 in order to reduce the risk that there are other unexpected behavioral changes. This should also let us revert 0ba06e0bf's change in initdb.c. I wonder whether pgwin32_open() also ought to enforce that either O_BINARY or O_TEXT mode gets selected. regards, tom lane
Commits
-
Enforce translation mode for Windows frontends to text with open/fopen
- 40cfe86068f4 12.0 landed
-
Fix pgbench lexer's "continuation" rule to cope with Windows newlines.
- db37ab2c60b8 12.0 landed
- d45f157e8b07 11.0 landed
- 3ea7e015f37a 10.6 landed
-
Allow concurrent-safe open() and fopen() in frontend code for Windows
- 0ba06e0bfb8c 12.0 cited