lilypond-book: Rewrite processing of snippets
The previous version relied on a stable hash() method, both for the
ordering in a set() and for the list's checksum. This probably worked
with Python 2 and up to Python 3.2, but later versions use a random
seed for invocations of hash(). This ensures different hash values for
subsequent invocations to make malicious attacks more difficult.
The new code uses hashlib.md5() and .hexdigest() instead which returns
a deterministic result across runs. It also sorts the snippets' names
which leads to more stable profiling results for 'make check'.
This change also tries to improve performance by writing snippets with
the same basename only once. Additionally it solves potential problems
if the build directory has the string '.ly' in its path.
Diff:
Passes make, make check and a full make doc.
Address comments & revert temporary workaround in master
http://codereview.appspot.com/555220043
Passes make, make check and a full make doc.
snippet-names-*.ly -> .txt
http://codereview.appspot.com/555220043
Revert change to .txt
http://codereview.appspot.com/555220043
Passes make, make check and a full make doc.
(although I get all those cell counts back again, I assume this would be expected in this one case - ie. I am checking against a baseline that used .ly and now is using .txt)
Yes, profiling differences are expected for this change because the snippets are in a different order. However I had to revert the .txt change, it's back to .ly ;-)
Patch on countdown for Feb 6th.
Patch counted down - please push.
pushed to
staging