NetBSD Problem Report #39765

From jmcneill@black.invisible.ca  Sat Oct 18 23:13:59 2008
Return-Path: <jmcneill@black.invisible.ca>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 67A1763B93C
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 18 Oct 2008 23:13:59 +0000 (UTC)
Message-Id: <20081018231354.CF6BC7D9BC0@black.invisible.ca>
Date: Sat, 18 Oct 2008 19:13:54 -0400 (EDT)
From: jmcneill@invisible.ca
Reply-To: jmcneill@invisible.ca
To: gnats-bugs@gnats.NetBSD.org
Subject: glib2 does not support WCHAR_T conversion using built-in iconv on NetBSD
X-Send-Pr-Version: 3.95

>Number:         39765
>Category:       pkg
>Synopsis:       glib2 does not support WCHAR_T conversion using built-in iconv on NetBSD
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 18 23:15:00 +0000 2008
>Closed-Date:    Sun Dec 19 01:14:04 +0000 2021
>Last-Modified:  Sun Dec 19 01:14:04 +0000 2021
>Originator:     Jared D. McNeill
>Release:        NetBSD 4.99.73
>Organization:

>Environment:


System: NetBSD black.invisible.ca 4.99.73 NetBSD 4.99.73 (GENERIC) #10: Sat Oct 18 12:27:54 EDT 2008 jmcneill@black.invisible.ca:/export/home/jmcneill/branches/HEAD/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
	g_convert fails when trying to convert to or from WCHAR_T on NetBSD
	because of limitations in the system iconv implementation. glibmm
	uses this in its ustring class implementation, so any application
	using glibmm will fail.
>How-To-Repeat:
	Build the following application on NetBSD:

	$ cc glibconvert.c -o glibconvert `pkg-config --cflags --libs glib-2.0`
	$ ./glibconvert

	** (process:5615): WARNING **: g_convert failed: Conversion from character set 'UTF-8' to 'WCHAR_T' is not supported

	The same application works fine on Linux:

	$ ./glibconvert 
	** Message: g_convert success

/* g_convert test application */
#include <glib.h>

int
main(void)
{
	GError *gerror = NULL;
	gsize read, written;
	gchar *convstr;

	convstr = g_convert("hello", 5,
			    "WCHAR_T", "UTF-8", &read, &written,
			    &gerror);
	if (convstr == NULL)
		g_warning("g_convert failed: %s\n", gerror->message);
	else
		g_message("g_convert success\n");
	return 0;
}

>Fix:


>Release-Note:

>Audit-Trail:
From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/39765: glib2 does not support WCHAR_T conversion using
	built-in iconv on NetBSD
Date: Sun, 19 Oct 2008 10:49:13 +0200

 On Sat, Oct 18, 2008 at 11:15:00PM +0000, jmcneill@invisible.ca wrote:
 > 	g_convert fails when trying to convert to or from WCHAR_T on NetBSD
 > 	because of limitations in the system iconv implementation. glibmm
 > 	uses this in its ustring class implementation, so any application
 > 	using glibmm will fail.

 I disagree with this analyses. glibmm makes the assumption that the
 internal encoding is constant, which is not valid. The correct code to
 use here is nl_langinfo to extract CODESET, use iconv to convert to that
 and then do a normal mbstowcs.

 Joerg

From: "Jared D. McNeill" <jmcneill@invisible.ca>
To: gnats-bugs@NetBSD.org
Cc: pkg-manager@netbsd.org, gnats-admin@netbsd.org, 
 pkgsrc-bugs@netbsd.org
Subject: Re: pkg/39765: glib2 does not support WCHAR_T conversion using	built-in
 iconv on NetBSD
Date: Sun, 19 Oct 2008 09:49:17 -0400

 Joerg Sonnenberger wrote:
 >  I disagree with this analyses. glibmm makes the assumption that the
 >  internal encoding is constant, which is not valid. The correct code to
 >  use here is nl_langinfo to extract CODESET, use iconv to convert to that
 >  and then do a normal mbstowcs.

 glib should not behave different on NetBSD than Linux.

From: "Adam Ciarcinski" <adam@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/39765 CVS commit: pkgsrc/devel/glibmm
Date: Tue, 3 Feb 2015 11:50:43 +0000

 Module Name:	pkgsrc
 Committed By:	adam
 Date:		Tue Feb  3 11:50:43 UTC 2015

 Modified Files:
 	pkgsrc/devel/glibmm: distinfo
 Added Files:
 	pkgsrc/devel/glibmm/patches: patch-glib_glibmm_ustring.cc

 Log Message:
 Work-around NetBSD's native iconv lacking support for WCHAR_T.
 See also PR 39765.
 Need for graphics/inkscape 0.91.


 To generate a diff of this commit:
 cvs rdiff -u -r1.45 -r1.46 pkgsrc/devel/glibmm/distinfo
 cvs rdiff -u -r0 -r1.1 \
     pkgsrc/devel/glibmm/patches/patch-glib_glibmm_ustring.cc

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sat, 14 Feb 2015 10:06:16 +0000
State-Changed-Why:
Is that an adequate workaround?


From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc: pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org,
	jmcneill@invisible.ca
Subject: Re: PR/39765 CVS commit: pkgsrc/devel/glibmm
Date: Sun, 15 Feb 2015 16:41:23 +0100

 On Tue, Feb 03, 2015 at 11:55:02AM +0000, Adam Ciarcinski wrote:
 > The following reply was made to PR pkg/39765; it has been noted by GNATS.
 > 
 > From: "Adam Ciarcinski" <adam@netbsd.org>
 > To: gnats-bugs@gnats.NetBSD.org
 > Cc: 
 > Subject: PR/39765 CVS commit: pkgsrc/devel/glibmm
 > Date: Tue, 3 Feb 2015 11:50:43 +0000
 > 
 >  Module Name:	pkgsrc
 >  Committed By:	adam
 >  Date:		Tue Feb  3 11:50:43 UTC 2015
 >  
 >  Modified Files:
 >  	pkgsrc/devel/glibmm: distinfo
 >  Added Files:
 >  	pkgsrc/devel/glibmm/patches: patch-glib_glibmm_ustring.cc
 >  
 >  Log Message:
 >  Work-around NetBSD's native iconv lacking support for WCHAR_T.
 >  See also PR 39765.
 >  Need for graphics/inkscape 0.91.

 The code is very suspicious. We do *not* store UCS4 in wchar_t and we do
 *not* support the translation to wchar_t via iconv, because it is
 completely undefined what such behavior should be. Really, this code
 should be using mbstowcs or similar and iconv.

 Joerg

State-Changed-From-To: feedback->open
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Thu, 18 Jun 2015 04:58:12 +0000
State-Changed-Why:
joerg doesn't like it


State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 19 Dec 2021 01:14:04 +0000
State-Changed-Why:
Workaround was committed almost seven years ago. Joerg's had plenty of time
to float an alternative.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.