🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.ghostscript.bug
Article #183

possible bug in gs

#183
From: Diab Jerius
Date: Tue, 04 Aug 1992 17:39
113 lines
2946 bytes
i've run into some bizarre behavior trying to use bb.ps (the bounding box
program) with output from sm (a plotting package).  i've reduced the
postscript code to the point where it's non-intelligible (as far as the
original intent goes) but still produces the behavior.

versions: gs 2.4.1(gcc-2.1), gs 2.3(gcc???)
system: Sun IPC, SunOS4.1.1

input file:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50 dict /$BoundingBox exch def

$BoundingBox begin
/-stroke /stroke load def
end % $BoundingBox

/stroke {
    $BoundingBox begin
    gsave
    initmatrix
    {
        strokepath
        flattenpath
    } stopped { 
        grestore
        gsave
    } if
    includepath 
    grestore
    -stroke
    end % $BoundingBox
} def

$BoundingBox begin

/includepath {
    gsave
    { flattenpath } stopped { grestore gsave } if
    { pathbbox } stopped not { pop pop pop pop } if
    grestore
} def

end % $BoundingBox

/CS { currentpoint stroke } def
errordict /nocurrentpoint { pop 0 0 moveto currentpoint } put
CS moveto
CS moveto 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

upon running this through gs, i get the following error:

pelf% gsnd goo.ps
Error: /stackunderflow in --moveto--
Operand stack:
  
Execution stack:
    %interp_exit    --nostringval--  --nostringval--  false  --nostringval--  --nostringval--  false  --nostringval--  --nostringval--  --nostringval--
Dictionary stack:
    433/449  9/200
GS>

if i add the command `pstack' after the `pathbbox' command in 
includepath, i.e.

    { pathbbox pstack } stopped not { pop pop pop pop } if

i get the following output:

pelf% gsnd goo.ps
-0
0
-0
0
-0
0
-0
0
-0
0
-0
0
-0
0
-0
0
-0
0
-0
0
-0
0
GS<6>


what i don't understand is:

  - why did gs blow up on the program?  i can't find anything wrong with it.
    for some reason pathbbox is swallowing up two stack entries.

  - why should pstack have any effect?  i thought pstack was essentially
    a diagnostic command with no effect on anything?


i'd appreciate help on this.  i believe it's a ghostscript problem, and
not a postscript misunderstanding, but my knowledge of postscript isn't
all that great.

diab jerius
-- 
diab jerius                                     harvard-smithsonian 
internet: jerius@cfa.harvard.edu              center for astrophysics  
voice: (617) 496-7575               60 garden st., m/s 81 cambridge, ma 02138 
Technical Details
Message-ID: <1992Aug4.173917.27233@cfa.harvard.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cfa.harvard.edu!dj

Show Full Headers
Complete Article Headers
Newsgroups: gnu.ghostscript.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cfa.harvard.edu!dj
From: dj@cfa.harvard.edu (Diab Jerius)
Subject: possible bug in gs
Message-ID: <1992Aug4.173917.27233@cfa.harvard.edu>
Sender: gnulists@ai.mit.edu
Organization: Smithsonian Astrophysical Observatory, Cambridge, MA,  USA
Distribution: gnu
Date: Tue, 4 Aug 1992 17:39:17 GMT
Approved: bug-ghostscript@prep.ai.mit.edu
Lines: 114