[tlbuild] texlive 2011 build on aix 4.3 - "make check": 12 of 46 tests failed

Vladimir Volovich vvv at vsu.ru
Tue Jun 21 20:52:23 CEST 2011


Hi!

TeX segfaults on AIX when running trip test. I'm hoping to isolate and
fix this problem. For this, i've looked at the svn log for
Master/bin/powerpc-aix/tex and checked all revisions from the start, to
see where this segfaults first started.

It turns out that the last revision where running the trip test still
works is:

------------------------------------------------------------------------
r10221 | vvv | 2008-08-10 03:32:00 +0400 (Sun, 10 Aug 2008) | 2 lines

rebuild sparc-solaris and powerpc-aix from r10219.
------------------------------------------------------------------------

and the next revision fails:

------------------------------------------------------------------------
r13774 | vvv | 2009-06-17 00:27:31 +0400 (Wed, 17 Jun 2009) | 2 lines

TL2009 build, from r13768, for sparc-solaris and powerpc-aix
------------------------------------------------------------------------

I.e. the breakage occurred between TL2008 and TL2009, specifically
between revisions r10219 and r13768.

I've bisected the source tree between those revisions (compiling and
testing if it works, narrowing the range of revisions each time), and
found an exact time when it happened:

last revision where TeX still successfully runs the trip test, is:

r12461 | peter | 2009-03-20 13:24:22 +0300 (Fri, 20 Mar 2009) | 1 line

and it starts to segfault in

r12464 | peter | 2009-03-20 13:47:15 +0300 (Fri, 20 Mar 2009) | 1 line

it's not easy to build the tree for the 2 revisions in between of these,
since Peter was in the middle or re-organizing the build infrastructure.

Further, i've compared the generated C sources of TeX (texini.c, tex0.c,
tex1.c, tex2.c, tex-pool.c, texextra.c), between the good revision
r12461 and the bad revision r12464, and I see the following changes:

==============================
--- source_r12461/Work/texk/web2c/texini.c
+++ source_r12464/Work/texk/web2c/texini.c
@@ -1574,7 +1574,7 @@
     } 
     if ( curp == -268435455L ) 
     {
-      trybreak ( -10000 , 1 ) ;
+      trybreak ( 2550000L , 1 ) ;
       if ( mem [memtop - 7 ].hh .v.RH != memtop - 7 ) 
       {
 	r = mem [memtop - 7 ].hh .v.RH ;
@@ -2693,7 +2693,7 @@
   println () ;
   printint ( fmemptr - 7 ) ;
   print ( 1290 ) ;
-  printint ( fontptr - 0 ) ;
+  printint ( fontptr + 0 ) ;
   if ( fontptr != 1 ) 
   print ( 1291 ) ;
   else print ( 1292 ) ;
--- source_r12461/Work/texk/web2c/tex1.c
+++ source_r12464/Work/texk/web2c/tex1.c
@@ -4369,7 +4369,7 @@
   if ( abs ( pi ) >= 10000 ) 
   if ( pi > 0 ) 
   goto lab10 ;
-  else pi = -10000 ;
+  else pi = 2550000L ;
   nobreakyet = true ;
   prevr = memtop - 7 ;
   oldl = 0 ;
@@ -4681,7 +4681,7 @@
 	fitclass = 3 ;
 	else fitclass = 2 ;
       } 
-      if ( ( b > 10000 ) || ( pi == -10000 ) ) 
+      if ( ( b > 10000 ) || ( pi == 2550000L ) ) 
       {
 	if ( finalpass && ( minimumdemerits == 1073741823L ) && ( mem [r ]
 	.hh .v.RH == memtop - 7 ) && ( prevr == memtop - 7 ) ) 
@@ -4708,7 +4708,7 @@
 	if ( pi != 0 ) 
 	if ( pi > 0 ) 
 	d = d + pi * pi ;
-	else if ( pi > -10000 ) 
+	else if ( pi > 2550000L ) 
 	d = d - pi * pi ;
 	if ( ( breaktype == 1 ) && ( mem [r ].hh.b0 == 1 ) ) 
 	if ( curp != -268435455L ) 
@@ -5874,7 +5874,7 @@
   while ( true ) {
       
     if ( p == -268435455L ) 
-    pi = -10000 ;
+    pi = 2550000L ;
     else switch ( mem [p ].hh.b0 ) 
     {case 0 : 
     case 1 : 
@@ -5925,7 +5925,7 @@
       b = 1073741823L ;
       else b = badness ( activewidth [1 ]- h , activewidth [6 ]) ;
       if ( b < 1073741823L ) 
-      if ( pi <= -10000 ) 
+      if ( pi <= 2550000L ) 
       b = pi ;
       else if ( b < 10000 ) 
       b = b + pi ;
@@ -5936,7 +5936,7 @@
 	leastcost = b ;
 	bestheightplusdepth = activewidth [1 ]+ prevdp ;
       } 
-      if ( ( b == 1073741823L ) || ( pi <= -10000 ) ) 
+      if ( ( b == 1073741823L ) || ( pi <= 2550000L ) ) 
       goto lab30 ;
     } 
     if ( ( mem [p ].hh.b0 < 10 ) || ( mem [p ].hh.b0 > 11 ) ) 
@@ -6634,7 +6634,7 @@
 	      printscaled ( bestheightplusdepth ) ;
 	      print ( 945 ) ;
 	      if ( q == -268435455L ) 
-	      printint ( -10000 ) ;
+	      printint ( 2550000L ) ;
 	      else if ( mem [q ].hh.b0 == 12 ) 
 	      printint ( mem [q + 1 ].cint ) ;
 	      else printchar ( 48 ) ;
@@ -6649,7 +6649,7 @@
 	    mem [r + 1 ].hh .v.RH = q ;
 	    mem [r + 1 ].hh .v.LH = p ;
 	    if ( q == -268435455L ) 
-	    insertpenalties = insertpenalties - 10000 ;
+	    insertpenalties = insertpenalties + 2550000L ;
 	    else if ( mem [q ].hh.b0 == 12 ) 
 	    insertpenalties = insertpenalties + mem [q + 1 ].cint ;
 	  } 
@@ -6674,7 +6674,7 @@
       else b = badness ( pagesofar [1 ]- pagesofar [0 ], pagesofar [6 ]) 
       ;
       if ( b < 1073741823L ) 
-      if ( pi <= -10000 ) 
+      if ( pi <= 2550000L ) 
       c = pi ;
       else if ( b < 10000 ) 
       c = b + pi + insertpenalties ;
@@ -6719,7 +6719,7 @@
 	  r = mem [r ].hh .v.RH ;
 	} 
       } 
-      if ( ( c == 1073741823L ) || ( pi <= -10000 ) ) 
+      if ( ( c == 1073741823L ) || ( pi <= 2550000L ) ) 
       {
 	fireup ( p ) ;
 	if ( outputactive ) 
@@ -11517,10 +11517,10 @@
     fprintf ( logfile , "%c%ld%s%ld\n",  ' ' , (long)poolptr - initpoolptr ,     " string characters out of " , (long)poolsize - initpoolptr ) ;
     fprintf ( logfile , "%c%ld%s%ld\n",  ' ' , (long)lomemmax - memmin + memend - himemmin + 2 ,     " words of memory out of " , (long)memend + 1 - memmin ) ;
     fprintf ( logfile , "%c%ld%s%ld%c%ld\n",  ' ' , (long)cscount ,     " multiletter control sequences out of " , (long)10000 , '+' , (long)hashextra ) ;
-    fprintf ( logfile , "%c%ld%s%ld%s",  ' ' , (long)fmemptr , " words of font info for " , (long)fontptr - 0     , " font" ) ;
+    fprintf ( logfile , "%c%ld%s%ld%s",  ' ' , (long)fmemptr , " words of font info for " , (long)fontptr + 0     , " font" ) ;
     if ( fontptr != 1 ) 
     putc ( 's' ,  logfile );
-    fprintf ( logfile , "%s%ld%s%ld\n",  ", out of " , (long)fontmemsize , " for " , (long)fontmax - 0 ) ;
+    fprintf ( logfile , "%s%ld%s%ld\n",  ", out of " , (long)fontmemsize , " for " , (long)fontmax + 0 ) ;
     fprintf ( logfile , "%c%ld%s",  ' ' , (long)hyphcount , " hyphenation exception" ) ;
     if ( hyphcount != 1 ) 
     putc ( 's' ,  logfile );
==============================

i.e. -10000 was changed to 2550000L in a few places, and this broke TeX
on AIX.

Peter, Karl, or whoever knows why this change was made, maybe you'll be
able to find out what's going on. I think we're getting close to know
the root cause of this breakage.

Best wishes,
v.

--------------------------------
From: Vladimir Volovich <vvv at vsu.ru>
Subject: Re: [tlbuild] texlive 2011 build on aix 4.3 - "make check": 12 of 46 tests failed
Date: Tue, 14 Jun 2011 23:42:48 +0400

"PB" == Peter Breitenlohner writes:

 PB> The first step ./tex --progname=initex --ini
 PB> <$srcdir/triptrap/trip1.in >tripin.fot is supposed to create
 PB> ./trip.fmt but fails to do so: ../../../texk/web2c/trip.test[32]:
 PB> 14028 Memory fault(coredump)

 PB> The rest is a consequence of that.

> dbx shows that the segfault occurs in

> zpostlinebreak() at 0x10010270
> zlinebreak() at 0x10046718
> endgraf() at 0x1000b1b0
> doendv() at 0x1000a020
> maincontrol() at 0x100047b8
> mainbody() at 0x1004a66c
> main() at 0x100009bc

> i'll recompile with -g to see more details...

it segfaults when it first enters into the zpostlinebreak() function:

$ export TEXMFCNF=../../../texk/web2c/triptrap
$ dbx ./tex
Type 'help' for help.
reading symbolic information ...
(dbx) stop in zpostlinebreak
[1] stop in zpostlinebreak
(dbx) run --progname=initex --ini < ../../../texk/web2c/triptrap/trip1.in 
This is TeX, Version 3.1415926 (TeX Live 2011) (INITEX)
**Please type the name of your input file.
**(./trip.tex
! Bad character code (256).
<to be read again> 
                   -
l.26   \nonstopmode\lccode256-
                              0\mathchardef\a="8000\def\a{ SC...
! Bad mathchar (32768).
<to be read again> 
                   \def 
l.26 ...\mathchardef\a="8000\def
                                \a{ SCALED 3~2769}
! Illegal magnification has been changed to 1000 (32769).
<to be read again> 
                   \skewchar 
l.28   \skewchar
                \rip=`B \countdef\countz % \countz will be \c...
! Missing number, treated as zero.
<to be read again> 
                   \def 
l.29   \def
           \on{1} \toksdef\tokens=256 \show\errorstopmode
! Bad register code (256).
l.29 ...{1} \toksdef\tokens=256 
                                \show\errorstopmode
> \errorstopmode=\errorstopmode.
l.29 ...=256 \show\errorstopmode
                                
> \rip .
<recently read> \font 
                      
l.30   \showthe\font
                     \showthe\pageshrink \showthe\pagegoal
> 0.0pt.
l.30 ...font \showthe\pageshrink
                                 \showthe\pagegoal
> 16383.99998pt.
l.30 ...shrink \showthe\pagegoal
                                
! Illegal unit of measure (replaced by filll).
l.32 ...fdim\hsize<\hsize\fi lll
                                minus 0 fill
\one \csname on line 60
! You can't use `\badness' in vertical mode.
l.61 ...yphenpenalty 89 \badness
                                
! Bad \patterns.
l.75 ...uage256\patterns{0111 \?
                                50AA1b3 *1AcA. bb bb1 0B2B0 b...
! Nonletter.
l.75 ...ge256\patterns{0111 \?50
                                AA1b3 *1AcA. bb bb1 0B2B0 b1c...
! Duplicate pattern.
l.75 ...1b3 *1AcA. bb bb1 0B2B0 
                                b1c}} % *==space
! OK (see the transcript file).
l.78 ...ns{q9q} -\0qq \showlists
                                {\language\?\noboundary111}%
[1] stopped in zpostlinebreak at line 15505 in file "tex0.c"
15505     /* 30 31 */ postlinebreak_regmem 
(dbx) next
stopped in zpostlinebreak at line 15514 in file "tex0.c"
15514     q = mem [bestbet + 1 ].hh .v.RH ;
(dbx) next
stopped in zpostlinebreak at line 15515 in file "tex0.c"
15515     curp = -268435455L ;
(dbx) next
stopped in zpostlinebreak at line 15517 in file "tex0.c"
15517         r = q ;
(dbx) next
stopped in zpostlinebreak at line 15518 in file "tex0.c"
15518       q = mem [q + 1 ].hh .v.LH ;
(dbx) where
zpostlinebreak(finalwidowpenalty = 125), line 15518 in "tex0.c"
zlinebreak(??), line 1616 in "texini.c"
endgraf(), line 18130 in "tex0.c"
doendv(), line 18651 in "tex0.c"
maincontrol(), line 21180 in "tex0.c"
mainbody(), line 4281 in "texini.c"
main(ac = 0, av = (nil)), line 808 in "texmfmp.c"
(dbx) dump
zpostlinebreak(finalwidowpenalty = 125), line 15518 in "tex0.c"
t = ' '
s = 0
r = -268435455
q = -268435455
curline = 537031840
pen = 447
curindent = 55
curwidth = 58612
postdiscbreak = 335
discbreak = 0
mem = 0x2008ec80
eqtb = 0x200c38d8
(dbx) print bestbet
450 
(dbx) print mem [bestbet + 1 ].hh.v
(RH = -268435455, LH = 1) 
(dbx) next

Segmentation fault in zpostlinebreak at line 15518 in file "tex0.c"
15518       q = mem [q + 1 ].hh .v.LH ;
(dbx) dump
zpostlinebreak(finalwidowpenalty = 125), line 15518 in "tex0.c"
t = ' '
s = 0
r = -268435455
q = -268435455
curline = 537031840
pen = 447
curindent = 55
curwidth = 58612
postdiscbreak = 335
discbreak = 0
mem = 0x2008ec80
eqtb = 0x200c38d8
(dbx) 

=======================================

zpostlinebreak comes from tex0.c:

void
zpostlinebreak ( integer finalwidowpenalty )
{
  /* 30 31 */ postlinebreak_regmem
  halfword q, r, s  ;
  boolean discbreak  ;
  boolean postdiscbreak  ;
  scaled curwidth  ;
  scaled curindent  ;
  quarterword t  ;
  integer pen  ;
  halfword curline  ;
  q = mem [bestbet + 1 ].hh .v.RH ;
  curp = -268435455L ;
  do {
      r = q ;
    q = mem [q + 1 ].hh .v.LH ; /* <<<<<< HERE IS WHERE IT SEGFAULTS */
    mem [r + 1 ].hh .v.LH = curp ;
    curp = r ;
  } while ( ! ( q == -268435455L ) ) ;

does this ring a bell to anyone? from the output of "dump" in dbx above,
it appears that the value of q is a large negative number (-268435455)
when it entered the "do" loop, and it tried to access mem[q+1], which
probably caused the segfault.

[i've completely disabled optimization when compiling tex-tex0.o from tex0.c]

Best wishes,
v.


More information about the tlbuild mailing list