Re: Stop pgpass.conf EOL conversion - Mailing list pgadmin-support

From Daniel Browning
Subject Re: Stop pgpass.conf EOL conversion
Date
Msg-id 201409051232.49736.db@kavod.com
Whole thread Raw
In response to Re: Stop pgpass.conf EOL conversion  (Dave Page <dpage@pgadmin.org>)
Responses Re: Stop pgpass.conf EOL conversion
List pgadmin-support
On Friday 05 September 2014 12:57:21 am Dave Page wrote:
> On Thu, Sep 4, 2014 at 11:23 PM, Daniel Browning <db@kavod.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
inAppData\Roaming\etc.* When he tries to open it in notepad, it's all wonky and he is confused.* He tries running
PgAdminanyway* 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



pgadmin-support by date:

Previous
From: Dave Page
Date:
Subject: Re: PgAdmin Crash Dialog
Next
From: Dave Page
Date:
Subject: Re: Stop pgpass.conf EOL conversion