Re: Stop pgpass.conf EOL conversion
От | Dave Page |
---|---|
Тема | Re: Stop pgpass.conf EOL conversion |
Дата | |
Msg-id | B54161B6-C5A3-4EC9-99B6-0DD1972D1E8F@pgadmin.org обсуждение исходный текст |
Ответ на | Re: Stop pgpass.conf EOL conversion (Daniel Browning <db@kavod.com>) |
Ответы |
Re: Stop pgpass.conf EOL conversion
|
Список | 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
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK:http://www.enterprisedb.com
The Enterprise PostgreSQL Company
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 EOLcharacters 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 thatformat 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 onepgpass file for both Windows applications (pgAdmin, psql underpowershell, etc.) and cygwin applications (/usr/bin/psql). I created asymlink from the pgpass.conf file to .pgpass, and it works perfectly.Until, that is, I launch pgAdmin and it adds the Windows carriagereturns. Then, cygwin's psql stops working; it seems to send the carriagereturn appended to the end of the password, resulting in incorrectpassword errors.The primary reason that file (and others) are written with DOS lineendings is because the default editor on Windows (notepad) can't copewith *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 requiresusers to install a better editor (which is arguably a very good ideaanyway, but we don't want to force it on users who may just be settingup 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 findthat when I am forced to use Windows, as in this case, it issignificantly easier for me to use cygwin than to learn all theWindows-equivalent commandline tools, which in many cases do not evenexist.Have you tried Msys? Not suggesting you should switch, but it would beinteresting 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 yourproblem, but you're the only person to report it in 12+ years that Ican remember. I suspect the notepad issue would inconvenience far moreusers. 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 по дате отправления: