From: Mike Moya
Subject: Sun Common Lisp 4.0 weird problem
Date: 
Message-ID: <1991Oct25.162532.21930@noose.ecn.purdue.edu>
It involves using the dribble function, *standard-io* and *debug-io*. Take a
look at the following:

let say we have file called grader, it basically loads in the function 
"simplify" and starts a dribble file to record the output:
(load "ans1.lisp")
(dribble ".dribble570")
;;;
;;;  test cases
;;; 
(simplify '(*) )
:a

(simplify '(+) )
:a

;error condition
(simplify 'A )
:a

(simplify '(4) )
:a

(simplify '(5) )
:a


Now, let say I run the test cases with SCL ineractively, the following 
is a recording of me doing so:
Script started on Fri Oct 25 11:11:48 1991
orchestra:/home/orchestra/moyman/scl[1]/usr/lisp/scl
;;; Sun Common Lisp, Development Environment 4.0.1, 6 July 1990
;;; Sun-4 Version for SunOS 4.0.x and sunOS 4.1 
;;;
;;; Copyright (c) 1985, 1986, 1987, 1988, 1989, 1990
;;;            by Sun Microsystems, Inc.,  All Rights Reserved
;;; Copyright (c) 1985, 1986, 1987, 1988, 1989, 1990
;;;            by Lucid, Inc., All Rights Reserved
;;; This software product contains confidential and trade secret
;;; information belonging to Sun Microsystems, Inc.  It may not be copied
;;; for any reason other than for archival and backup purposes.
;;;
;;; Sun, Sun-4, and Sun Common Lisp are trademarks of Sun Microsystems Inc.

> (load "ans1.lisp")
;;; Loading source file "ans1.lisp"
;;; Warning: File "ans1.lisp" does not begin with IN-PACKAGE.  Loading into package "USER"
#P"/home/orchestra/moyman/scl/ans1.lisp"
> (dribble "tmp.out")
;;; Dribble file "tmp.out" started
T
> (simplify '(*) )
(* 1)
> :a
:A
> (simplify '(+) )
(+ 0)
> :a
:A
> (simplify 'A )
>>Error: The value of X, A, should be a LIST

CAR:
   Required arg 0 (X): A
:C  0: Use a new value
:A  1: Abort to Lisp Top Level

-> :a
Abort to Lisp Top Level
Back to Lisp Top Level

> (simplify '(4) )
NIL

:A
> (simplify '(5) )
NIL
> :a
:A
> (quit)
;;; Dribble file "tmp.out" finished
orchestra:/home/orchestra/moyman/scl[2]more tmp.out
;;; Dribble file "tmp.out" started
T
> (simplify '(*) )
(* 1)
> :a
:A
> (simplify '(+) )
(+ 0)
> :a
:A
> (simplify 'A )
>>Error: The value of X, A, should be a LIST

CAR:
   Required arg 0 (X): A
:C  0: Use a new value
:A  1: Abort to Lisp Top Level

-> :a
Abort to Lisp Top Level
Back to Lisp Top Level

> (simplify '(4) )
NIL
> :a
:A
> (simplify '(5) )
NIL
> :a
:A
> (quit)
;;; Dribble file "tmp.out" finished
orchestra:/home/orchestra/moyman/scl[3]^D
script done on Fri Oct 25 11:13:28 1991


Hey, no problemo! Now let's try that again only doing it via command line:

Script started on Fri Oct 25 11:17:11 1991
orchestra:/home/orchestra/moyman/scl[1]/usr/lisp/scl < grader1
;;; Sun Common Lisp, Development Environment 4.0.1, 6 July 1990
;;; Sun-4 Version for SunOS 4.0.x and sunOS 4.1 
;;;
;;; Copyright (c) 1985, 1986, 1987, 1988, 1989, 1990
;;;            by Sun Microsystems, Inc.,  All Rights Reserved
;;; Copyright (c) 1985, 1986, 1987, 1988, 1989, 1990
;;;            by Lucid, Inc., All Rights Reserved
;;; This software product contains confidential and trade secret
;;; information belonging to Sun Microsystems, Inc.  It may not be copied
;;; for any reason other than for archival and backup purposes.
;;;
;;; Sun, Sun-4, and Sun Common Lisp are trademarks of Sun Microsystems Inc.

> ;;; Loading source file "ans1.lisp"
;;; Warning: File "ans1.lisp" does not begin with IN-PACKAGE.  Loading into package "USER"
#P"/home/orchestra/moyman/scl/ans1.lisp"
> ;;; Dribble file ".dribble570" started
T
> (* 1)

> (+ 0)
> :A
> 
Clearing input from *debug-io*
>>Error: The value of X, A, should be a LIST

CAR:
   Required arg 0 (X): A
:C  0: Use a new value
:A  1: Abort to Lisp Top Level

-> 
End of File read by debugger -- quitting Lisp
orchestra:/home/orchestra/moyman/scl[2]^D
script done on Fri Oct 25 11:17:34 1991


Wowwwwww!!! If yiou look in the dribble file it's totally empty!! So, a 
couple of things happend here that aren't (in my opinion) correct. 

1) Lisp quit after the error condition (detected EOF???)
2) The dribble file was emptied

Why? My own suspicions are that somehow *standard-io* is being redirected
to *debug-io*, which in the script you can see gets cleared (why I don't 
know) when the error condition occurs, which as result also clears the input
stream, which means the rest of the file does not get read. Now why the 
dribble file also gets cleared I'm not sure, unless *standard-out* get 
cleared as well (I'm groping)...

This works fine with kcl (If that's worth anything) and it didn't work with 
an older version of allegro Common Lisp (don't know about the new stuff 
however...

Any ideas?
-moya


Mike Moya
Macintosh Systems and Networking
Engineering Computer Network
Purdue University
From: Barry Margolin
Subject: Re: Sun Common Lisp 4.0 weird problem
Date: 
Message-ID: <kh9u0cINN5d3@early-bird.think.com>
In article <······················@noose.ecn.purdue.edu> ······@ecn.purdue.edu (Mike Moya) writes:
>It involves using the dribble function, *standard-io* and *debug-io*. Take a
>look at the following:

[transcripts deleted]

>Wowwwwww!!! If yiou look in the dribble file it's totally empty!! So, a 
>couple of things happend here that aren't (in my opinion) correct. 
>
>1) Lisp quit after the error condition (detected EOF???)
>2) The dribble file was emptied
>
>Why? My own suspicions are that somehow *standard-io* is being redirected
>to *debug-io*, which in the script you can see gets cleared (why I don't 
>know) when the error condition occurs, which as result also clears the input
>stream, which means the rest of the file does not get read. 

By default, *standard-input* (there's no such thing as *standard-io*) and
*debug-io* are set to synonym streams to *terminal-io*.  Operations on all
three are equivalent.

I believe Lucid CL clears *debug-io* in this case because errors are
presumably unexpected, and buffered input is likely not prepared to deal
with the situation.  The buffered input is presumably intended for the
top-level read-eval-print loop or for input functions in the program that
is being run, not for the debugger.

For instance, suppose you type:

(read *standard-niput*) :a

Had you spelled "input" correctly, this would return the symbol :A.  But
since you misspelled it, you'll go into the debugger.  If the buffered
input were then read, the :a would be interpreted as the debugger's abort
command.

>							     Now why the 
>dribble file also gets cleared I'm not sure, unless *standard-out* get 
>cleared as well (I'm groping)...

I think the problem is that the file was never closed properly due to the
abnormal termination of Lisp -- it never executed (dribble).  I think it
would be reasonable to complain to Lucid about this.
-- 
Barry Margolin, Thinking Machines Corp.

······@think.com
{uunet,harvard}!think!barmar