Subject: pkg/37441: x11/lablgtk is not 32-bit friendly
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Brian de Alwis <bsd@cs.ubc.ca>
List: pkgsrc-bugs
Date: 11/27/2007 17:45:00
Note: There was a bad value `<[ no | yes ] (one line)>' for the field `Confidential'.
It was set to the default value of `yes'.
>Number: 37441
>Category: pkg
>Synopsis: x11/lablgtk is not 32-bit friendly
>Confidential: yes
>Severity: critical
>Priority: high
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Nov 27 17:45:00 +0000 2007
>Originator: Brian de Alwis
>Release: NetBSD 4.99.35
>Organization:
Brian de Alwis | Software Practices Lab | UBC | http://www.cs.ubc.ca/~bsd/
"Amusement to an observing mind is study." - Benjamin Disraeli
>Environment:
System: NetBSD monolith 4.99.35 NetBSD 4.99.35 (GENERIC.MP) #0: Fri Nov 9 13:00:33 CST 2007 bsd@monolith:/home/scratch/netbsd-src/obj/sys/arch/i386/compile/GENERIC.MP i386
Architecture: i386
Machine: i386
>Description:
lablgtk provides access to GTK from within ocaml. Unfortunately
the current representation used to pass certain identifiers to
and from ocaml is not fully information-preserving on 32-bit
architectures and results in segment faults.
The details: GTK uses glib's gobject to maintain type information.
Types are represented by a type identifier (a GType). gobject
uses the memory address for a class of type, called non-fundamental
types, as the type identifier. These non-fundamental types
are allocated through malloc, and the new jemalloc causes these
to be allocated > 2GB, such that the top-most bit is set.
The lablgtk mapping converts GTypes as ocaml-longs, but the
ocaml-longs mapping perform a 1-bit shift and thus only preserves
the lower 31 bits on a 32-bit architecture.
The patch below uses an alternative definition as proposed by
Jacques Garrigue <garrigue@math.nagoya-u.ac.jp> on the lablgtk
mailinglist (Message-Id
<20071127.141140.182616637.garrigue@math.nagoya-u.ac.jp>).
>How-To-Repeat:
Compile and install net/mldonkey-gui on a 32-bit machine
on a NetBSD since jemalloc was imported. Try running mlgui(1).
See it crash.
>Fix:
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/x11/lablgtk/distinfo,v
retrieving revision 1.11
diff -w -b -u -r1.11 distinfo
--- distinfo 27 Oct 2007 13:29:38 -0000 1.11
+++ distinfo 27 Nov 2007 17:26:56 -0000
@@ -4,3 +4,4 @@
RMD160 (lablgtk-2.10.0.tar.gz) = c149acc683c43b846347aeb3454966fd6ce1cce8
Size (lablgtk-2.10.0.tar.gz) = 742009 bytes
SHA1 (patch-aa) = 613dc2ffbc245b0593df8c500673e19ed1de1554
+SHA1 (patch-ab) = 0b5a8e4899eb74a19ddbf3fc6d60e0bbd173f9e5
--- /dev/null 2007-11-27 11:26:23.000000000 -0600
+++ patches/patch-ab 2007-11-27 10:57:35.000000000 -0600
@@ -0,0 +1,16 @@
+$NetBSD$
+
+--- src/ml_gobject.h.orig 2007-09-24 20:56:09.000000000 -0600
++++ src/ml_gobject.h
+@@ -31,8 +31,9 @@ CAMLexport value Val_GObject_new (GObjec
+ #define Val_GAnyObject_new(val) Val_GObject_new(G_OBJECT(val))
+ CAMLexport void ml_g_object_unref_later (GObject *);
+
+-#define GType_val Long_val
+-#define Val_GType Val_long
++/* As per Garrigue's suggestion on the lablgtk@yuqm.inria.fr mailinglist */
++#define GType_val(t) ((GType)t)
++#define Val_GType(t) ((value)t)
+
+ #define GClosure_val(val) ((GClosure*)Pointer_val(val))
+ CAMLexport value Val_GClosure (GClosure *);
--
Brian de Alwis | Software Practices Lab | UBC | http://www.cs.ubc.ca/~bsd/
"Amusement to an observing mind is study." - Benjamin Disraeli
>Unformatted:
<Please check that the above is correct for the bug being reported,>
<and append source date of snapshot, if applicable (one line).>