Re: BUG #15827: Unable to connect on Windows using pg_services.conf using Python psycopg2

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #15827: Unable to connect on Windows using pg_services.conf using Python psycopg2
Дата
Msg-id 23215.1560977098@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #15827: Unable to connect on Windows using pg_services.conf using Python psycopg2  (Jorge Gustavo Rocha <jgr@geomaster.pt>)
Ответы Re: BUG #15827: Unable to connect on Windows using pg_services.conf using Python psycopg2  (Jorge Gustavo Rocha <jgr@geomaster.pt>)
Re: BUG #15827: Unable to connect on Windows using pg_services.confusing Python psycopg2  (Michael Paquier <michael@paquier.xyz>)
Список pgsql-bugs
Jorge Gustavo Rocha <jgr@geomaster.pt> writes:
> The error I was facing in QGIS is because the application changes the
> default fopen mode to binary mode. So, every file is opened in binary
> mode and so is pg_services.conf.

Ah-hah!  That explains much.  So a non-invasive fix would be to force
parseServiceFile to open the file in text mode; I think this would
work for that:

-    f = fopen(serviceFile, "r");
+    f = fopen(serviceFile, "rt");

I don't think that that's really a good solution, because it does little
to prevent the same problem from reappearing elsewhere.  But if we wanted
the smallest possible fix that might do.

> In my humble opinion, we could make pg_services.conf agnostic in terms
> of \r, just by filtering them, if present.

I think we should have it go further and ignore any trailing isspace()
characters, so that trailing spaces don't cause problems either.
But in any case, the real stumbling block here is to get a project-wide
convention as to how to do it.

            regards, tom lane



В списке pgsql-bugs по дате отправления:

Предыдущее
От: Jorge Gustavo Rocha
Дата:
Сообщение: Re: BUG #15827: Unable to connect on Windows using pg_services.conf using Python psycopg2
Следующее
От: Jorge Gustavo Rocha
Дата:
Сообщение: Re: BUG #15827: Unable to connect on Windows using pg_services.conf using Python psycopg2