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,UNPARSEABLE_RELAY
X-Spam-Check-By: sourceware.org
X-Yahoo-SMTP: jenXL62swBAWhMTL3wnej93oaS0ClBQOAKs8jbEbx_o-
Date: Mon, 7 Mar 2011 10:37:08 -0500
From: Christopher Faylor <cgf-use-the-mailinglist-please@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: 1.7.8: write fails with EAGAIN
Message-ID: <20110307153708.GA2538@ednor.casa.cgf.cx>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <4D72992D.4090007@tweerlei.de> <20110307103951.GL6393@calimero.vinschen.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20110307103951.GL6393@calimero.vinschen.de>
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 Mon, Mar 07, 2011 at 11:39:51AM +0100, Corinna Vinschen wrote:
>On Mar  5 21:12, Robert Wruck wrote:
>> Hi,
>> 
>> recently, I found that cygwin-git was not able to 'cat-file' files
>> that exceeded some size (in my case about 80MB).
>> I tracked this down to the cygwin implementation of write() that
>> behaves quite odd in some cases.
>> 
>> I wrote a small program (source attached) that mmaps a given file
>> and tries to write it to another file or stdout.
>> 
>> The results vary:
>> 
>> If the destination is a file (`writetest infile outfile` or
>> `writetest infile > outfile`), the write succeeds in a single call.
>> 
>> If the destination is a pipe (`writetest infile | cat > outfile`),
>> the write succeeds in most cases. BUT:
>> 
>> Under WinXP (XP Service Pack 2, 32bit), the call returns -1 and
>> errno=EAGAIN. Nevertheless, SOME data is written to the pipe (in my
>> case 4096 byte for each call).
>> This breaks git since it does an infinite loop while errno=EAGAIN.
>
>Hang on, you are saying that a *blocking* write(2) to a pipe returns
>with EAGAIN?  Are you sure?  It would be quite a surprise if git would
>actually do that.  EAGAIN is only an expected error for non-blocking
>I/O, so applications which use blocking I/O usually only test for EINTR.

I can barely convince myself that there's a pathological case where an
EAGAIN could leak out.  I'm investigating now.

cgf

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

