lilypond-devel
[Top][All Lists]
Advanced

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

race condition in writing lilypond-book filenames


From: Graham Percival
Subject: race condition in writing lilypond-book filenames
Date: Sun, 13 Dec 2009 15:55:00 +0000

diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py
index 392ddd0..b9731f1 100644
--- a/scripts/lilypond-book.py
+++ b/scripts/lilypond-book.py
@@ -1273,7 +1273,11 @@ left-margin-default right-margin-default)"
         directory = os.path.split(path)[0]
         if not os.path.isdir (directory):
             os.makedirs (directory)
-        out = file (path + '.ly', 'w')
+        filename = path + '.ly'
+        if os.path.exists(filename):
+            print "PANIC!  ", filename, "already exists!"
+            sys.exit(1)
+        out = file (filename, 'w')
         out.write (self.full_ly ())
         file (path + '.txt', 'w').write ('image of music')


make doc-clean
make clean
nice make -j3
...
Reading /home/gperciva/src/lilypond/Documentation/usage/lilypond-book.itely...
Dissecting...
Writing snippets...PANIC!
/main/src/build-lilypond/out/lybook-db/85/lily-dabb3c4a.ly already
exists!
make[1]: *** [out/usage.texi] Error 1
make[1]: *** Waiting for unfinished jobs....
rm out/web.texi
make[1]: Leaving directory `/main/src/build-lilypond/Documentation'
make: *** [all] Error 2


I'm honestly surprised I got this with a simple "make" instead of "make doc".
... oh wait, this file is <c e g>, which is at the beginning of the
LM.  Of course it would generate the same file multiple times... once
for the HTML output, once for PDF, maybe a third time for info?
... oh wait *2, just running "make" shouldn't generate the HTML/PDF.
Hmm... maybe the second time through, it was generating a translation
of the LM?

In any case, we definitely have the same filename being used multiple
times when building lilypond.  Is this a problem?  I can't say for
certainty, but I *do* know that unpredictable race conditions occur in
the docs when building with more than one process.

Cheers,
- Graham




reply via email to

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