From owner-freebsd-bugs@FreeBSD.ORG Tue May 5 23:50:01 2009 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59211106564A for ; Tue, 5 May 2009 23:50:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 313548FC28 for ; Tue, 5 May 2009 23:50:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n45No1vg004646 for ; Tue, 5 May 2009 23:50:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n45No1i4004645; Tue, 5 May 2009 23:50:01 GMT (envelope-from gnats) Resent-Date: Tue, 5 May 2009 23:50:01 GMT Resent-Message-Id: <200905052350.n45No1i4004645@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Dmitry Marakasov Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3FE5A1065672 for ; Tue, 5 May 2009 23:47:29 +0000 (UTC) (envelope-from amdmi3@amdmi3.ru) Received: from smtp.timeweb.ru (smtp.timeweb.ru [217.170.79.85]) by mx1.freebsd.org (Postfix) with ESMTP id F018C8FC32 for ; Tue, 5 May 2009 23:47:28 +0000 (UTC) (envelope-from amdmi3@amdmi3.ru) Received: from [213.148.20.85] (helo=hive.panopticon) by smtp.timeweb.ru with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1M1UMB-0004Kk-SA for FreeBSD-gnats-submit@freebsd.org; Wed, 06 May 2009 03:47:27 +0400 Received: from hades.panopticon (hades.panopticon [192.168.0.32]) by hive.panopticon (Postfix) with ESMTP id 51345B84D for ; Wed, 6 May 2009 03:46:02 +0400 (MSD) Received: by hades.panopticon (Postfix, from userid 1000) id 79163108841; Wed, 6 May 2009 03:46:22 +0400 (MSD) Message-Id: <20090505234622.79163108841@hades.panopticon> Date: Wed, 6 May 2009 03:46:22 +0400 (MSD) From: Dmitry Marakasov To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: kern/134249: [iconv] ignore case for character set names X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Dmitry Marakasov List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 May 2009 23:50:01 -0000 >Number: 134249 >Category: kern >Synopsis: [iconv] ignore case for character set names >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue May 05 23:50:00 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Dmitry Marakasov >Release: FreeBSD 8.0-CURRENT i386 >Organization: >Environment: System: FreeBSD hades.panopticon 8.0-CURRENT FreeBSD 8.0-CURRENT #0: Thu Apr 30 06:41:20 MSD 2009 root@hades.panopticon:/async/obj/usr/src/sys/HADES i386 >Description: Currently kernel iconv facility is sensitive to character set names, which is both ineffective and confusing: for example, each of this commands: mount_cd9660 -C koi8-r /dev/acd0 /mnt mount_cd9660 -C KOI8-r /dev/acd0 /mnt mount_cd9660 -C KOI8-R /dev/acd0 /mnt mount_cd9660 -C Koi8-r /dev/acd0 /mnt will result in loading a separate copy of KOI8-R <-> UTF-16BE conversion tables, using 4x more memory than needed. Also users who want to mount media with charset cnversion enabled and as non-root (i.e. with vfs.usermount=1) and thus use sysutils/kiconvtool to preload needed conversion tables on system boot will have to carefully check that encodings are specified in the same case everywhere, or the mount will fail. The simple patch attached - makes charset name comparisons case insensitive - coverts charset names to uppercase when storing >How-To-Repeat: >Fix: --- iconv-case-insensitive.patch begins here --- Index: sys/libkern/iconv.c =================================================================== --- sys/libkern/iconv.c (revision 191469) +++ sys/libkern/iconv.c (working copy) @@ -33,6 +33,7 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include #include @@ -171,8 +172,8 @@ struct iconv_cspair *csp; TAILQ_FOREACH(csp, &iconv_cslist, cp_link) { - if (strcmp(csp->cp_to, to) == 0 && - strcmp(csp->cp_from, from) == 0) { + if (strcasecmp(csp->cp_to, to) == 0 && + strcasecmp(csp->cp_from, from) == 0) { if (cspp) *cspp = csp; return 0; @@ -207,12 +208,16 @@ if (!ucsto) { strcpy(cp, to); csp->cp_to = cp; - cp += strlen(cp) + 1; + for (; *cp; cp++) + *cp = toupper(*cp); + cp++; } else csp->cp_to = iconv_unicode_string; if (!ucsfrom) { strcpy(cp, from); csp->cp_from = cp; + for (; *cp; cp++) + *cp = toupper(*cp); } else csp->cp_from = iconv_unicode_string; csp->cp_data = data; --- iconv-case-insensitive.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: