From sce!mitel!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!hplabs!hplabsz!mayer Thu Jun 22 07:40:45 EDT 1989
Article: 118 of comp.lang.lisp.x
Path: cognos!sce!mitel!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!hplabs!hplabsz!mayer
From: mayer@hplabsz.HPL.HP.COM (Niels Mayer)
Newsgroups: comp.lang.lisp.x
Subject: Re: XLISP 2.0 -- bug in stream implementation // XLISP internals Docs?
Message-ID: <3478@hplabsz.HPL.HP.COM>
Date: 14 Jun 89 05:10:28 GMT
References: <3468@hplabsz.HPL.HP.COM>
Reply-To: mayer@hplabs.hp.com (Niels Mayer)
Organization: Hewlett-Packard Labs, Software Technology Lab, Palo Alto, CA.
Lines: 41
Summary:
Expires:
Sender:
Followup-To:

In article <3468@hplabsz.HPL.HP.COM> mayer@hplabs.hp.com (Niels Mayer) writes:
>It looks like garbage collection is trashing a pointer somewhere when using
>make-string-input-stream running read-char on that stream. After doing a
>bunch of read-chars on that stream, I get an "error: bad stream" message.
>This happens more often right after you start up xlisp, and less frequently
>upon subsequent garbage collections.

Someone inside HP kindly mailed me an archive of the last year of
comp.lang.lisp.x, and inside that archive, I found the following fix:

     Note 58       two bugs with unnamed streams in xlisp 2.0
     nikkie@dutesta.UUCP (Paul A.W. van Niekerk)   7:13 am  Dec 16, 1988
     
     I discovered two bugs in my copy of xlisp 2.0 concerning unnamed streams.
     The bugs + fixes follow.
     
     1. Unnamed streams never survive a garbage collection.
        Fix: in xldmem.c change in function mark the line:
           if ((type = ntype(this)) == CONS) {
        to
           if ((type = ntype(this)) == CONS || type == USTREAM) {
     
     2. (format nil ...) does not protect the unnamed stream it creates, it will
        vanish during a GC.
        Fix: in xlfio.c add to function xformat the lines:
           xlsave1(val);
           ...
           xlpop();
     
     Now USTREAMS seem to work fine.
     Paul van Niekerk.
     --
     Paul A.W. van Niekerk                 |  All standard
     Delft University of Technology        |  disclaimers apply ...

-------------------------------------------------------------------------------
	    Niels Mayer -- hplabs!mayer -- mayer@hplabs.hp.com
		  Human-Computer Interaction Department
		       Hewlett-Packard Laboratories
			      Palo Alto, CA.
				   *


From sce!mitel!uunet!cs.utexas.edu!csd4.milw.wisc.edu!dogie.macc.wisc.edu!indri!nero!blake!uw-beaver!tektronix!tekcrl!tekgvs!toma Thu Jun 22 07:41:11 EDT 1989
Article: 119 of comp.lang.lisp.x
Path: cognos!sce!mitel!uunet!cs.utexas.edu!csd4.milw.wisc.edu!dogie.macc.wisc.edu!indri!nero!blake!uw-beaver!tektronix!tekcrl!tekgvs!toma
From: toma@tekgvs.LABS.TEK.COM (Tom Almy)
Newsgroups: comp.lang.lisp.x
Subject: Re: XLISP 2.0 -- bug in stream implementation // XLISP internals Docs?
Message-ID: <5353@tekgvs.LABS.TEK.COM>
Date: 14 Jun 89 14:41:38 GMT
References: <3468@hplabsz.HPL.HP.COM>
Reply-To: toma@tekgvs.LABS.TEK.COM (Tom Almy)
Organization: Tektronix, Inc., Beaverton,  OR.
Lines: 39

In article <3468@hplabsz.HPL.HP.COM> mayer@hplabs.hp.com (Niels Mayer) writes:
>It looks like garbage collection is trashing a pointer somewhere when using
>make-string-input-stream running read-char on that stream. A[...]

>I'm going to try to track this down in the code, but I thought I'd tap your
>collective wisdoms on this problem. Maybe someone's already fixed it?  [...]

Yes the fix has been posted.  An abridged copy is appended to this posting.

Tom Almy
toma@tekgvs.labs.tek.com
Standard Disclaimers Apply

----------------------- OLD POSTING FOLLOWS --------------------------

From: nikkie@dutesta.UUCP (Paul A.W. van Niekerk)
Newsgroups: comp.lang.lisp.x
Subject: two bugs with unnamed streams in xlisp 2.0
Date: 16 Dec 88 15:13:26 GMT
Organization: DELFT UNIVERSITY OF TECHNOLOGY
              Faculty of Electrical Engineering
              Computer architecture and Digital Technique
              Mekelweg 4   -   2628 CD  Delft

I discovered two bugs in my copy of xlisp 2.0 concerning unnamed streams.
The bugs + fixes follow.

1. Unnamed streams never survive a garbage collection. 
   Fix: in xldmem.c change in function mark the line:
	if ((type = ntype(this)) == CONS) {
   to
	if ((type = ntype(this)) == CONS || type == USTREAM) {

2. (format nil ...) does not protect the unnamed stream it creates, it will
   vanish during a GC.
   Fix: in xlfio.c add to function xformat the lines:
	xlsave1(val);
	...
	xlpop();

NOTES: xlsave1(val) is being passed an uninitialized value! where do the 
       above xlsave1/xlpop go? pop before return? 
