Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New gs 10.01.0 from brew yields many subtle failures #7336

Closed
PaulWessel opened this issue Mar 23, 2023 · 45 comments
Closed

New gs 10.01.0 from brew yields many subtle failures #7336

PaulWessel opened this issue Mar 23, 2023 · 45 comments
Assignees
Labels
bug Something isn't working discussion Topics for longer discussion

Comments

@PaulWessel
Copy link
Member

After doing brew update and brew upgrade I got gs 10.01.0 which seems to yield numerous tiny failures where lines are just processed and rendered slightly differently. So suddenly I have 85 failures on my hand that hours ago were fine. Hoping @GenericMappingTools/core can check to verify this. I guess 85 DVC updates are no big deal but this is kind of annoying.

@PaulWessel PaulWessel added the bug Something isn't working label Mar 23, 2023
@PaulWessel PaulWessel self-assigned this Mar 23, 2023
@seisman
Copy link
Member

seisman commented Mar 23, 2023

Please note that our Linux CI is still using old gs versions. Thus, if we update the PS files, the Linux CI may break.

@PaulWessel
Copy link
Member Author

As a brew master, is there a command that takes me back to 10.00?

@seisman
Copy link
Member

seisman commented Mar 24, 2023

There is no easy way to install old versions of a homebrew package, but you can try:

  1. change into the homebrew-core directory. For me, it's /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula
  2. Download the old gs recipe file ghostscript.rb (https://raw.githubusercontent.com/Homebrew/homebrew-core/7ef0570825ab93c0557c3561e66cfeb6b78686be/Formula/ghostscript.rb), which provides gs 10.0.0
  3. Replace the new ghostscript.rb file with the old one
  4. Reinstall ghostscript

@PaulWessel
Copy link
Member Author

Step 4 redownloads 10.01 even though I had placed the previous there. Perhaps I don’t know how to “reinstall”

also, when you say you are using “old” gs, are vi talking 9.x?

@joa-quim
Copy link
Member

Don't remember how but one can tell brew to run a locally stored formula. So you'd run brew on formula after step 2.

@PaulWessel
Copy link
Member Author

Just to show some of the craziness happening once 10.01 got used (presumably also via gm). Look at this failing example 23:

wPgX3

Yes it still fails with what you think is not too much given the picture?

/opt/homebrew/bin/gm compare: image difference exceeds limit (0.0233046 > 0.003).

@PaulWessel
Copy link
Member Author

Was able to roll back to 10.00 so failures are back to normal.

@seisman
Copy link
Member

seisman commented Mar 26, 2023

Step 4 redownloads 10.01 even though I had placed the previous there. Perhaps I don’t know how to “reinstall”

also, when you say you are using “old” gs, are vi talking 9.x?

This looks pretty bad. Attached are ex023 PNG images generated by gs 9.54 and gs 10.01.

ex23-gs954
ex23-gs1001

A significant change is that in the gs 10.01 version, the character "k" in the contour annotations is almost invisible.

However, the PDF version from gs 10.01 seems OK.

ex23.pdf

@PaulWessel
Copy link
Member Author

Yes, the PDF look fine - I wonder if this is a gm/gs issue since it makes no sense.

@seisman
Copy link
Member

seisman commented Mar 26, 2023

It's a gs issue because gm is not used when converting ps to png.

@KristofKoch
Copy link
Contributor

Just a heads-up:

Ghostscript […] has been found vulnerable to a critical-severity remote code execution flaw.

The flaw is tracked as CVE-2023-3664, having a CVSS v3 rating of 9.8, and impacts all versions of Ghostscript before 10.01.2, which is the latest available version released three weeks ago.

Source: Bleeping Computer: Critical RCE found in popular Ghostscript open-source PDF library

@PaulWessel
Copy link
Member Author

At summit we should build 10.01.2 and see if they have fixed the bugs affecting us.

@joa-quim
Copy link
Member

Don’t think they have. In that recent report of malfunction from Dan he was using 10.01.2

@remkos
Copy link
Contributor

remkos commented Jul 19, 2023

I tried both ghostscript 10.00.0 and 10.01.2 on ex23.ps
ex23.ps

Results are here for ghostscript 10.00.0 and rendering to png, jpg, and plotting on Xwindows.
ex23_gs10000.jpg
ex23_gs10000.png
ex23_gs10000_x

Results are here for ghostscript 10.01.2 and rendering to png, jpg, and plotting on Xwindows.
ex23_gs10012.jpg
ex23_gs10012.png
ex23_gs10012_x

@remkos
Copy link
Contributor

remkos commented Jul 19, 2023

This patch to ghostscript appears to fix it: https://git.ghostscript.com/?p=ghostpdl.git;a=blobdiff;f=base/gspaint.c;h=b3500c1d5282972dbb5ae1a27452c27644a4af32;hp=d67ef36bce6cacf2d02c547a9f4337a420667ff6;hb=c52b4a80cdfc6d9b7d04f52c4a872717aeeff73c;hpb=772d6f3f65b9453df52fb3f12058613842e3565c

It is not yet applied to ghostscript 10.01.2 that was released in June. But with this patch applied, things are OK again.

@PaulWessel
Copy link
Member Author

Thanks to @remkos, macports now delivers a patched gs 10.02.1 that seems to work fine.

@seisman
Copy link
Member

seisman commented Jul 21, 2023

Do you think we should has a page that lists the working gs versions?

@WalterHFSmith
Copy link
Contributor

WalterHFSmith commented Jul 21, 2023 via email

@PaulWessel
Copy link
Member Author

@joa-quim might have good intel on this. Pre 9.56 had a few buggers, then 10.0.0 right?

@remkos
Copy link
Contributor

remkos commented Jul 21, 2023

Thanks to @remkos, macports now delivers a patched gs 10.02.1 that seems to work fine.

In fact, it is gs 10.01.2, which is the latest release.
The patch that is applied is this one: https://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=c52b4a80cdfc6d9b7d04f52c4a872717aeeff73c

@remkos remkos added the discussion Topics for longer discussion label Jul 21, 2023
@seisman
Copy link
Member

seisman commented Aug 24, 2023

FYI, Ghostscript has released the first candidate release of 10.02.0.

I just built it from the source and ran the GMT full tests. Now I have 13 failing tests (similar to what we're having using gs 9.56.1):

	 22 - doc/scripts/GMT_App_F_stand+_iso+.sh (Failed)
	320 - test/gmt_core/testsuite.sh (Failed)
	442 - test/grdfill/gridfill.sh (Failed)
	489 - test/grdimage/url_map.sh (Failed)
	552 - test/grdvector/met_uv.sh (Failed)
	556 - test/grdvector/shrink.sh (Failed)
	583 - test/greenspline/gspline_7.sh (Failed)
	603 - test/modern/longbasemap.sh (Failed)
	618 - test/movie/movie_indicator_de.sh (Failed)
	624 - test/movie/trajectory5.sh (Failed)
	728 - test/psevents/event_lines.sh (Failed)
	729 - test/psevents/eventlabelbox.sh (Failed)
	730 - test/psevents/events.sh (Failed)

I didn't check all the tests carefully, but the failures look reasonable.

The example ex23 mentioned in #7336 (comment) also looks good with gs 10.02.0.

@PaulWessel
Copy link
Member Author

Hi @seisman I am trying to build on my M1 Mac. Run ./configure then make and get at the end:

	/bin/sh <./obj/ldt.tr
Undefined symbols for architecture arm64:
  "_iconv", referenced from:
      _opvp_to_utf8 in gdevopvp.o
  "_iconv_close", referenced from:
      _opvp_to_utf8 in gdevopvp.o
  "_iconv_open", referenced from:
      _opvp_to_utf8 in gdevopvp.o
ld: symbol(s) not found for architecture arm64

Anything I need to initialise first, args to configure ?

@seisman
Copy link
Member

seisman commented Aug 24, 2023

./configure works for me on Linux and Intel Mac. I don't have M1 Mac at hand, so can't help here.

@PaulWessel
Copy link
Member Author

No worries, I think I did do this before so there must be a way. Obviously the gs team do not use Macs I think.

@seisman
Copy link
Member

seisman commented Aug 24, 2023

Hi @seisman I am trying to build on my M1 Mac. Run ./configure then make and get at the end:

	/bin/sh <./obj/ldt.tr
Undefined symbols for architecture arm64:
  "_iconv", referenced from:
      _opvp_to_utf8 in gdevopvp.o
  "_iconv_close", referenced from:
      _opvp_to_utf8 in gdevopvp.o
  "_iconv_open", referenced from:
      _opvp_to_utf8 in gdevopvp.o
ld: symbol(s) not found for architecture arm64

Anything I need to initialise first, args to configure ?

This post may be helpful: https://stackoverflow.com/questions/57734434/libiconv-or-iconv-undefined-symbol-on-mac-osx

@joa-quim
Copy link
Member

Tested 10.02.0 on Windows and seems to work. Same number of failures as before.

@PaulWessel
Copy link
Member Author

I have about 80 failures. Either tiny things (mixcompose.sh):

tiny

or very bad (imgshade.sh):

bad

Not among @seisman's list and I am guessing no among @joa-quim's either. I have a bunch that is related to different reference grids (like the last one here), and probably round off (top one)? Note sure what I should do. What data server do you use for your tests? Cannot be the same as me (oceania)?

@joa-quim
Copy link
Member

These latest clearly look originated in different grid versions. We shouldn’t have these type of tests.

@PaulWessel
Copy link
Member Author

Well, we cannot avoid having plots that need to be compared. I agree we should avoid such test if an alternative way without needing gs, but I dont see how given these types of modules. What we do need is to run these of a static set of data that does not get updated. Remember that lots of tests results from bug reports and we turned those into tests.

@joa-quim
Copy link
Member

They could use small synthetic grids.

@seisman
Copy link
Member

seisman commented Sep 14, 2023

gs 10.02.0 is out.

I built the source code and ran the full tests on Linux. Here are a list of failures I have:

	 22 - doc/scripts/GMT_App_F_stand+_iso+.sh (Failed)
	 52 - doc/scripts/GMT_Defaults_1c.sh (Failed)
	235 - doc/examples/ex38/ex38.sh (Failed)
	264 - test/api/apimodern.sh (Failed)
	321 - test/gmt_core/testsuite.sh (Failed)
	380 - test/grd2cpt/equalarea.sh (Failed)
	399 - test/grdcontour/contours.sh (Failed)
	443 - test/grdfill/gridfill.sh (Failed)
	452 - test/grdfilter/threads.sh (Failed)
	455 - test/grdgradient/aspect.sh (Failed)
	471 - test/grdimage/grdcyclic.sh (Failed)
	474 - test/grdimage/grdread.sh (Failed)
	490 - test/grdimage/url_map.sh (Failed)
	553 - test/grdvector/met_uv.sh (Failed)
	557 - test/grdvector/shrink.sh (Failed)
	584 - test/greenspline/gspline_7.sh (Failed)
	600 - test/modern/imagepluscpt.sh (Failed)
	604 - test/modern/longbasemap.sh (Failed)
	617 - test/modern/viewpluscpt.sh (Failed)
	621 - test/movie/movie_indicator_f_ver.sh (Failed)
	625 - test/movie/trajectory5.sh (Failed)
	730 - test/psevents/eventlabelbox.sh (Failed)
	731 - test/psevents/events.sh (Failed)

I didn't check all these failures carefully, but most of them look good to me.

In summary, gs 10.02.0 looks like a working version for GMT.

@remkos
Copy link
Contributor

remkos commented Sep 17, 2023

I created a PR for Ghostscript 10.02.0 on macports. It was accepted and merged yesterday, so macports users can get it easily now.

@seisman
Copy link
Member

seisman commented Sep 18, 2023

FYI, conda and homebrew also updated their ghostscript to 10.02.0

@ghomsi123
Copy link

Thanks @seisman for the updates. Transparency is still not working on my MBpro Ventura.
I'm using the 6.4.0 version installed via brew. I've even linked gs10.2.0 with gmt and it still doesn't work.

@joa-quim
Copy link
Member

With GMT6.4 you need a gs version < 10 to have transparency.

@ghomsi123
Copy link

Thanks @joa-quim. Any ideas or process for downgrading gs version < 10?

@joa-quim
Copy link
Member

Homebrew can do it but I don't remember how (very occasional Mac user)

@ghomsi123
Copy link

Surely @seisman and @PaulWessel have tricks to find out!

@seisman
Copy link
Member

seisman commented Sep 20, 2023

Any ideas or process for downgrading gs version < 10?

It's not easy to downgrade gs to <10, because many gs dependencies are too new to be compatible with gs 9.

I think it's much easier to install the GMT master branch instead. With homebrew, you just need to run

brew install gmt --HEAD

@ghomsi123
Copy link

Thanks @seisman. Is the master branch compatible with the current version of gs?

@joa-quim
Copy link
Member

Can that --HEAD be limited to recent commits only to avoid having to download the ~1 GB repo?

Is the master branch compatible with the current version of gs?

Yes.

@seisman
Copy link
Member

seisman commented Sep 20, 2023

Can that --HEAD be limited to recent commits only to avoid having to download the ~1 GB repo?

I believe it only downloads the latest commit using git clone --depth=1.

@joa-quim
Copy link
Member

Ah, that is good. We should probably advertise that in our installing instructions.

@seisman
Copy link
Member

seisman commented Sep 20, 2023

We should probably advertise that in our installing instructions.

We already did it https://github.com/GenericMappingTools/gmt/blob/master/INSTALL.md#install-via-homebrew

@seisman
Copy link
Member

seisman commented Sep 24, 2023

Since gs 10.02.0 seems working well with GMT master branch, I think we can close the issue, although we still need to update the baseline images if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working discussion Topics for longer discussion
Projects
None yet
Development

No branches or pull requests

7 participants