This patch has been applied to DBDpg and will appear in the next
official release.  Thanks.

---------------------------------------------------------------------------

Oleg Bartunov wrote:
> Zach,
> 
> We just found a bug in DBD-PG 0.98 and sent bug report to Edmund.
> You may try our patch:
> 
>       Regards,
> 
>               Oleg
> 
> >From [EMAIL PROTECTED] Thu May 24 19:51:22 2001
> Date: Thu, 24 May 2001 20:49:46 +0400 (MSD)
> From: Ivan E. Panchenko <[EMAIL PROTECTED]>
> To: Edmund Mergl <[EMAIL PROTECTED]>
> Cc: Oleg Bartunov <[EMAIL PROTECTED]>
> Subject: DBD-Pg-0.98 horrible segfault bug !!!
> 
> 
> Dear Edmund,
> 
> There is a horrible bug in DBD-Pg introduced in the 0.98 version.
> It can lead to a segmentation falut under some random circumstances,
> namely, in the case of my applications.
> 
> This bug lives in pg_error() , dbdimp.c  near line 90 and consists of two
>  ugly mistakes. Please see the patch below.
> 
> I would greatly appreciate the prompt  inclusion of this patch in the next
> version.
> 
> Regards, Ivan
> 
> 
> --- DBD-Pg-0.98/dbdimp.c      Wed Apr 25 15:29:06 2001
> +++ DBD-Pg-0.98a/dbdimp.c     Thu May 24 20:12:52 2001
> @@ -75,15 +75,16 @@
>      char *err, *src, *dst;
>      int  len  = strlen(error_msg);
> 
> -    err = (char *)malloc(strlen(error_msg + 1));
> +    err = (char *)malloc(strlen(error_msg) + 1);
>      if (!err) {
>        return;
>      }
>      src = error_msg;
>      dst = err;
> 
> +
>      /* copy error message without trailing newlines */
> -    while (*dst != '\0' && *dst != '\n') {
> +    while (*src != '\0' && *src != '\n') {
>          *dst++ = *src++;
>      }
>      *dst = '\0';
> 
> On Wed, 23 May 2001, Zachary Beane wrote:
> 
> > I've been having trouble getting the proper value of $handle->errstr
> > or $DBI::errstr. For some reason, it's always giving the scalar 7 back
> > rather than an informative error message. Here's an script and output:
> >
> > --- foo.pl ---
> > #!/usr/bin/perl
> >
> > use DBI;
> > my $dbh = DBI->connect("dbi:Pg:dbname=template1", "xach", undef);
> >
> > my $sql = "bogus sql goes here";
> > my $sth = $dbh->prepare($sql);
> > $sth->execute() or die $sth->errstr;
> >
> > my ($result) = $sth->fetchrow_array();
> >
> > $sth->finish;
> >
> > print $result, "\n";
> > $dbh->disconnect();
> > --- end ---
> >
> > When run, it prints out this:
> >
> >    $ perl foo.pl
> >    DBD::Pg::st execute failed:  at foo.pl line 8.
> >    7 at foo.pl line 8.
> >    Database handle destroyed without explicit disconnect.
> >
> > Now, I'm not surprised at the "database handle destroyed..." part, but
> > I can't figure out why i'm getting "7 at foo.pl" and a blank message
> > in the execute failed string. Any ideas?
> >
> > Zach
> >
> _____________________________________________________________
> Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
> Sternberg Astronomical Institute, Moscow University (Russia)
> Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
> phone: +007(095)939-16-83, +007(095)939-23-83
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  [EMAIL PROTECTED]               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Reply via email to