public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug libc/9674] New: mbtowc keeps internal state even for stateless encodings @ 2008-12-19 1:10 bruno at clisp dot org 2008-12-22 10:15 ` [Bug libc/9674] " bonzini at gnu dot org 2008-12-26 18:56 ` drepper at redhat dot com 0 siblings, 2 replies; 7+ messages in thread From: bruno at clisp dot org @ 2008-12-19 1:10 UTC (permalink / raw) To: glibc-bugs Run the following program on a system with a fr_FR.UTF-8 locale. =================================================================== #include <locale.h> #include <stdio.h> #include <stdlib.h> #include <wchar.h> int main () { int locale_found = setlocale (LC_ALL, "fr_FR.UTF-8") != NULL; printf ("%d\n", locale_found); printf ("%d\n", mbtowc (NULL, NULL, 0)); static const char input[4] = { 195, 188, 195, 159 }; wchar_t wc; int res2a = mbtowc (&wc, input, 4); printf ("%d\n", res2a); int res1 = mbtowc (&wc, input, 1); printf ("%d\n", res1); int res2b = mbtowc (&wc, input, 4); printf ("%d\n", res2b); return 0; } =================================================================== $ gcc -O -Wall foo.c $ ./a.out 1 0 2 -1 -1 Expected output: 1 0 2 -1 2 Rationale: The first line shows that the locale was correctly set. So the locale encoding is UTF-8. The second line that the UTF-8 encoding is non state dependent. The third and fifth line show that the same call has different results, that is, it must depend on a hidden state. But the mbtowc specification says that "For a state-dependent encoding ... Subsequent calls with s as other than a null pointer shall cause the internal state of the function to be altered as necessary." However, the encoding in use here is not state dependent. Hence the function's results should not depend on hidden state. Reference: POSIX:2008 specification of mbtowc: <http://www.opengroup.org/onlinepubs/9699919799/functions/mbtowc.html> -- Summary: mbtowc keeps internal state even for stateless encodings Product: glibc Version: 2.8 Status: NEW Severity: normal Priority: P2 Component: libc AssignedTo: drepper at redhat dot com ReportedBy: bruno at clisp dot org CC: glibc-bugs at sources dot redhat dot com GCC build triplet: i686-suse-linux GCC host triplet: i686-suse-linux GCC target triplet: i686-suse-linux http://sourceware.org/bugzilla/show_bug.cgi?id=9674 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libc/9674] mbtowc keeps internal state even for stateless encodings 2008-12-19 1:10 [Bug libc/9674] New: mbtowc keeps internal state even for stateless encodings bruno at clisp dot org @ 2008-12-22 10:15 ` bonzini at gnu dot org 2008-12-26 18:56 ` drepper at redhat dot com 1 sibling, 0 replies; 7+ messages in thread From: bonzini at gnu dot org @ 2008-12-22 10:15 UTC (permalink / raw) To: glibc-bugs ------- Additional Comments From bonzini at gnu dot org 2008-12-22 10:14 ------- For completeness, I will add that this requirement is also present in ISO C at the beginning of 7.20.7 (outside 7.20.7.2 which is where mbtowc is defined). OTOH, the fact that "For a state-dependent encoding, each function is placed into its initial state by a call for which its character pointer argument, s, is a null pointer" does not imply that an implementation cannot do the same for state-independent encodings too... -- What |Removed |Added ---------------------------------------------------------------------------- CC| |bonzini at gnu dot org http://sourceware.org/bugzilla/show_bug.cgi?id=9674 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libc/9674] mbtowc keeps internal state even for stateless encodings 2008-12-19 1:10 [Bug libc/9674] New: mbtowc keeps internal state even for stateless encodings bruno at clisp dot org 2008-12-22 10:15 ` [Bug libc/9674] " bonzini at gnu dot org @ 2008-12-26 18:56 ` drepper at redhat dot com 1 sibling, 0 replies; 7+ messages in thread From: drepper at redhat dot com @ 2008-12-26 18:56 UTC (permalink / raw) To: glibc-bugs ------- Additional Comments From drepper at redhat dot com 2008-12-26 18:54 ------- The state does not only contain the shift state but also incomplete input. That explains the behavior and it is a correct implementation according to the wording of the specification. You'll have to get the standard body to explicitly confirm your reading before anything will be changed. -- What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |WAITING http://sourceware.org/bugzilla/show_bug.cgi?id=9674 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <bug-9674-131@http.sourceware.org/bugzilla/>]
* [Bug libc/9674] mbtowc keeps internal state even for stateless encodings [not found] <bug-9674-131@http.sourceware.org/bugzilla/> @ 2011-05-16 0:10 ` drepper.fsp at gmail dot com 2014-02-16 19:41 ` jackie.rosen at hushmail dot com ` (2 subsequent siblings) 3 siblings, 0 replies; 7+ messages in thread From: drepper.fsp at gmail dot com @ 2011-05-16 0:10 UTC (permalink / raw) To: glibc-bugs http://sourceware.org/bugzilla/show_bug.cgi?id=9674 Ulrich Drepper <drepper.fsp at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |RESOLVED Resolution| |INVALID --- Comment #3 from Ulrich Drepper <drepper.fsp at gmail dot com> 2011-05-16 00:10:38 UTC --- I'm closing this now. The "state object" as meant to be used like this. "State" as in stateful is something else. -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libc/9674] mbtowc keeps internal state even for stateless encodings [not found] <bug-9674-131@http.sourceware.org/bugzilla/> 2011-05-16 0:10 ` drepper.fsp at gmail dot com @ 2014-02-16 19:41 ` jackie.rosen at hushmail dot com 2014-05-28 19:43 ` schwab at sourceware dot org 2014-07-02 7:49 ` fweimer at redhat dot com 3 siblings, 0 replies; 7+ messages in thread From: jackie.rosen at hushmail dot com @ 2014-02-16 19:41 UTC (permalink / raw) To: glibc-bugs https://sourceware.org/bugzilla/show_bug.cgi?id=9674 Jackie Rosen <jackie.rosen at hushmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jackie.rosen at hushmail dot com --- Comment #4 from Jackie Rosen <jackie.rosen at hushmail dot com> --- *** Bug 260998 has been marked as a duplicate of this bug. *** Seen from the domain http://volichat.com Page where seen: http://volichat.com/adult-chat-rooms Marked for reference. Resolved as fixed @bugzilla. -- You are receiving this mail because: You are on the CC list for the bug. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libc/9674] mbtowc keeps internal state even for stateless encodings [not found] <bug-9674-131@http.sourceware.org/bugzilla/> 2011-05-16 0:10 ` drepper.fsp at gmail dot com 2014-02-16 19:41 ` jackie.rosen at hushmail dot com @ 2014-05-28 19:43 ` schwab at sourceware dot org 2014-07-02 7:49 ` fweimer at redhat dot com 3 siblings, 0 replies; 7+ messages in thread From: schwab at sourceware dot org @ 2014-05-28 19:43 UTC (permalink / raw) To: glibc-bugs https://sourceware.org/bugzilla/show_bug.cgi?id=9674 Andreas Schwab <schwab at sourceware dot org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC|jackie.rosen at hushmail dot com | -- You are receiving this mail because: You are on the CC list for the bug. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libc/9674] mbtowc keeps internal state even for stateless encodings [not found] <bug-9674-131@http.sourceware.org/bugzilla/> ` (2 preceding siblings ...) 2014-05-28 19:43 ` schwab at sourceware dot org @ 2014-07-02 7:49 ` fweimer at redhat dot com 3 siblings, 0 replies; 7+ messages in thread From: fweimer at redhat dot com @ 2014-07-02 7:49 UTC (permalink / raw) To: glibc-bugs https://sourceware.org/bugzilla/show_bug.cgi?id=9674 Florian Weimer <fweimer at redhat dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Flags| |security- -- You are receiving this mail because: You are on the CC list for the bug. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-07-02 7:49 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2008-12-19 1:10 [Bug libc/9674] New: mbtowc keeps internal state even for stateless encodings bruno at clisp dot org 2008-12-22 10:15 ` [Bug libc/9674] " bonzini at gnu dot org 2008-12-26 18:56 ` drepper at redhat dot com [not found] <bug-9674-131@http.sourceware.org/bugzilla/> 2011-05-16 0:10 ` drepper.fsp at gmail dot com 2014-02-16 19:41 ` jackie.rosen at hushmail dot com 2014-05-28 19:43 ` schwab at sourceware dot org 2014-07-02 7:49 ` fweimer at redhat dot com
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).