gregs1104 / pgbench-tools

PostgreSQL Benchmarking Toolset
BSD 3-Clause "New" or "Revised" License
251 stars 73 forks source link

gnuplot graphs have garbled text on Mac OS/homebrew #24

Open gregs1104 opened 4 years ago

gregs1104 commented 4 years ago

In July 2019 pgbench-tools merged PR #15 which switched to using gnuplot's pngcairo output "terminal", to use gnuplot's terminology. This improves the quality of graphs compared to the basic png output. In July 2020, I noticed that output stopped working correctly under the gnuplot chain distributed by the Mac homebrew tool. The text of the labels is corrupted, with successive characters overwriting each other. It's easy to test for the problem:

$ gnuplot
set output "test.png"
set term pngcairo
plot sin(x)
quit
$ open test.png

And I'm attaching a sample. Commit a81305cbcba998da9fada785a67207c46bbd988c gave a workaround for the problem, which is simply to switch back to set term png and lose some graphics quality.

The problem appears resolved for both OS X Mojave and Catalina after this update:

$ brew update && brew upgrade
...
Updated Homebrew from 5de4378a9 to 7eb1a0969.

The versions of gnuplot and cairo didn't change between those two commits. This makes me think it was a typography library bug, in a lower level drawing package; maybe freetype? I'm still bisecting a root cause, mainly to defend against a future regression now that it's fixed. I'll document a bit further and revert the workaround once I'm satisfied with this issue report. broken

gregs1104 commented 4 years ago

Confirmed the bug was gone on a third Mac. Homebrew was updated to here:

Homebrew/homebrew-core (git revision 097f65; last commit 2020-08-30)
Homebrew/homebrew-cask (git revision 132569; last commit 2020-08-30)

Out of the packages gnuplot directly depends on, only two were updated since the bug was introduced:

/usr/local/Cellar/freetype/2.10.1 (61 files, 2.2MB) *
  Poured from bottle on 2020-02-29 at 11:21:18
--->  One rev update, 2.10.1 -> 2.10.2
/usr/local/Cellar/freetype/2.10.2 (61 files, 2.3MB) *
  Poured from bottle on 2020-08-30 at 17:20:12

No brew change to that one, just grabbed latest rev 2.10.2: https://sourceforge.net/projects/freetype/files/freetype2/2.10.2/ The only fix that seems in the right neighborhood is "Function `FT_Get_Var_Axis_Flags' returned random data for Type 1 MM fonts."; I don't know that any of the fonts I'm using are Type 1 Multi-Master, but perhaps that is the issue and why not everyone ran into it.

glib was also updated:

/usr/local/Cellar/glib/2.64.3 (436 files, 15.7MB) *
  Poured from bottle on 2020-06-23 at 10:39:46
--->  Two rev updates, 2.64.3 -> 2.64.4 -> 2.65.5
/usr/local/Cellar/glib/2.64.5 (436 files, 14.8MB) *
  Poured from bottle on 2020-08-30 at 17:20:27

Those changes seem below where the bug was happening. 2.65.5: https://gitlab.gnome.org/GNOME/glib/-/commit/f91af2021ca4e0cef2fc0e2ef188958b3d590681

gregs1104 commented 4 years ago

Done with this after last commit. I'm keeping this open so it's more likely people will find it. I'll close it in a few months.