Looks fine, though the DBI.xs change (assert) isn't needed and isn't in the DBI
code.
Tim.
On Tue, Jun 19, 2007 at 12:43:53AM +0200, Christian Hammers wrote:
> Hello
>
> As reported in the Debian bug tracking system. Can you comment if this
> patch is OK?
>
> bye,
>
> -christian-
>
>
>
> From: Tim Cutts <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: libdbi-perl 1.55
> Date: Mon, 14 May 2007 11:48:26 +0100
> X-Mailer: Apple Mail (2.752.2)
>
> Hi Christian,
>
> One of the changes introduced in DBI 1.55 is a very small fix which
> fixes a bug which can really cause data loss (a problem with
> selectall_arrayref). The bug was spotted by one of my colleagues
> here (Rob Davies, whom Tim Bunce credits in the changelog). We have
> actually seen it cause real data loss here, so it's not just a
> theoretical problem.
>
> What I was wondering was whether there is any way we can get that fix
> into Debian on etch's next point release? The patch to fix that
> particular issue is as follows:
>
> diff -Naur DBI-1.54/DBI.xs DBI-1.54.patched/DBI.xs
> --- DBI-1.54/DBI.xs 2007-02-22 01:36:15.000000000 +0000
> +++ DBI-1.54.patched/DBI.xs 2007-04-26 09:38:00.667000000 +0100
> @@ -9,7 +9,7 @@
>
> #define IN_DBI_XS 1 /* see DBIXS.h */
> #define PERL_NO_GET_CONTEXT
> -
> +#include <assert.h>
> #include "DBIXS.h" /* DBI public interface for DBD's written in C
> */
>
> # if (defined(_WIN32) && (! defined(HAS_GETTIMEOFDAY)))
> @@ -3104,6 +3104,9 @@
> outitems = perl_call_sv(isGV(imp_msv) ? (SV*)GvCV(imp_msv) :
> imp_msv,
> (is_DESTROY ? gimme | G_EVAL | G_KEEPERR : gimme) );
> }
> +
> + assert(outitems >= 0);
> +
> SPAGAIN;
>
> /* XXX restore local vars so ST(n) works below */
> diff -Naur DBI-1.54/Driver.xst DBI-1.54.patched/Driver.xst
> --- DBI-1.54/Driver.xst 2007-02-22 01:36:15.000000000 +0000
> +++ DBI-1.54.patched/Driver.xst 2007-04-26 15:15:47.084000000 +0100
> @@ -121,6 +121,7 @@
> }
> else {
> sth = dbixst_bounce_method("prepare", 3);
> + SPAGAIN; SP -= items; /* because stack might have been realloc'd */
> if (!SvROK(sth))
> XSRETURN_UNDEF;
> }
> @@ -157,6 +158,7 @@
> else {
> /* --- prepare --- */
> sth = dbixst_bounce_method("prepare", 3);
> + SPAGAIN; SP -= items; /* because stack might have been realloc'd */
> if (!SvROK(sth)) {
> if (is_selectrow_array) { XSRETURN_EMPTY; } else { XSRETURN_UNDEF; }
> }