Re: [PATCH] Prompt for password on Windows platforms

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Magnus Hagander <mha(at)sollentuna(dot)net>
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: [PATCH] Prompt for password on Windows platforms
Date: 2006-02-28 21:07:16
Message-ID: 4404BB84.5040807@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Magnus Hagander wrote:

>>>I was very surprised by this issue as well. I am just assuming that
>>>not many people have a c:\dev directory on their machines
>>>
>>>
>>where they
>>
>>
>>>run postgreSQL from. That is the only way that you would be able to
>>>open the file '/dev/tty', if the cwd is c:.
>>>
>>>If I switch my cwd to a drive that does not have a dev directory at
>>>the root, the problem goes away.
>>>
>>>
>>This sounds to me like a reasonable explanation to the fact
>>that this works in most cases but not all. And that some have
>>it working when they're on C: but not on a network drive or
>>the other way around.
>>
>>And I can confirm this problem definitly exists. Haven't had
>>time to test the patch, but:
>>
>>
>
>
>
>>So yes, it looks like this patch will be needed. A very good
>>catch, Robert! This one has been annoying me for a long time!
>>
>>Tom - if you're unsure the patch fixes the problem, I'll try
>>to test it soonest. But the problem definitly exists!
>>
>>
>
>I have now tested the patch, and it does work. Didn't apply cleanly,
>most likely because the mailer (either yours or mine) messed up -
>probably with the tabs. Attached is a version as an attachment which
>should survive this (win32_tty.patch).
>
>This patch fixes a longstanding issue. Anybody who has a \dev directory
>on the drive that happens to be current when executing psql will get
>broken password authentication without any error msg. I beleive this bug
>is responsible for most, if not all, the reports of this kind of issue
>we've seen on win32.
>
>The only reason we don't se eit all the time is that c:\dev isn't a very
>common directory on win32. But I'm sure several packages doing "I wanna
>look like unix" stuff creates one (cygwin, which breaks a lot of other
>things, doesn't though - they stick thereis in the cygwin directory. but
>there are others)
>
>
>Now, this bug can in theory affect all platforms not just win32 - any
>platform where /dev/tty is not a file, or when it doesn't exist but can
>be created (in which case it will be created the first time you run
>psql, and then it'll be used later). I've attached a second version of
>the patch (alternate_tty.patch) which I think could help in this case.
>But I haven't tested it on != win32.
>(Specifically, it's bad that we open /dev/tty for writing even if we
>failed it for reading (that will create a new file), and that we don't
>check if it's a tty at all).
>
>
>Since this bug is fairly bad for win32, please apply whichever version
>of this patch you prefer to HEAD and also to both 8.0 and 8.1 branches.
>
>
>
>

Maybe we should stat the file and check that it's actually a character
special device.

cheers

andrew

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Magnus Hagander 2006-02-28 21:11:49 Re: [PATCH] Prompt for password on Windows platforms
Previous Message Tom Lane 2006-02-28 20:26:15 Re: 2 line patch to allow plpythonu functions to return