From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14476 invoked by alias); 9 May 2012 19:00:14 -0000 Received: (qmail 14465 invoked by uid 22791); 9 May 2012 19:00:13 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from ishtar.tlinx.org (HELO Ishtar.sc.tlinx.org) (173.164.175.65) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 09 May 2012 19:00:00 +0000 Received: from [192.168.3.12] (Athenae [192.168.3.12]) by Ishtar.sc.tlinx.org (8.14.4/8.14.4/SuSE Linux 0.8) with ESMTP id q49IxvAW024397 for ; Wed, 9 May 2012 11:59:59 -0700 Message-ID: <4FAABEAE.7000309@tlinx.org> Date: Wed, 09 May 2012 19:00:00 -0000 From: Linda Walsh User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24 Mnenhy/0.7.6.666 MIME-Version: 1.0 To: "cygwin@cygwin.com" Subject: Re: Cygwin passes through null writes to other software when redirecting standard input/output (i.e. piping) References: <020501cd23f2$20f07620$62d16260$@motionview3d.com> <20120427143753.GO25385@calimero.vinschen.de> <025501cd24c6$6a353990$3e9facb0$@motionview3d.com> <4F9B38FB.9030607@dancol.org> <20120428052727.GA23749@ednor.casa.cgf.cx> <4F9BD262.2000403@dancol.org> In-Reply-To: <4F9BD262.2000403@dancol.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2012-05/txt/msg00190.txt.bz2 Daniel Colascione wrote: > On 4/27/12 10:27 PM, Christopher Faylor wrote: >> The above comment shows an "and" relationship here. Message type pipes >> more closely mimic Linux (UNIX) pipe behavior AND are definitely >> required for ptys. > > Yeah, but because message pipes break other programs. Cygwin has only > been using message pipes since 23-Oct-11 (1.134), and it got along > fine before that, ICANON aside. If Cygwin programs don't actually > _need_ message pipes in the general case, Cygwin should use byte pipes > instead. ---- But Daniel -- if the point is to make cygwin behave like *nix, wouldn't it be proper to use the method that most closely emulates it's behavior? I can't say with 100% certainty, but I would bet with 90+% confidence that this is a bug in MS's libraries -- they "cheat" and use a null/0 byte read as a signal for end of file rather than sending out-of-band information that *nix supports. A suggestion for a workaround: Write a simple C program as a pipe for stdin -- that buffers the I/O by 'line' (or xx bytes). Then you can have it NOT do writes of 0 bytes to MS progs. You could even do it as a wrapper avoidmsbug "normal progline with it's arguments" avoid would open the appropriate pipes and do the buffering to any buggy MS lib... Essentially you need a 'shim' layer between a POSIX compliant subsystem to NON-POSIX compliant programs. I'm sure that in the case that my assumptions are true, you wouldn't want to deliberate put something in cygwin that would make it less POSIX compliant when it is only to support external-to-cygwin, NON-POSIX compliant programs... Note -- I use programs between cygwin and Windows 'alot', so I want these things to work as well. Another approach in using the wrapper... Just have your real program be named "xxx".bin.exe, and let "xxx" be a link to "avoidmsbug.exe". That prog could look at it's name, automatically append the ".bin" to it's name to execute it... Then you could have any number of cygwin programs with transparent wrappers around them designed to deal with calling programs that mishandle pipe I/O...? -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple