From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7586 invoked by alias); 22 Jul 2013 15:41:25 -0000 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 Received: (qmail 7575 invoked by uid 89); 22 Jul 2013 15:41:25 -0000 X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_50,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_NO,RCVD_IN_NIX_SPAM,RDNS_NONE,SPF_SOFTFAIL,TW_TV,TW_VB autolearn=no version=3.3.1 Received: from Unknown (HELO mtaout20.012.net.il) (80.179.55.166) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 22 Jul 2013 15:40:57 +0000 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0MQC00L00GU6PT00@a-mtaout20.012.net.il> for gdb-patches@sourceware.org; Mon, 22 Jul 2013 18:40:48 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MQC00L4DGW0EU50@a-mtaout20.012.net.il>; Mon, 22 Jul 2013 18:40:48 +0300 (IDT) Date: Mon, 22 Jul 2013 15:41:00 -0000 From: Eli Zaretskii Subject: Re: [PATCH] Unbuffer stdout and stderr on windows In-reply-to: <1374462417-7961-1-git-send-email-yao@codesourcery.com> To: Yao Qi Cc: gdb-patches@sourceware.org Reply-to: Eli Zaretskii Message-id: <838v0yy556.fsf@gnu.org> References: <1374462417-7961-1-git-send-email-yao@codesourcery.com> X-SW-Source: 2013-07/txt/msg00500.txt.bz2 > From: Yao Qi > Date: Mon, 22 Jul 2013 11:06:57 +0800 > > +#ifdef _WIN32 > + /* A Cygwin ssh session may not look like a terminal to the Windows > + runtime; ensure unbuffered output. */ > + setvbuf (stdout, NULL, _IONBF, BUFSIZ); > + setvbuf (stderr, NULL, _IONBF, BUFSIZ); > +#endif This is wrong, stdout should be line-buffered by default. Also, this punishes batch mode with stdout redirected to a file: its stdout buffering (and perhaps also that of stderr, although that's less important) will now always be line-buffered, i.e. less efficient. Is it possible to detect the "Cygwin ssh session", whatever that means, and only do this then? I don't think it's right to change behavior of a native w32 GDB just because it misbehaves when mixed with Cygwin. Mixing native and Cygwin programs is asking for trouble to begin with, so punishing good citizens on behalf of that corner case is not TRT, IMO.