[tex-live] Re: bug in etex

Taco Hoekwater taco at elvenkind.com
Tue Jul 13 14:53:59 CEST 2004


Hi all (especially Peter),

> Hi Taco (since i think that you qualify for sorting this out -) and others,
> 
> Etex can have > 256 token registers. The following fails (bombs) on my machine 
> (i cannot make atest file since it's part of a more complex piece of code) 
> ....

I've been working on this for quite a few hours now, and there really is a bug
somewhere in the (web2c version of) the etex code. The following extended 
mode plain input file causes both of pdfetex and etex (Web2c 7.5.3 and 7.4.5) 
to quit with SIGSEGV under linux:

------
  \toksdef\whatevertoks = 266
  \toksdef\extratoks = 267
  \whatevertoks={junk}
  \everypar{\extratoks=\whatevertoks}
  \immediate\write16{t={\the\toks265}}
  some paragraph\par
  \bye
-------

It seems that the '\the' command that accesses a previously undefined token 
register is what is causing the problem later on; the SIGSEGV happens when
TeX tries to access the RHS of the \extratoks=\whatevertoks assignment.

------
  (gdb) r
  Starting program: /home/taco/perforce/Build/source.development/Work/TeX/texk/
   web2c/tests/texmf/bin/pdfetex \&plain dumptest
  This is pdfeTeX, Version 3.141592-1.20a-rc4-2.1 (Web2C 7.5.3)
   \write18 enabled.
  output format initialized to DVI
  entering extended mode
  (./dumptest.tex
  t={}

  Program received signal SIGSEGV, Segmentation fault.
  0x0805048f in prefixedcommand () at pdfetexini.c:2903
  2903            else q = mem [curptr + 1 ].hh .v.RH ;
  (gdb) bt
  #0  0x0805048f in prefixedcommand () at pdfetexini.c:2903
  #1  0x08095c46 in maincontrol () at pdfetex3.c:6560
  #2  0x080576a4 in mainbody () at pdfetexini.c:5592
  #3  0x0809a08d in main (ac=3, av=0xbffff4b4) at pdfetexextra.c:327
  (gdb) p curptr
  $1 = -268435455
-----

I hope Peter can sort this out quicker than I can. The line in the 
stack trace refers to this section of the web, the marked line {HERE!}:

------
@ @<If the right-hand side is a token parameter...@>=
if (cur_cmd=toks_register)or(cur_cmd=assign_toks) then
  begin if cur_cmd=toks_register then
    if cur_chr=mem_bot then
      begin scan_register_num;
      if cur_val<256 then q:=equiv(toks_base+cur_val)
      else  begin find_sa_element(tok_val,cur_val,false);
        if cur_ptr=null then q:=null
        else q:=sa_ptr(cur_ptr);
        end;
      end
    else q:=sa_ptr(cur_ptr)  {HERE! }
  else q:=equiv(cur_chr);
  if q=null then sa_define(p,null)(p,undefined_cs,null)
  else  begin add_token_ref(q); sa_define(p,q)(p,call,q);
    end;
  goto done;
  end
------
And 
------
  curptr (in C)  == cur_ptr (in pWeb) 
  -268435455 (in C) == null (in pWeb)
-----

-- 
groeten,

Taco



More information about the tex-live mailing list