develooper Front page | perl.perl5.porters | Postings from April 2003

make test fails with perl 5.8.0 and my patch

Thread Next
From:
Pradeep Hodigere
Date:
April 20, 2003 12:23
Subject:
make test fails with perl 5.8.0 and my patch
Message ID:
20030420192346.16774.qmail@web12308.mail.yahoo.com
Hi,

   I have a very simple patch that stores length on
utf8 encoded strings in an SV. On RedHat 7.3, i can
apply this patch on the 5.8.0 source and build
successfully but it fails on RedHat 7.2 and <.

   On changing the option to -Dprefix from /usr to
/usr/local the  build and test succeeds on all
versions of Redhat greater than 7.1. I don't have
access to older versions. 

   The options to Configure are as follows:
sh Configure -des '-Doptimize=-O2 -march=i386
-mcpu=i686' -Dmyhostname=localhost
-Dperladmin=root@localhost -Dcc=gcc '-Dcf_by=Red Hat,
Inc.' -Dinstallprefix=/var/tmp/perl-root/usr
-Dprefix=/usr -Darchname=i386-linux
-Dvendorprefix=/usr -Dsiteprefix=/usr -Duseshrplib
-Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid
-Dd_semctl_semun -Ui_ndbm -Di_gdbm -Di_shadow
-Di_syslog -Dman3ext=3pm -Duseperlio
-Dinstallusrbinperl -Ubincompat5005 -Uversiononly
'-Dpager=/usr/bin/less -isr' 

  Tests that fail are:
ext/B/t/deparse......................FAILED at test 2
ext/PerlIO/t/via.....................FAILED at test 9
ext/threads/shared/t/cond............FAILED at test 17

  The output from ./perl harness is:

../ext/B/t/deparse.....................dubious
        Test returned status 0 (wstat 11, 0xb)
DIED. FAILED tests 2-17
        Failed 16/17 tests, 5.88% okay

../ext/PerlIO/t/via....................dubious
        Test returned status 0 (wstat 11, 0xb)
DIED. FAILED tests 9-16
        Failed 8/16 tests, 50.00% okay

../ext/threads/shared/t/cond...........dubious
        Test returned status 0 (wstat 11, 0xb)
DIED. FAILED tests 17-31
        Failed 15/31 tests, 51.61% okay


   The Patch being applied is:
diff -ruN ./oldperl/perl-5.8.0/doop.c
./newperl/perl-5.8.0/doop.c
--- ./oldperl/perl-5.8.0/doop.c Sat Jun  1 10:02:50
2002
+++ ./newperl/perl-5.8.0/doop.c Thu Apr 10 14:01:40
2003
@@ -698,8 +698,10 @@
     bool do_taint = FALSE;

     SvUTF8_off(sv);
-    if (DO_UTF8(*sarg))
+    if (DO_UTF8(*sarg)) {
         SvUTF8_on(sv);
+        (sv)->sv_length = 0;
+    }
     sv_vsetpvfn(sv, pat, patlen, Null(va_list*), sarg
+ 1, len - 1, &do_taint);
     SvSETMAGIC(sv);
     if (do_taint)
diff -ruN ./oldperl/perl-5.8.0/pp.c
./newperl/perl-5.8.0/pp.c
--- ./oldperl/perl-5.8.0/pp.c   Tue Jun 18 13:26:49
2002
+++ ./newperl/perl-5.8.0/pp.c   Thu Apr 10 14:01:42
2003
@@ -2993,6 +2993,7 @@
     sv = POPs;
     PUTBACK;
     if (repl_sv) {
+    (sv)->sv_length = 0;
        if (repl_is_utf8) {
            if (!DO_UTF8(sv))
                sv_utf8_upgrade(sv);
@@ -3079,6 +3080,7 @@
                SvREFCNT_dec(repl_sv_copy);
        }
        else if (lvalue) {              /* it's an
lvalue! */
+        (sv)->sv_length = 0;
            if (!SvGMAGICAL(sv)) {
                if (SvROK(sv)) {
                    STRLEN n_a;
@@ -3123,6 +3125,7 @@

     SvTAINTED_off(TARG);               /*
decontaminate */
     if (lvalue) {                      /* it's an
lvalue! */
+       (targ)->sv_length = 0;
        if (SvTYPE(TARG) < SVt_PVLV) {
            sv_upgrade(TARG, SVt_PVLV);
            sv_magic(TARG, Nullsv, PERL_MAGIC_vec,
Nullch, 0);
diff -ruN ./oldperl/perl-5.8.0/pp_hot.c
./newperl/perl-5.8.0/pp_hot.c
--- ./oldperl/perl-5.8.0/pp_hot.c       Thu Jul 18
14:32:07 2002
+++ ./newperl/perl-5.8.0/pp_hot.c       Thu Apr 10
14:06:28 2003
@@ -106,6 +106,8 @@
     if (PL_tainting && PL_tainted &&
!SvTAINTED(left))
        TAINT_NOT;
     SvSetMagicSV(right, left);
+    (right)->sv_length = 0;
+    (left)->sv_length = 0;
     SETs(right);
     RETURN;
 }
@@ -186,6 +188,7 @@
     }
     sv_catpvn_nomg(TARG, rpv, rlen);

+    (targ)->sv_length = 0;
     SETTARG;
     RETURN;
   }
@@ -1920,6 +1923,7 @@
        EXTEND(SP,1);
     }

+    (targ)->sv_length = 0;
     if (SvFAKE(TARG) && SvREADONLY(TARG))
        sv_force_normal(TARG);
     if (SvREADONLY(TARG)
diff -ruN ./oldperl/perl-5.8.0/sv.c
./newperl/perl-5.8.0/sv.c
--- ./oldperl/perl-5.8.0/sv.c   Wed Jul 17 15:52:14
2002
+++ ./newperl/perl-5.8.0/sv.c   Thu Apr 10 14:01:44
2003
@@ -5233,15 +5233,20 @@
     if (!sv)
        return 0;

+    if ((sv)->sv_length)
+       return (sv)->sv_length;
+    else {
     if (SvGMAGICAL(sv))
-       return mg_length(sv);
+       (sv)->sv_length = mg_length(sv);
     else
     {
        STRLEN len;
        U8 *s = (U8*)SvPV(sv, len);

-       return Perl_utf8_length(aTHX_ s, s + len);
+       (sv)->sv_length = Perl_utf8_length(aTHX_ s, s
+ len);
     }
+    }
+    return (sv)->sv_length;
 }

 /*
diff -ruN ./oldperl/perl-5.8.0/sv.h
./newperl/perl-5.8.0/sv.h
--- ./oldperl/perl-5.8.0/sv.h   Sun Jun  9 17:26:54
2002
+++ ./newperl/perl-5.8.0/sv.h   Thu Apr 10 14:01:44
2003
@@ -62,41 +62,46 @@
 } svtype;

 /* Using C's structural equivalence to help emulate
C++ inheritance here... */
-
 struct STRUCT_SV {             /* struct sv { */
     void*      sv_any;         /* pointer to
something */
     U32                sv_refcnt;      /* how many
references to us */
     U32                sv_flags;       /* what we are
*/
+    STRLEN      sv_length;      /* character length
of the scalar */
 };

 struct gv {
     XPVGV*     sv_any;         /* pointer to
something */
     U32                sv_refcnt;      /* how many
references to us */
     U32                sv_flags;       /* what we are
*/
+    STRLEN      sv_length;      /* character length
of the scalar */
 };

 struct cv {
     XPVCV*     sv_any;         /* pointer to
something */
     U32                sv_refcnt;      /* how many
references to us */
     U32                sv_flags;       /* what we are
*/
+    STRLEN      sv_length;      /* character length
of the scalar */
 };

 struct av {
     XPVAV*     sv_any;         /* pointer to
something */
     U32                sv_refcnt;      /* how many
references to us */
     U32                sv_flags;       /* what we are
*/
+    STRLEN      sv_length;      /* character length
of the scalar */
 };

 struct hv {
     XPVHV*     sv_any;         /* pointer to
something */
     U32                sv_refcnt;      /* how many
references to us */
     U32                sv_flags;       /* what we are
*/
+    STRLEN      sv_length;      /* character length
of the scalar */
 };

 struct io {
     XPVIO*     sv_any;         /* pointer to
something */
     U32                sv_refcnt;      /* how many
references to us */
     U32                sv_flags;       /* what we are
*/
+    STRLEN      sv_length;      /* character length
of the scalar */
 };

 /*
@@ -124,6 +129,7 @@

 #define SvANY(sv)      (sv)->sv_any
 #define SvFLAGS(sv)    (sv)->sv_flags
 #define SvREFCNT(sv)   (sv)->sv_refcnt
+#define SvLENGTH(sv)   (sv)->sv_length

 #ifdef USE_5005THREADS


  None of the failed functions seem to be using the
changes that the patch causes. 

  I would greatly appreciate if i can get some help on
figuring out the reason for these failures.

thanks,
Pradeep





__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About