[Dot] "Error: trouble in init_rank" puzzle finally solved!
Created by: ens-lg4
Dear GraphViz developers,
We were migrating our software that uses "dot" for graph generation to another RedHat Linux machine. I was puzzled by the fact that the same code behaved differently on two computers, although we made sure all the installed packages/libraries were the same. The same version of "dot" (actually the same binary living on a shared mounted filesystem) with the same input file was working fine on one computer and throwing the infamous "trouble in init_rank" error on another.
Today we finally tracked it down to a single culprit: the availability of Type1 fonts in /usr/share/fonts/ ! There is a clear 100% correlation: adding the files solves the problem, removing the files causes the "trouble in init_rank" kind of crash.
Apparently, before laying out the graph "dot" uses (possibly indirectly, via png/svg libraries?) system's font files to estimate sizes of text-containing elements. For some reason, the failure to find those files is not properly caught/reported, but the missing data somehow causes that "trouble in init_rank".
It was very confusing that for smaller graphs there was no crash. Probably, this dependence on font files is masked by some other, stronger conditions.
The same behaviour has been seen in "dot" versions from 2.28.0 through 2.38.0 (under Ubuntu and RedHat). The test file has been attached. To replicate you can either move files out of and back into /usr/share/fonts or simply change font paths in /etc/fonts/fonts.conf to temporarily mask the actual font files.
Thank you in advance for looking into this!