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
run postgreSQL from. That is the only way that you would be able to
open the file '/dev/tty', if the cwd is c:.
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.
If I switch my cwd to a drive that does not have a dev directory at
the root, the problem goes away.
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
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings