delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/09/16/10:43:12

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Injected-Via-Gmane: http://gmane.org/
To: cygwin AT cygwin DOT com
From: Sam Steingold <sds AT gnu DOT org>
Subject: Re: isatty bug
Date: 16 Sep 2003 10:42:49 -0400
Organization: disorganization
Lines: 55
Message-ID: <uwuc8x09i.fsf@gnu.org>
References: <usmmxyckr DOT fsf AT gnu DOT org> <20030916100108 DOT GO9981 AT cygbert DOT vinschen DOT de>
Reply-To: sds AT gnu DOT org
Mime-Version: 1.0
X-Complaints-To: usenet AT sea DOT gmane DOT org
X-Attribution: Sam
X-Disclaimer: You should not expect anyone to agree with me.
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

>* Corinna Vinschen <pbevaan-pltjva AT pltjva DOT pbz> [2003-09-16 12:01:08 +0200]:
>
> On Mon, Sep 15, 2003 at 05:19:16PM -0400, Sam Steingold wrote:
> > calling isatty(0) in a program results in a segfault:
> And the version number of the DLL is ...

1.5.4(0.94/3/2)

> Fd 0 is a tty, a console window, a tape drive, a ...

I am doing this in a windows console, as created by clicking on the
cygwin icon, i.e., in the bash shell.
I assume that 0 means stdin.

> Reproducible testcase is ...

------- scratch.c ----
#include <stdio.h>
int main (void) {
#define Y_N(x)  ((x) ? "(TTY)" : "(not a TTY)")
  printf("0: %s %s\n1: %s %s\n2: %s %s\n",
         ttyname(0),Y_N(isatty(0)),ttyname(1),Y_N(isatty(1)),
         ttyname(2),Y_N(isatty(2)))
#undef Y_N
  return 0;
}
------- scratch.c ----


$ gdb scratch
GNU gdb 2003-09-02-cvs (cygwin-special)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"...
(gdb) run tty
Starting program: /cygdrive/d/sds/c/scratch.exe tty

Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? () from
(gdb) where
#0  0x00000000 in ?? () from
(gdb) p isatty(1)
Segmentation fault (core dumped)
$

same for ttyname(0) &c.

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
Between grand theft and a legal fee, there only stands a law degree.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019