From owner-freebsd-bugs Mon Jun 1 21:30:35 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id VAA05715 for freebsd-bugs-outgoing; Mon, 1 Jun 1998 21:30:35 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id VAA05692 for ; Mon, 1 Jun 1998 21:30:32 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id VAA14317; Mon, 1 Jun 1998 21:30:02 -0700 (PDT) Received: from news.mplik.ru (root@news.mplik.ru [195.58.1.152]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id VAA04053 for ; Mon, 1 Jun 1998 21:23:49 -0700 (PDT) (envelope-from sg@dream.mplik.ru) Received: from dream.mplik.ru (uucp@localhost) by news.mplik.ru (8.8.8/8.8.8) with UUCP id KAA08523 for FreeBSD-gnats-submit@freebsd.org; Tue, 2 Jun 1998 10:20:23 +0600 (ESD) Received: from dream.mplik.ru (uucp@localhost) by ns.mplik.ru (8.8.8/8.8.8) with UUCP id KAA22899 for FreeBSD-gnats-submit@freebsd.org; Tue, 2 Jun 1998 10:18:03 +0600 (ESS) Received: (from sg@localhost) by dream.mplik.ru (8.8.8/8.8.8) id KAA23435; Tue, 2 Jun 1998 10:05:28 +0600 (ESS) Message-Id: <199806020405.KAA23435@dream.mplik.ru> Date: Tue, 2 Jun 1998 10:05:28 +0600 (ESS) From: sg@mplik.ru Reply-To: sg@mplik.ru To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: bin/6825: strxfrm() function returns junk in any locale except "C" Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 6825 >Category: bin >Synopsis: strxfrm() function returns junk in any locale except "C" >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jun 1 21:30:00 PDT 1998 >Last-Modified: >Originator: Sergey Gershtein >Organization: Ural Relcom Ltd >Release: FreeBSD 3.0-CURRENT i386 >Environment: The problem appears to exist both in FreeBSD 2.2.5-RELEASE and FreeBSD 3.0-CURRENT >Description: The strxfrm() function always fill up all the supplied *dst space with THE SAME character IF supplied *src string is longer than 1 character AND current locale is not "C". The particular character that is filled in *dst seems to depend only on the first character of *src. This behaviour makes strxfrm() function useless for comapring strings that start with the same character. strcoll() function works fine. >How-To-Repeat: #include #include #include int main() { /* any but C locale seems to produce the bug */ setlocale(LC_ALL,"ru_SU.KOI8-R"); char s1[50]="qasdf", s2[50]="qdfg", s3[50], s4[50]; strxfrm(s3,s1,49); strxfrm(s4,s2,49); /* The following line prints 0 though strings aren't equal */ cerr << strcmp(s3,s4) << endl; /* This reveals WHY strcmp() returned 0 */ cerr << s3 << endl; cerr << s4 << endl; /* This shows that strcoll() still works fine */ cerr << strcoll(s1,s2) << endl; return 0; } >Fix: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message