From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Jorge Gustavo Rocha <jgr(at)geomaster(dot)pt> |
Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #15827: Unable to connect on Windows using pg_services.conf using Python psycopg2 |
Date: | 2019-06-19 20:44:58 |
Message-ID: | 23215.1560977098@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Jorge Gustavo Rocha <jgr(at)geomaster(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Jorge Gustavo Rocha | 2019-06-19 23:19:08 | Re: BUG #15827: Unable to connect on Windows using pg_services.conf using Python psycopg2 |
Previous Message | Jorge Gustavo Rocha | 2019-06-19 20:01:49 | Re: BUG #15827: Unable to connect on Windows using pg_services.conf using Python psycopg2 |