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

asymptote with gs 9.24 fails #73

Closed
spotrh opened this issue Sep 5, 2018 · 12 comments
Closed

asymptote with gs 9.24 fails #73

spotrh opened this issue Sep 5, 2018 · 12 comments

Comments

@spotrh
Copy link
Contributor

@spotrh spotrh commented Sep 5, 2018

Fedora 29/30 have ghostscript 9.24. I get these errors when that version is present:

  • make all
    ../asy -dir ../base -config "" -render=0 -h 2>&1 | grep -iv Asymptote > options
    ../asy -dir ../base -config "" -render=0 -f pdf -noprc Hobbycontrol.asy
    ./base/gsicc_manage.c:1244: gsicc_open_search(): Could not find default_rgb.icc
    | ./base/gsicc_manage.c:2025: gsicc_set_device_profile(): cannot find device profile
    Error: /rangecheck in .installpagedevice
    Operand stack:
    --nostringval-- --dict:206/212(ro)(L)-- --nostringval-- --nostringval-- false
    Execution stack:
    %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 2015 1 3 %oparray_pop 2014 1 3 %oparray_pop 1936 1 3 %GPL Ghostscript 9.24: Unrecoverable error, exit code 1
    oparray_pop --nostringval-- 1920 1 3 %oparray_pop --nostringval-- --nostringval--
    Dictionary stack:
    --dict:975/1684(ro)(G)-- --dict:0/20(G)-- --dict:78/200(L)--
    Current allocation mode is local
    Last OS error: No such file or directory
    ./base/gsicc_manage.c:1244: gsicc_open_search(): Could not find default_gray.icc
    | ./base/gsicc_manage.c:2025: gsicc_set_device_profile(): cannot find device profile
    ../base/plain_shipout.asy: 102.11: runtime: shipout failed
    make: *** [Makefile:42: Hobbycontrol.pdf] Error 1

Downgrading to gs 9.23 makes this error go away, so I suspect that something that asymptote is doing in its calls to gs is no longer permitted.

@johncbowman
Copy link
Member

@johncbowman johncbowman commented Sep 5, 2018

Can you try out the latest git source? The issue likely has already been addressed
(commit 28bc9c7). We will make a new release soon,
once we hear back from you. Thanks!

@spotrh
Copy link
Contributor Author

@spotrh spotrh commented Sep 5, 2018

I'm using 2.47 already, which appears to have the changes in 28bc9c7 applied. I tried the latest git source and it fails in exactly the same manner as originally reported.

@johncbowman
Copy link
Member

@johncbowman johncbowman commented Sep 5, 2018

From the error message, it looks like a gs installation problem (Could not find default_rgb.icc).
I tried out gs-9.24 and it works for me:

asy -V doc/Hobbycontrol -f pdf -gs=/usr/local/src/ghostscript-9.24-linux-x86_64/gs-924-linux-x86_64 -noprc -render=0 -vv
Using configuration directory /u/bowman/.asy
Loading config.asy from /u/bowman/.asy/config.asy
Using history /u/bowman/asymptote/.asy_history
Welcome to Asymptote version 2.48-1
cd /u/bowman/asymptote
Processing Hobbycontrol
Loading plain from /u/bowman/asymptote/base/plain.asy
Including plain_constants from /u/bowman/asymptote/base/plain_constants.asy
Loading version from /u/bowman/asymptote/base/version.asy
Including plain_strings from /u/bowman/asymptote/base/plain_strings.asy
Including plain_pens from /u/bowman/asymptote/base/plain_pens.asy
Including plain_paths from /u/bowman/asymptote/base/plain_paths.asy
Including plain_filldraw from /u/bowman/asymptote/base/plain_filldraw.asy
Including plain_margins from /u/bowman/asymptote/base/plain_margins.asy
Including plain_picture from /u/bowman/asymptote/base/plain_picture.asy
Loading plain_scaling from /u/bowman/asymptote/base/plain_scaling.asy
Loading simplex from /u/bowman/asymptote/base/simplex.asy
Loading plain_bounds from /u/bowman/asymptote/base/plain_bounds.asy
Including plain_scaling from /u/bowman/asymptote/base/plain_scaling.asy
Including plain_prethree from /u/bowman/asymptote/base/plain_prethree.asy
Including plain_Label from /u/bowman/asymptote/base/plain_Label.asy
Including plain_shipout from /u/bowman/asymptote/base/plain_shipout.asy
Including plain_arcs from /u/bowman/asymptote/base/plain_arcs.asy
Including plain_boxes from /u/bowman/asymptote/base/plain_boxes.asy
Including plain_markers from /u/bowman/asymptote/base/plain_markers.asy
Including plain_arrows from /u/bowman/asymptote/base/plain_arrows.asy
Including plain_debugger from /u/bowman/asymptote/base/plain_debugger.asy
Loading common from /u/bowman/.asy/common.asy
Loading doc/Hobbycontrol from doc/Hobbycontrol.asy
latex \scrollmode
latex \nonstopmode\input Hobbycontrol_.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=latex)
restricted \write18 enabled.
entering extended mode
LaTeX2e <2018-04-01> patch level 5

(./Hobbycontrol_.tex
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/size12.clo))
(/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/ifluatex.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics-def/dvips.def)))
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/color.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics-cfg/color.cfg)
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/dvipsnam.def))
No file Hobbycontrol_.aux.
<Hobbycontrol_0.eps> [1] (./Hobbycontrol_.aux) )
Output written on Hobbycontrol_.dvi (1 page, 832 bytes).
Transcript written on Hobbycontrol_.log.
dvips -R -Pdownload35 -D600 -O-128.4bp,466.2bp -E -oHobbycontrol_.ps Hobbycontrol_.dvi
This is dvips(k) 5.998 Copyright 2018 Radical Eye Software (www.radicaleye.com)
' TeX output 2018.09.05:1746' -> Hobbycontrol_.ps
</usr/local/texlive/2018/texmf-dist/dvips/base/tex.pro>
</usr/local/texlive/2018/texmf-dist/dvips/base/texps.pro>
</usr/local/texlive/2018/texmf-dist/dvips/base/special.pro>
</usr/local/texlive/2018/texmf-dist/dvips/base/color.pro>.
</usr/local/texlive/2018/texmf-dist/fonts/type1/public/amsfonts/cm/cmr8.pfb>
</usr/local/texlive/2018/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi12.pfb>
[1<./Hobbycontrol_0.eps>]
/usr/local/src/ghostscript-9.24-linux-x86_64/gs-924-linux-x86_64 -q -dNOPAUSE -dBATCH -P -dSAFER -sDEVICE=pdfwrite -dEPSCrop -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100 -dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=150.377 -dDEVICEHEIGHTPOINTS=200 -sOutputFile=Hobbycontrol.pdf Hobbycontrol_.eps
Wrote Hobbycontrol.pdf
acroread Hobbycontrol.pdf

@johncbowman johncbowman closed this Sep 5, 2018
@mojca
Copy link
Contributor

@mojca mojca commented Sep 6, 2018

@l2dy: I was bitten by the same problem on MacPorts. Not saying it's asy's fault, but apparently there's a GS packaging issue which must have hit everyone.

@johncbowman
Copy link
Member

@johncbowman johncbowman commented Sep 6, 2018

To be fair, I didn't install gs-9.24 from source and only tested the binary.
Check to see if you have this file (in my test this file actually came from the gs-9.23 release):

/usr/share/ghostscript/iccprofiles/default_rgb.icc

@mojca
Copy link
Contributor

@mojca mojca commented Sep 6, 2018

I switched back to 9.23 and it works with that one for me as well. I checked the list of files and apart from some trivial differences there is no major difference between the list of files in the working and broken version, in particular the ICC profiles didn't change at all. I suspect there's some internal setting somewhere that prevents those files from being found by gs (the files are under /opt/local/share/ghostscript/9.24/iccprofiles/).

Anyway, I agree that this has probably nothing to do with asymptote.

@lemniscati
Copy link
Contributor

@lemniscati lemniscati commented Sep 6, 2018

Though I don't know why, the problem can be avoided by reverting the following hunk of a commit in ghostscript:

http://git.ghostscript.com/?p=ghostpdl.git;a=blobdiff;f=base/gsicc_manage.c;h=69f05c48cd20a68efb16635427f87bc368f9209e;hp=ca13366b802b13dc66c332615ae8e1bc65e09789;hb=d224b4abec1d0bd991028b7e38e95d47b7a834f4;hpb=78911a01b67d590b4a91afac2e8417360b934156

--- a/base/gsicc_manage.c
+++ b/base/gsicc_manage.c
@@ -1179,14 +1201,21 @@ gsicc_open_search(const char* pname, int namelen, gs_memory_t *mem_gc,
         if (buffer == NULL)
             return_error(gs_error_VMerror);
         strcpy(buffer, dirname);
+        buffer[dirlen] = '\0';
         strcat(buffer, pname);
         /* Just to make sure we were null terminated */
         buffer[namelen + dirlen] = '\0';
-        str = sfopen(buffer, "r", mem_gc);
-        gs_free_object(mem_gc, buffer, "gsicc_open_search");
-        if (str != NULL) {
-            *strp = str;
-            return 0;
+
+        if (gs_check_file_permission(mem_gc, buffer, strlen(buffer), "r") >= 0) {
+            str = sfopen(buffer, "r", mem_gc);
+            gs_free_object(mem_gc, buffer, "gsicc_open_search");
+            if (str != NULL) {
+                *strp = str;
+                return 0;
+            }
+        }
+        else {
+            gs_free_object(mem_gc, buffer, "gsicc_open_search");
         }
     }

And something wrong in ghostscript.

@spotrh
Copy link
Contributor Author

@spotrh spotrh commented Sep 6, 2018

@lemniscati
Copy link
Contributor

@lemniscati lemniscati commented Sep 6, 2018

Thank you, @spotrh !

@spotrh
Copy link
Contributor Author

@spotrh spotrh commented Sep 7, 2018

I can confirm that applying the fixes to ghostscript in these commits resolves the issue:

http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=c8c01f8c4164
http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=13418541a5ae

Thanks to everyone!

@michael-o
Copy link

@michael-o michael-o commented Oct 4, 2018

Folks, can someone explain for the stupid how I can fix this on Windows for TeXLive 2018 where these files are somehow part of asymptote?!

@michael-o
Copy link

@michael-o michael-o commented Oct 5, 2018

After a mail to the TeXLive mailing list the package has been updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants