Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Error in .tex file makes latex loop forever
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  18 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
John Forkosh  
View profile  
 More options Aug 6, 8:21 pm
Newsgroups: comp.text.tex
From: John Forkosh <j...@please.see.sig.for.email.com>
Date: Fri, 7 Aug 2009 00:21:50 +0000 (UTC)
Local: Thurs, Aug 6 2009 8:21 pm
Subject: Error in .tex file makes latex loop forever
The following short document
   \documentclass[10pt]{article}
   \usepackage{amsmath}
   \begin{document}
   \[ \array{chars\\0-15:&\Diamond&\Heart} \]
   \end{document}
causes latex to emit the error
   ! Use of \@array doesn't match its definition.
If you reply "q" then it says
   OK, entering \batchmode
and then runs forever.  Without \usepackage{amsmath}
it emits the same error but quickly runs to completion
after you reply "q".

Now, the \array{...} construction is obviously a latex error,
and I don't really care about the .dvi output produced.
But the "runs forever" part is a real problem.  How can
I get latex to not get hung up like this regardless of
silly document errors?  Thanks,
--
John Forkosh  ( mailto:  j...@f.com  where j=john and f=forkosh )


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Forkosh  
View profile  
 More options Aug 6, 8:48 pm
Newsgroups: comp.text.tex
From: John Forkosh <j...@please.see.sig.for.email.com>
Date: Fri, 7 Aug 2009 00:48:04 +0000 (UTC)
Local: Thurs, Aug 6 2009 8:48 pm
Subject: Re: Error in .tex file makes latex loop forever

When it rains it pours... the same behavior is also produced
by the following short document
   \documentclass[10pt]{article}
   \usepackage{amsmath}
   \begin{document}
   \renewcommand{\input}[1]{\mbox{[[$\backslash$input\{#1\} illegal]]}}
   \[ \left(\begin{array} \]
   \end{document}
which causes latex to emit the error
   ! LaTeX Error: Illegal character in array arg.
and also runs forever in \batchmode after you reply "q".
Taking out either the \usepackage or the \renewcommand
allows it to quickly run to completion after replying "q".
--
John Forkosh  ( mailto:  j...@f.com  where j=john and f=forkosh )

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Scott Pakin  
View profile  
 More options Aug 6, 9:50 pm
Newsgroups: comp.text.tex
From: Scott Pakin <scott+...@pakin.org>
Date: Thu, 06 Aug 2009 19:50:26 -0600
Local: Thurs, Aug 6 2009 9:50 pm
Subject: Re: Error in .tex file makes latex loop forever

Are you trying to quit by entering "q"?  If so, then you instead need
to enter "x" for "eXit":

    $ tex
    This is TeX, Version 3.1415926 (Web2C 7.5.7)
    **\badcommand
    ! Undefined control sequence.
    <*> \badcommand

    ? ?
    Type <return> to proceed, S to scroll future error messages,
    R to run without stopping, Q to run quietly,
    I to insert something,
    1 or ... or 9 to ignore the next 1 to 9 tokens of input,
    H for help, X to quit.
    ? x
    No pages of output.

"q" means "run Quietly", i.e., in batch mode.  This causes TeX to ignore
errors and slog ahead as best it can, even if its error-recovery approach
locks it into an infinite loop.

-- Scott


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
GL  
View profile  
 More options Aug 7, 3:48 am
Newsgroups: comp.text.tex
From: GL <gouail...@gmail.com>
Date: Fri, 07 Aug 2009 09:48:33 +0200
Local: Fri, Aug 7 2009 3:48 am
Subject: Re: Error in .tex file makes latex loop forever
John Forkosh a écrit :

array sould be used as an environment :
\begin{array}{ preamble }
  chars \\
  0-15: & \Diamond & \Heart
\end{array}

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robin Fairbairns  
View profile  
 More options Aug 7, 5:47 am
Newsgroups: comp.text.tex
From: r...@cl.cam.ac.uk (Robin Fairbairns)
Date: 7 Aug 2009 09:47:27 GMT
Local: Fri, Aug 7 2009 5:47 am
Subject: Re: Error in .tex file makes latex loop forever
 John Forkosh <j...@please.see.sig.for.email.com> writes:

i take it this is something inside your mathtex system?  does that
emit "q" when it gets an error message from latex? -- seems odd.
--
Robin Fairbairns, Cambridge

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Forkosh  
View profile  
 More options Aug 7, 10:56 am
Newsgroups: comp.text.tex
From: John Forkosh <j...@please.see.sig.for.email.com>
Date: Fri, 7 Aug 2009 14:56:49 +0000 (UTC)
Local: Fri, Aug 7 2009 10:56 am
Subject: Re: Error in .tex file makes latex loop forever

Yes, sir, Robin, you nailed it.  I was slightly reluctant to mention
that since it publicizes a way for anybody to create runaway processes
on the mathtex public web service I'm hosting.

> does that emit "q" when it gets an error message from latex?

Yes.  After pulling your expression from the ?query_string,
it constructs a file latex.tex containing, more or less,
actually a little more than...
   \documentclass[10pt]{article}
   \usepackage{amsmath}
   \begin{document}
   \[ your expression from ?query_string \]
   \end{document}
and another file reply.txt containing just the single byte
   q
and then from within the C program issues, more or less,
   system("/path/to/latex/latex latex.tex < reply.txt");

> -- seems odd.

The thought is that if a user submits an expression
containing some latex syntax error, any .dvi output latex
can produce may help him debug his problem.

The easy solution here, as suggested by Scott, is to put
an x in reply.txt (or just to omit the "< reply.txt" part).
Actually, that's already an option, but q's the current
default.  Is that a bad idea?

In any event, I need to apply some kind of fix to make
the program more robust to "silly user input".  I'm actually
a little surprised latex (or is it amsmath?) allows this
to happen at all.  I'd think unpredictable output is okay
when input contains errors, but no program should ever
let bad input just hang the machine.

Is this a known latex/amsmath behavior?  Anybody planning
to change it, or any way I can easily fix it?  Otherwise,
what's my best course of action to fix mathtex?  Thanks,
--
John Forkosh  ( mailto:  j...@f.com  where j=john and f=forkosh )


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lars Madsen  
View profile  
 More options Aug 7, 11:05 am
Newsgroups: comp.text.tex
From: Lars Madsen <dal...@RTFSIGNATUREimf.au.dk>
Date: Fri, 07 Aug 2009 17:05:41 +0200
Local: Fri, Aug 7 2009 11:05 am
Subject: Re: Error in .tex file makes latex loop forever

batchmode and parse the log file

and how do you define silly input?

query:

a=b \]\input{/etc/passwd}\[ a=b

--

/daleif (remove RTFSIGNATURE from email address)

LaTeX FAQ:      http://www.tex.ac.uk/faq
LaTeX book:     http://www.imf.au.dk/system/latex/bog/    (in Danish)
Remember to post minimal examples, see URL below
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=minxampl
http://www.minimalbeispiel.de/mini-en.html


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Forkosh  
View profile  
 More options Aug 7, 11:08 am
Newsgroups: comp.text.tex
From: John Forkosh <j...@please.see.sig.for.email.com>
Date: Fri, 7 Aug 2009 15:08:44 +0000 (UTC)
Local: Fri, Aug 7 2009 11:08 am
Subject: Re: Error in .tex file makes latex loop forever

Thanks, Scott.  As discussed in preceding reply to Robin,
the "q" default was intended to help users "debug" expressions
containing latex syntax errors by showing them any .dvi output
latex could possibly produce.  I guess what I need instead is
a "gentler" option to "slog ahead but eXit if locked into a loop".
If there's no middle ground between "q" and "x", then I suppose
"x" has to become the new default.  Is that what you'd recommend?
--
John Forkosh  ( mailto:  j...@f.com  where j=john and f=forkosh )

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Forkosh  
View profile  
 More options Aug 7, 11:16 am
Newsgroups: comp.text.tex
From: John Forkosh <j...@please.see.sig.for.email.com>
Date: Fri, 7 Aug 2009 15:16:41 +0000 (UTC)
Local: Fri, Aug 7 2009 11:16 am
Subject: Re: Error in .tex file makes latex loop forever

Thanks, GL, but (see preceding reply to Robin) input like
that \array{...} error is coming from a general user population.
So telling them "don't submit input containing errors" won't work.
The program has to robustly handle any input, with or without errors.
--
John Forkosh  ( mailto:  j...@f.com  where j=john and f=forkosh )

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Forkosh  
View profile  
 More options Aug 7, 12:05 pm
Newsgroups: comp.text.tex
From: John Forkosh <j...@please.see.sig.for.email.com>
Date: Fri, 7 Aug 2009 16:05:43 +0000 (UTC)
Local: Fri, Aug 7 2009 12:05 pm
Subject: Re: Error in .tex file makes latex loop forever

Thanks, Lars, I hadn't thought of that.  A little test
is showing me that the .log file indeed exists and is
readable when the error is reported to the screen.
But the  "! LaTeX Error: ..."  stuff isn't in the .log file
at that point, and only appears there >>after<< you reply
q or x, which is too late to base the q-or-x decision on.
That problem aside, there are two more issues I don't
immediately see how to resolve.  First, the process created by
    system("/path/to/latex/latex latex.tex < reply.txt");
is already running.  I'd have to put latex to sleep, waiting
on a signal issued after parsing the .log file and deciding
how to proceed, ...or something like that.  Is there some
way to do that which doesn't involve modifying latex's source?
Second, although I can parse the .log file (if it contains
the "! LaTeX Error:" message), how can I distinguish between
errors that actually cause infinite loops and "benign" errors?

> and how do you define silly input?

:).  Well, the only quantifiable characteristic that concerns me
is whether or not input causes latex to hang.

> query: a=b \]\input{/etc/passwd}\[ a=b

Okay, yeah, that too.  But mathtex already disables \input,
though I'd agree any attempt to hack/crack the host by
submitting an expression designed to exploit a vulnerability
is also a concern.  But besides pulling the plug, I know of no
100% foolproof solution to that general problem.  If you've
got a more complete list of dangerous \commands, that would
be helpful.
--
John Forkosh  ( mailto:  j...@f.com  where j=john and f=forkosh )

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lars Madsen  
View profile  
 More options Aug 7, 12:27 pm
Newsgroups: comp.text.tex
From: Lars Madsen <dal...@RTFSIGNATUREimf.au.dk>
Date: Fri, 07 Aug 2009 18:27:57 +0200
Local: Fri, Aug 7 2009 12:27 pm
Subject: Re: Error in .tex file makes latex loop forever

don;t run it in a mode that hangs

>> query: a=b \]\input{/etc/passwd}\[ a=b

> Okay, yeah, that too.  But mathtex already disables \input,
> though I'd agree any attempt to hack/crack the host by
> submitting an expression designed to exploit a vulnerability
> is also a concern.  But besides pulling the plug, I know of no
> 100% foolproof solution to that general problem.  If you've
> got a more complete list of dangerous \commands, that would
> be helpful.

classical code injection

well jonathan fine already mentioned this, it is much harder to harden
LaTeX than TeX.

as I mentioned run in bachmode (emacs and latexmk does this) and then
look in the log.

The safest thing to do might be to run LaTeX in a chrooted environment,
but that is not easy to create

I'd just do

latex -interaction=batchmode file.tex

and then parse the log fil. I usally just put the entire log back into
the browser and let the user check it. Making nice interfaces to users
is quite hard. And some errors just does not make sense to the user.

--

/daleif (remove RTFSIGNATURE from email address)

LaTeX FAQ:      http://www.tex.ac.uk/faq
LaTeX book:     http://www.imf.au.dk/system/latex/bog/    (in Danish)
Remember to post minimal examples, see URL below
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=minxampl
http://www.minimalbeispiel.de/mini-en.html


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Forkosh  
View profile  
 More options Aug 7, 2:16 pm
Newsgroups: comp.text.tex
From: John Forkosh <j...@please.see.sig.for.email.com>
Date: Fri, 7 Aug 2009 18:16:29 +0000 (UTC)
Local: Fri, Aug 7 2009 2:16 pm
Subject: Re: Error in .tex file makes latex loop forever

Thanks again, Lars, I think that'll have to be the solution
(see additional example/remarks at bottom three paragraphs).

Especially not easy when the program runs as a cgi.
And it's one thing for me to do that on my host running the
public web service, but quite another for users who download
the source and run the program on their own machines.
Most of them just want to see some math on their web pages,
without becoming sysadmins or webmasters.  So any feasible solution
has to be completely transparent to users.

> I'd just do

> latex -interaction=batchmode file.tex

> and then parse the log fil. I usally just put the entire log back into
> the browser and let the user check it. Making nice interfaces to users
> is quite hard. And some errors just does not make sense to the user.

Strangely (seems strange to me), -interaction=batchmode still hangs
for the following example
   \documentclass[10pt]{article}
   \begin{document}
   \renewcommand{\input}[1]{dummy renewcommand}
   %%\renewcommand{\sqrt}[1]{dummy renewcommand}
   %%\renewcommand{\beta}{dummy renewcommand}
   \[ \left(\begin{array}{cccc}1 & 0 & 0 &0\\0 & 1  %%% \end{array}\right)
   \]
   \end{document}
whereas just  latex example.tex < reply.txt  with an x in file reply.txt
runs to completion (still has the error, of course, but doesn't hang).

That above example also illustrates the following: if you comment out
the \renewcommand{\input} and uncomment either or both of the other
\renewcommand's, then latex runs to completion (with the error, of
course, but without hanging).  So there's some weird side effect
specifically with \renewcommand for \input.  And that does seem to
me like something that somebody (who knows the internals) might want
to look at sometime.

Meanwhile, the quickest and easiest fix is to put an x rather than a q
in reply.txt (just changing the program's default option is even easier).
Actually, changing the documentation is a bit more work, and I'll submit
the (trivial) CTAN update when finished.  For the time being, anyone
reading this and running mathtex on their server should just recompile
their cgi with the -DNOQUIET option on the compile line.  That's all you
need to do (assuming not running in quiet mode always fixes the problem).
--
John Forkosh  ( mailto:  j...@f.com  where j=john and f=forkosh )


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Scott Pakin  
View profile  
 More options Aug 7, 6:13 pm
Newsgroups: comp.text.tex
From: Scott Pakin <scott+...@pakin.org>
Date: Fri, 07 Aug 2009 16:13:48 -0600
Local: Fri, Aug 7 2009 6:13 pm
Subject: Re: Error in .tex file makes latex loop forever

John Forkosh wrote:
> Thanks, Scott.  As discussed in preceding reply to Robin,
> the "q" default was intended to help users "debug" expressions
> containing latex syntax errors by showing them any .dvi output
> latex could possibly produce.  I guess what I need instead is
> a "gentler" option to "slog ahead but eXit if locked into a loop".
> If there's no middle ground between "q" and "x", then I suppose
> "x" has to become the new default.  Is that what you'd recommend?

You wrote that the "q" is coming from an input file, right?  So how
about having the input file instead be
"<Enter><Enter><Enter><Enter><Enter>x<Enter>"?  That will let TeX
swallow and log five errors before exiting.  Even better, you can use
"q" but run latex using the timelimit command
(http://devel.ringlet.net/sysutils/timelimit/).  If mathTeX takes more
than, say, five seconds to typeset a simple math expression, then you
can probably assume it's stuck in an infinite loop.  That'll be good
when a jerk like me enters "\def\foo{\foo}\foo" on your site, which
causes latex to chug away for a while -- without producing a TeX error
or even writing anything to the log file -- before issuing an internal
server error.

-- Scott


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Forkosh  
View profile  
 More options Aug 8, 5:27 pm
Newsgroups: comp.text.tex
From: John Forkosh <j...@please.see.sig.for.email.com>
Date: Sat, 8 Aug 2009 21:27:16 +0000 (UTC)
Local: Sat, Aug 8 2009 5:27 pm
Subject: Re: Error in .tex file makes latex loop forever

Scott Pakin <scott+...@pakin.org> wrote:
> John Forkosh wrote:
>> Thanks, Scott.  As discussed in preceding reply to Robin,
>> the "q" default was intended to help users "debug" expressions
>> containing latex syntax errors by showing them any .dvi output
>> latex could possibly produce.  I guess what I need instead is
>> a "gentler" option to "slog ahead but eXit if locked into a loop".
>> If there's no middle ground between "q" and "x", then I suppose
>> "x" has to become the new default.  Is that what you'd recommend?

Thanks for two excellent suggestions, Scott...

> You wrote that the "q" is coming from an input file, right?  So how
> about having the input file instead be
> "<Enter><Enter><Enter><Enter><Enter>x<Enter>"?  That will let TeX
> swallow and log five errors before exiting.

Seems obvious now that you've said it, but never occurred to me
until you did.  A few preliminary tests show that some expressions
which lock latex into a loop with "q" still lock it into a loop
after six or so <Enter>'s, but two or three (or even four) seem
safe.  I'll clearly just make it a compile-time -D option, and
better determine the maximum safe default later.
   The most important benefit is for simple syntax errors like
\alpha\beta\gamow\delta where a few <Enter>'s let the user
see an \alpha\beta\delta image, pointing him to the error more
directly than an iimmediate x which shows the user no image at all.

> Even better, you can use
> "q" but run latex using the timelimit command
> (http://devel.ringlet.net/sysutils/timelimit/).  If mathTeX takes more
> than, say, five seconds to typeset a simple math expression, then you
> can probably assume it's stuck in an infinite loop.  That'll be good
> when a jerk like me enters "\def\foo{\foo}\foo" on your site, which
> causes latex to chug away for a while -- without producing a TeX error
> or even writing anything to the log file -- before issuing an internal
> server error.

This is also a terrific idea that I'll implement as a -D compile option
for users who want to use timelimit and can install it on their hosts.
My preliminary tests work fine from the command line, but are behaving a
little weirdly from within a running program when issued as
  system("/path/to/timelimit -t10 -T5 /path/to/latex input.tex < reply.txt");
with or without the "< reply.txt" part, which may be being eaten by
timelimit.  I'll just write a small program to better trace what's
going on, which I'm sure will resolve any problems.

Your "\def\foo{\foo}\foo" kinds of problems won't be an issue,
as I'll also be disabling a bunch of dangerous \directives (list
supplied by Steve Mayer -- thanks).  But since \renewcommand seems
to have its own dangers (sometimes causing syntax errors to lock latex
in a loop), I'll now handle all command disabling from the C program,
which should be a third solution to the "latex locked in a loop" problem
that started this thread.

Thanks again, Scott, and also everyone else who replied.
--
John Forkosh  ( mailto:  j...@f.com  where j=john and f=forkosh )


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Donald Arseneau  
View profile  
 More options Aug 10, 4:26 pm
Newsgroups: comp.text.tex
From: Donald Arseneau <a...@triumf.ca>
Date: Mon, 10 Aug 2009 13:26:39 -0700 (PDT)
Local: Mon, Aug 10 2009 4:26 pm
Subject: Re: Error in .tex file makes latex loop forever
On Aug 7, 8:08 am, John Forkosh <j...@please.see.sig.for.email.com>
wrote:

> Thanks, Scott.  As discussed in preceding reply to Robin,
> the "q" default was intended to help users "debug" expressions
> containing latex syntax errors by showing them any .dvi output
> latex could possibly produce.  I guess what I need instead is
> a "gentler" option to "slog ahead but eXit if locked into a loop".
> If there's no middle ground between "q" and "x", then I suppose
> "x" has to become the new default.  Is that what you'd recommend?

I would send a hundred carriage returns and then x.

But you need more protection anyway because bad documents
don't need to generate any error before going into an endless
loop!

Donald Arseneau


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Forkosh  
View profile  
 More options Aug 10, 5:01 pm
Newsgroups: comp.text.tex
From: John Forkosh <j...@please.see.sig.for.email.com>
Date: Mon, 10 Aug 2009 21:01:14 +0000 (UTC)
Local: Mon, Aug 10 2009 5:01 pm
Subject: Re: Error in .tex file makes latex loop forever

Donald Arseneau <a...@triumf.ca> wrote:
> John Forkosh <please.see.sig.for.email.com> wrote:
>> Thanks, Scott.  As discussed in preceding reply to Robin,
>> the "q" default was intended to help users "debug" expressions
>> containing latex syntax errors by showing them any .dvi output
>> latex could possibly produce.  I guess what I need instead is
>> a "gentler" option to "slog ahead but eXit if locked into a loop".
>> If there's no middle ground between "q" and "x", then I suppose
>> "x" has to become the new default.  Is that what you'd recommend?

> I would send a hundred carriage returns and then x.

Thanks, Donald.  I've already changed the program so you
can compile it with a -DNQUIET=n switch which will then
send n returns followed by an x.  But I've changed the
default from sending q to sending 3 returns and then x.
That shows images for simple errors like "\sqrt{123",
but stops before any of the examples I gave previously
gets locked into a loop.  They're all locked into loops
by 100 returns.

> But you need more protection anyway because bad documents
> don't need to generate any error before going into an endless
> loop!

Got any examples besides Scott's "\def\foo{\foo}\foo"?
I'll be disabling \def,\newcommand,\etc, so that kind
of issue won't be a problem, but I'm no texpert (not even close)
and can't even imagine what else might go wrong that I might
be able to program around.
--
John Forkosh  ( mailto:  j...@f.com  where j=john and f=forkosh )

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Donald Arseneau  
View profile  
 More options Aug 11, 2:49 pm
Newsgroups: comp.text.tex
From: Donald Arseneau <a...@triumf.ca>
Date: Tue, 11 Aug 2009 11:49:17 -0700 (PDT)
Local: Tues, Aug 11 2009 2:49 pm
Subject: Re: Error in .tex file makes latex loop forever
On Aug 10, 2:01 pm, John Forkosh <j...@please.see.sig.for.email.com>
wrote:

> Donald Arseneau <a...@triumf.ca> wrote:
> > But you need more protection anyway because bad documents
> > don't need to generate any error before going into an endless
> > loop!

> Got any examples besides Scott's "\def\foo{\foo}\foo"?
> I'll be disabling \def,\newcommand,\etc, so that kind
> of issue won't be a problem, but I'm no texpert (not even close)
> and can't even imagine what else might go wrong that I might
> be able to program around.

There are many possible ways,

\loop\iftrue\repeat

is obvious.

\everypar{\par} or \everypar{\hrule} produce pages without limit,
whereas some use of \hrule in a tabular where \par is disabled
will silently loop forever.

Furthermore, some "symbols" *require* \def, and you lose them
by disabling it.

Donald Arseneau


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Forkosh  
View profile  
 More options Aug 12, 12:46 pm
Newsgroups: comp.text.tex
From: John Forkosh <j...@please.see.sig.for.email.com>
Date: Wed, 12 Aug 2009 16:46:18 +0000 (UTC)
Local: Wed, Aug 12 2009 12:46 pm
Subject: Re: Error in .tex file makes latex loop forever

Donald Arseneau <a...@triumf.ca> wrote:
> John Forkosh <j...@please.see.sig.for.email.com> wrote:
>> Donald Arseneau <a...@triumf.ca> wrote:
>> > But you need more protection anyway because bad documents
>> > don't need to generate any error before going into an endless
>> > loop!

>> Got any examples besides Scott's "\def\foo{\foo}\foo"?
>> I'll be disabling \def,\newcommand,\etc, so that kind
>> of issue won't be a problem, but I'm no texpert (not even close)
>> and can't even imagine what else might go wrong that I might
>> be able to program around.

> There are many possible ways,  \loop\iftrue\repeat  is obvious.
> \everypar{\par} or \everypar{\hrule} produce pages without limit,

Thanks again, Donald.  \loop's also on Steve Mayer's "blacklist",
and also \everypar, so they shouldn't pose a problem.  He's been
following this thread (hi, Steve), and asked in email that I not
post the complete list.  But if you (anybody) are curious and want
a copy, it's okay with Steve to email me (john at forkosh dot com)
or him (mayer at dial dot pipex dot com) for one.

> some use of \hrule in a tabular where \par is disabled
> will silently loop forever.  Furthermore, some "symbols"
> *require* \def, and you lose them by disabling it.

I'm getting the feeling there's no foolproof solution,
and Steve's list may be as good as it's going to get
without considerable additional effort.  And Scott's timelimit
suggestion will hopefully provide a catchall for any pathological
expressions that slip through the cracks (I'll be adding that as
a mathtex option for users who can install timelimit on their
servers).  Thanks so much,
--
John Forkosh  ( mailto:  j...@f.com  where j=john and f=forkosh )

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google