From: Akira Yokosawa <akiyks@gmail.com>
To: paulmck@linux.vnet.ibm.com
Cc: perfbook@vger.kernel.org, Akira Yokosawa <akiyks@gmail.com>
Subject: Re: [PATCH 2/2] runlatex.sh: Fix while loop condition
Date: Fri, 22 Apr 2016 21:58:24 +0900 [thread overview]
Message-ID: <571A1FF0.2080602@gmail.com> (raw)
In-Reply-To: <20160421235400.GI3879@linux.vnet.ibm.com>
On 2016/04/22 16:54 -0700, Paul E. McKenney wrote:
[snip]
>> Can you try this one?
>> Thanks, Akira
>
> I did, though for some reason I had to hand-apply it on my test branch.
> Not sure what "git apply" didn't like.
Well, I'm afraid you tried to apply it after [PATCH 2/2] applied.
I should have made it clear it was a diff from master at that moment.
Sorry for your trouble.
> It does repeat upon undefined, which is good. Nicer behavior after
> bibliography changes!
>
> There is another "Fatal latex error" earlier that I missed, and it would
> be good to have an "exit 1" on that one as well.
>
> The one thing I am still concerned about is a real undefined reference,
> which would consume a full five iterations. Not really sure what would
> be improved behavior, though. Thoughts?
>
> Thanx, Paul
So your question is why you need to change the maximum value from 4 to 5,
isn't it? That's because the count is checked at the end of the loop,
and even when the 4th round of pdflatex is successful, the check will
fire and 'make' will regard it as an error. At such a later stage,
remaining warning should only be 'LaTeX Warning: Label(s) may have changed',
if any.
So I made a fairly invasive modification to the script so that the count
is checked at the beginning of the loop. Also the loop is separated for each
of the warning message.
Appended is the whole source code of the script (without the comment part at
the head). I'm not sure which point should I make a diff from. Note that
I truncated the warning messages given to grep. They should be long enough.
What do you think?
If it is OK, I'll resubmit the V2 of the patch series relative to the
current master.
Thanks, Akira.
---
#!/bin/sh
# [snip]
#
if test -z "$1"
then
echo No latex file, aborting.
exit 1
fi
basename=`echo $1 | sed -e 's/\.tex$//'`
iter=1
echo "pdflatex $iter"
pdflatex $basename > /dev/null 2>&1 < /dev/null || :
if grep -q '! Emergency stop.' $basename.log
then
echo "----- Fatal latex error, see $basename.log for details. -----"
fi
if grep -q 'LaTeX Warning: There were undefined references' $basename.log
then
if test -d "$2"
then
bibtex $basename || :
else
echo "No bibliography directory, skipping bibtex."
fi
fi
while grep -q 'LaTeX Warning: There were undefined references' $basename.log
do
if test "$iter" -eq 4
then
echo "Iteration limit: $iter passes through pdflatex"
exit 1
fi
iter=`expr $iter + 1`
echo "pdflatex $iter"
pdflatex $basename > /dev/null 2>&1 < /dev/null || :
if grep -q '! Emergency stop.' $basename.log
then
echo "----- Fatal latex error, see $basename.log for details. -----"
exit 1
fi
done
while grep -q 'LaTeX Warning: Label(s) may have changed' $basename.log
do
if test "$iter" -ge 4
then
echo "Iteration limit: $iter passes through pdflatex"
exit 1
fi
iter=`expr $iter + 1`
echo "pdflatex $iter"
pdflatex $basename > /dev/null 2>&1 < /dev/null || :
if grep -q '! Emergency stop.' $basename.log
then
echo "----- Fatal latex error, see $basename.log for details. -----"
exit 1
fi
done
grep "LaTeX Warning:" $basename.log
exit 0
next prev parent reply other threads:[~2016-04-22 12:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-21 14:28 [PATCH 0/2] qqz and runlatex improvements Akira Yokosawa
2016-04-21 14:30 ` [PATCH 1/2] qqz: Improve accuracy of cross-links Akira Yokosawa
2016-04-21 14:32 ` [PATCH 2/2] runlatex.sh: Fix while loop condition Akira Yokosawa
2016-04-21 16:27 ` Paul E. McKenney
2016-04-21 22:05 ` Akira Yokosawa
2016-04-21 23:54 ` Paul E. McKenney
2016-04-22 12:58 ` Akira Yokosawa [this message]
2016-04-22 13:34 ` Paul E. McKenney
2016-04-22 14:20 ` Akira Yokosawa
2016-04-22 15:28 ` Paul E. McKenney
2016-04-23 2:14 ` Akira Yokosawa
2016-04-23 5:44 ` Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=571A1FF0.2080602@gmail.com \
--to=akiyks@gmail.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=perfbook@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.