X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:to:subject:mime-version:content-type
	:content-transfer-encoding:date:from:message-id; q=dns; s=
	default; b=csFohLlPaRIjMx+Atxcy4eDIWehmtySezHzos78KVdJ4Wmr4DWAnG
	HV2IFvbFaFkuYpSjjePTChzN0GFvTK2Vn39rVPo6r3oDRfEQfyXN1nSRivhWvF4A
	ytsct7ik8MMVpZ94bKWloSB9ndWs3j7qmiLZFwBl9XxQfJ3HDxgmBI=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:to:subject:mime-version:content-type
	:content-transfer-encoding:date:from:message-id; s=default; bh=U
	jx4KGnD8h1qBdVo6UxfzHwTiGk=; b=O20ORaOlRmADx5tAEyG6HtkDW0uUEE7cc
	uN9Fk5VO2egH1PU37Ew8IeSQm7JL1sP+EwAEQFGvqhYWDRzFPbOjYDZWuoB3uCqb
	TIaqu+WdAVIk/m9NUpmJuUwtUKmVmizincyOHn0GIuG6z7q3KyslP9BvekIIl0FH
	WJdRJwXo2U=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.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
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=0.8 required=5.0 tests=BAYES_50,FROM_STARTS_WITH_NUMS,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=Mac, buffering, HX-PHP-Originating-Script:501, stdio
X-HELO: smtp-out-so.shaw.ca
X-Authority-Analysis: v=2.1 cv=VIR9547X c=1 sm=1 tr=0 a=WiYoHcCliNeVponEdG0Ckg==:117 a=WiYoHcCliNeVponEdG0Ckg==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=IkcTkHD0fZMA:10 a=SMorJkV_YP8A:10 a=7OsogOcEt9IA:10 a=uPZiAMpXAAAA:8 a=2KUf1mbJAAAA:8 a=TKfZGsrgrFnpe2WQR6cA:9 a=QEXdDO2ut3YA:10
To: cygwin@cygwin.com
Subject: Problem with line buffering and getc function on 1.7.33.
X-PHP-Originating-Script: 501:rcmail.php
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Date: Fri, 11 Mar 2016 11:16:52 -0800
From: Kaz Kylheku <920-082-4242@kylheku.com>
Message-ID: <d3f9d978d9afecf07fd1d96be73213c6@mail.kylheku.com>
X-Sender: 920-082-4242@kylheku.com
User-Agent: Roundcube Webmail/0.9.2
X-CMAE-Envelope: MS4wfHoUPYWa01kgU6GvOuWcCxeF0GA9BJliomskogeoOY0bmWI1935yhNhalqNl+nnrTZb5b6OCKqRFhrWB9dxmaDOujAzv2LYkaWUyMYy+9MzxSHe8uUim /iLCd9iDolAiC1Aos549iy3rPg11J8BW7YpOccVERAKdHXXshc79fz+D
X-IsSubscribed: yes
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id u2BJHKJa023821

Hi all,

On a Cygwin installation version 1.7.33-2(0.280/5/3), I encountered an 
odd issue.

I wrote it up in a StackOverflow question:

http://stackoverflow.com/questions/35928828/cygwin-missing-stream-data-due-to-stdio-putc-line-buffering

This contains a repro test case.

For the benefit of non-users of WWW, the summary is this:
I'm sending data to a stdio stream which has been fdopen-ed from a 
socket
descriptor (which could be irrelevant). The stream is put into line
buffered mode with setvbuf.  When the getc function is used to perform
output on this stream, it loses data. When the string "REPLY\n" is sent,
character by character, the receiver receives only "\n".

If line buffering is not employed, or of putc(ch, stream) is replaced
by fputs(str, stream) (where str is a one-character-long string 
containing
the character to be output), then things work as expected.

Here is a patch I put into the real program where this issue was
found:

http://www.kylheku.com/cgit/txr/commit/?id=3c5f110cc29f8d3fbf2069c68d25ccebee46679e

with the patch, TXR's socket test cases pass on Cygwin.
The tests pass on Solaris 10, various GNU/Linuxes and Mac OS 10.7.3.




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


