* Re: isatty bug
@ 2003-09-16 21:01 Brian Ford
2003-09-16 22:05 ` Christopher Faylor
0 siblings, 1 reply; 15+ messages in thread
From: Brian Ford @ 2003-09-16 21:01 UTC (permalink / raw)
To: cygwin
Sam Steingold wrote:
> it turned out that I needed to recompile the obj file that defined my
> same_tty_p() - of course. how silly of me! [now, I think I was told
> that everything was binary backwards compatible; I guess I was confused]
> now that I did it -- my scratch.c works just like your stest.c.
> good.
>
Executables (and DLLs) are binary backwards compatible. Static libs
and objects are not. The 64 bit translation happens at link time.
> (gdb) p fstat(fd1, &stat1)
> Segmentation fault (core dumped)
>
> now, why does GDB crash?
>
Maybe because gdb actually calls fstat instead of fstat64 since it doesn't
get the magic link time redirection? No idea really.
--
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
Phone: 314-551-8460
Fax: 314-551-8444
--
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/
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: isatty bug
@ 2003-09-16 19:34 Brian Ford
2003-09-16 20:28 ` Sam Steingold
0 siblings, 1 reply; 15+ messages in thread
From: Brian Ford @ 2003-09-16 19:34 UTC (permalink / raw)
To: cygwin
Was that stock Cygwin gdb that crashed?
Try this:
$ cat stest.c
#include <sys/types.h>
#include <sys/stat.h>
int same_tty_p (int fd1, int fd2)
{
struct stat stat1, stat2;
return (fstat(fd1, &stat1) >= 0 && fstat(fd2, &stat2) >= 0 &&
stat1.st_dev == stat2.st_dev && stat2.st_ino == stat2.st_ino);
}
int main(void)
{
printf("0/1: %d\n1/2: %d\n2/0: %d\n",same_tty_p(0,1),
same_tty_p(1,2),same_tty_p(2,0));
printf("stat %d bytes\n", sizeof(struct stat));
}
ford@fordpc ~
$ gcc -o stest stest.c
ford@fordpc ~
$ ./stest
0/1: 1
1/2: 1
2/0: 1
stat 96 bytes
$ nm stest.exe | grep fstat
00402970 T __fstat64
004060a4 I __imp___fstat64
004060e0 I __imp__fstat
004027a0 T _fstat
Make sure struct stat is 96 bytes and you are calling fstat64.
--
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
Phone: 314-551-8460
Fax: 314-551-8444
--
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/
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: isatty bug
2003-09-16 19:34 Brian Ford
@ 2003-09-16 20:28 ` Sam Steingold
0 siblings, 0 replies; 15+ messages in thread
From: Sam Steingold @ 2003-09-16 20:28 UTC (permalink / raw)
To: cygwin
> * Brian Ford <sbeq@iff.sfv.pbz> [2003-09-16 14:22:33 -0500]:
>
> Was that stock Cygwin gdb that crashed?
yes, gdb 20030901-1
> $ cat stest.c
> #include <sys/types.h>
> #include <sys/stat.h>
>
> int same_tty_p (int fd1, int fd2)
> {
> struct stat stat1, stat2;
>
> return (fstat(fd1, &stat1) >= 0 && fstat(fd2, &stat2) >= 0 &&
> stat1.st_dev == stat2.st_dev && stat2.st_ino == stat2.st_ino);
> }
>
> int main(void)
> {
> printf("0/1: %d\n1/2: %d\n2/0: %d\n",same_tty_p(0,1),
> same_tty_p(1,2),same_tty_p(2,0));
> printf("stat %d bytes\n", sizeof(struct stat));
> }
>
> ford@fordpc ~
> $ gcc -o stest stest.c
>
> ford@fordpc ~
> $ ./stest
> 0/1: 1
> 1/2: 1
> 2/0: 1
> stat 96 bytes
>
> $ nm stest.exe | grep fstat
> 00402970 T __fstat64
> 004060a4 I __imp___fstat64
> 004060e0 I __imp__fstat
> 004027a0 T _fstat
i get the exact same output (but read on!):
15:57:15 /cygdrive/d/sds/c [74]$ gcc -o stest stest.c
15:57:21 /cygdrive/d/sds/c [75]$ ./stest
0/1: 1
1/2: 1
2/0: 1
stat 96 bytes
15:57:27 /cygdrive/d/sds/c [76]$ nm stest.exe | grep fstat
00402970 T __fstat64
004060a4 I __imp___fstat64
004060e0 I __imp__fstat
004027a0 T _fstat
15:57:40 /cygdrive/d/sds/c [77]$ gcc -g -o stest stest.c
15:58:05 /cygdrive/d/sds/c [78]$ ./stest
0/1: 1
1/2: 1
2/0: 1
stat 96 bytes
15:58:07 /cygdrive/d/sds/c [79]$ nm stest.exe | grep fstat
00402970 T __fstat64
004060a4 I __imp___fstat64
004060e0 I __imp__fstat
004027a0 T _fstat
15:58:10 /cygdrive/d/sds/c [80]$ gdb stest
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
Starting program: /cygdrive/d/sds/c/stest.exe
0/1: 1
1/2: 1
2/0: 1
stat 96 bytes
Program exited with code 016.
(gdb) break main
Breakpoint 1 at 0x401138: file stest.c, line 17.
(gdb) run
Starting program: /cygdrive/d/sds/c/stest.exe
Breakpoint 1, main () at stest.c:17
17 printf("0/1: %d\n1/2: %d\n2/0: %d\n",same_tty_p(0,1),
(gdb) s
same_tty_p (fd1=0, fd2=1) at stest.c:11
11 return (fstat(fd1, &stat1) >= 0 && fstat(fd2, &stat2) >= 0 &&
(gdb) s
13 }
(gdb) p stat1
$1 = {st_dev = 65536, st_ino = 768719909725019470, st_mode = 8630,
st_nlink = 1, st_uid = 13044, st_gid = 10513, st_rdev = 65536, st_size = 0,
st_atim = {tv_sec = 1063742318, tv_nsec = 659000000}, st_mtim = {
tv_sec = 1063742318, tv_nsec = 659000000}, st_ctim = {
tv_sec = 1063742318, tv_nsec = 659000000}, st_blksize = 1024,
st_blocks = 0, st_spare4 = {0, 0}}
(gdb) p stat2
$2 = {st_dev = 65536, st_ino = 5383573127766058053, st_mode = 8630,
st_nlink = 1, st_uid = 13044, st_gid = 10513, st_rdev = 65536, st_size = 0,
st_atim = {tv_sec = 1063742318, tv_nsec = 699000000}, st_mtim = {
tv_sec = 1063742318, tv_nsec = 699000000}, st_ctim = {
tv_sec = 1063742318, tv_nsec = 699000000}, st_blksize = 1024,
st_blocks = 0, st_spare4 = {0, 0}}
(gdb) p fstat(fd1, &stat1)
Segmentation fault (core dumped)
it turned out that I needed to recompile the obj file that defined my
same_tty_p() - of course. how silly of me! [now, I think I was told
that everything was binary backwards compatible; I guess I was confused]
now that I did it -- my scratch.c works just like your stest.c.
good.
now, why does GDB crash?
--
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>
All extremists should be taken out and shot.
--
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/
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: isatty bug
@ 2003-09-16 19:01 Brian Ford
2003-09-16 19:02 ` Sam Steingold
0 siblings, 1 reply; 15+ messages in thread
From: Brian Ford @ 2003-09-16 19:01 UTC (permalink / raw)
To: cygwin
Sam Steingold wrote:
> I get crash both in program and gdb (i.e., gdb itself segfaults) on the
> fstat() calls.
>
Sounds like you have 1.3.22 headers and a 1.5.x Cygwin DLL and import lib?
--
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
Phone: 314-551-8460
Fax: 314-551-8444
--
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/
^ permalink raw reply [flat|nested] 15+ messages in thread
* isatty bug
@ 2003-09-15 21:19 Sam Steingold
2003-09-16 10:13 ` Corinna Vinschen
0 siblings, 1 reply; 15+ messages in thread
From: Sam Steingold @ 2003-09-15 21:19 UTC (permalink / raw)
To: cygwin
calling isatty(0) in a program results in a segfault:
Exception: STATUS_ACCESS_VIOLATION at eip=00000000
eax=00000000 ebx=00000004 ecx=610CEE30 edx=610CEE18 esi=004073B8 edi=0022FECC
ebp=00000400 esp=0022FE00 program=d:\sds\c\scratch.exe
cs=001B ds=0023 es=0023 fs=0038 gs=0000 ss=0023
Stack trace:
Frame Function Args
End of stack trace
calling isatty(0) in gdb results in a segfault too:
Exception: STATUS_ACCESS_VIOLATION at eip=610B7374
eax=00000010 ebx=00000010 ecx=00000004 edx=00000000 esi=D0105E51 edi=100F7240
ebp=0022F178 esp=0022F16C program=d:\gnu\cygwin\bin\gdb.exe
cs=001B ds=0023 es=0023 fs=0038 gs=0000 ss=0023
Stack trace:
Frame Function Args
0022F178 610B7374 (100F7240, D0105E51, 00000010, 000005EC)
0022F1A8 004A767A (100F7178, 00000020, D0105E51, 004C26D8)
0022F1C8 004A75C1 (00000020, D0105E51, 00000000, 00000000)
0022F1E8 004B6175 (00000020, 00000000, 00000000, 000005EC)
0022F218 004A5B8D (100F7178, 00000020, 0022F270, 10292E34)
0022F238 004A5085 (100F7178, 00000020, 0022F270, 0042EF07)
0022F298 004A4F14 (102CB4A8, 004A5050, 100F7178, 0042EF59)
0022F2B8 004A51C5 (102CB4A8, 100F7178, 0022F2E8, 0042DDC0)
0022F2E8 004A5403 (100F7178, FFFFFFE2, 0022F3A8, 004D1F07)
0022F2F8 0049B0A5 (00000001, 61602144, 0022F330, 00A00088)
0022F3A8 004D1F07 (101DBAE8, 00000001, 0022F3DC, 00446EB4)
0022F648 0044712F (00000000, 102AE3D8, 0022F684, 00000000)
0022F668 004443F6 (00000000, 102AE3D8, 0022F684, 00000000)
0022F688 0044461F (102AE3D8, 0022F6B8, 00000000, 00000000)
0022F6C8 0047D269 (100C050A, 00000000, 00000001, 00000001)
0022F6E8 0047D2E1 (100C050A, 00000001, 0022F718, 00407A8C)
End of stack trace (more stack frames may be present)
--
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>
If brute force does not work, you are not using enough.
--
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/
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: isatty bug
2003-09-15 21:19 Sam Steingold
@ 2003-09-16 10:13 ` Corinna Vinschen
2003-09-16 15:01 ` Sam Steingold
0 siblings, 1 reply; 15+ messages in thread
From: Corinna Vinschen @ 2003-09-16 10:13 UTC (permalink / raw)
To: cygwin
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 ...
Fd 0 is a tty, a console window, a tape drive, a ...
Reproducible testcase is ...
http://cygwin.com/problems.html
I've tested with 1.5.[234] and current CVS, with fd 0 being a tty and a
console window. No segv.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Developer mailto:cygwin@cygwin.com
Red Hat, Inc.
--
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/
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: isatty bug
2003-09-16 10:13 ` Corinna Vinschen
@ 2003-09-16 15:01 ` Sam Steingold
2003-09-16 17:22 ` Christopher Faylor
0 siblings, 1 reply; 15+ messages in thread
From: Sam Steingold @ 2003-09-16 15:01 UTC (permalink / raw)
To: cygwin
>* Corinna Vinschen <pbevaan-pltjva@pltjva.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/
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: isatty bug
2003-09-16 15:01 ` Sam Steingold
@ 2003-09-16 17:22 ` Christopher Faylor
2003-09-16 17:30 ` Sam Steingold
0 siblings, 1 reply; 15+ messages in thread
From: Christopher Faylor @ 2003-09-16 17:22 UTC (permalink / raw)
To: cygwin
On Tue, Sep 16, 2003 at 10:42:49AM -0400, Sam Steingold wrote:
>>* Corinna Vinschen <pbevaan-pltjva@pltjva.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 ----
Fixing the obvious typo in the above provides the desired results both
inside gdb and outside gdb. With CYGWIN=tty and with CYGWIN=notty.
So, I can't duplicate this problem.
cgf
--
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/
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: isatty bug
2003-09-16 17:22 ` Christopher Faylor
@ 2003-09-16 17:30 ` Sam Steingold
2003-09-16 17:37 ` Igor Pechtchanski
0 siblings, 1 reply; 15+ messages in thread
From: Sam Steingold @ 2003-09-16 17:30 UTC (permalink / raw)
To: cygwin
> * Christopher Faylor <pts-epz@pltjva.pbz> [2003-09-16 13:19:51 -0400]:
>
> On Tue, Sep 16, 2003 at 10:42:49AM -0400, Sam Steingold wrote:
> >>* Corinna Vinschen <pbevaan-pltjva@pltjva.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 ----
>
> Fixing the obvious typo in the above provides the desired results both
> inside gdb and outside gdb. With CYGWIN=tty and with CYGWIN=notty.
what is the "obvious typo"?
--
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>
((lambda (x) `(,x ',x)) '(lambda (x) `(,x ',x)))
--
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/
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: isatty bug
2003-09-16 17:30 ` Sam Steingold
@ 2003-09-16 17:37 ` Igor Pechtchanski
2003-09-16 18:23 ` Sam Steingold
0 siblings, 1 reply; 15+ messages in thread
From: Igor Pechtchanski @ 2003-09-16 17:37 UTC (permalink / raw)
To: Sam Steingold; +Cc: cygwin
On Tue, 16 Sep 2003, Sam Steingold wrote:
> > * Christopher Faylor <pts-epz@pltjva.pbz> [2003-09-16 13:19:51 -0400]:
> >
> > On Tue, Sep 16, 2003 at 10:42:49AM -0400, Sam Steingold wrote:
> > >>* Corinna Vinschen <pbevaan-pltjva@pltjva.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 ----
> >
> > Fixing the obvious typo in the above provides the desired results both
> > inside gdb and outside gdb. With CYGWIN=tty and with CYGWIN=notty.
>
> what is the "obvious typo"?
Aw, come on, try to at least *compile* the code you posted, will ya? ;-)
Igor
--
http://cs.nyu.edu/~pechtcha/
|\ _,,,---,,_ pechtcha@cs.nyu.edu
ZZZzz /,`.-'`' -. ;-;;,_ igor@watson.ibm.com
|,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D.
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster." -- Patrick Naughton
--
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/
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: isatty bug
2003-09-16 17:37 ` Igor Pechtchanski
@ 2003-09-16 18:23 ` Sam Steingold
2003-09-16 18:36 ` Igor Pechtchanski
2003-09-16 19:37 ` Christopher Faylor
0 siblings, 2 replies; 15+ messages in thread
From: Sam Steingold @ 2003-09-16 18:23 UTC (permalink / raw)
To: cygwin
> * Igor Pechtchanski <crpugpun@pf.alh.rqh> [2003-09-16 13:36:30 -0400]:
>
> > > >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;
> > > >}
> > >
> > > Fixing the obvious typo in the above provides the desired results both
> > > inside gdb and outside gdb. With CYGWIN=tty and with CYGWIN=notty.
> >
> > what is the "obvious typo"?
>
> Aw, come on, try to at least *compile* the code you posted, will ya? ;-)
looks like my cut-and-paste is not as good as it was ... :-)
OK.
what about this:
int same_tty_p (int fd1, int fd2)
{
struct stat stat1;
struct stat stat2;
return ((fstat(fd1,&stat1) >= 0) && (fstat(fd2,&stat2) >= 0) &&
(stat1.st_dev == stat2.st_dev) && (stat2.st_ino == stat2.st_ino));
}
printf("0/1: %d\n1/2: %d\n2/0: %d\n",same_tty_p(0,1),
same_tty_p(1,2),same_tty_p(2,0));
I get crash both in program and gdb (i.e., gdb itself segfaults) on the
fstat() calls.
ps. I am missing "man fstat" - what package do I need for that?
--
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>
The only time you have too much fuel is when you're on fire.
--
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/
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: isatty bug
2003-09-16 18:23 ` Sam Steingold
@ 2003-09-16 18:36 ` Igor Pechtchanski
2003-09-16 19:37 ` Christopher Faylor
1 sibling, 0 replies; 15+ messages in thread
From: Igor Pechtchanski @ 2003-09-16 18:36 UTC (permalink / raw)
To: Sam Steingold; +Cc: cygwin
On Tue, 16 Sep 2003, Sam Steingold wrote:
> [snip]
> ps. I am missing "man fstat" - what package do I need for that?
I don't believe system call manpages are contained in any package (a
search on <http://cygwin.com/packages/> for "man2/" returns nothing).
Feel free to submit one.
Igor
--
http://cs.nyu.edu/~pechtcha/
|\ _,,,---,,_ pechtcha@cs.nyu.edu
ZZZzz /,`.-'`' -. ;-;;,_ igor@watson.ibm.com
|,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D.
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster." -- Patrick Naughton
--
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/
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: isatty bug
2003-09-16 18:23 ` Sam Steingold
2003-09-16 18:36 ` Igor Pechtchanski
@ 2003-09-16 19:37 ` Christopher Faylor
1 sibling, 0 replies; 15+ messages in thread
From: Christopher Faylor @ 2003-09-16 19:37 UTC (permalink / raw)
To: cygwin
On Tue, Sep 16, 2003 at 02:16:05PM -0400, Sam Steingold wrote:
>what about this:
>
>int same_tty_p (int fd1, int fd2)
>{
> struct stat stat1;
> struct stat stat2;
> return ((fstat(fd1,&stat1) >= 0) && (fstat(fd2,&stat2) >= 0) &&
> (stat1.st_dev == stat2.st_dev) && (stat2.st_ino == stat2.st_ino));
>}
>
>
> printf("0/1: %d\n1/2: %d\n2/0: %d\n",same_tty_p(0,1),
> same_tty_p(1,2),same_tty_p(2,0));
>
>
>I get crash both in program and gdb (i.e., gdb itself segfaults) on the
>fstat() calls.
Is it really that hard to produce working test cases that compile out of
the box?
Anyway, after adding a main and some include files the above, unsurprisingly,
works fine.
cgf
--
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/
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2003-09-16 22:00 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-16 21:01 isatty bug Brian Ford
2003-09-16 22:05 ` Christopher Faylor
-- strict thread matches above, loose matches on Subject: below --
2003-09-16 19:34 Brian Ford
2003-09-16 20:28 ` Sam Steingold
2003-09-16 19:01 Brian Ford
2003-09-16 19:02 ` Sam Steingold
2003-09-15 21:19 Sam Steingold
2003-09-16 10:13 ` Corinna Vinschen
2003-09-16 15:01 ` Sam Steingold
2003-09-16 17:22 ` Christopher Faylor
2003-09-16 17:30 ` Sam Steingold
2003-09-16 17:37 ` Igor Pechtchanski
2003-09-16 18:23 ` Sam Steingold
2003-09-16 18:36 ` Igor Pechtchanski
2003-09-16 19:37 ` Christopher Faylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).