From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28748 invoked by alias); 4 Dec 2007 23:50:06 -0000 Received: (qmail 28736 invoked by uid 22791); 4 Dec 2007 23:50:05 -0000 X-Spam-Check-By: sourceware.org Received: from ug-out-1314.google.com (HELO ug-out-1314.google.com) (66.249.92.172) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 04 Dec 2007 23:49:56 +0000 Received: by ug-out-1314.google.com with SMTP id h2so472121ugf for ; Tue, 04 Dec 2007 15:49:52 -0800 (PST) Received: by 10.86.51.2 with SMTP id y2mr7117660fgy.1196812192390; Tue, 04 Dec 2007 15:49:52 -0800 (PST) Received: from ?62.169.93.250? ( [62.169.93.250]) by mx.google.com with ESMTPS id 34sm429165nfu.2007.12.04.15.49.50 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 04 Dec 2007 15:49:51 -0800 (PST) Message-ID: <4755E78F.7000301@portugalmail.pt> Date: Tue, 04 Dec 2007 23:50:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.13pre) Gecko/20071023 Thunderbird/1.5.0.14pre Mnenhy/0.7.5.0 MIME-Version: 1.0 To: Pierre Muller CC: gdb-patches@sourceware.org Subject: Re: [RFC] gdb/testsuite/gdb.base/fileio.exp patch for cygwin References: <000101c83593$89c0fcd0$9d42f670$@u-strasbg.fr> In-Reply-To: <000101c83593$89c0fcd0$9d42f670$@u-strasbg.fr> Content-Type: multipart/mixed; boundary="------------060400070008010904040701" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-12/txt/msg00068.txt.bz2 This is a multi-part message in MIME format. --------------060400070008010904040701 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 2886 Pierre Muller wrote: > I tried to expose some cygwin testsuite problems > related to the fact that dejagnu does not seem > to be able to fool the cygwin system, to > get it to believe that the output is not redirected. > > http://sourceware.org/ml/gdb/2007-11/msg00273.html > > The main effect is that, Cygwin knowing that > the output is redirected to a non-tty, it will start > to use file buffering that will interact badly > with the expectation of the gdb testsuite. > I don't think that dejagnu is to blame here, and I believe the individual testfiles are the wrong place to fix this. You can easily reproduce the symptoms in any run. Try this with the attached patch: #include #include int main () { printf ("isatty 0 = %d\n", isatty (0)); printf ("isatty 1 = %d\n", isatty (1)); printf ("isatty 2 = %d\n", isatty (2)); return 0; } -------------------- Cygwin host: >./main.exe isatty 0 = 1 isatty 1 = 1 isatty 2 = 1 >gdb main.exe isatty (0) = 1 isatty (1) = 1 isatty (2) = 1 ttyname (0) = /dev/tty2 ttyname (1) = /dev/tty2 ttyname (2) = /dev/tty2 GNU gdb 6.7.50.20071201-cvs Copyright (C) 2007 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i686-pc-cygwin"... (gdb) r Starting program: /home/pedro/isatty/main.exe isatty 0 = 0 isatty 1 = 0 isatty 2 = 0 Program exited normally. (gdb) Notice the "isatty $x = 0", and contrast with: ------------- Linux host: >./main isatty 0 = 1 isatty 1 = 1 isatty 2 = 1 >gdb ./main isatty (0) = 1 isatty (1) = 1 isatty (2) = 1 ttyname (0) = /dev/pts/5 ttyname (1) = /dev/pts/5 ttyname (2) = /dev/pts/5 GNU gdb 6.7.50.20071204-cvs Copyright (C) 2007 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i686-pc-linux-gnu"... (gdb) r Starting program: /home/pedro/isatty/main isatty 0 = 1 isatty 1 = 1 isatty 2 = 1 Program exited normally. (gdb) ------------- I don't know enough of the Cygwin tty support, but I would expect that if gdb had a (Windows) console attached (bash started from cmd.exe, not the xterm or rxvt), the inferior would inherit it, and the runtime would arrange for the isatty to be true, but that doesn't seem to hold. Neither CYGWIN=tty nor 'set new-group 0' seemed to help. This probably has something to do with starting the inferior with CreateProcess in win32-nat.c:win32_create_inferior. -- Pedro Alves --------------060400070008010904040701 Content-Type: text/x-diff; name="isatty.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="isatty.diff" Content-length: 823 --- gdb/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) Index: src/gdb/main.c =================================================================== --- src.orig/gdb/main.c 2007-12-04 23:21:10.000000000 +0000 +++ src/gdb/main.c 2007-12-04 23:23:22.000000000 +0000 @@ -875,6 +875,14 @@ extern int gdbtk_test (char *); int gdb_main (struct captured_main_args *args) { + printf ("isatty (0) = %d\n", isatty (0)); + printf ("isatty (1) = %d\n", isatty (1)); + printf ("isatty (2) = %d\n", isatty (2)); + + printf ("ttyname (0) = %s\n", ttyname (0)); + printf ("ttyname (1) = %s\n", ttyname (1)); + printf ("ttyname (2) = %s\n", ttyname (2)); + use_windows = args->use_windows; catch_errors (captured_main, args, "", RETURN_MASK_ALL); /* The only way to end up here is by an error (normal exit is --------------060400070008010904040701--