Ugly bug with one-click installer and postgres-pr


#1

Windows XP Pro
dbi 0.0.23
postgres-pr 0.4.0
Ruby one-click installer, p3

I’m getting a rather ugly bug when I try to connect to a PostgreSQL
database using the one click installer. Any ideas?

If I don’t include the username

C:\ruby2\src\ruby-dbi-all>c:\ruby2\bin\irb
irb(main):001:0> VERSION
=> “1.8.4”
irb(main):002:0> require “dbi”
=> true
irb(main):003:0> DBI::VERSION
=> “0.0.23”
irb(main):004:0> dbh = DBI.connect(‘dbi:Pg:cdlib_development’)
RuntimeError: FATAL C28000 Mno PostgreSQL user name specified in
startup packet Fpostmaster.c L1537 RProcess
StartupPacket
from
c:/ruby2/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/connection.rb:55:in
initialize' from c:/ruby2/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/connection.rb:29:ininitialize’
from
c:/ruby2/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/postgres-compat.rb:23:in
initialize' from c:/ruby2/lib/ruby/site_ruby/1.8/DBD/Pg/Pg.rb:96:ininitialize’
from c:/ruby2/lib/ruby/site_ruby/1.8/DBD/Pg/Pg.rb:55:in
connect' from c:/ruby2/lib/ruby/site_ruby/1.8/dbi/dbi.rb:584:inconnect’
from c:/ruby2/lib/ruby/site_ruby/1.8/dbi/dbi.rb:384:in
`connect’
from (irb):4

If I add the username

irb(main):005:0> dbh =
DBI.connect(‘dbi:Pg:cdlib_development’,‘postgres’)
Errno::EINVAL: Invalid argument
from c:/ruby2/lib/ruby/1.8/readbytes.rb:16:in read' from c:/ruby2/lib/ruby/1.8/readbytes.rb:16:inreadbytes’
from
c:/ruby2/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/message.rb:32:in
read' from c:/ruby2/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/connection.rb:30:ininitialize’
from
c:/ruby2/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/connection.rb:29:in
initialize' from c:/ruby2/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/postgres-compat.rb:23:ininitialize’
from c:/ruby2/lib/ruby/site_ruby/1.8/DBD/Pg/Pg.rb:96:in
initialize' from c:/ruby2/lib/ruby/site_ruby/1.8/DBD/Pg/Pg.rb:55:inconnect’
from c:/ruby2/lib/ruby/site_ruby/1.8/dbi/dbi.rb:584:in
connect' from c:/ruby2/lib/ruby/site_ruby/1.8/dbi/dbi.rb:384:inconnect’
from (irb):5

I do NOT see this behavior with a hand built 1.8.4. Compiler issue?
How that would make a difference with a pure Ruby driver I’m not sure,
but it seems to.

Regards,

Dan


#2

I tracked this down into readbytes.rb, which is a standard ruby library.
It is where a 1 (Fixnum) gets passed in. I tried putting rescu around
it an
hard coding in the 1 but that also fails.
That is very strange because IO.read should take a 1.