tags 824429 upstream forwarded 824429 https://sourceware.org/bugzilla/show_bug.cgi?id=20617 thanks
* Christoph Biedl: > It might be questionable whether this is a bug in glibc at all. But at > least it's surprising behaviour. > > The reproducer below calls mbstowcs two times, first time with > an illegal UTF-8 sequence, second time a correct one. > > Now if the caller's environment is set to something UTF-8-ish like > "en_US.UTF-8" or "de_DE.UTF-8", also the second and any further > mbsrtowcs invocation fail with EILSEQ. Note setting LC_CTYPE to an > empty string is also required to make this happen. POSIX and C11 explicitly say that the conversion state is undefined after EILSEQ. There does not appear to be a way to reset the internal (global) conversion state used by mbsrtowcs, so a NULL argument for the conversion state pointer is rarely useful. We should probably add a warning in glibc for that case. Filed upstream: https://sourceware.org/bugzilla/show_bug.cgi?id=20617