Thread: pgAdmin corrupts pgpass.conf on windows

pgAdmin corrupts pgpass.conf on windows

From
"George Pavlov"
Date:
Is this a known problem? Is there a fix for it? It seems that pgAdmin
(v.1.4.1 for sure, but I think some prior versions as well) on Windows
corrupt the pgpass.conf file by deleting existing entries and adding
"garbage" ones. This is not a huge problem for pgAdmin itself, although
this presents itself as pgAdmin "forgetting" the password that it had
previously remembered for you and making you type it again -- a minor
annoyance. Where it ends up being really disruptive for me is that it
trips my psql runs and various scripts that rely on my passwords being
set.

Are there any plans to fix the problem? Is it at all possible to change
the behavior so that psql and pgAdmin to not rely on the same
pgpass.conf? Is there any configuration variable that I can set for
pgAdmin to make it point to a different pgpass.conf

As an example, below is my actual pgpass.conf file as of today after a
few battles between pgAdmin and psql for control over it (I have changed
usernames and passwords to protect the innocent). And no, I do not have
a server named "7" -- these are just truncated garbage lines inserted by
pgAdmin. the sequences of #s are places where pgAdmin has deleted the
lines after the comment, so it used to look like this:

#
servername1:5432:*:moo:goo
servername1:5432:*:gai:pan
#
servername2:5432:*:moo:goo
servername2:5432:*:gai:pan

and pgAdmin made it look like this:

#
#


Here are the complete pgpass file contents:

-----------------------------------------------------
#
#
#
localhost:5432:*:foo:foo
#
dev07:5432:*:moo:moo
dev07:5432:*:foo:foo
#
#
#
192.168.68.67:5432:*:foo:foo
#
localhost:5435:*:foo:foo
#
localhost:5436:*:foo:foo
#
localhost:5437:*:moo:moo
localhost:5437:*:foo:foo
#
7:*:foo:foo
#
7:*:foo:foo
#
:foo
#
7:*:foo:foo
#
7:*:foo:foo
#
192.168.68.65:5432:*:foo:foo
dev03:5432:*:moo:moo
res:foo
dev03:5432:*:moo:moo
res:foo
dev03:5432:*:moo:moo
es
dev03:5432:*:moo:moo
localhost:5435:*:moo:moo
localhost:5435:*:moo:moo
localhost:5435:*:moo:moo
-----------------------------------------------------


Re: pgAdmin corrupts pgpass.conf on windows

From
"Dave Page"
Date:

> -----Original Message-----
> From: pgadmin-support-owner@postgresql.org
> [mailto:pgadmin-support-owner@postgresql.org] On Behalf Of
> George Pavlov
> Sent: 15 May 2006 23:17
> To: pgadmin-support@postgresql.org
> Subject: [pgadmin-support] pgAdmin corrupts pgpass.conf on windows
>
> Is this a known problem? Is there a fix for it? It seems that pgAdmin
> (v.1.4.1 for sure, but I think some prior versions as well)
> on Windows corrupt the pgpass.conf file by deleting existing
> entries and adding "garbage" ones. This is not a huge problem
> for pgAdmin itself, although this presents itself as pgAdmin
> "forgetting" the password that it had previously remembered
> for you and making you type it again -- a minor annoyance.
> Where it ends up being really disruptive for me is that it
> trips my psql runs and various scripts that rely on my
> passwords being set.

No, this is not a known issue - at least not one I've ever seen.

> Are there any plans to fix the problem? Is it at all possible
> to change the behavior so that psql and pgAdmin to not rely
> on the same pgpass.conf? Is there any configuration variable
> that I can set for pgAdmin to make it point to a different pgpass.conf

No, because it's libpq that actually reads the file, not pgAdmin.

> As an example, below is my actual pgpass.conf file as of
> today after a few battles between pgAdmin and psql for
> control over it (I have changed usernames and passwords to
> protect the innocent). And no, I do not have a server named
> "7" -- these are just truncated garbage lines inserted by
> pgAdmin. the sequences of #s are places where pgAdmin has
> deleted the lines after the comment, so it used to look like this:
>

If you remove your file altogether and just let pgAdmin manage it
itself, does it then corrupt it as well?

What characterset/locale etc. does your copy of Windows run in?

Regards, Dave


Re: pgAdmin corrupts pgpass.conf on windows

From
"George Pavlov"
Date:
> If you remove your file altogether and just let pgAdmin manage it
> itself, does it then corrupt it as well?

I tried that for a bit a while ago and I did not see any corruption, but
I am not sure my tests were exhaustive. The problem is that that is
really not a solution for me because I want to be able to have many more
server/port/user/password combinations stored in there for psql/script
purposes than the few that I need for pgAdmin. For a while I thought
that my comment lines (starting with #) were confusing pgAdmin but it
seems to do the rearranging with or without comments in there. Another
workaround would be to never let pgAdmin store passwords -- that does
help although pgAdmin still seems to touch the file (it does not mess it
up as bad). If I have to I would take this approach because for my
purposes psql scripts/pg_dump/pg_restore are primary to pgAdmin. I was
just hoping for a way for the two to coexist peacefully (and also to be
able to reuse my Linux .pgpass on Windows).

> What characterset/locale etc. does your copy of Windows run in?

Don't know which of the many locale-related Windows settings you are
interested in but this is a Win XP Pro ver 2002 SP2 with the most
standard default English/US settings that have not been messed with
since it came from the factory. Under "Regional and Language Options"
under "Standards and formats" it says "English (United States)", under
Location it says "United States", under "Language for non-Unicode
programs" it says "English (United States)", etc. Let me know if there
is some registry or env variable that would be helpful.


Re: pgAdmin corrupts pgpass.conf on windows

From
"Dave Page"
Date:

> -----Original Message-----
> From: George Pavlov [mailto:gpavlov@mynewplace.com]
> Sent: 16 May 2006 00:51
> To: Dave Page; pgadmin-support@postgresql.org
> Subject: RE: [pgadmin-support] pgAdmin corrupts pgpass.conf on windows
>
> > If you remove your file altogether and just let pgAdmin manage it
> > itself, does it then corrupt it as well?
>
> I tried that for a bit a while ago and I did not see any
> corruption, but I am not sure my tests were exhaustive. The
> problem is that that is really not a solution for me because
> I want to be able to have many more server/port/user/password
> combinations stored in there for psql/script purposes than
> the few that I need for pgAdmin. For a while I thought that
> my comment lines (starting with #) were confusing pgAdmin but
> it seems to do the rearranging with or without comments in
> there. Another workaround would be to never let pgAdmin store
> passwords -- that does help although pgAdmin still seems to
> touch the file (it does not mess it up as bad). If I have to
> I would take this approach because for my purposes psql
> scripts/pg_dump/pg_restore are primary to pgAdmin. I was just
> hoping for a way for the two to coexist peacefully (and also
> to be able to reuse my Linux .pgpass on Windows).

OK, I think I've found the bug and fixed it - can I mail you an updated
.exe to try?

Regards, Dave.