Re: Perl 5.13.3+ MAY BREAK COMPILED DRIVERS - Please test DBI 1.613_71!

Tim Bunce <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Message-ID <[email protected]>
On Mon, Aug 30, 2010 at 01:13:30PM -0700, Jonathan Leffler wrote:
> 
> Where do I download DBI 1.613_71 from?  I go the DBI 1.613 page at
> search.cpan.org and click on the link that says "download the latest dev
> build" which is identifies as 1.613_71, but it goes to a 404 page.

There are several servers (well, at least two) geographically
distributed. One may be lagging behind and not have the file yet.
(Just a guess.)

You can try http://pause.perl.org/incoming/ for very recently uploaded
items or http://backpan.perl.org/authors/id/T/TI/TIMB/ (often lags).

> Also, what are the symptoms that there are going to be problems?  I can find
> nothing that looks like PERL_POLLUTE in the Makefiles or build process I
> have - there is an "MPOLLUTE =" in one Makefile.  Does that mean that I
> (meaning DBD::Informix) don't use PERL_POLLUTE, or is there something else?

It means you don't define it yourself. That's fine, it's what I'd expect.

> There are lines like:
> 
> Informix.c:    ST(0) = (av) ? sv_2mortal(newRV((SV *)av)) : &sv_undef;
> Informix.c:    else ST(0) = &sv_undef;
> Informix.xsi:    ST(0) = (av) ? sv_2mortal(newRV((SV *)av)) : &sv_undef;
> Informix.xsi:    else ST(0) = &sv_undef;
> 
> Do these require a PL_ prefix?

Yes.

> That prefix used to appear automagically,
> didn't it - but is the trouble that the auto-magic is going away?

Yes.

> If I look
> at the Perl 5.12.1 'perldoc perlguts', there is nothing there to indicate
> that you do not continue to use SvIOK and sv_catpv() - pulling a couple of
> names at quasi-random.  So, since the documentation doesn't indicate any
> change there - and 'perldoc perlguts' does not contain 'pollute' or
> 'POLLUTE' - I think the change must be different from what I'm imagining.

No, it's just the PL_ change I believe. I've appended the change applied
to the DBI (from a patch by Andreas Koenig).

> I modified Informix.c to contain the following stanza after all the headers
> and just before the first function definition:
> 
> #ifdef PERL_POLLUTE
> #error PERL_POLLUTE defined
> #endif
> 
> I recompiled (several times - editing the Informix.c file after it was
> generated and then running just the GCC compilation), and that '#error'
> never fired.  Does that prove anything useful?

Er, I'm not sure.

Another approach to the issue is to run Devel::PPPort on your code
    http://search.cpan.org/perldoc?Devel::PPPort
E.g.
    perl ppport.h Informix.xs

That'll tell you what need changing.

Tim.

p.s. Another approach is to build perl 5.13.4+ and then build DBI and
drivers using that and see what breaks.


Author: timbo
Date: Fri Jul 30 06:20:00 2010
New Revision: 14292

Modified:
   dbi/trunk/DBI.xs
   dbi/trunk/Driver.xst
   dbi/trunk/dbipport.h
   dbi/trunk/dbixs_rev.h

Log:
Fix use of old 'polluted' symbols that now break with perl v5.13.3-20-gcfef31b
Patch from Andreas Koenig applied verbatim


Modified: dbi/trunk/DBI.xs
==============================================================================
--- dbi/trunk/DBI.xs	(original)
+++ dbi/trunk/DBI.xs	Fri Jul 30 06:20:00 2010
@@ -3441,16 +3441,16 @@
             (void)(*CvXSUB(xscv))(aTHXo_ xscv); /* Call the C code directly */
 
             if (gimme == G_SCALAR) {    /* Enforce sanity in scalar context */
-                if (++markix != PL_stack_sp - stack_base ) {
-                    if (markix > PL_stack_sp - stack_base)
-                         *(stack_base + markix) = &PL_sv_undef;
-                    else *(stack_base + markix) = *PL_stack_sp;
-                    PL_stack_sp = stack_base + markix;
+                if (++markix != PL_stack_sp - PL_stack_base ) {
+                    if (markix > PL_stack_sp - PL_stack_base)
+                         *(PL_stack_base + markix) = &PL_sv_undef;
+                    else *(PL_stack_base + markix) = *PL_stack_sp;
+                    PL_stack_sp = PL_stack_base + markix;
                 }
                 outitems = 1;
             }
             else {
-                outitems = PL_stack_sp - (stack_base + markix);
+                outitems = PL_stack_sp - (PL_stack_base + markix);
             }
 
         }
@@ -3463,7 +3463,7 @@
 
         /* XXX restore local vars so ST(n) works below  */
         SP -= outitems;
-        ax = (SP - stack_base) + 1;
+        ax = (SP - PL_stack_base) + 1;
 
 #ifdef DBI_save_hv_fetch_ent
         if (is_FETCH)

Modified: dbi/trunk/Driver.xst
==============================================================================
--- dbi/trunk/Driver.xst	(original)
+++ dbi/trunk/Driver.xst	Fri Jul 30 06:20:00 2010
@@ -47,7 +47,7 @@
     CODE:
     D_imp_drh(drh);
     if (0) ix = ix;     /* avoid unused variable warning */
-    ST(0) = dbd_discon_all(drh, imp_drh) ? &sv_yes : &sv_no;
+    ST(0) = dbd_discon_all(drh, imp_drh) ? &PL_sv_yes : &PL_sv_no;
 
 #endif /* dbd_discon_all */
 
@@ -95,11 +95,11 @@
     char *u = (SvOK(username)) ? SvPV(username,lna) : "";
     char *p = (SvOK(password)) ? SvPV(password,lna) : "";
 #ifdef dbd_db_login6_sv
-    ST(0) = dbd_db_login6_sv(dbh, imp_dbh, dbname, username, password, attribs) ? &sv_yes : &sv_no;
+    ST(0) = dbd_db_login6_sv(dbh, imp_dbh, dbname, username, password, attribs) ? &PL_sv_yes : &PL_sv_no;
 #elif defined(dbd_db_login6)
-    ST(0) = dbd_db_login6(dbh, imp_dbh, SvPV_nolen(dbname), u, p, attribs) ? &sv_yes : &sv_no;
+    ST(0) = dbd_db_login6(dbh, imp_dbh, SvPV_nolen(dbname), u, p, attribs) ? &PL_sv_yes : &PL_sv_no;
 #else
-    ST(0) = dbd_db_login( dbh, imp_dbh, SvPV_nolen(dbname), u, p) ? &sv_yes : &sv_no;
+    ST(0) = dbd_db_login( dbh, imp_dbh, SvPV_nolen(dbname), u, p) ? &PL_sv_yes : &PL_sv_no;
 #endif
     }
 
@@ -274,7 +274,7 @@
     D_imp_dbh(dbh);
     if (DBIc_has(imp_dbh,DBIcf_AutoCommit) && DBIc_WARN(imp_dbh))
         warn("commit ineffective with AutoCommit enabled");
-    ST(0) = dbd_db_commit(dbh, imp_dbh) ? &sv_yes : &sv_no;
+    ST(0) = dbd_db_commit(dbh, imp_dbh) ? &PL_sv_yes : &PL_sv_no;
 
 
 void
@@ -284,7 +284,7 @@
     D_imp_dbh(dbh);
     if (DBIc_has(imp_dbh,DBIcf_AutoCommit) && DBIc_WARN(imp_dbh))
         warn("rollback ineffective with AutoCommit enabled");
-    ST(0) = dbd_db_rollback(dbh, imp_dbh) ? &sv_yes : &sv_no;
+    ST(0) = dbd_db_rollback(dbh, imp_dbh) ? &PL_sv_yes : &PL_sv_no;
 
 
 void
@@ -297,14 +297,14 @@
     }
     /* Check for disconnect() being called whilst refs to cursors       */
     /* still exists. This possibly needs some more thought.             */
-    if (DBIc_ACTIVE_KIDS(imp_dbh) && DBIc_WARN(imp_dbh) && !dirty) {
+    if (DBIc_ACTIVE_KIDS(imp_dbh) && DBIc_WARN(imp_dbh) && !PL_dirty) {
         STRLEN lna;
         char *plural = (DBIc_ACTIVE_KIDS(imp_dbh)==1) ? "" : "s";
         warn("%s->disconnect invalidates %d active statement handle%s %s",
             SvPV(dbh,lna), (int)DBIc_ACTIVE_KIDS(imp_dbh), plural,
             "(either destroy statement handles or call finish on them before disconnecting)");
     }
-    ST(0) = dbd_db_disconnect(dbh, imp_dbh) ? &sv_yes : &sv_no;
+    ST(0) = dbd_db_disconnect(dbh, imp_dbh) ? &PL_sv_yes : &PL_sv_no;
     DBIc_ACTIVE_off(imp_dbh);   /* ensure it's off, regardless */
 
 
@@ -317,10 +317,10 @@
     D_imp_dbh(dbh);
     if (SvGMAGICAL(valuesv))
         mg_get(valuesv);
-    ST(0) = &sv_yes;
+    ST(0) = &PL_sv_yes;
     if (!dbd_db_STORE_attrib(dbh, imp_dbh, keysv, valuesv))
         if (!DBIc_DBISTATE(imp_dbh)->set_attr(dbh, keysv, valuesv))
-            ST(0) = &sv_no;
+            ST(0) = &PL_sv_no;
 
 
 void
@@ -341,10 +341,10 @@
     PPCODE:
     /* keep in sync with default DESTROY in DBI.xs */
     D_imp_dbh(dbh);
-    ST(0) = &sv_yes;
+    ST(0) = &PL_sv_yes;
     if (!DBIc_IMPSET(imp_dbh)) {        /* was never fully set up       */
         STRLEN lna;
-        if (DBIc_WARN(imp_dbh) && !dirty && DBIc_DBISTATE(imp_dbh)->debug >= 2)
+        if (DBIc_WARN(imp_dbh) && !PL_dirty && DBIc_DBISTATE(imp_dbh)->debug >= 2)
              PerlIO_printf(DBIc_LOGPIO(imp_dbh),
                 "         DESTROY for %s ignored - handle not initialised\n",
                     SvPV(dbh,lna));
@@ -370,7 +370,7 @@
                 if (DBIc_WARN(imp_dbh) /* only warn if likely to be useful... */
                 &&  DBIc_is(imp_dbh, DBIcf_Executed) /* has not just called commit/rollback */
             /*  && !DBIc_is(imp_dbh, DBIcf_ReadOnly) -- is not read only */
-                && (!dirty || DBIc_DBISTATE(imp_dbh)->debug >= 3)
+                && (!PL_dirty || DBIc_DBISTATE(imp_dbh)->debug >= 3)
                 ) {
                     warn("Issuing rollback() due to DESTROY without explicit disconnect() of %s handle %s",
                         SvPV_nolen(*hv_fetch((HV*)SvRV(dbh), "ImplementorClass", 16, 1)),
@@ -449,9 +449,9 @@
     D_imp_sth(sth);
     DBD_ATTRIBS_CHECK("_prepare", sth, attribs);
 #ifdef dbd_st_prepare_sv
-    ST(0) = dbd_st_prepare_sv(sth, imp_sth, statement, attribs) ? &sv_yes : &sv_no;
+    ST(0) = dbd_st_prepare_sv(sth, imp_sth, statement, attribs) ? &PL_sv_yes : &PL_sv_no;
 #else
-    ST(0) = dbd_st_prepare(sth, imp_sth, SvPV_nolen(statement), attribs) ? &sv_yes : &sv_no;
+    ST(0) = dbd_st_prepare(sth, imp_sth, SvPV_nolen(statement), attribs) ? &PL_sv_yes : &PL_sv_no;
 #endif
     }
 
@@ -495,13 +495,13 @@
         }
     }
     switch(dbd_st_bind_col(sth, imp_sth, col, ref, sql_type, attribs)) {
-    case 2:     ST(0) = &sv_yes;        /* job done completely */
+    case 2:     ST(0) = &PL_sv_yes;        /* job done completely */
                 break;
     case 1:     /* fallback to DBI default */
                 ST(0) = (DBIc_DBISTATE(imp_sth)->bind_col(sth, col, ref, attribs))
-                    ? &sv_yes : &sv_no;
+                    ? &PL_sv_yes : &PL_sv_no;
                 break;
-    default:    ST(0) = &sv_no;         /* dbd_st_bind_col has called set_err */
+    default:    ST(0) = &PL_sv_no;         /* dbd_st_bind_col has called set_err */
                 break;
     }
     }
@@ -533,7 +533,7 @@
         }
     }
     ST(0) = dbd_bind_ph(sth, imp_sth, param, value, sql_type, attribs, FALSE, 0)
-                ? &sv_yes : &sv_no;
+                ? &PL_sv_yes : &PL_sv_no;
     }
 
 
@@ -568,7 +568,7 @@
         }
     }
     ST(0) = dbd_bind_ph(sth, imp_sth, param, value, sql_type, attribs, TRUE, maxlen)
-                ? &sv_yes : &sv_no;
+                ? &PL_sv_yes : &PL_sv_no;
     }
 
 
@@ -679,9 +679,9 @@
         XSRETURN_YES;
     }
 #ifdef dbd_st_finish3
-    ST(0) = dbd_st_finish3(sth, imp_sth, 0) ? &sv_yes : &sv_no;
+    ST(0) = dbd_st_finish3(sth, imp_sth, 0) ? &PL_sv_yes : &PL_sv_no;
 #else
-    ST(0) = dbd_st_finish(sth, imp_sth) ? &sv_yes : &sv_no;
+    ST(0) = dbd_st_finish(sth, imp_sth) ? &PL_sv_yes : &PL_sv_no;
 #endif
 
 
@@ -713,10 +713,10 @@
     D_imp_sth(sth);
     if (SvGMAGICAL(valuesv))
         mg_get(valuesv);
-    ST(0) = &sv_yes;
+    ST(0) = &PL_sv_yes;
     if (!dbd_st_STORE_attrib(sth, imp_sth, keysv, valuesv))
         if (!DBIc_DBISTATE(imp_sth)->set_attr(sth, keysv, valuesv))
-            ST(0) = &sv_no;
+            ST(0) = &PL_sv_no;
 
 
 # FETCH renamed and ALIAS'd to avoid case clash on VMS :-(
@@ -742,10 +742,10 @@
     PPCODE:
     /* keep in sync with default DESTROY in DBI.xs */
     D_imp_sth(sth);
-    ST(0) = &sv_yes;
+    ST(0) = &PL_sv_yes;
     if (!DBIc_IMPSET(imp_sth)) {        /* was never fully set up       */
         STRLEN lna;
-        if (DBIc_WARN(imp_sth) && !dirty && DBIc_DBISTATE(imp_sth)->debug >= 2)
+        if (DBIc_WARN(imp_sth) && !PL_dirty && DBIc_DBISTATE(imp_sth)->debug >= 2)
              PerlIO_printf(DBIc_LOGPIO(imp_sth),
                 "         DESTROY for %s ignored - handle not initialised\n",
                     SvPV(sth,lna));
@@ -758,7 +758,7 @@
         }
         if (DBIc_ACTIVE(imp_sth)) {
             D_imp_dbh_from_sth;
-            if (!dirty && DBIc_ACTIVE(imp_dbh)) {
+            if (!PL_dirty && DBIc_ACTIVE(imp_dbh)) {
 #ifdef dbd_st_finish3
                 dbd_st_finish3(sth, imp_sth, 1);
 #else
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.