- Subject: libc/1173: strcmp with multibyte text returns incorrect value
- From: OHKAWA Yuichi <kuri@makino.cc.tohoku.ac.jp>
- Date: Tue Jun 22 08:17:22 1999
Topics:
libc/1173: strcmp with multibyte text returns incorrect value
Re: libc/1173: strcmp with multibyte text returns incorrect
----------------------------------------------------------------------
Date: Mon, 21 Jun 1999 20:40:44 +0900
From: OHKAWA Yuichi <kuri@makino.cc.tohoku.ac.jp>
To: bugs@gnu.org
Subject: libc/1173: strcmp with multibyte text returns incorrect value
Message-Id: <19990621204044J.kuri@makino.cc.tohoku.ac.jp>
>Number: 1173
>Category: libc
>Synopsis: strcmp with multibytetext returns incorrect value
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: libc-gnats
>State: open
>Class: sw-bug
>Submitter-Id: unknown
>Arrival-Date: Mon Jun 21 07:50:01 EDT 1999
>Last-Modified:
>Originator: OHKAWA Yuichi
>Organization:
Graduate School of Information Sciences,TOHOKU University.
>Release: libc-2.1.1
>Environment:
<machine, os, target, libraries (multiple lines)>
Host type: powerpc-redhat-linux-gnu
System: Linux parabola 2.2.10 #1 Wed Jun 16 20:04:26 JST 1999 ppc unknown
Architecture: ppc
Addons: crypt linuxthreads
Build CFLAGS: -O2 -fsigned-char
Build CC: egcs
Compiler version: egcs-2.91.66 19990314 (egcs-1.1.2 release)
Kernel headers: UTS_RELEASE
Symbol versioning: yes
Build static: yes
Build shared: yes
Build pic-default: no
Build profile: yes
Build omitfp: no
Build bounded: no
Build static-nss: no
Stdio: libio
>Description:
strcmp compareing multibyte text and another text returns 0
incorrectry. But if arguments' order is reversed, strcmp
returns non-zero value.
This bug happens in only powerpc machines, maybe.
>How-To-Repeat:
main()
{
char *a,*b;
a = (char *)malloc(7);
b = (char *)malloc(7);
strcpy (a, "test");
strcpy (b, "testあ"); /* test + Japanese kana char in euc encode*/
printf ("%i\n", strcmp (b, a)); /* return incorrect value */
printf ("%i\n", strcmp (a, b));
free (a);
free (b);
}
>Fix:
>Audit-Trail:
>Unformatted:
------------------------------
Date: Tue, 22 Jun 1999 14:11:18 +0900
From: OHKAWA Yuichi <kuri@makino.cc.tohoku.ac.jp>
To: aj@arthur.rhein-neckar.de
Cc: kuri@makino.cc.tohoku.ac.jp
Subject: Re: libc/1173: strcmp with multibyte text returns incorrect
value
Message-Id: <19990622141118H.kuri@makino.cc.tohoku.ac.jp>
References: <19990621204044J.kuri@makino.cc.tohoku.ac.jp>
<u87loxfqf4.fsf@arthur.rhein-neckar.de>
<19990622132552D.kuri@makino.cc.tohoku.ac.jp>
Content-Type: Multipart/Mixed;
boundary="--Next_Part(Tue_Jun_22_14:11:13_1999_809)--"
Content-Transfer-Encoding: 7bit
- ---Next_Part(Tue_Jun_22_14:11:13_1999_809)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
From: OHKAWA Yuichi <kuri@makino.cc.tohoku.ac.jp>
Subject: Re: libc/1173: strcmp with multibyte text returns incorrect value
Date: Tue, 22 Jun 1999 13:25:52 +0900
> This error cause that source file is encoded by JIS (iso-2022-jp).
> I attach EUC-jp encoded file after here.
Sorry, I sent wrong file.
Now I exactly attach EUC-jp encoded file.
- -
OHKAWA Yuchi (kuri@makino.cc.tohoku.ac.jp)
- ---Next_Part(Tue_Jun_22_14:11:13_1999_809)--
Content-Type: Application/Octet-Stream
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test.c"
bWFpbigpCnsKICBjaGFyICphLCpiOwoKICBhID0gKGNoYXIgKiltYWxsb2MoNyk7CiAgYiA9
IChjaGFyICopbWFsbG9jKDcpOwoKICBzdHJjcHkgKGEsICJ0ZXN0Iik7CiAgc3RyY3B5IChi
LCAidGVzdKSiIik7CgogIHByaW50ZiAoIiVpXG4iLCBzdHJjbXAgKGIsIGEpKTsKICBwcmlu
dGYgKCIlaVxuIiwgc3RyY21wIChhLCBiKSk7CgogIGZyZWUgKGEpOwogIGZyZWUgKGIpOwp9
Cg==
- ---Next_Part(Tue_Jun_22_14:11:13_1999_809)----
------------------------------
End of forwardZUCQ_W Digest
***************************