[tex-live] Bug?: pdflatex hangs with self-referential \newcommand{\bad}{\bad} definition

Jess Riedel jessriedel at gmail.com
Wed Jan 9 16:34:36 CET 2019


Dear all,

I'd like to report what looks like a bug in tex-live. Apologies if I'm
sending this to the wrong place.  I did my best to find the proper bug
tracker for tex-live, and I couldn't understand how to search through
previous bug reports.

*Bug summary*:  pdflatex hangs when building tex file that calls a command
with self-referential definition of the form \newcommand{\bad}{\bad}.  I
believe it should instead throw an error.

Detail below.

Best regards,
Jess Riedel

-------------------------

==== Main bug report ====

After incorrectly using find-replace-all, my tex file accidentally defined
a new command self-referentially.  Here is a minimal example using `\bad`
as the command.

    \documentclass{article}
    \newcommand{\bad}{\bad}
    \begin{document}
   Test words.
   \bad
    \end{document}`

Call that "test.tex".  When I build this in TexStudio, the message console
displays

Process started: /Library/TeX/texbin/pdflatex -synctex=1
-interaction=nonstopmode "test".tex

and then TexStudio became unresponsive.  By looking at the MacOS Activity
Monitor I can see that the process `pdftex` gets stuck at 99% CPU usage.

If I comment out the `\bad` command, it builds fine, even with the bad
definition in place.

I confirmed that this happens when running `pdflatex test.tex` directly
from the command line.  The output is given below

### Environment
- TeXstudio 2.12.6 (hg 6631:16db084dae24)
- Using Qt Version 5.7.1, compiled with Qt 5.7.1 R
- OS: MacOS version 10.14.2 (18C54)
- TeX distribution: pdfTeX 3.14159265-2.6-1.40.16 (TeX Live 2015).
kpathsea version 6.2.1

### Expected behavior

`pdftex` should throw an error that can be caught by TexStudio.

### Actual behavior

`pdftex` hangs.

### How to reproduce

Run from the command line

   $ pdflatex "test".tex

This produces the following output, after which pdftex hangs:

   This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015)
(preloaded format=pdflatex)
   restricted \write18 enabled.
   entering extended mode
   (./test.tex
   LaTeX2e <2015/01/01>
   Babel <3.9l> and hyphenation patterns for 79 languages loaded.
   (/usr/local/texlive/2015/texmf-dist/tex/latex/base/article.cls
   Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
   (/usr/local/texlive/2015/texmf-dist/tex/latex/base/size10.clo))
(./test.aux)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/tex-live/attachments/20190109/67972b76/attachment.html>


More information about the tex-live mailing list