lilypond-devel
[Top][All Lists]
Advanced

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

Re: Issue 5381: Change intermediate PDF filename (issue 357760043 by add


From: trueroad
Subject: Re: Issue 5381: Change intermediate PDF filename (issue 357760043 by address@hidden)
Date: Sat, 14 Jul 2018 01:22:49 -0700

Thank you for your reviewing.


https://codereview.appspot.com/357760043/diff/20001/make/lilypond-book-rules.make
File make/lilypond-book-rules.make (right):

https://codereview.appspot.com/357760043/diff/20001/make/lilypond-book-rules.make#newcode33
make/lilypond-book-rules.make:33: mv $@ $(outdir)/$*.tmp.pdf
On 2018/07/14 07:43:14, dak wrote:
This appears to change the output name after the fact.  It would still
create
the output under the final name and when
a) some parallel Make goes looking for it, it will find it existing
and new
b) the script aborts while the file is still there
the problem, if any, would likely persist, possibly with a smaller
time window
for causing trouble.

I think that any solution predicated on USE_EXTRACTPDFMARK would
require an
if/then/else construct rather than an if/then construct in order not
to have
this kind of race condition built-in by producing a file with the
final name,
then doing additional actions on it.

If I understand correctly,
GNU make deletes a target file that the recipe was supposed to update
when aborted.
https://www.gnu.org/software/make/manual/html_node/Interrupts.html#Interrupts

Unfortunately, we cannnot specify an output filename for LaTeX.
So the patch uses `mv` after outputting the target filename.

I have another idea like following.

```
$(outdir)/%.pdf_tmp:  $(outdir)/%.tex
        pdflatex $<
        mv $(outdir)/$*.pdf $@

$(outdir)/%.pdf:  $(outdir)/%.pdf_tmp
ifeq ($(USE_EXTRACTPDFMARK),yes)
        extractpdfmark -o $(outdir)/$*.pdfmark $<
        gs -sOutputFile=$@ $(outdir)/$*.pdfmark $<
else
        cp $< $@
endif
```
How about this?

https://codereview.appspot.com/357760043/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]