Hey all, In my quest to debug issue 2801, I stumbled upon behavior in LilyPond that is non-deterministic. You'll see four attached files: a simple diff to apply to current master, two .ly files, and a python script to run in the same directory as the LilyPond files.
1) Apply the diff and compile. The diff prints out the name of a grob and its extent to stderr every time Grob::extent is called. 2) Download the files and the python script to the same directory. Change the Lilypond executable in the python script as need be. The python script overwrites log0.txt and log1.txt, so make sure you don't have important files named that. 3) Oscillate between foo.ly and bar.ly in the python script. foo.ly is deterministic whereas bar.ly is not. bar.ly will usually produce non-deterministic behavior before it hits 20 runs. The only difference between the two files is the presence of a slur. As a test, I rewound Lilypond to 26e8b94f358244216a83c1a6653d5a72c1a1c5e7 (about 2 years ago) and did the same thing - it is still not deterministic, but at different points in the compilation process. I realize that LilyPond may be using containers that do not guarantee the order of things (i.e. sets) and that the test I've written may not be a good reflection of what "deterministic" should mean. However, for debugging purposes, I think it's important that when LilyPond compiles the same score, the extents measured and the order in which they're measured remain constant. Otherwise, finding changes in extents, offsets, and skylines is difficult. I think it's important to get 2-3 people brainstorming to figure out where and why this is happening. Cheers, MS P.S. I don't believe that the measurement tool I'm using are the cause of the non-deterministic behavior, but I'm aware that that is always a problem. The .diff is minimally invasive.
""" Compile the same file with LilyPond, writing standard error to log0.txt and log1.txt alternatively. Compares all lines starting with the `@' symbol. If lines diverge, stop the script and report the offending line. """ import subprocess import sys LILYPOND_EXECUTABLE = 'Lilypond' FILE_TO_COMPILE = 'foo.ly' #FILE_TO_COMPILE = 'bar.ly' MAX_RUNS = 100 for i in range (MAX_RUNS) : subprocess.call (LILYPOND_EXECUTABLE+' '+FILE_TO_COMPILE+' 2> log'+str(i%2)+'.txt', shell=True) if i > 1 : print "ON COMPARISON", i - 1 f0 = file('log'+str(i%2)+'.txt','r') c0 = f0.read () f0.close () f1 = file('log'+str((i+1)%2)+'.txt','r') c1 = f1.read () f1.close () c0 = c0.split ('\n') c1 = c1.split ('\n') c0x = 0 c1x = 0 while (c0x < len(c0)) & (c1x < len(c1)) : try : while (c0[c0x][0] != '@') : c0x += 1 except IndexError : pass try : while (c1[c1x][0] != '@') : c1x += 1 except IndexError : pass if (c0x >= len(c0)) | (c1x >= len(c1)) : break # stop the script and report the offending line if c0[c0x] != c1[c1x] : print "DIVERGES HERE", c0x, c1x, c0[c0x], c1[c1x], sys.exit (1) c0x += 1 c1x += 1
bar.ly
Description: Binary data
foo.ly
Description: Binary data
simple.diff
Description: Binary data
_______________________________________________ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond