Discussions of the Parallel Programming book
 help / color / mirror / Atom feed
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 23:20:24 +0900	[thread overview]
Message-ID: <571A3328.6020901@gmail.com> (raw)
In-Reply-To: <20160422133424.GP3879@linux.vnet.ibm.com>

Hi, 

On 2016/04/22 06:34 -0700, Paul E. McKenney wrote:
> On Fri, Apr 22, 2016 at 09:58:24PM +0900, Akira Yokosawa wrote:
>> On 2016/04/22 16:54 -0700, Paul E. McKenney wrote:

Oh, I miss-converted the date. This should have been "On 2016/04/21 16:54 -0700."

>> [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.
> 
> I am pretty sure that I was applying it to the current master,
> but I cannot prove anything at this point.  ;-)
> 
>>> 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.
> 
> Yes, I do understand that.  Your (very welcome!) changes to the quick-quiz
> links can require additional passes through latex.  Therefore, the script
> should change to provide this.
> 
> To see what I am getting at, please add a "\ref{this is a typo}" or a
> reference to any other non-\label string, then type "make".  This is a
> pure error that no number of reruns will fix, but the build script will
> nevertheless crank away multiple times.
> 
> Before, it would run bibtex and stop.  (Which, I freely admit, wasn't
> particularly good behavior either!)
> 
> My question is whether it is possible to make the script let the user
> know why it is re-running latex, so that the user can choose to kill
> it early, if appropriate.  Or, alternatively (and for extra credit!),
> recognize which labels are undefined, and do more passes if they are
> quick-quiz links.
>

I see. I'll try to add those features and improve the behavior. I'm not sure
how far I can do, but please wait for a while. And thank you so much for
your valuable suggestions.

                                                      Regards, Akira

>> 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.
> 
> Good idea!
> 
>> What do you think?
> 
> Please see below.
> 
> 							Thanx, Paul
> 
>> 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. -----"
> 
> Please add "exit 1" here.  (Yes, this was a bug in my orignal.  But as
> long as we are here...)
> 
>> 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`
> 
> This would be one point to add some indication of why we are doing
> another pass through the loop.  Might be as simple as adding "Undefined
> references" to the "echo" below.  Or maybe even show the last symbol
> listed as undefined.
> 
>> 	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`
> 
> This would be one point to add some indication of why we are doing
> another pass through the loop.  Might be as simple as adding "Label(s)
> may have changed" to the "echo" below.
> 
>> 	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
>>
> 
> 


  reply	other threads:[~2016-04-22 14:20 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
2016-04-22 13:34           ` Paul E. McKenney
2016-04-22 14:20             ` Akira Yokosawa [this message]
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=571A3328.6020901@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox