Thread: pg_restore bug on win32
I have verfied this bug exists in all pg_restore versions greater than 8.0.0 Someone else reported it way back in Feb: http://groups.google.com/group/mailing.database.pgsql-bugs/browse_thread/thread/4dacdd43b894a2c3/e59e3203bb22745b?lnk=st&q=pg_restore+password+authentication+failed&rnum=9&hl=en#e59e3203bb22745b basicly pg_restore prompts for the password, but no matter what you enter it fails, the only way it works is to have the server pg_hba.conf file set to trust. version 8.0.0 works, so it was the result of some change in versions later than 8.0.0 Anyone know if this is resolved for 8.1? Thanks, Tony
Tony Caduto <tony_caduto@amsoftwaredesign.com> writes: > basicly pg_restore prompts for the password, but no matter what you > enter it fails, the only way it works is to have > the server pg_hba.conf file set to trust. version 8.0.0 works, so it > was the result of some change in versions later than 8.0.0 Hmm. The only relevant-looking change between 8.0.0 and 8.0.1 is this one: http://developer.postgresql.org/cvsweb.cgi/pgsql/src/bin/pg_dump/pg_backup_archiver.c.diff?r1=1.101.4.2;r2=1.101.4.3;f=h I wonder if this could be messing up the password acceptance --- for instance, by causing CR or LF to not be stripped off what you type. regards, tom lane
I wrote: > Hmm. The only relevant-looking change between 8.0.0 and 8.0.1 is > this one: > http://developer.postgresql.org/cvsweb.cgi/pgsql/src/bin/pg_dump/pg_backup_archiver.c.diff?r1=1.101.4.2;r2=1.101.4.3;f=h > I wonder if this could be messing up the password acceptance --- for > instance, by causing CR or LF to not be stripped off what you type. I've applied a patch that should fix it if that is the source of the problem. I can't test it though, for lack of a Windows setup. regards, tom lane Index: pg_backup_archiver.c =================================================================== RCS file: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v retrieving revision 1.101.4.7 diff -c -r1.101.4.7 pg_backup_archiver.c *** pg_backup_archiver.c 17 May 2005 17:30:41 -0000 1.101.4.7 --- pg_backup_archiver.c 11 Sep 2005 00:32:33 -0000 *************** *** 1714,1724 **** /* * On Windows, we need to use binary mode to read/write non-text archive ! * formats. Force stdin/stdout into binary mode in case that is what * we are using. */ #ifdef WIN32 ! if (fmt != archNull) { if (mode == archModeWrite) setmode(fileno(stdout), O_BINARY); --- 1714,1725 ---- /* * On Windows, we need to use binary mode to read/write non-text archive ! * formats. Force stdin/stdout into binary mode if that is what * we are using. */ #ifdef WIN32 ! if (fmt != archNull && ! (AH->fSpec == NULL || strcmp(AH->fSpec, "") == 0)) { if (mode == archModeWrite) setmode(fileno(stdout),O_BINARY);
Tom Lane wrote: >I wrote: > > >>Hmm. The only relevant-looking change between 8.0.0 and 8.0.1 is >>this one: >>http://developer.postgresql.org/cvsweb.cgi/pgsql/src/bin/pg_dump/pg_backup_archiver.c.diff?r1=1.101.4.2;r2=1.101.4.3;f=h >>I wonder if this could be messing up the password acceptance --- for >>instance, by causing CR or LF to not be stripped off what you type. >> >> > >I've applied a patch that should fix it if that is the source of the >problem. I can't test it though, for lack of a Windows setup. > > regards, tom lane > >Index: pg_backup_archiver.c >=================================================================== >RCS file: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v >retrieving revision 1.101.4.7 >diff -c -r1.101.4.7 pg_backup_archiver.c >*** pg_backup_archiver.c 17 May 2005 17:30:41 -0000 1.101.4.7 >--- pg_backup_archiver.c 11 Sep 2005 00:32:33 -0000 >*************** >*** 1714,1724 **** > > /* > * On Windows, we need to use binary mode to read/write non-text archive >! * formats. Force stdin/stdout into binary mode in case that is what > * we are using. > */ > #ifdef WIN32 >! if (fmt != archNull) > { > if (mode == archModeWrite) > setmode(fileno(stdout), O_BINARY); >--- 1714,1725 ---- > > /* > * On Windows, we need to use binary mode to read/write non-text archive >! * formats. Force stdin/stdout into binary mode if that is what > * we are using. > */ > #ifdef WIN32 >! if (fmt != archNull && >! (AH->fSpec == NULL || strcmp(AH->fSpec, "") == 0)) > { > if (mode == archModeWrite) > setmode(fileno(stdout), O_BINARY); > >---------------------------(end of broadcast)--------------------------- >TIP 5: don't forget to increase your free space map settings > > > > If someone can create a binary, I can test it in my environment. Tony
Tony Caduto wrote: > Tom Lane wrote: > >>> Hmm. The only relevant-looking change between 8.0.0 and 8.0.1 is >>> this one: >>> http://developer.postgresql.org/cvsweb.cgi/pgsql/src/bin/pg_dump/pg_backup_archiver.c.diff?r1=1.101.4.2;r2=1.101.4.3;f=h >>> >>> I wonder if this could be messing up the password acceptance --- for >>> instance, by causing CR or LF to not be stripped off what you type. >>> >> >> >> I've applied a patch that should fix it if that is the source of the >> problem. I can't test it though, for lack of a Windows setup. >> > If someone can create a binary, I can test it in my environment. build placed for a limited time at: http://developer.postgresql.org/~adunstan/rel8_0_stable-20050910.tgz cheers andrew