Page MenuHomePhabricator

Random rendering issue (lines starting from lower left corner)
Open, Needs TriagePublic

Description

There seems to be a bug in Ploticus that causes random errors in timelines generated by EasyTimeline. The pictures have these random lines with one end in the lower left corner. Here is a test page to show the problem https://fi.wikibooks.org/wiki/K%C3%A4ytt%C3%A4j%C3%A4:Hunsvotti/timeline-issue. All the images have the same input, yet one is mangled. (I had to change the amount of whitespace in the scripts, because the software was smart enough to use the same image otherwise. It's not relevant here.)

This problem is in Plotibus not in EasyTimeline. If you take the output of EasyTimeline.pl with, for example, the
input above and give it to the pl executable a number of times, you should see the same random bug appear there. For example generating a hundred
images with the same input, 13 have the bug appear:

> for index in $(seq 1 100); do
  ploticus/pl241src/src/pl -png -o "./test/testi-$index.png" './piano-c–e–g–b♭–d♯–f–a.txt' -tightcrop -font 'ascii';
done

Output:


A Proposed fix. I've already looked at the problem and think I have found the problem.

On lines 460 and 488 there are these for-loops with ending condition iline <= procstop.

460	for( iline = txtstartline; iline <= procstop ; iline++ ) {
488	for( iline = txtstartline; iline <= txtstopline; iline++ ) {

This causes a line to be read past the array PLL.procline on line 489 and some garbage been appended to the buffer on line 495. It's then
returned to back to proc_line.c: 70. The garbage is counted as a string. The conditional on line 73 gets the wrong count and branches to wonky town!
This causes the warning

pl proc line:  2959: warning: points must have either 4 or 2 values per line

I think the fix is to change the loop condition on line 488 to not allow iline to be equal to procstop. Patch:

460	for( iline = txtstartline; iline < procstop ; iline++ ) {

On line 488 the procstop condition seems useless since txtstopline is already capped to it after the previous loop (line 468). So line 488 could be

488	for( iline = txtstartline; iline < txtstopline; iline++ ) {

I am not sure if this fix will cause some other problems. I've tested it with some random timelines I donwloaded from Wikipedia and none of them
seems to have any issues. Also if you look at how procstop is set in execline.c. At line 398 it is set start position + length, and on 403 to
number of lines, it would make sense the iline pointer should never be equal to procstop.

I coudn't get the error to appear on any of the Ploticus testsuit files. So, there might be something in Timeline generated files that makes it visble.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 16 2018, 7:23 PM
Hunsvotti updated the task description. (Show Details)Oct 16 2018, 7:24 PM
Hunsvotti updated the task description. (Show Details)
Hunsvotti updated the task description. (Show Details)Oct 17 2018, 1:47 PM

This is probably the same error as T204570.

Hunsvotti renamed this task from Random rendering issue to Random rendering issue (lines starting from lower left corner).Oct 17 2018, 1:51 PM

Hi @Hunsvotti, thanks for taking the time to report this and for taking a look at the code!

I wonder how to proceed here. Ploticus saw its last upstream release five years ago and it's not maintained anymore, I'd say. On Wikimedia servers we use Debian packages so maybe that could be proposed to Debian instead of maintaining a custom patch on Wikimedia servers only. Maybe the Editing team could provide insight.

Thanks for the reply @Aklapper! I reported the bug and send the patch to Debian.

Aklapper removed ezachte as the assignee of this task.Nov 18 2019, 11:52 AM
Aklapper added a subscriber: ezachte.

Removing assignee @ezachte as that Phabricator account has been deactivated. (If there are questions, it seems that @erik_zachte could be contacted.)