windows: (interactive-stream-p *standard-input*) crashes

Bug #498508 reported by andrejv on 2009-12-19
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

I get an error for (interactive-stream-p *standard-input*) in Command Prompt on Windows Vista.

Microsoft Windows [Version 6.0.6001]
Copyright (c) 2006 Microsoft Corporation. All rights reserved.

This is SBCL 1.0.29, an implementation of ANSI Common Lisp.
More information about SBCL is available at <>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.

This is experimental prerelease support for the Windows platform: use
at your own risk. "Your Kitten of Death awaits!"
* (interactive-stream-p *standard-input*)

debugger invoked on a TYPE-ERROR: The value 64 is not of type BIT.

Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

 #<SB-SYS:FD-STREAM for "standard input" {23B57679}>
 #<unused argument>)
0] (quit)

Also reproduced with SBCL on WinXP.

POSIX says that isatty(3) returns 1 if the fd is a tty and 0 otherwise, while MSDN says "nonzero" if the fd is a tty (whether "tty"ness corresponds to being attached to a console handle is another matter). The fd-stream-misc-routine is very obviously using (= 1 (the (member 0 1) (isatty ...))). Perhaps this should be (not (zerop (the integer (isatty ...))))?

Calling interactive-stream-p on a stream for a file on disk works as expected.

tags: added: os-windows streams
Changed in sbcl:
status: New → Confirmed
Changed in sbcl:
importance: Undecided → Medium
Changed in sbcl:
status: Confirmed → In Progress
assignee: nobody → Roman Marynchak (roman-marynchak)

This is already fixed in Anton's fork (I have just checked), so let us wait until it is merged and do not do the same thing twice.

Changed in sbcl:
status: In Progress → Confirmed
assignee: Roman Marynchak (roman-marynchak) → nobody
Stas Boukarev (stassats) wrote :

Probably fixed by this commit:

commit 784b5e283b15eb146670a9b3a2017dea0553ecc7
Author: David Lichteblau <email address hidden>
Date: Thu Oct 25 14:49:08 2012 +0200

    Do not assert that the integer returned by UNIX-ISATTY is a BIT

Changed in sbcl:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers