On Mon, 17 Mar 2014, Donovan Watteau wrote:
> Hi,
> 
> rev 1.76 of gnome.port.mk made it possible to build a full Xfce desktop
> on loongson (yay!).  Unfortunately, Thunar crashes at startup with a
> SIGBUS.
> 
> I do have the latest glib2-2.38.2p6 update.  thunar-1.6.3 and
> gvfs-1.18.3p5 were rebuilt with DEBUG=-g.
> 
> Please let me know if I should report this to upstream instead.
> 
> [snip]

Some progress...

Here's a hack found in upstream's bugzilla.  Works for me.  But it's
a hack.

Only tested on loongson, don't have access to any other arch ATM.

Index: Makefile
===================================================================
RCS file: /cvs/ports/x11/gnome/gvfs/Makefile,v
retrieving revision 1.112
diff -u -p -r1.112 Makefile
--- Makefile    9 Mar 2014 19:46:35 -0000       1.112
+++ Makefile    18 Mar 2014 19:29:59 -0000
@@ -11,7 +11,7 @@ PKGNAME-main= ${DISTNAME}
 PKGNAME-smb=   ${GNOME_PROJECT}-smb-${GNOME_VERSION}
 PKGNAME-goa=   ${GNOME_PROJECT}-goa-${GNOME_VERSION}
 
-REVISION-main= 5
+REVISION-main= 6
 
 SHARED_LIBS +=  gvfscommon           4.0      # unknown
 
Index: patches/patch-metadata_metatree_c
===================================================================
RCS file: patches/patch-metadata_metatree_c
diff -N patches/patch-metadata_metatree_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-metadata_metatree_c   18 Mar 2014 19:29:59 -0000
@@ -0,0 +1,54 @@
+$OpenBSD$
+
+XXX Hack for unaligned access 
+
+https://bugzilla.gnome.org/show_bug.cgi?id=726456
+
+--- metadata/metatree.c.orig   Thu Nov  7 14:40:18 2013
++++ metadata/metatree.c        Tue Mar 18 19:43:37 2014
+@@ -132,6 +132,27 @@ struct _MetaTree {
+   MetaJournal *journal;
+ };
+ 
++/* Unfortunately the journal entries are only aligned to 32 bit boundaries
++   but on some 64-bit RISC architectures (e.g. Alpha) this is insufficient
++   to guarantee correct alignment of 64-bit accesses. This is not a show
++   stopper but does cause inefficient traps to the kernel and pollution of
++   kernel logs.  Rather than fix the alignment we provide a helper function,
++   dependent on features specific to gcc, to correctly access a 64-bit datum
++   that may be misaligned.  This causes no loss of inefficiency on
++   architectures where alignment is not an issue provided we are compiled
++   with compiler optimisation turned on. */
++#ifdef __GNUC__
++struct una_u64 { guint64 x __attribute__((packed)); };
++static inline guint64 ldq_u(guint64 *p)
++{
++        const struct una_u64 *ptr = (const struct una_u64 *) p;
++        return ptr->x;
++}
++#else
++#define ldq_u(x) (*(x))
++#endif
++
++
+ static void         meta_tree_refresh_locked   (MetaTree    *tree,
+                                               gboolean     force_reread);
+ static MetaJournal *meta_journal_open          (MetaTree    *tree,
+@@ -1230,7 +1251,7 @@ meta_journal_iterate (MetaJournal *journal,
+           break;
+         }
+ 
+-      mtime = GUINT64_FROM_BE (entry->mtime);
++      mtime = GUINT64_FROM_BE( ldq_u(&(entry->mtime)) );
+       journal_path = &entry->path[0];
+ 
+       if (journal_entry_is_key_type (entry) &&
+@@ -2214,7 +2235,7 @@ apply_journal_to_builder (MetaTree *tree,
+   entry = journal->first_entry;
+   while (entry < journal->last_entry)
+     {
+-      mtime = GUINT64_FROM_BE (entry->mtime);
++      mtime = GUINT64_FROM_BE( ldq_u(&(entry->mtime)) );
+       journal_path = &entry->path[0];
+ 
+       switch (entry->entry_type)

Reply via email to