Re: [PATCH 2/2] runlatex.sh: Fix while loop condition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe perfbook" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux