Article View: gnu.ghostscript.bug
Article #47bugfix for infinite loop in interp (version 1.3)
From: Snoopy
Date: Wed, 28 Jun 1989 22:15
Date: Wed, 28 Jun 1989 22:15
52 lines
2230 bytes
2230 bytes
Ghostscript 1.3 goes into an infinite loop if you specify a filename
on the command line that does not exist (e.g. you make a typo).
There are a couple of ways (at least) to fix this. Way number one is to
add e_undefinedfilename to the list of errors that the interpreter doesn't
attempt to retry. This gets you the "Interp returns -22" message, along
with stack dumps. Not pretty, but much better than an infinite loop.
(I believe this is what version 1.2 did.) You could add a printf to the
file_open() function in zfile.c telling what filename couldn't be opened.
(I have mine exit if it is using a hardcopy device.)
Another way, which doesn't require hacking the source and recompiling,
is to modify the definition of the 'run' function in ghost.ps:
change
{(r) file} % let the error happen
to
{(\nfile \007) print print ( not found\n\n) print flush} % warn user
Here is the diff for interp.c:
RCS file: RCS/interp.c,v
Retrieving revision 1.2
diff -c -r1.2 interp.c
*** /tmp/,RCSt1004558 Wed Jun 28 14:53:12 1989
--- interp.c Wed Jun 28 14:31:51 1989
***************
*** 150,155
case e_dictstackoverflow:
case e_execstackoverflow:
case e_stackoverflow:
case e_VMerror:
return code;
}
--- 150,156 -----
case e_dictstackoverflow:
case e_execstackoverflow:
case e_stackoverflow:
+ case e_undefinedfilename: /* avoid infinite loop -Snoopy */
case e_VMerror:
return code;
}
_____ .-----.
/_____\ Snoopy ./ RIP \.
/_______\ qiclab!sopwith!snoopy | |
|___| parsely!sopwith!snoopy | tekecs |
|___| sun!nosun!illian!sopwith!snoopy |_________|
"I *was* the next man!" -Indy
Technical Details
Message-ID:
<229@sopwith.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!usc!cs.utexas.edu!uunet!zephyr!tektronix!psueea!qiclab!sopwith!snoopyShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!usc!cs.utexas.edu!uunet!zephyr!tektronix!psueea!qiclab!sopwith!snoopy From: snoopy@sopwith.UUCP (Snoopy) Newsgroups: gnu.ghostscript.bug Subject: bugfix for infinite loop in interp (version 1.3) Keywords: bugfix Ghostscript 1.3 undefined_filename Message-ID: <229@sopwith.UUCP> Date: 28 Jun 89 22:15:18 GMT Reply-To: snoopy@sopwith.UUCP (Snoopy) Distribution: gnu Organization: The Daisy Hill Puppy Farm Lines: 52