• Bug#264394: tetex-bin: e-TeX is broken on registers > 255

    From Hilmar Preusse@1:229/2 to [email protected] on Wed Aug 11 11:50:11 2004
    XPost: linux.debian.maint.tetex
    From: [email protected]

    On 08.08.04 Benjamin BAYART ([email protected]) wrote:

    Hi,

    On a document of mine, too complex to be sent as a minimal example,
    e-TeX seems broken with registers after 255. The following input:

    minimal exmaple (just took your one and reduced it):

    \documentclass{minimal}
    \begin{document}
    \makeatletter
    \dimendef\z@=263\relax
    \z@=0pt\relax
    \show\z@
    \end{document}

    root@drachi:~# latex etex1.tex
    This is e-TeX, Version 3.14159-2.1 (Web2C 7.4.5)
    entering extended mode
    (./etex1.tex
    LaTeX2e <2001/06/01>
    Babel <v3.7h> and hyphenation patterns for american, french, german, ngerman, russian, nohyphenation, loaded.
    (/usr/share/texmf/tex/latex/base/minimal.cls
    Document Class: minimal 2001/05/25 Standard LaTeX minimal class
    ) (./etex1.aux)
    \z@=\dimen263.
    l.7 \show\z@

    ?

    same bug with Knuth TeX. So why do you think this is an e-TeX
    problem?

    My guess is that one of the "magical stuff" done to \z@ by amsmath
    (and seems to be by other packages, and perhaps even by the LaTeX
    kernel itself) makes e-TeX wrong.

    Of course, the same example just runs fine in lambda (omega)
    which also allows registers >255 (but have other bugs elsewhere).

    Hmm: same code as above.

    root@drachi:~# lambda etex1.tex
    This is Omega, Version 3.14159--1.23.2.1 (Web2C 7.4.5)
    Copyright (c) 1994--2000 John Plaice and Yannis Haralambous
    (etex1.tex
    LaTeX2e <2001/06/01> patch level 1
    Babel <v3.7h> and hyphenation patterns for english, spanish, russian, greek, inuit, dumylang, nohyphenation, loaded.
    (/usr/share/texmf/tex/latex/base/minimal.cls
    Document Class: minimal 2001/05/25 Standard LaTeX minimal class
    ) (etex1.aux)
    \z@=\dimen263.
    l.7 \show\z@

    ?

    unfortunately I don't understand so much about (La)TeX internal
    registers and their limitations...

    H.
    --
    sigmentation fault


    --
    To UNSUBSCRIBE, email to [email protected]
    with a subject of "unsubscribe". Trouble? Contact [email protected]

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)
  • From Olaf Weber@1:229/2 to Hilmar Preusse on Wed Aug 11 14:40:05 2004
    XPost: linux.debian.maint.tetex
    From: [email protected]

    Hilmar Preusse writes:
    On 08.08.04 Benjamin BAYART ([email protected]) wrote:

    On a document of mine, too complex to be sent as a minimal example,
    e-TeX seems broken with registers after 255. The following input:

    minimal exmaple (just took your one and reduced it):

    \documentclass{minimal}
    \begin{document}
    \makeatletter
    \dimendef\z@=263\relax
    \z@=0pt\relax
    \show\z@
    \end{document}

    root@drachi:~# latex etex1.tex
    This is e-TeX, Version 3.14159-2.1 (Web2C 7.4.5)
    entering extended mode
    (./etex1.tex
    LaTeX2e <2001/06/01>
    Babel <v3.7h> and hyphenation patterns for american, french, german, ngerman, russian, nohyphenation, loaded.
    (/usr/share/texmf/tex/latex/base/minimal.cls
    Document Class: minimal 2001/05/25 Standard LaTeX minimal class
    ) (./etex1.aux)
    \z@=\dimen263.
    l.7 \show\z@

    ?

    You misunderstood the nature of the problem. Using a variation of the
    original example:

    $ cat etex-bug.tex
    \documentclass{article}
    \usepackage{amsmath}
    \begin{document}
    \makeatletter
    \dimendef\z@=256\relax
    \z@=0pt\relax
    \[aa\]
    \show\z@
    \end{document}
    $ latex etex-bug.tex
    This is pdfeTeX, Version 3.141592-1.20a-rc7.1-2.1 (Web2C 7.5.3)
    output format initialized to DVI
    entering extended mode
    (./etex-bug.tex
    LaTeX2e <2003/12/01>
    Babel <v3.8c> and hyphenation patterns for english, french, german, ngerman, ca talan, croatian, czech, danish, dutch, estonian, finnish, greek, hungarian, ita lian, latin, mongolian, norwegian, polish, portuguese, romanian, russian, slove ne, slovak, spanish, swedish, ukenglish, ukrainian, welsh, dumylang, nohyphenat ion, loaded.
    (/usr/local/share/texmf-dist/tex/latex/base/article.cls
    Document Class: article 2004/02/16 v1.4f Standard LaTeX document class (/usr/local/share/texmf-dist/tex/latex/base/size10.clo)) (/usr/local/share/texmf-dist/tex/latex/amslatex/amsmath.sty
    For additional information on amsmath, use the `?' option. (/usr/local/share/texmf-dist/tex/latex/amslatex/amstext.sty (/usr/local/share/texmf-dist/tex/latex/amslatex/amsgen.sty)) (/usr/local/share/texmf-dist/tex/latex/amslatex/amsbsy.sty) (/usr/local/share/texmf-dist/tex/latex/amslatex/amsopn.sty)) (./etex-bug.aux)
    \z@=\count652.
    l.8 \show\z@

    ?

    The significant bit is that it prints \z@=\count652 instead of

    1) Complaining about a "Bad register code" (which plain TeX would have
    done.
    2) Printing \z@=\dimen256 like omega or aleph does.

    This is evidence that e-TeX's internal datastructures are messed up.

    In e-TeX registers 0..255 are handled as in TeX, but the
    larger-numbered registers are allocated in a sparce array, and
    deallocated when there is no longer any reference to them. What
    appears to happen is that the reference counting doesn't take into
    account that references already exist to \z@ because it is being
    redefined instead of seeing a pristine definition. So the register
    gets deallocated and the memory reused. This is something I'll have
    to punt to the e-TeX maintainer (who's on vacation at the moment).

    The amsmath code is needed just to provide enough "churn" to actually
    make this problem manifest itself in the example.

    --
    Olaf Weber

    (This space left blank for technical reasons.)



    --
    To UNSUBSCRIBE, email to [email protected]
    with a subject of "unsubscribe". Trouble? Contact [email protected]

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)
  • From Hilmar Preusse@1:229/2 to [email protected] on Wed Aug 11 19:20:08 2004
    XPost: linux.debian.maint.tetex
    From: [email protected]

    tags 264394 + upstream
    stop

    On 11.08.04 Olaf Weber ([email protected]) wrote:
    Hilmar Preusse writes:

    Hi all,

    root@drachi:~# latex etex1.tex
    This is e-TeX, Version 3.14159-2.1 (Web2C 7.4.5)
    entering extended mode
    (./etex1.tex
    LaTeX2e <2001/06/01>
    Babel <v3.7h> and hyphenation patterns for american, french, german, ngerman, russian, nohyphenation, loaded.
    (/usr/share/texmf/tex/latex/base/minimal.cls
    Document Class: minimal 2001/05/25 Standard LaTeX minimal class
    ) (./etex1.aux)
    \z@=\dimen263.
    l.7 \show\z@

    ?

    You misunderstood the nature of the problem. Using a variation of
    the original example:

    I was afraid of this. Thanks for clarification. Is this bug that
    serious, that we have to assume e-TeX to be useless and to use better
    Knuth TeX instead?

    The significant bit is that it prints \z@=\count652 instead of

    1) Complaining about a "Bad register code" (which plain TeX would have
    done.
    2) Printing \z@=\dimen256 like omega or aleph does.

    This is evidence that e-TeX's internal datastructures are messed up.

    OK thanks.

    So the register gets deallocated and the memory reused. This is
    something I'll have to punt to the e-TeX maintainer (who's on
    vacation at the moment).

    So can we assume, that you forward the problem to the e-TeX team?

    Many thanks for you efforts. I'll tag that bug upstream for now.

    Regards,
    Hilmar
    --
    sigmentation fault


    --
    To UNSUBSCRIBE, email to [email protected]
    with a subject of "unsubscribe". Trouble? Contact [email protected]

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)
  • From Olaf Weber@1:229/2 to Hilmar Preusse on Wed Aug 11 20:20:07 2004
    XPost: linux.debian.maint.tetex
    From: [email protected]

    Hilmar Preusse writes:

    I was afraid of this. Thanks for clarification. Is this bug that
    serious, that we have to assume e-TeX to be useless and to use better
    Knuth TeX instead?

    This has been in e-TeX for a _long_ time. I believe the idiom needed
    to trigger to be rarely used (and only e-TeX-specific code can use it
    at all).

    So can we assume, that you forward the problem to the e-TeX team?

    Yes.

    --
    Olaf Weber

    (This space left blank for technical reasons.)



    --
    To UNSUBSCRIBE, email to [email protected]
    with a subject of "unsubscribe". Trouble? Contact [email protected]

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)
  • From Benjamin BAYART@1:229/2 to All on Sat Aug 14 01:40:07 2004
    XPost: linux.debian.maint.tetex
    From: [email protected]

    Le Wed, Aug 11, 2004 at 04:14:38PM +0200, Hilmar Preusse:

    I was afraid of this. Thanks for clarification. Is this bug that
    serious, that we have to assume e-TeX to be useless and to use better
    Knuth TeX instead?

    upstream maintainers will probably deal with it: the LaTeX-project team
    plan to use e-TeX for future LaTeX upstream releases, so if it is
    broken, there will be work to fix it before releasing a new LaTeX
    version.

    Olaf, about your comments on the bug itself: in my minimal example, \z@
    was re-defined, so your explaination might be possible. But in the full
    initial example, \z@ was initially (as far as I can see) defined as
    \dimen263: I'm working on a very large document, which loads dozens of packages, and thus need more than the 256 registers in TeX, so I did a
    small patch on the LaTeX kernel to make it use register <255 for inserts
    and >255 for everything else. It works smoothly with Omega (did not yet
    try aleph) but triggered this bug in e-TeX.

    So can we assume, that you forward the problem to the e-TeX team?

    Many thanks for you efforts. I'll tag that bug upstream for now.

    Thanks for your efforts both of you.

    Benjamin.



    --
    To UNSUBSCRIBE, email to [email protected]
    with a subject of "unsubscribe". Trouble? Contact [email protected]

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)
  • From Hilmar Preusse@1:229/2 to [email protected] on Sat Aug 14 13:30:09 2004
    XPost: linux.debian.maint.tetex
    From: [email protected]

    On 14.08.04 Benjamin BAYART ([email protected]) wrote:
    Le Wed, Aug 11, 2004 at 04:14:38PM +0200, Hilmar Preusse:

    Hi,

    I was afraid of this. Thanks for clarification. Is this bug that
    serious, that we have to assume e-TeX to be useless and to use
    better Knuth TeX instead?

    upstream maintainers will probably deal with it: the LaTeX-project
    team plan to use e-TeX for future LaTeX upstream releases, so if it
    is broken, there will be work to fix it before releasing a new
    LaTeX version.

    For the time being you may switch back to Knuth TeX. Read NEWS.Debian
    how to do that.

    H.
    --
    sigmentation fault


    --
    To UNSUBSCRIBE, email to [email protected]
    with a subject of "unsubscribe". Trouble? Contact [email protected]

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)
  • From Olaf Weber@1:229/2 to Benjamin BAYART on Sun Aug 15 17:00:11 2004
    XPost: linux.debian.maint.tetex
    From: [email protected]

    Benjamin BAYART writes:

    Olaf, about your comments on the bug itself: in my minimal example, \z@
    was re-defined, so your explaination might be possible. But in the full initial example, \z@ was initially (as far as I can see) defined as \dimen263: I'm working on a very large document, which loads dozens of packages, and thus need more than the 256 registers in TeX, so I did a
    small patch on the LaTeX kernel to make it use register <255 for inserts
    and >255 for everything else. It works smoothly with Omega (did not yet
    try aleph) but triggered this bug in e-TeX.

    Can you supply the patch and an example that shows the bug in
    combination with it? If nothing else, this can be a sanity check that
    whatever fix is made actually fixes the underlying issue.

    --
    Olaf Weber

    (This space left blank for technical reasons.)



    --
    To UNSUBSCRIBE, email to [email protected]
    with a subject of "unsubscribe". Trouble? Contact [email protected]

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)
  • From Olaf Weber@1:229/2 to All on Sun Aug 15 17:00:11 2004
    XPost: linux.debian.maint.tetex
    From: [email protected]

    FYI, I believe that the problem can be worked around (at the expense
    of leaking some memory) by changing .../texk/web2c/etexdir/etex.fix to
    read as follows:

    ---------------8<---------------8<---------------
    % Bugfixes for etex.ch version 2.1
    % Public Domain.

    @x l.1163 - |int_val| is a level, not a value.
    begin cur_val:=int_val;
    @y
    begin cur_val_level:=int_val;
    @z

    @x l.2737 - typo
    else q:=sa_ptr(cur_ptr)
    @y
    else q:=sa_ptr(cur_chr)
    @z

    @x l.5503 - comparison with 0 instead of |null|.
    if cur_ptr<>0 then
    @y
    if cur_ptr<>null then
    @z

    @x l.5514 - do not deallocate even when reference count goes to 0.
    begin decr(sa_ref(q));
    @y
    begin decr(sa_ref(q));
    return;
    @z
    ---------------8<---------------8<---------------

    --
    Olaf Weber

    (This space left blank for technical reasons.)



    --
    To UNSUBSCRIBE, email to [email protected]
    with a subject of "unsubscribe". Trouble? Contact [email protected]

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)