public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Kaz Kylheku <920-082-4242@kylheku.com>
To: cygwin@cygwin.com
Subject: Problem with line buffering and getc function on 1.7.33.
Date: Fri, 11 Mar 2016 19:17:00 -0000	[thread overview]
Message-ID: <d3f9d978d9afecf07fd1d96be73213c6@mail.kylheku.com> (raw)

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

             reply	other threads:[~2016-03-11 19:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-11 19:17 Kaz Kylheku [this message]
2016-03-11 20:09 ` Yaakov Selkowitz
2016-03-11 21:57 Kaz Kylheku
2016-03-11 22:14 ` Marco Atzeri
2016-03-12  0:05   ` Kaz Kylheku
2016-03-12 19:39     ` Corinna Vinschen
2016-03-12 22:29       ` Corinna Vinschen
2016-03-13  0:37         ` Kaz Kylheku
2016-03-13 10:47           ` Corinna Vinschen
2016-03-13  0:41         ` Kaz Kylheku
2016-03-13 11:06           ` Corinna Vinschen
2016-03-13 11:37             ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d3f9d978d9afecf07fd1d96be73213c6@mail.kylheku.com \
    --to=920-082-4242@kylheku.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).