Date: Sat, 30 Oct 2010 15:54:52 GMT From: daniele <glimp@live.com> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/151833: sysutils/kiconvtool: I don't know how to load the pair (UTF-8 -> _wctype) Message-ID: <201010301554.o9UFsqgW042344@www.freebsd.org> Resent-Message-ID: <201010301600.o9UG0QSa011338@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 151833 >Category: ports >Synopsis: sysutils/kiconvtool: I don't know how to load the pair (UTF-8 -> _wctype) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Oct 30 16:00:26 UTC 2010 >Closed-Date: >Last-Modified: >Originator: daniele >Release: 8.1-RELEASE #0 >Organization: >Environment: FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:55:53 UTC 2010 root@:/usr/obj/usr/src/sys/GENERIC i386 >Description: As a standard user I could not succesfully execute 'mount_msdosfs -L en_US.UTF-8 /dev/da0s1 local/mnt' I installed kiconvtool and added the following lines to /etc/rc.conf kiconv_preload="YES" kiconv_local_charsets="UTF-8" kiconv_foreign_charsets="UTF-16BE UTF-8" Even with this I could not execute the preceding command as a standard user. Taking a look at the code I discovered that "mount_msdosfs -L en_US.UTF-8 /dev/da0s1 local/mnt" when starts up sets its locale to en_US.UTF-8 [1]. And this leads to loading also the pair (UTF-8,_wctype) [2]. So, apparently, if that pair is not loaded, standard users can not execute the preceding command. At this point the problem that arises is that at command line I do not know how to specify the charset _wctype (unless this is not possible) and feed kiconvtool. To solve the problem, I then modified kiconvtool (explained below) so that the pair (UTF-8, _wctype) is loaded automatically. d [1] /usr/src/sbin/mount_msdosfs/mount_msdosfs.c - Line 114 [2] /usr/src/lib/libkiconv/xlat16_iconv.c - Line 123 >How-To-Repeat: >Fix: The workaround to solve this __specific__ problem was to apply the following patch and rebuild kiconvtool. Please *note* that this patch is not intended for general usage but just to give an idea of a base to further improve the port in case it is not possible to specify _wctype at command line (or to remove the requirement). --- kiconvtool.c 2010-10-30 17:18:32.000000000 +0200 +++ kiconvtool.new 2010-10-30 17:18:32.000000000 +0200 @@ -35,6 +35,7 @@ #include <sys/sysctl.h> #include <string.h> #include <memstat.h> +#include <locale.h> enum arg_type_t_ { ARGTYPE_LOCAL, @@ -185,6 +186,7 @@ return 1; } + setlocale(LC_CTYPE, "en_US.UTF-8"); enum arg_type_t_ arg_type = ARGTYPE_PAIR; for (i = 1; i < argc; i++) { if (argv[i][0] == '-') { >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010301554.o9UFsqgW042344>