[SCM] Debian packaging of DBD-Firebird CPAN distribution branch, master, updated. debian/0.91-2-25-gaff8232

Damyan Ivanov dmn at debian.org
Sat May 18 11:56:47 UTC 2013


The following commit has been merged in the master branch:
commit 0aa8b6fdab4582d9ecf4845e82cac1e356274d6a
Author: Damyan Ivanov <dmn at debian.org>
Date:   Sat May 18 14:52:02 2013 +0300

    add patch removing wrong conversion of utf8 to bytes when feeding character data to firebird
    
     1) the bytes_from_utf8 function doesn't convert from utf8 to bytes, but from
        utf8 to "native encoding", which may be something like latin1
     2) firebird already expects utf8, so conversion is not really necessary
    
    fixes failure to build with perl 5.16+. perl 5.14 seems to have broken
    bytes_from_utf8 function, or something else in the environment made it work as
    expected
    
    Closes: #704265 -- FTBFS with perl 5.16: test failures

diff --git a/debian/patches/direct_utf8.patch b/debian/patches/direct_utf8.patch
new file mode 100644
index 0000000..18548a9
--- /dev/null
+++ b/debian/patches/direct_utf8.patch
@@ -0,0 +1,109 @@
+--- a/dbdimp.c
++++ b/dbdimp.c
+@@ -2076,7 +2076,6 @@ int ib_blob_write(SV *sth, imp_sth_t *im
+     char            *p, *seg, *string;
+     int             is_text_blob, seg_len;
+     bool            is_utf8;
+-    U8              *encoded;
+ 
+     DBI_TRACE_imp_xxh(imp_sth, 2, (DBIc_LOGPIO(imp_sth), "ib_blob_write\n"));
+ 
+@@ -2099,11 +2098,6 @@ int ib_blob_write(SV *sth, imp_sth_t *im
+ 
+     /* get length, pointer to data */
+     string = SvPV(value, total_length);
+-    if (is_text_blob && imp_dbh->ib_enable_utf8) {
+-        is_utf8 = SvUTF8(value);
+-        encoded = bytes_from_utf8((U8*)string, &total_length, &is_utf8);
+-    }
+-    else encoded = (U8*)string;
+ 
+     /* write it segment by segment */
+     seg_len = BLOB_SEGMENT;
+@@ -2141,8 +2135,6 @@ int ib_blob_write(SV *sth, imp_sth_t *im
+         isc_put_segment(status, &handle, (unsigned short) seg_len, seg);
+         if (ib_error_check(sth, status))
+         {
+-            if (encoded != (U8*)string)
+-                Safefree(encoded);
+             isc_cancel_blob(status, &handle);
+             return FALSE;
+         }
+@@ -2151,9 +2143,6 @@ int ib_blob_write(SV *sth, imp_sth_t *im
+ 
+     }
+ 
+-    if (encoded != (U8*)string)
+-        Safefree(encoded);
+-
+     /* close blob, check for error */
+     isc_close_blob(status, &handle);
+     if (ib_error_check(sth, status))
+@@ -2266,18 +2255,9 @@ static int ib_fill_isqlda(SV *sth, imp_s
+             char *string;
+             STRLEN len;
+             bool is_utf8;
+-            U8 *encoded;
+ 
+             string = SvPV(value, len);
+ 
+-            if (imp_dbh->ib_enable_utf8) {
+-                is_utf8 = SvUTF8(value);
+-                encoded = bytes_from_utf8((U8*)string, &len, &is_utf8);
+-                /* either returns string (nothing changed, plain ASCII)
+-                   or returns a new pointer to encoded octets */
+-            }
+-            else encoded = (U8*)string;
+-
+             if (len > ivar->sqllen) {
+                 char err[80];
+                 sprintf(err, "String truncation (SQL_VARYING): attempted to bind %lu octets to column sized %lu",
+@@ -2289,9 +2269,7 @@ static int ib_fill_isqlda(SV *sth, imp_s
+                 Newxz(ivar->sqldata, ivar->sqllen + sizeof(short), char);
+ 
+             *((short *)ivar->sqldata) = len;
+-            Copy((char*)encoded, ivar->sqldata + sizeof(short), len, char);
+-            if (encoded != (U8*)string)
+-                Safefree(encoded);
++            Copy(string, ivar->sqldata + sizeof(short), len, char);
+             break;
+         }
+         /**********************************************************************/
+@@ -2301,18 +2279,9 @@ static int ib_fill_isqlda(SV *sth, imp_s
+             char *string;
+             STRLEN len;
+             bool is_utf8;
+-            U8 *encoded;
+ 
+             string = SvPV(value, len);
+ 
+-            if (imp_dbh->ib_enable_utf8) {
+-                is_utf8 = SvUTF8(value);
+-                encoded = bytes_from_utf8((U8*)string, &len, &is_utf8);
+-                /* either returns string (nothing changed, plain ASCII)
+-                   or returns a new pointer to encoded octets */
+-            }
+-            else encoded = (U8*)string;
+-
+             if (len > ivar->sqllen) {
+                 char err[80];
+                 sprintf(err, "String truncation (SQL_TEXT): attempted to bind %lu octets to column sized %lu",
+@@ -2320,14 +2289,15 @@ static int ib_fill_isqlda(SV *sth, imp_s
+                 break;
+             }
+ 
++            if (DBIc_TRACE_LEVEL(imp_sth) >= 1)
++                PerlIO_printf(DBIc_LOGPIO(imp_sth), "filling SQL_TEXT (sqllen=%ld, len=%ld)\n", (long)ivar->sqllen, (long)len);
++
+             if (!(ivar->sqldata))
+                 Newxc(ivar->sqldata, ivar->sqllen, char, ISC_SCHAR);
+ 
+             /* Pad the entire field with blanks */
+             PoisonWith(ivar->sqldata, ivar->sqllen, char, ' ');
+-            Copy((char*)encoded, ivar->sqldata, len, char);
+-            if (encoded != (U8*)string)
+-                Safefree(encoded);
++            Copy(string, ivar->sqldata, len, char);
+             break;
+         }
+ 
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..854ba93
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+direct_utf8.patch

-- 
Debian packaging of DBD-Firebird CPAN distribution



More information about the Pkg-perl-cvs-commits mailing list