! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
SIGBUS in _thunar_vfs_path_init()
Status:
CLOSED: FIXED
Product:
Thunar-vfs
Component:
General

Comments

Description Landry Breuil editbugs 2007-01-24 20:49:53 CET
Compiling Thunar 0.8 works fine (OpenBSD-current/sparc64), but got SIGBUS in thunar-vfs... Thunar and Xfdesktop crashes both. (src taken from fat 4.4 tarball)

Machine is:
hw.machine=sparc64
hw.model=SUNW,UltraSPARC-IIi (rev 1.3) @ 333 MHz, version 0 FPU

two warning during configure, dunno if related to the crash..

checking sys/mount.h usability... no
checking sys/mount.h presence... yes
configure: WARNING: sys/mount.h: present but cannot be compiled
configure: WARNING: sys/mount.h:     check for missing prerequisite h
configure: WARNING: sys/mount.h: see the Autoconf documentation
configure: WARNING: sys/mount.h:     section "Present But Cannot Be C
configure: WARNING: sys/mount.h: proceeding with the preprocessor's r
configure: WARNING: sys/mount.h: in the future, the compiler will tak
configure: WARNING:     ## ---------------------------------------- #
configure: WARNING:     ## Report this to http://bugzilla.xfce.org/ #
configure: WARNING:     ## ---------------------------------------- #
checking for sys/mount.h... yes
......
checking sys/ucred.h usability... no
checking sys/ucred.h presence... yes
configure: WARNING: sys/ucred.h: present but cannot be compiled
configure: WARNING: sys/ucred.h:     check for missing prerequisite h
configure: WARNING: sys/ucred.h: see the Autoconf documentation
configure: WARNING: sys/ucred.h:     section "Present But Cannot Be C
configure: WARNING: sys/ucred.h: proceeding with the preprocessor's r
configure: WARNING: sys/ucred.h: in the future, the compiler will tak
configure: WARNING:     ## ---------------------------------------- #
configure: WARNING:     ## Report this to http://bugzilla.xfce.org/ #
configure: WARNING:     ## ---------------------------------------- #
checking for sys/ucred.h... yes


Build Configuration:

* Operating system support:  bsd
* D-BUS support:             yes
* File System Monitor:       none
* GNOME Thumbnailers:        no
* Startup Notification:      no
* Volume Manager:            none
* Debug Support:             yes

Additional Plugins:

* Advanced Properties:       yes
* Simple Builting Renamers:  yes
* Trash Panel Applet:        yes
* User Customizable Actions: yes


First backtrace w/o --enable-debug

Program received signal SIGBUS, Bus error.
---Type <return> to continue, or q <return> to quit---
0x0000000050c0bce0 in _thunar_vfs_path_init ()
   from /opt/lib/libthunar-vfs-1.so.4.2
(gdb) where
#0  0x0000000050c0bce0 in _thunar_vfs_path_init ()
   from /opt/lib/libthunar-vfs-1.so.4.2
#1  0x0000000050c16f28 in thunar_vfs_init ()
   from /opt/lib/libthunar-vfs-1.so.4.2
#2  0x0000000000119548 in xfce_desktop_set_icon_style ()
#3  0x000000000011ab24 in xfce_desktop_settings_load_initial ()
#4  0x000000000010ff04 in main ()

Recompiled with --enable-debug=full, backtrace is :

Program received signal SIGBUS, Bus error.
0x000000004bf2a840 in _thunar_vfs_path_init () at thunar-vfs-path.c:1154
1154            path->parent = home_components[n];
(gdb) bt
#0  0x000000004bf2a840 in _thunar_vfs_path_init () at thunar-vfs-path.c:1154
#1  0x000000004bf3808c in IA__thunar_vfs_init () at thunar-vfs.c:61
#2  0x000000000011bd08 in main (argc=1, argv=0xfffffffffffd5668) at main.c:193
(gdb) bt full
#0  0x000000004bf2a840 in _thunar_vfs_path_init () at thunar-vfs-path.c:1154
        path = (ThunarVfsPath *) 0x4187ae2c
        s = (const gchar *) 0xfffffffffffd4b91 ""
        offset = (gchar *) 0x4187ae2c ""
        components = (gchar **) 0x4bdf72a0
        component = (gchar **) 0x4bdf72a8
        n_bytes = 68
        n = 0
        t = (gchar *) 0x0
#1  0x000000004bf3808c in IA__thunar_vfs_init () at thunar-vfs.c:61
No locals.
#2  0x000000000011bd08 in main (argc=1, argv=0xfffffffffffd5668) at main.c:193
        session_client = (ThunarSessionClient *) 0x6c31ebef470dd486
        dbus_service = (ThunarDBusService *) 0xfffffffffffd4d61
        application = (ThunarApplication *) 0x4cafe008
        error = (GError *) 0x0
        working_directory = (gchar *) 0x4612e3c0 "/home/landry/src/xfce-4.4.0/src/Thunar-0.8.0"
        filenames = (gchar **) 0x4d8801b0

I can provide config.log if needed, or test a patch

Thanks
Comment 1 Landry Breuil editbugs 2007-01-24 20:52:41 CET
Created attachment 964 
config.log

Err, forgot to precise that first backtrace was when running Xfdesktop, and second (with debug syms) when running Thunar
Comment 2 Benedikt Meurer editbugs 2007-01-25 10:05:55 CET
Hm, that code didn't change for a long time. Which is the last revision known to work?
Comment 3 Landry Breuil editbugs 2007-01-25 10:19:16 CET
Dunno, this is the first time i try to compile Xfce & Thunar on OpenBSD/sparc64 -- everything works fine on OpenBSD/i386.
Maybe a cast/alignment problem with sparc64 specificities..
Comment 4 Landry Breuil editbugs 2007-02-09 18:23:10 CET
Fyi, i tested with Thunar-0.4.0rc1 and Thunar-0.5.0rc2, and got the same error.. (the code is the same.)

More gdb info :
Program received signal SIGBUS, Bus error.
0x00000000442ba840 in _thunar_vfs_path_init () at thunar-vfs-path.c:1154
1154            path->parent = home_components[n];
(gdb) p n
$1 = 0
(gdb) p home_components
$2 = (ThunarVfsPath **) 0x4cb94e80
(gdb) p *home_components
$3 = (ThunarVfsPath *) 0x4cb94e98
(gdb) p **home_components
$4 = {ref_count = 1, parent = 0x0}
(gdb) p home_components[0]
$5 = (ThunarVfsPath *) 0x4cb94e98
(gdb) p *path
$6 = {ref_count = 1, parent = 0x4042640000000000}
(gdb) p *path.parent
Cannot access memory at address 0x4042640000000000
(gdb) p path->parent
$7 = (ThunarVfsPath *) 0x4042640000000000
(gdb) p *path->parent
Cannot access memory at address 0x4042640000000000
(gdb) p n_home_components
$8 = 3
(gdb) p offset
$9 = (gchar *) 0x4cb94eac ""
(gdb) p path
$10 = (ThunarVfsPath *) 0x4cb94eac
(gdb) p sizeof(guint)
$11 = 4
(gdb) p *offset
$12 = 0 '\0'
(gdb) p *component
$15 = (gchar *) 0x4fb03900 "home"
(gdb) p *(component+1)
$16 = (gchar *) 0x4fb03910 "landry"
(gdb) p *(component+2)
$17 = (gchar *) 0x0
(gdb) p n_bytes
$20 = 68

I start to understand what the code does, but dunno why it crashes... i'm open to any debug information/patches..
Comment 5 Benedikt Meurer editbugs 2007-02-12 18:58:20 CET
Dunno why it crashes. Looks properly aligned to me. Maybe ask an OpenBSD/sparc guru for help?
Comment 6 Landry Breuil editbugs 2007-02-12 22:07:13 CET
Done, linking my post on openbsd-sparc here :
http://marc.theaimsgroup.com/?l=openbsd-sparc&m=117131730303668&w=2
Comment 7 Landry Breuil editbugs 2007-02-13 21:29:26 CET
Apparently, there _is_ an alignment problem with the offset used in this part of code..

1152            path = (gpointer) offset;
(gdb) p offset
$23 = (gchar *) 0x4198862c "\001s"
(gdb) n
1153            path->ref_count = 1;
(gdb) p path
$33 = (ThunarVfsPath *) 0x4198862c
(gdb) p *path
$34 = {ref_count = 24313856, parent = 0x146f72672e}

$echo $(((0x4198862c)%8))
4

whereas all other adresses/pointers used seems to be right..

Maybe the problem comes from the offset incrementation with 
sizeof (ThunarVfsPath) + sizeof (guint), which turns to be 20 bytes.. sizeof(guint) is 4. Shouldn't it be sizeof (ThunarVfsPath) + sizeof (gpointer) and in other offset/n_bytes computations ?
sizeof (gpointer) is 8 on sparc64.

I've made an _ugly_ workaround, replacing the code with 
path = (gpointer) offset + 4;

Now it seems to work... xfdesktop initialises normally thunar-vfs, and runs well, i have icons on desktop.. we still have to find a _nice_ bugfix, but we're near :)

Anyway, i'm still having troubles running thunar.. it aborts if it doesn't find gtk-xfce-engine ?? other xfce apps only throws a warning for this issue..

gtk-xfce-engine is installed in /opt prefix (like the rest of xfce), i have /opt/lib/gtk-2.0/2.4.0/engines/libxfce.so.0.0 and .la (tried with a symlink named libxfce.so -> libxfce.so.0.0 too), LD_LIBRARY_PATH and XDG_DATA_DIRS are correctly set (other xfce apps run fine), and i've event tried with 'module_path /opt/lib/gtk-2.0/2.4.0/engines' in a ~/.gtkrc.

Gtk-WARNING **: Unable to locate theme engine in module_path: "xfce",
aborting...

Program received signal SIGABRT, Aborted.
abort () at /usr/src/lib/libc/stdlib/abort.c:71
71      /usr/src/lib/libc/stdlib/abort.c: No such file or directory.
        in /usr/src/lib/libc/stdlib/abort.c

#1  0x000000004359264c in g_logv () from /usr/local/lib/libglib-2.0.so.1000.3
#2  0x0000000043592684 in g_log () from /usr/local/lib/libglib-2.0.so.1000.3
#3  0x00000000483e2468 in gtk_text_view_move_visually () from /usr/local/lib/libgtk-x11-2.0.so.802.1
#4  0x000000004632c7fc in g_type_module_use () from /usr/local/lib/libgobject-2.0.so.1000.3
#5  0x00000000483e2604 in gtk_theme_engine_get () from /usr/local/lib/libgtk-x11-2.0.so.802.1
#6  0x0000000048375058 in gtk_rc_find_module_in_path () from /usr/local/lib/libgtk-x11-2.0.so.802.1
#7  0x0000000048374364 in gtk_rc_scanner_new () from /usr/local/lib/libgtk-x11-2.0.so.802.1
#8  0x0000000048373e58 in gtk_rc_scanner_new () from /usr/local/lib/libgtk-x11-2.0.so.802.1
#9  0x0000000048372d78 in gtk_rc_scanner_new () from /usr/local/lib/libgtk-x11-2.0.so.802.1
#10 0x0000000048370fdc in gtk_rc_parse_string () from /usr/local/lib/libgtk-x11-2.0.so.802.1
#11 0x0000000048371160 in gtk_rc_parse_string () from /usr/local/lib/libgtk-x11-2.0.so.802.1
#12 0x0000000048370bf8 in gtk_rc_get_default_files () from /usr/local/lib/libgtk-x11-2.0.so.802.1
#13 0x0000000048372380 in gtk_rc_reparse_all_for_settings () from /usr/local/lib/libgtk-x11-2.0.so.802.1
#14 0x0000000048382b68 in gtk_settings_get_for_screen () from /usr/local/lib/libgtk-x11-2.0.so.802.1
#15 0x000000004838f498 in gtk_style_get_type () from /usr/local/lib/libgtk-x11-2.0.so.802.1
#16 0x0000000046326208 in g_type_create_instance () from /usr/local/lib/libgobject-2.0.so.1000.3
#17 0x000000004630f0b8 in g_object_new_valist () from /usr/local/lib/libgobject-2.0.so.1000.3
#18 0x000000004630e8bc in g_object_newv () from /usr/local/lib/libgobject-2.0.so.1000.3
#19 0x000000004630f05c in g_object_new_valist () from /usr/local/lib/libgobject-2.0.so.1000.3
#20 0x000000004630e518 in g_object_new () from /usr/local/lib/libgobject-2.0.so.1000.3
#21 0x000000004843fb10 in gtk_widget_get_default_style () from /usr/local/lib/libgtk-x11-2.0.so.802.1
#22 0x000000004843989c in gtk_widget_get_type () from /usr/local/lib/libgtk-x11-2.0.so.802.1
#23 0x00000000463262cc in g_type_create_instance () from /usr/local/lib/libgobject-2.0.so.1000.3
#24 0x000000004630f0b8 in g_object_new_valist () from /usr/local/lib/libgobject-2.0.so.1000.3
#25 0x000000004630e8bc in g_object_newv () from /usr/local/lib/libgobject-2.0.so.1000.3
#26 0x000000004630ef20 in g_object_new_valist () from /usr/local/lib/libgobject-2.0.so.1000.3
#27 0x000000004630e518 in g_object_new () from /usr/local/lib/libgobject-2.0.so.1000.3
#28 0x0000000000123330 in thunar_application_open_window_with_role (application=0x47d14140, role=0x470fd6e0 "Thunar-1171393454-320666134",-
    directory=0x4cfc4120, screen=0x4300a030) at thunar-application.c:510
#29 0x0000000000125254 in thunar_application_open_window (application=0x47d14140, directory=0x4cfc4120, screen=0x4300a030) at thunar-application.c:938
#30 0x000000000014720c in thunar_file_launch (file=0x4cfc4120, parent=0x0, error=0xffffffffffffc3e0) at thunar-file.c:885
#31 0x0000000000125c14 in thunar_application_process_filenames (application=0x47d14140,-
    working_directory=0x4b13e7c0 "/home/landry/src/xfce-4.4.0/src/Thunar-0.8.0", filenames=0x4811c1a0, screen=0x0, error=0xffffffffffffc560)
    at thunar-application.c:1101
#32 0x000000000011be18 in main (argc=1, argv=0xffffffffffffc6d8) at main.c:21

Thanks for your help :)
Comment 8 Landry Breuil editbugs 2007-05-04 11:20:13 CEST
Fyi, this SIGBUS still happens with Thunar 0.8.0 compiled against glib 2.12/gtk 2.10

another weird thing is that the crash doens't happen at the same line if not compiled with --enable-debug :

Program received signal SIGBUS, Bus error.
0x0000000051198a08 in thunar_vfs_path_list_free () from /usr/local/lib/libthunar-vfs-1.so.4.2
(gdb) bt full
#0  0x0000000051198a08 in thunar_vfs_path_list_free () from /usr/local/lib/libthunar-vfs-1.so.4.2
No symbol table info available.
#1  0x00000000511a03fc in thunar_vfs_init () from /usr/local/lib/libthunar-vfs-1.so.4.2

I'm writing the port of Thunar for openbsd -current, and really have to check if it works on various archs, specially 64-bits.. so this aligment bug is really annoying.

Any idea ?

What about my ugly hotfix on previous comment ?
Comment 9 Landry Breuil editbugs 2007-05-04 14:15:33 CEST
1145   offset += sizeof (ThunarVfsPath) + sizeof (guint);
                                                 ^^^^^^^^
shouldn't it be gint here ? ref_count is a gint..
i'm investigating in this area..
Comment 10 Benedikt Meurer editbugs 2007-05-20 13:54:22 CEST
Created attachment 1147 
Possible fix

Please try with this patch.
Comment 11 Landry Breuil editbugs 2007-05-21 17:42:47 CEST
(In reply to comment #10)
> Created an attachment (id=1147) [details]
> Possible fix
> 
> Please try with this patch.
> 

Rebuilded, seems to work fine on my sparc64. I think you can safely commit it if it doesn't break things on other arches.
Going to submit this patch as a replacement for my previous workaround (http://www.openbsd.org/cgi-bin/cvsweb/ports/x11/xfce4/thunar/patches/patch-thunar-vfs_thunar-vfs-path_c?rev=1.1.1.1&content-type=text/x-cvsweb-markup)

Thanks,
Landry
Comment 12 Benedikt Meurer editbugs 2007-05-22 13:34:28 CEST
Committed with revision 25738.

2007-05-22      Benedikt Meurer <benny@xfce.org>

        * thunar-vfs/thunar-vfs-path.c: Fix unaligned access in ThunarVfsPath
          on sparc64. Bug #2815.

Bug #2815

Reported by:
Landry Breuil
Reported on: 2007-01-24
Last modified on: 2010-11-07

People

Assignee:
Jannis Pohlmann
CC List:
1 user

Version

Version:
unspecified

Attachments

config.log (177.43 KB, application/octet-stream)
2007-01-24 20:52 CET , Landry Breuil
no flags
Possible fix (6.09 KB, patch)
2007-05-20 13:54 CEST , Benedikt Meurer
no flags

Additional information