dbTalk Databases Forums  

[BUGS] BUG #2459: psql 8.1.4 vs 8.0.x behaves differently with tty / con / stdin recent fixes

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #2459: psql 8.1.4 vs 8.0.x behaves differently with tty / con / stdin recent fixes in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default [BUGS] BUG #2459: psql 8.1.4 vs 8.0.x behaves differently with tty / con / stdin recent fixes - 05-29-2006 , 11:55 AM







The following bug has been logged online:

Bug reference: 2459
Logged by: Silvio Macedo
Email address: smacedo (AT) calmetric (DOT) pt
PostgreSQL version: 8.1.4
Operating system: Windows XP SP2
Description: psql 8.1.4 vs 8.0.x behaves differently with tty / con
/ stdin recent fixes
Details:

Hi,

I've been using stdin/stdout of psql on Windows to run a script, without
messing with "expect".

Before v8.1.4, one could include the password in the string fed to psql via
stdin to authenticate the connection.

With 8.1.4, it doesn't work.

All of this *seems* to be related to patch introduced by Bruce:
http://archives.postgresql.org/pgsql...3/msg00051.php
to avoid relying on /dev/con on Msys.

Is this a BUG or a design decision? If it's by design, people should be
warned about this different behaviour (getting a password on the stdin
doesn't work in 8.1.4)
If it's a bug, correction should be on file
\src\port\sprompt.c:69
This, together with what is in file port.h, seems to be wrong :
#ifdef WIN32
/* See DEVTTY comment for msys */
Quote:
| (getenv("OSTYPE") && strcmp(getenv("OSTYPE"), "msys") == 0)
#endif


Below, reference material with relevant excerpts of different versions of
\src\include\port.h and \src\port\sprompt.c

Thanks for any tip or feedback!
Silvio
calmetric.pt

\postgresql-8.0.7\src\include\port.h:81 to 85

#if defined(WIN32) && !defined(__CYGWIN__)
#define DEVNULL "nul"


#else
#define DEVNULL "/dev/null"

#endif



\postgresql-8.1.4\src\include\port.h:85 to 92

#if defined(WIN32) && !defined(__CYGWIN__)
#define DEVNULL "nul"
/* "con" does not work from the Msys 1.0.10 console (part of MinGW). */
#define DEVTTY "con"
#else
#define DEVNULL "/dev/null"
#define DEVTTY "/dev/tty"
#endif






\postgresql-8.0.7\src\port\sprompt.c:64 to 78

* Do not try to collapse these into one "w+" mode file. Doesn't work
* on some platforms (eg, HPUX 10.20).
*/
termin = fopen("/dev/tty", "r");
termout = fopen("/dev/tty", "w");
if (!termin || !termout)





{
if (termin)
fclose(termin);
if (termout)
fclose(termout);
termin = stdin;
termout = stderr;
}




\postgresql-8.1.4\src\port\sprompt.c:63 to 82
* Do not try to collapse these into one "w+" mode file. Doesn't work on
* some platforms (eg, HPUX 10.20).
*/
termin = fopen(DEVTTY, "r");
termout = fopen(DEVTTY, "w");
if (!termin || !termout
#ifdef WIN32
/* See DEVTTY comment for msys */
Quote:
| (getenv("OSTYPE") && strcmp(getenv("OSTYPE"), "msys") == 0)
#endif
)
{
if (termin)
fclose(termin);
if (termout)
fclose(termout);
termin = stdin;
termout = stderr;
}

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings


Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default Re: [BUGS] BUG #2459: psql 8.1.4 vs 8.0.x behaves differently with tty / con / stdin recent fixes - 05-29-2006 , 11:58 AM






Silvio Macedo wrote:

Quote:
I've been using stdin/stdout of psql on Windows to run a script, without
messing with "expect".

Before v8.1.4, one could include the password in the string fed to psql via
stdin to authenticate the connection.

With 8.1.4, it doesn't work.
You can use PGPASSWORD or a pgpass.conf file instead.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.