On Apr 21 22:18, Eric Blake wrote: > The bug was that isblank(-1) was blindly treated as if were equivalent > with isblank(0xff), which, in some locales, is flat out wrong > (isblank(EOF) should always be 0, even when isblank(0xff) is well-defined > as 1). Broken apps can't tell the difference between isblank((char)0xff) > and isblank(EOF), but correct apps, like sed, CAN tell the difference > between 0xff and EOF in "int ch = getchar(); isblank(ch)" since getchar() > returns an int containing an unsigned char value (and not a char). > > Sed's infinite loop, then, was because of newlib/cygwin's bug - sed > reached the end of the file while trying to skip blanks, but because > isblank() was returning the wrong value for -1, sed thought that EOF was a > blank and kept trying to read the file instead of breaking out of the loop.
Thanks for the explanation. Apparently I'm unable to explain this clearly enough. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/