Hello. I have found a gs bug, "/typecheck in --setfileposition--" when invoking preview-latex from emacs (as part of the "generate previews" functionality of the WYSIWYG emacs-mode latex editor auctex). gs crashes upon rendering a section of latex as an image. (emacs23 with auctex, latex from mactex, and mac 10.7)
i marked the problem as "major" because it is part of a pipeline (auctex), and its failure eliminates WYSIWYG, rendering the application that depends on it useless. Here is the full dump: gs -dOutputFile\=\(_region_.prv/tmp18542Aas/pr1-25.png\) -q -dSAFER -dNOPAUSE -DNOPLATFONTS -dPrinted -sDEVICE\=png16m -r110.557x110.613 GS>{DELAYSAFER{.setsafe}if}stopped pop/.preview-BP currentpagedevice/BeginPage get dup null eq{pop{pop}bind}if def<</BeginPage{currentpagedevice/PageSize get dup 0 get 1 ne exch 1 get 1 ne or{.preview-BP gsave 0.996109 0.996109 0.996109 setrgbcolor clippath fill grestore }{pop}ifelse}bind/PageSize[1 1]>>setpagedevice/preview-do{[count 3 roll save]3 1 roll dup length 0 eq{pop}{setpagedevice}{ifelse .runandhide}stopped{handleerror quit}if aload pop restore}bind def [(_region_.prv/tmp18542Aas/preview.ps)(r)file]aload exch dup 0 setfileposition 330211()/SubFileDecode filter cvx .runandhide aload pop dup dup 331101 setfileposition 253()/SubFileDecode filter cvx<<>>preview-do Error: /typecheck in --setfileposition-- Operand stack: --nostringval-- (_region_.prv/tmp18542Aas/preview.ps) (r) (r) (r) 364663 364663 364663 363713 363713 363713 363262 363262 363262 363146 363146 363146 363044 363044 363044 362942 362942 362942 362840 362840 362840 362733 362733 362733 362594 362594 362594 362473 362473 362473 362324 362324 362324 362170 362170 362170 361608 361608 361608 361454 361454 361454 361020 361020 361020 360881 360881 360881 360754 360754 360754 360600 360600 360600 360452 360452 360452 330211 330211 330211 352820 352820 352820 351318 351318 351318 350327 350327 350327 331101 Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- %loop_continue --nostringval-- --nostringval-- false 1 %stopped_push .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- Dictionary stack: --dict:1155/1684(ro)(G)-- --dict:0/20(G)-- --dict:79/200(L)-- Current allocation mode is local Current file position is 31 GS<75>
(In reply to comment #0) > Hello. I have found a gs bug, "/typecheck in --setfileposition--" when invoking > preview-latex from emacs (as part of the "generate previews" functionality of > the WYSIWYG emacs-mode latex editor auctex). gs crashes upon rendering a > section of latex as an image. > > (emacs23 with auctex, latex from mactex, and mac 10.7) In order to investigate this problem we need a specimen input file and a command line to feed to Ghostscript. You have supplied what looks like a GS command line, though there appears to be a GS> interactive prompt in there which is a little puzzling. Also the OutputFile is specified using -d when it should be -s. However we also need the PostScript or PDF file which was the input. We are not generally in a position to be able to use third party tools to reproduce problems, if you can't get a PostScript file then I woudl suggest that you report the problem to the auctex developers. You should also try the current version, 9.04, to see if the problem has already been resolved. Finally, it is entirely possible that this is a genuine error, and the problem lies in the PostScript which is being sent to Ghostscript, but without seeing the file, we can't tell.
I think, the problem is in the file preview.ps, which has left some junk on the stack. The logic of the program suggest that this file should not change the stack.
This file is using '.runandhide' -- a (rarely used) function I added to allow Ghostscript to be used as a server in a way that the "master" postscript could 'restore' to an unprotected state after running a job in 'SAFER' mode. Once we have all of the referenced .ps (and/or .pdf) files, if it looks like it only happens when .runandhide is used, I will have a look, or am available to discuss the concepts used with the assigned engineer if they are obtuse (i.e., poorly documented). If the program/procedure being executed by .runandhide leaves junk on the stack, then the 'restore' _could_ cause invalidrestore, but shouldn't cause (directly) a 'typecheck'.
Unfortunately, nothing can be done without a sample file. Feel free to re-open this bug report when you submit all the files necessary to reproduce the problem.