This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
BUG: garbled transliterated fwprintf(stderr, ...) output
- To: libc-alpha at sources dot redhat dot com
- Subject: BUG: garbled transliterated fwprintf(stderr, ...) output
- From: Markus Kuhn <Markus dot Kuhn at cl dot cam dot ac dot uk>
- Date: Sat, 23 Sep 2000 15:23:02 +0100
BUG REPORT
May be the earlier reported problem has not even much to do with just
ungraceful behaviour in the case of non-strictly-ISO-portable concurrent
use of byte and wide functions. It seems that the use of wide functions
alone has already severe problems just because stderr is used (still
with the recent 2.1.93 CVS snapshot):
Test program:
-----------------------------------------------------------------
#define _ISOC99_SOURCE /* argl */
#include <stdio.h>
#include <wchar.h>
int main() {
fwprintf(stderr, L"Schöne Grüße!\n");
fwprintf(stderr, L"Have a nice day!\n");
return 0;
}
-----------------------------------------------------------------
Output:
-----------------------------------------------------------------
SchoHave a nice day!
-----------------------------------------------------------------
Output of strace:
-----------------------------------------------------------------
...
write(2, "S", 1S) = 1
write(2, "c", 1c) = 1
write(2, "h", 1h) = 1
write(2, "o", 1o) = 1
write(2, "H", 1H) = 1
write(2, "a", 1a) = 1
write(2, "v", 1v) = 1
write(2, "e", 1e) = 1
write(2, " ", 1 ) = 1
write(2, "a", 1a) = 1
write(2, " ", 1 ) = 1
write(2, "n", 1n) = 1
write(2, "i", 1i) = 1
write(2, "c", 1c) = 1
write(2, "e", 1e) = 1
write(2, " ", 1 ) = 1
write(2, "d", 1d) = 1
write(2, "a", 1a) = 1
write(2, "y", 1y) = 1
write(2, "!", 1!) = 1
write(2, "\n", 1
) = 1
_exit(0) = ?
-----------------------------------------------------------------
Interestingly, if I use
wprintf(L"Schöne Grüße!\n");
wprintf(L"Have a nice day!\n");
instead of
fwprintf(stderr, L"Schöne Grüße!\n");
fwprintf(stderr, L"Have a nice day!\n");
then I get on stdout the correct output
-----------------------------------------------------------------
Schoene Gruesse!
Have a nice day!
-----------------------------------------------------------------
and strace reports as expected
-----------------------------------------------------------------
write(1, "Schoene Gruesse!\n", 17Schoene Gruesse!
) = 17
write(1, "Have a nice day!\n", 17Have a nice day!
) = 17
-----------------------------------------------------------------
which is obviously what I had also hoped to see for the stderr case.
The effect seems to be triggered by the translitaration of the "ü" to
"ue" on stderr, as nothing goes wrong with
fwprintf(stderr, L"Schone Gruse!\n");
Markus
--
Markus G. Kuhn, Computer Laboratory, University of Cambridge, UK
Email: mkuhn at acm.org, WWW: <http://www.cl.cam.ac.uk/~mgk25/>