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

GhostScript 9.27 released with yet another bug #880

Closed
PaulWessel opened this issue Jun 11, 2019 · 32 comments
Closed

GhostScript 9.27 released with yet another bug #880

PaulWessel opened this issue Jun 11, 2019 · 32 comments
Labels
longterm Long standing issues that need to be resolved

Comments

@PaulWessel
Copy link
Member

Fixed one bug, introduced another

I think they have fixed the #195 but added another bug. The attached minimal pure PostScript example demonstrates the problem. It looks fine in previewers as a full US Letter page. To crop tightly we need the bounding box. In gs 9.26 we get the correct box:

gs -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox bug.ps

which gives

%%BoundingBox: 71 71 361 385
%%HiResBoundingBox: 71.278803 71.278803 360.721184 384.173988

while in 9.27 we now get

%%BoundingBox: 71 71 361 377
%%HiResBoundingBox: 71.278803 71.278803 360.721184 376.541989

The smaller y-max means we crop across the Title and we get an error. Before I post this to the ghostscript issue tracker, can at least one confirm that this is the case please?

bug.ps.zip

@seisman
Copy link
Member

seisman commented Jun 11, 2019

How did you install ghostscript 9.27?

The ghostscript from homebrew is still in 9.26. I also don't find a binary package from ghostscript website.

@PaulWessel
Copy link
Member Author

I am using macports and they finally updated to 9.27 today. Surprised the homebrew is behind - they seem to be ahead of macports for most things. 9.27 was released 4 months ago.

@joa-quim
Copy link
Member

joa-quim commented Jun 11, 2019 via email

@seisman seisman added the help wanted We need some help! label Jun 11, 2019
@seisman
Copy link
Member

seisman commented Jun 11, 2019

I can reproduce the issue with the Linux x64 binary package provided by ghostscript website.

@seisman seisman removed the help wanted We need some help! label Jun 11, 2019
@PaulWessel PaulWessel added the longterm Long standing issues that need to be resolved label Jun 11, 2019
@PaulWessel
Copy link
Member Author

Thanks, I have opened a bug report with ghostscript: https://bugs.ghostscript.com/show_bug.cgi?id=701186.

@joa-quim
Copy link
Member

joa-quim commented Jun 11, 2019

This is even worst than the bugs. No more previewer on Windows (not even the abandoned gsview is now available to dowload)

Capture

@PaulWessel
Copy link
Member Author

Are there really no other viewers for Windows? Presumably you will be OK producing PDFs instead.

@joa-quim
Copy link
Member

Not an issue for me that have both gsview 5 and 6 but highly disturbing news.

@PaulWessel
Copy link
Member Author

Well, you know the old story about rats and sinking ships.

@joa-quim
Copy link
Member

Yes, but there is also that story about the Ghost ships squad (Mary Celeste, of its name, was the head of them).

Nice name for a gsview replacement.

@PaulWessel
Copy link
Member Author

My bug report was seen as a duplicate of another report and apparently the problem has been fixed in the repo (https://bugs.ghostscript.com/show_bug.cgi?id=700952).

@anbj
Copy link
Contributor

anbj commented Jun 12, 2019

Is there an alternative to postscript to create figures? Will this ever be necessary? It appears to me that postscript is becoming more and more peripheral, and the tools to show and process (at least free/open source) are fading away. Is this true?

As of know, GMT is totally dependant on gs, right? Any danger that gs will disappear? What happens then?

I do not know my gs history, so please dont keelhaul me.

@joa-quim
Copy link
Member

Nope. Long time concern of mine too. The closest I can imagine now would be postscript lib calls replaced by ones that would use Cairo. While some of them do not seem that different, there are many who are. This would be a large piece of work, though doable. I think.

@seisman
Copy link
Member

seisman commented Jun 26, 2019

Homebrew finally updated to ghostscript 9.27 a few days ago. gs9.27 is known to be buggy, so I tried to install development version using brew install ghostscript --HEAD.

Unfortunately, the gs development version has more serious bugs.

I generated a PS file and tried to convert it to other formats:

gmt psbasemap -R0/10/0/10 -JX10c -Baf > test.ps

Following command generated an empty PDF file.

$ gmt psconvert -A -P -Tf -Vd test.ps
... 
psconvert [INFORMATION]: Processing test.ps...
psconvert [INFORMATION]: Find HiResBoundingBox ...
psconvert [DEBUG]: Running: gs -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox -DPSL_no_pagefill -dMaxBitmap=2147483647 -dUseFastColor=true 'test.ps' 2> './psconvert_22529c.bb'
psconvert [INFORMATION]: Figure dimensions: Width: 321.03 points [11.3252 cm]  Height: 328.41 points [11.5856 cm]
psconvert [DEBUG]: Delete ./psconvert_22529c.bb
psconvert [INFORMATION]: [220.86 49.914 541.89 378.324]...
psconvert [WARNING]: An unknown psconvert setting was found but since image coordinates seem to be geographical, a linear transformation will be used.
psconvert [INFORMATION]: Convert to PDF...
psconvert [DEBUG]: Running: gs -q -dNOPAUSE -dBATCH -dPDFSETTINGS=/prepress -dDownsampleColorImages=false -dDownsampleGrayImages=false -dDownsampleMonoImages=false -dUseFlateCompression=true -dEmbedAllFonts=true -dSubsetFonts=true -dMonoImageFilter=/FlateEncode -dAutoFilterGrayImages=false -dGrayImageFilter=/FlateEncode -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dSCANCONVERTERTYPE=2 -dMaxBitmap=2147483647 -dUseFastColor=true -sDEVICE=pdfwrite  -g3285x3211 -r720 -sOutputFile='test.pdf' -f'./psconvert_22529d.eps'
psconvert [DEBUG]: Delete ./psconvert_22529d.eps
psconvert [DEBUG]: Final input buffer length was 128
psconvert (gmtlib_free_tmp_arrays): tried to free unallocated memory
gmt [DEBUG]: Entering GMT_Destroy_Session

Following command don't generate a JPG file.

$ gmt psconvert -A -P -Tj -Vd test.ps
...
psconvert [INFORMATION]: Processing test.ps...
psconvert [INFORMATION]: Find HiResBoundingBox ...
psconvert [DEBUG]: Running: gs -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox -DPSL_no_pagefill -dMaxBitmap=2147483647 -dUseFastColor=true 'test.ps' 2> './psconvert_22548c.bb'
psconvert [INFORMATION]: Figure dimensions: Width: 321.03 points [11.3252 cm]  Height: 328.41 points [11.5856 cm]
psconvert [DEBUG]: Delete ./psconvert_22548c.bb
psconvert [INFORMATION]: [220.86 49.914 541.89 378.324]...
psconvert [WARNING]: An unknown psconvert setting was found but since image coordinates seem to be geographical, a linear transformation will be used.
psconvert [INFORMATION]: Convert to JPG...
psconvert [DEBUG]: Running: gs -q -dNOPAUSE -dBATCH -dSCANCONVERTERTYPE=2 -dMaxBitmap=2147483647 -dUseFastColor=true -dGraphicsAlphaBits=2 -dTextAlphaBits=4 -sDEVICE=jpeg -dJPEGQ=90 -g1369x1338 -r300 -sOutputFile='test.jpg' -f'./psconvert_22548d.eps'
psconvert [ERROR]: Could not create test.jpg. Maybe input file does not fulfill PS specifications.
psconvert [DEBUG]: Delete ./psconvert_22548d.eps
psconvert [DEBUG]: Final input buffer length was 128
psconvert (gmtlib_free_tmp_arrays): tried to free unallocated memory
gmt [DEBUG]: Entering GMT_Destroy_Session

@PaulWessel
Copy link
Member Author

What is the WARNING from psconvert about?

@seisman
Copy link
Member

seisman commented Jun 27, 2019

Do you mean this warning?

psconvert [WARNING]: An unknown psconvert setting was found but since image coordinates seem to be geographical, a linear transformation will be used.

I have the same warning with gs 9.26.

@PaulWessel
Copy link
Member Author

Yes, given what it says I suspect something with the GeoPDF comments @joa-quim adds, but we can see what he things tomorrow. The message is not in the GMT source code.

@PaulWessel
Copy link
Member Author

Try running the raw gs command reported by -S to see if we get more useful message from gs directly.

@seisman
Copy link
Member

seisman commented Jun 27, 2019

The message comes from psconvert.c:

gmt/src/psconvert.c

Lines 2033 to 2040 in 53042bf

if (!strcmp (proj4_name,"xy") &&
(west >= -180) && ((east <= 360) && ((east - west) <= 360)) &&
(south >= -90) && (north <= 90) ) {
proj4_cmd = strdup ("latlon");
GMT_Report (API, GMT_MSG_VERBOSE, "An unknown psconvert setting was found but since "
"image coordinates seem to be geographical, a linear transformation "
"will be used.\n");
}
.

@PaulWessel
Copy link
Member Author

Yep, I grepped for too much and @joa-quim breaks lines to fit his tiny screen.

@seisman
Copy link
Member

seisman commented Jun 27, 2019

Run psconvert with -S option:

$ gmt psconvert -A -P -Tj -S test.ps
gs -q -dNOPAUSE -dBATCH -dSCANCONVERTERTYPE=2 -dMaxBitmap=2147483647 -dUseFastColor=true -dGraphicsAlphaBits=2 -dTextAlphaBits=4 -sDEVICE=jpeg -dJPEGQ=90 -g1369x1338 -r300 -sOutputFile='test.jpg' -f'./psconvert_59826d.eps'
psconvert [ERROR]: Could not create test.jpg. Maybe input file does not fulfill PS specifications.

Copy the raw gs command and run it give nothing. No errors, no test.jpg generated. Removing the -q option in the gs command doesn't help.

@PaulWessel
Copy link
Member Author

Maybe see if removing any of the -d choices affects the outcome, i.e., find the fewest arguments that still fails so we can report a simple case.

@seisman
Copy link
Member

seisman commented Jun 27, 2019

I removed all -d choices and used following command:

gs -sDEVICE=jpeg -g1369x1338 -r300 -sOutputFile='test.jpg' -f'./psconvert_59910d.eps'

gs development version still fails to generate the JPG file and gives no warnings. However, gs 9.26 works well.

@PaulWessel
Copy link
Member Author

Presumably the same with using test.ps directly? Please post that file (just in case) and gs --version output and I can submit a bug report. Alternatively, you could do the same at bugs.ghostscript.com.

@seisman
Copy link
Member

seisman commented Jun 27, 2019

EPS file (zipped): psconvert_59910d.eps.zip

gs command

gs -sDEVICE=jpeg -g1369x1338 -r300 -sOutputFile='test.jpg' -f'./psconvert_59910d.eps'

gs is installed via brew install ghostscript --HEAD, which compiles the gs source codes from the master branch. The commit hash is 12ffa0f40.

@PaulWessel
Copy link
Member Author

I have submitted a bug report for master regarding this case, at https://bugs.ghostscript.com/show_bug.cgi?id=701272.

@PaulWessel
Copy link
Member Author

Developers say:
--- Comment #1 from Chris Liddell (chrisl) [email protected] ---
It does produce the output file for me, on Linux.

@joa-quim
Copy link
Member

And it's only getting narrower. Because my eyes are f I'm forced to increase font size.

Maybe we should simply shut up that warning. Things initiated long ago when in our (almost unused -J proj4 codes we have an -Jxy. But probably I don't know anymore what to do with it and when psconvert finds that for likely geog limits, it issues that warning.

@seisman
Copy link
Member

seisman commented Jun 27, 2019

This gs (9.28) command doesn't work:

gs -sDEVICE=jpeg -g1369x1338 -r300 -sOutputFile='test.jpg' -f'./psconvert_59910d.eps'

This gs (9.28) command works well:

gs -sDEVICE=jpeg -g1369x1338 -r300 -sOutputFile='test.jpg' './psconvert_59910d.eps'

The only difference is the -f.

@PaulWessel
Copy link
Member Author

Update: At least macports have moved to @9.27_1 from @9.27_0 and this fixes the original bug reported at the top. This is a patch since there is no 9.28 out, but it does mean that perhaps most non-Linux users will be OK by just getting the latest from fink, macports, home-brew. I just noticed that my gs was updated June 27 to 9.27_1.

@claudiodsf
Copy link
Contributor

Hi, gs on homebrew (and maybe on other distributions as well) is now at version 9.50.
All the above examples work for me.
Should this issue be closed?

@joa-quim
Copy link
Member

Yes, I think so.

obaney pushed a commit to obaney/gmt that referenced this issue Aug 18, 2021
* Add affiliation and ORCID for Liam
* Add Will Schlitzer ORCID
* Add Dongdong Tian ORCID
* Add Michael Grund ORCID
* Clarify what should be added to AUTHORS.md
* Add Malte Ziebarth to AUTHORS.md
* Add Wei Ji ORCID and affiliation
* Add Tyler Newton ORCHID & affiliation (GenericMappingTools#880)

Co-authored-by: Dongdong Tian <[email protected]>
Co-authored-by: Wei Ji <[email protected]>
Co-authored-by: Meghan Jones <[email protected]>
Co-authored-by: Malte Ziebarth <[email protected]>
Co-authored-by: Will Schlitzer <[email protected]>
Co-authored-by: Michael Grund <[email protected]>
Co-authored-by: Tyler Newton <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
longterm Long standing issues that need to be resolved
Projects
None yet
Development

No branches or pull requests

5 participants