X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-1.7 required=5.0	tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE
X-Spam-Check-By: sourceware.org
X-Mail-Handler: MailHop Outbound by DynDNS
X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/mailhop/outbound_abuse.html for abuse reporting information)
X-MHO-User: U2FsdGVkX18wE7FcQVX0t9NuCjaT8uV/
Date: Sat, 28 Apr 2012 01:27:27 -0400
From: Christopher Faylor <cgf-use-the-mailinglist-please@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Cygwin passes through null writes to other software when redirecting standard input/output (i.e. piping)
Message-ID: <20120428052727.GA23749@ednor.casa.cgf.cx>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <020501cd23f2$20f07620$62d16260$@motionview3d.com> <20120427143753.GO25385@calimero.vinschen.de> <025501cd24c6$6a353990$3e9facb0$@motionview3d.com> <4F9B38FB.9030607@dancol.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4F9B38FB.9030607@dancol.org>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Fri, Apr 27, 2012 at 05:25:31PM -0700, Daniel Colascione wrote:
>IIRC, it had something to do with preserving message boundaries at the
>TTY later. Again IIRC (and I only faintly recall this part) the PTY
>layer has to deliver one line at a time to readers. If a client calls
>read(2) with a giant buffer, he's still supposed to get back only a
>single line at a time. A message-mode pipe seems like a good way to
>provide these semantics because it preserves write boundaries --- so if
>you write only a line at a time, the reader reads only a line at a time.
>It's a shame that this approach causes problems.
>
>Why can't only pseudoterminal pipes be created as PIPE_TYPE_MESSAGE?
>Cygwin already has special logic to tell whether a handle it's opening
>is a pty and to treat it specially in that case.

Use the source code, Jake.  From pipe.cc:

 Note that the write side of the pipe is opened as PIPE_TYPE_MESSAGE.
 This *seems* to more closely mimic Linux pipe behavior and is
 definitely required for pty handling since fhandler_pty_master
 writes to the pipe in chunks, terminated by newline when CANON mode
 is specified.  

The above comment shows an "and" relationship here.  Message type pipes
more closely mimic Linux (UNIX) pipe behavior AND are definitely
required for ptys.

--
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

