Problem with line buffering and getc function on 1.7.33.

Kaz Kylheku
Fri Mar 11 19:17:00 GMT 2016

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:

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 
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 
the character to be output), then things work as expected.

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

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:
Unsubscribe info:

More information about the Cygwin mailing list