#772538 shared-mime-info: Post-installation script fails with a segmentation fault

Package:
shared-mime-info
Source:
shared-mime-info
Description:
FreeDesktop.org shared MIME database and spec
Submitter:
Emile den Tex
Date:
2014-12-08 12:48:11 UTC
Severity:
important
#772538#5
Date:
2014-12-08 11:18:37 UTC
From:
To:
Dear Maintainer,

The postinstall script shared-mime-info causes a segfault on my desktop (64bit macbook air) with jessie/testing.
The crash occurs when the script invokes: /usr/bin/update-mime-database.real /usr/share/mime

Outcome: the shared-mime-info package installs but does NOT get configured (nor anything dependent on it)
Expected: a configured package

I did a gdb backtrace for update-mime-database.real invocation (see below), and it refers to libglib2.
I was installing the package cinnamon and shared-mime-info broke the chain.
If I can help with further instruction, please let me know.

Starting program: /usr/bin/update-mime-database.real /usr/share/mime
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff77f5196 in g_fprintf () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
(gdb) bt
#0  0x00007ffff77f5196 in g_fprintf () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#1  0x0000000001ee1600 in ?? ()
#2  0x00000000004030eb in ?? ()
#3  0x00007ffff73e0b45 in __libc_start_main (main=0x402ce0, argc=2, argv=0x7fffffffe398, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>,
    stack_end=0x7fffffffe388) at libc-start.c:287
#4  0x00000000004047cb in ?? ()

#772538#10
Date:
2014-12-08 12:44:30 UTC
From:
To:
The segmentation fault occurs everytime when calling g_fprintf() in
update-mime-database.c, first on line 3849.
See the gdb output below (on a build with debugging symbols).
Could this be related to libglib2 somehow not being fully configured yet
when first installing shared-mime-info?
I don't understand, but I effectively worked around the problem by
replacing g_fprintf() with standard printf().

(gdb) break update-mime-database.c:3624
Breakpoint 1 at 0x40a6d2: file update-mime-database.c, line 3624.
(gdb) run /usr/share/mime
Starting program: /usr/bin/update-mime-database.real /usr/share/mime
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, main (argc=2, argv=0x7fffffffe3a8) at
update-mime-database.c:3624
3624                    g_fprintf(globs,
(gdb) bt
#0  main (argc=2, argv=0x7fffffffe3a8) at update-mime-database.c:3624
(gdb) print globs
$1 = (FILE *) 0x64c600
(gdb) print globs_path
$2 = 0x21a7ac0 "/usr/share/mime/globs.new"
(gdb) continue
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff77f5191 in g_fprintf () from
/lib/x86_64-linux-gnu/libglib-2.0.so.0
(gdb) bt
#0  0x00007ffff77f5191 in g_fprintf () from
/lib/x86_64-linux-gnu/libglib-2.0.so.0
#1  0x000000000064c600 in ?? ()
#2  0x000000000040a6eb in main (argc=2, argv=0x7fffffffe3a8) at
update-mime-database.c:3624