Problem with line buffering and getc function on 1.7.33.

Corinna Vinschen corinna-cygwin@cygwin.com
Sun Mar 13 11:06:00 GMT 2016


On Mar 12 16:41, Kaz Kylheku wrote:
> On 12.03.2016 14:29, Corinna Vinschen wrote:
> >I do now.  Basically it's setvbuf screwing up the internal flags in the
> >FILE structure.  I took the liberty to update newlib's setvbuf to the
> >OpenBSD version locally and I'm going to apply my patches to newlib
> >soon.  I'll provide a new 2.5.0 test release of Cygwin with this patch
> >tomorrow or early next week.
> 
> The change in git now seems risky; it substantially rewrites setvbuf.
> Of course, it's not that I think OpenBSD has it wrong, but that it's
> being cherry-picked in isolation into what looks like a code base
> with some other old pieces. Just a thought.

Point taken.  I compared the code carefully and I'm reasonable sure
that the risk is low.  The major differences to the old setvbuf are:

- The locking call is later.  The first check potenitally exiting
  the function early does not need any access to either reent or fp.

- OpenBSD setvbuf now drops the ungetc buffer.

- OpenBSD resets more flags, namely __SOPT | __SNPT | __SEOF.  That's
  certainly the safer option.

- Optimal IO size handling is a bonus.  Just setting buffer to 1K was
  a bit sub-optimal.

- Add missing __sinit() call.

- Only set buffersize to non-0 in _IOLBF case if we're already writing.

- The rest is equivalent to before.  Only the switch statement has been
  changed to an if in OpenBSD's setvbuf.

Did you try Cygwin 2.0.5-0.6?


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20160313/943aae82/attachment.sig>


More information about the Cygwin mailing list