Re: Stop pgpass.conf EOL conversion

From: Dave Page <dpage(at)pgadmin(dot)org>
To: Daniel Browning <db(at)kavod(dot)com>
Cc: pgAdmin Support <pgadmin-support(at)postgresql(dot)org>
Subject: Re: Stop pgpass.conf EOL conversion
Date: 2014-09-05 19:38:26
Message-ID: B54161B6-C5A3-4EC9-99B6-0DD1972D1E8F@pgadmin.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

pgAdmin writes that file whenever a user successfully logs into a server with a new password for the first time, and opts to save it. If the user then edits the file in notepad (maybe to add new details for a server to use from psql), they'll run into problems.

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK:http://www.enterprisedb.com
The Enterprise PostgreSQL Company

> On 5 Sep 2014, at 20:32, Daniel Browning <db(at)kavod(dot)com> wrote:
>
>> On Friday 05 September 2014 12:57:21 am Dave Page wrote:
>>> On Thu, Sep 4, 2014 at 11:23 PM, Daniel Browning <db(at)kavod(dot)com> wrote:
>>> Do you agree with modifying pgAdmin so that it stops converting the EOL
>>> characters in the pgpass.conf file from unix-style (\n) to Windows-style
>>> (\r\n)?
>>>
>>> It works fine with unix-style line endings, and if the file is in that
>>> format already, I think it should leave well enough alone.
>>>
>>> The reason the issue came up is that I would like to be able to use one
>>> pgpass file for both Windows applications (pgAdmin, psql under
>>> powershell, etc.) and cygwin applications (/usr/bin/psql). I created a
>>> symlink from the pgpass.conf file to .pgpass, and it works perfectly.
>>> Until, that is, I launch pgAdmin and it adds the Windows carriage
>>> returns. Then, cygwin's psql stops working; it seems to send the carriage
>>> return appended to the end of the password, resulting in incorrect
>>> password errors.
>>
>> The primary reason that file (and others) are written with DOS line
>> endings is because the default editor on Windows (notepad) can't cope
>> with *nix style line ends.
>
> I can understand that, but how would such a user have ever ended up with a
> file that has unix line-endings anyway?
>
> If they were creating it from scratch, it would have windows EOLs already. If
> they copied the file from another windows developer, it would have them too.
> The only case I can think of where this feature would be useful is in a pretty
> specific set of circumstances:
>
> * A novice user copies a .pgpass file with *nix EOLs from a colleague
> * He knows to rename it to pgpass.conf and put it in AppData\Roaming\etc.
> * When he tries to open it in notepad, it's all wonky and he is confused.
> * He tries running PgAdmin anyway
> * PgAdmin fixed the file so it can be opened in notepad
> * The novice user is thankful for PgAdmin doing that
>
> To me, that seems like a pretty rare circumstance -- and not really PgAdmin's
> place to be doing that. Now if the user was actually *modifying* the
> pgpass.conf in PgAdmin, I could see some reason behind converting to windows
> EOLs; however, when the file is only being read and not written, it seems like
> converting EOLs is trying to be too helpful.
>
>> This is obviously a PITA, as it requires
>> users to install a better editor (which is arguably a very good idea
>> anyway, but we don't want to force it on users who may just be setting
>> up an app on a machine for someone else for example).
>
> Agreed. My inner pedant would like to point out that technically, they don't
> have to install a better editor, they just need to open the file in Wordpad,
> which is distributed with all versions of windows from at least Windows 95
> through 8.1, and reads files with unix-style line endings. But for some novice
> users, opening a file in a non-default program is probably just as hard as
> installing a new text editor, so your point remains.
>
>>> I could also just not use cygwin, but as a long-term Linux user, I find
>>> that when I am forced to use Windows, as in this case, it is
>>> significantly easier for me to use cygwin than to learn all the
>>> Windows-equivalent commandline tools, which in many cases do not even
>>> exist.
>>
>> Have you tried Msys? Not suggesting you should switch, but it would be
>> interesting to know how it behaves.
>
> I haven't tried it. If I get a chance to, I'll report back.
>
>>> What do you think?
>>
>> At the moment I'm leaning towards leaving it as-is. I see your
>> problem, but you're the only person to report it in 12+ years that I
>> can remember. I suspect the notepad issue would inconvenience far more
>> users. I suppose we could make it a configurable option.
>
> Personally, I'd be in favor of a configurable option and a dialog box that
> says something like:
>
> "Your pgpass.conf file was in unix format, so we converted it to Windows
> format for you. If you would like to change this behavior, access the such-
> and-such option."
> --
> DB

In response to

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message Daniel Browning 2014-09-05 20:55:31 Re: Stop pgpass.conf EOL conversion
Previous Message Daniel Browning 2014-09-05 19:32:49 Re: Stop pgpass.conf EOL conversion