Bug 202871 - Kbuildsycoca4 crashes because of mime problems (null KSycocaEntry::offset, KBuildMimeTypeFactory::savePatternLists, KBuildMimeTypeFactory::save)
Summary: Kbuildsycoca4 crashes because of mime problems (null KSycocaEntry::offset, KB...
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: ksycoca (show other bugs)
Version: unspecified
Platform: Unlisted Binaries Linux
: NOR crash
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
: 199748 203322 205120 205844 209701 212376 214419 215577 219494 221873 221874 221924 222224 224124 224251 228379 229094 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-08-06 22:15 UTC by Andras Fabian
Modified: 2015-09-19 23:07 UTC (History)
17 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
mime globs file (1.40 KB, application/octet-stream)
2009-08-06 22:18 UTC, Andras Fabian
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andras Fabian 2009-08-06 22:15:01 UTC
Application that crashed: kbuildsycoca4
Version of the application: 1.1
KDE Version: 4.3.00 (KDE 4.3.0) "release 152"
Qt Version: 4.5.2
Operating System: Linux 2.6.30-41-fab x86_64

What I was doing when the application crashed:
I have had the same problems with kbuildsycoca4. But I have narrowed it down even further. After some testing, removing ~/.local/share/mime was already enough to stop this error happening (which could be reproduced all the time by starting kbuildsycoca from bash). The i tried to find the culprit inside the directory and after some step-by-step file deleting I found one single file that caused this crash:
~/.local/share/mime/globs
When I removed that file, there was no crash. When I copy the file back, kbuildsycoca4 crached again. And, evem if I emptied that file, the crash still occured (on an empty, 0 byte globs file).


 -- Backtrace:
Application: KBuildSycoca (kbuildsycoca4), signal: Segmentation fault
[KCrash Handler]
#5  KSycocaEntry::offset (this=0x0) at /usr/src/debug/kdelibs-4.3.0/kdecore/sycoca/ksycocaentry.cpp:132
#6  0x00007fa6f2458948 in KBuildMimeTypeFactory::savePatternLists (this=0x65e2c0, str=@0x659ae0) at /usr/src/debug/kdelibs-4.3.0/kded/kbuildmimetypefactory.cpp:361
#7  0x00007fa6f2458e13 in KBuildMimeTypeFactory::save (this=0x65e2c0, str=@0x659ae0) at /usr/src/debug/kdelibs-4.3.0/kded/kbuildmimetypefactory.cpp:307
#8  0x00007fa6f2451d01 in KBuildSycoca::save (this=0x1137960, str=0x659ae0) at /usr/src/debug/kdelibs-4.3.0/kded/kbuildsycoca.cpp:525
#9  0x00007fa6f2453ea5 in KBuildSycoca::recreate (this=0x1137960) at /usr/src/debug/kdelibs-4.3.0/kded/kbuildsycoca.cpp:433
#10 0x00007fa6f2455cfc in kdemain (argc=1, argv=0x7fff6701fdc8) at /usr/src/debug/kdelibs-4.3.0/kded/kbuildsycoca.cpp:829
#11 0x00007fa6eee1a436 in __libc_start_main () from /lib64/libc.so.6
#12 0x0000000000400739 in _start ()

This bug may be a duplicate of or related to bug 199748

Reported using DrKonqi
Comment 1 Andras Fabian 2009-08-06 22:18:03 UTC
Created attachment 35937 [details]
mime globs file

This is the globs file which I had in mime folder. But as I told in first bug report, the crash even occurred when I emptied the file.
Comment 2 Dario Andres 2009-08-07 19:20:46 UTC
The backtrace looks related to bug 199300. Thanks
Comment 3 Dario Andres 2009-08-11 00:06:13 UTC
*** Bug 203322 has been marked as a duplicate of this bug. ***
Comment 4 Dario Andres 2009-08-25 23:18:01 UTC
*** Bug 205120 has been marked as a duplicate of this bug. ***
Comment 5 Christoph Feck 2009-09-02 01:22:09 UTC
*** Bug 205844 has been marked as a duplicate of this bug. ***
Comment 6 Marc Jeffrey Driftmeyer 2009-09-03 01:11:48 UTC
Tested against Debian 4.3.1 Sid.

Application that crashed: kbuildsycoca4
Version of the application: 1.1
KDE Version: 4.3.1 (KDE 4.3.1)
Qt Version: 4.5.2
Operating System: Linux 2.6.30-1-amd64 x86_64
Distribution: Debian GNU/Linux unstable (sid)

 -- Backtrace:
Application: KBuildSycoca (kdeinit4), signal: Segmentation fault
[KCrash Handler]
#5  KSycocaEntry::offset (this=0x0) at ../../kdecore/sycoca/ksycocaentry.cpp:132
#6  0x00007fb51425094d in KBuildMimeTypeFactory::savePatternLists (this=0x1c75b10, str=...) at ../../kded/kbuildmimetypefactory.cpp:361
#7  0x00007fb514250df3 in KBuildMimeTypeFactory::save (this=0x1c75b10, str=...) at ../../kded/kbuildmimetypefactory.cpp:307
#8  0x00007fb514249d21 in KBuildSycoca::save (this=0x29514f0, str=0x1c03610) at ../../kded/kbuildsycoca.cpp:525
#9  0x00007fb51424bee5 in KBuildSycoca::recreate (this=0x29514f0) at ../../kded/kbuildsycoca.cpp:433
#10 0x00007fb51424dd4b in kdemain (argc=2, argv=0x1b6e9f0) at ../../kded/kbuildsycoca.cpp:829
#11 0x0000000000407264 in launch (argc=2, _name=0x1b6ed28 "/usr/bin/kbuildsycoca4", args=<value optimized out>, cwd=0x0, envc=1, envs=0x1b6ed61 "", reset_env=false, tty=0x0, avoid_loops=false, 
    startup_id_str=0x1b6ed6a "horus;1251932503;200066;8876_TIME0") at ../../kinit/kinit.cpp:677
#12 0x0000000000407a28 in handle_launcher_request (sock=8, who=<value optimized out>) at ../../kinit/kinit.cpp:1169
#13 0x0000000000407fae in handle_requests (waitForPid=8875) at ../../kinit/kinit.cpp:1362
#14 0x00000000004089ff in main (argc=2, argv=0x7fff062f0fb8, envp=0x7fff062f0fd0) at ../../kinit/kinit.cpp:1745


Note: Removed all reference to blob, even move the mime folder to a hidden copy and nothing has prevented this crash report from reappearing as two copies.
Comment 7 Christoph Feck 2009-10-07 04:04:46 UTC
*** Bug 209701 has been marked as a duplicate of this bug. ***
Comment 8 Dario Andres 2009-10-31 02:37:40 UTC
*** Bug 212376 has been marked as a duplicate of this bug. ***
Comment 9 Dario Andres 2009-11-14 16:18:48 UTC
*** Bug 199300 has been marked as a duplicate of this bug. ***
Comment 10 Dario Andres 2009-11-14 16:18:50 UTC
*** Bug 214419 has been marked as a duplicate of this bug. ***
Comment 11 Dario Andres 2009-11-21 22:25:06 UTC
*** Bug 215577 has been marked as a duplicate of this bug. ***
Comment 12 David Faure 2009-11-27 23:05:33 UTC
*** Bug 199748 has been marked as a duplicate of this bug. ***
Comment 13 Björn Ruberg 2009-11-28 00:08:48 UTC
This bug is no easy to reproduce. Obviously the segfault happens when the mime types are written out to the globs file. 

Can someone who can reproduce this bug attach an archive containing his whole .local directory? Without it is hardly possible to find out what actually goes wrong.
Comment 14 David Faure 2009-11-28 16:31:16 UTC
No, the crash is while saving mimetypes to the ksycoca4 file.
The globs file is written by update-mime-database and is only read by kbuildsycoca4. Anyway, yes, a zip of ~/.local could help. Of course it could also depend on the contents of /usr/share/mime...
Comment 15 Nicolas L. 2009-11-30 15:36:10 UTC
SVN commit 1056651 by nlecureuil:

Fix crash in kbuildsycoca and add kDebug() to have more infos about this bug
CCBUG:202871


 M  +5 -0      kbuildmimetypefactory.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1056651
Comment 16 Nicolas L. 2009-11-30 15:39:18 UTC
please try with latest kdelibs and give here the lines with MIMETYPE NOT FOUND:  when doing kbuildsycoca4
Comment 17 Nicolas L. 2009-11-30 22:41:10 UTC
SVN commit 1056795 by nlecureuil:

Use kFatal instead of kDebug to catch the bug
CCBUG:202871


 M  +1 -1      kbuildmimetypefactory.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1056795
Comment 18 David Faure 2009-12-02 00:23:23 UTC
I found the cause for this: missing +x permissions in some subfolders of /usr/share/mime, like /usr/share/mime/interface.

What is your version of shared-mime-info?
These subdirs are created by update-mime-database.
You can find its version with "update-mime-database -v".

I'm looking at whether the crash is fixable, but a directory with +r and without +x permission is quite unusual and weird...
Comment 19 David Faure 2009-12-02 01:02:56 UTC
SVN commit 1057320 by dfaure:

Fix crash when a mimetype was detected (during directory listing) but isn't found again by name later on
(stat() fails, e.g. because it was removed meanwhile, or because the directory doesn't have +x permissions
for some still unknown reason). I believe the real bug is in update-mime-database.
Fixed for: 4.4.0-beta2
CCBUG: 202871


 M  +10 -6     kbuildmimetypefactory.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1057320
Comment 20 David Faure 2009-12-02 01:14:43 UTC
Also, what's your umask? (just type umask in a terminal).

I just checked update-mime-database and it simply says "mkdir(media, 0755)",
and always has. So I don't see how one could end up with subdirs without +x...
Comment 21 Dario Andres 2009-12-21 15:22:36 UTC
*** Bug 219494 has been marked as a duplicate of this bug. ***
Comment 22 Dario Andres 2009-12-21 15:22:50 UTC
*** Bug 219550 has been marked as a duplicate of this bug. ***
Comment 23 David Faure 2009-12-21 17:39:39 UTC
So, everyone with the savePatternLists/this=0x0 bug, can you type umask in a terminal and see what you get? It should be 022 or 002. Anything else looks very buggy, please find out what sets the umask to a wrong value...
Comment 24 Marc Jeffrey Driftmeyer 2009-12-21 23:38:11 UTC
/usr/share/mime/ umask reads: 0022
/usr/share/mime/interface/ umask reads: 0022
Comment 25 nofxgilles 2009-12-22 13:15:45 UTC
i get this

lain@LainIwakura:~$ umask
0022
Comment 26 David Faure 2009-12-22 15:32:58 UTC
Marc: umask is a user setting, doesn't depend on which directory you are in. 0022 looks ok.

What are the permissions of /usr/share/mime/interface?
Any sub-directory in ~/.local/share/mime that doesn't have 'x' in the 4th column (user permissions)?
Comment 27 Marc Jeffrey Driftmeyer 2009-12-22 19:30:26 UTC
I know umask is a user setting. I was just being redundant.

At any rate chmod for .local/settings/mime are 700 and for the following subdirectories:
packages 700
video 755
text 755
model 755
image 755
audio 755
application 755

for overkill, mime.cache is 644
Comment 28 David Faure 2009-12-22 20:28:49 UTC
7xx is fine and shouldn't have led to the crash. Maybe it's one of the /usr/share/mime subdirectories that doesn't have +x for your user? There has to be a reason it crashed, and up to now the only reason I found was un-listable directories.
Comment 29 Marc Jeffrey Driftmeyer 2009-12-23 01:09:48 UTC
There are no subdirectories I've listed sourced below the paths I cited above with 7xx.

However, there are now two source globs:

-rw-r--r-- 1 mdriftmeyer mdriftmeyer  937 Dec 22 10:10 globs2
-rw-r--r-- 1 mdriftmeyer mdriftmeyer  844 Dec 22 10:10 globs

globs2
# This file was automatically generated by the
# update-mime-database command. DO NOT EDIT!
50:image/sun-raster:*.rs
50:application/x-skype:*.skype
50:audio/annodex:*.axa
50:application/mathematica:*.nb
50:video/x-mpeg2:*.mp2ve
50:video/x-ms-wax:*.wva
50:application/adrift:*.amf
50:audio/x-amf:*.amf
50:application/mathematica:*.m
50:video/anim:*.anim
50:application/x-squeak-object:*.sqo
50:application/mathematicaplayer:*.nbp
50:application/x-ms-wmp:*.wmp
50:video/x-ms-wmp:*.wmp
50:application/mpeg4-iod:*.mpg4
50:application/mpeg4-muxcodetable:*.mpg4
50:audio/mpeg4:*.mpg4
50:video/mpeg4:*.mpg4
50:application/x-ms-wms:*.wms
50:application/x-squeak-source:*.sts
50:application/x-silverlight:*.scr
50:audio/168sv:*.16sv
50:audio/x-16sv:*.16sv
50:video/annodex:*.axv
50:application/annodex:*.anx
50:audio/3gpp2:*.3gpp2
50:video/3gpp2:*.3gpp2
50:video/x-mpeg2:*.mpv2
50:audio/8svx:*.8svx
50:audio/x-8svx:*.8svx
50:audio/x-mpeg:*.mpega

globs
# This file was automatically generated by the
# update-mime-database command. DO NOT EDIT!
image/sun-raster:*.rs
application/x-skype:*.skype
audio/annodex:*.axa
application/mathematica:*.nb
video/x-mpeg2:*.mp2ve
video/x-ms-wax:*.wva
application/adrift:*.amf
audio/x-amf:*.amf
application/mathematica:*.m
video/anim:*.anim
application/x-squeak-object:*.sqo
application/mathematicaplayer:*.nbp
application/x-ms-wmp:*.wmp
video/x-ms-wmp:*.wmp
application/mpeg4-iod:*.mpg4
application/mpeg4-muxcodetable:*.mpg4
audio/mpeg4:*.mpg4
video/mpeg4:*.mpg4
application/x-ms-wms:*.wms
application/x-squeak-source:*.sts
application/x-silverlight:*.scr
audio/168sv:*.16sv
audio/x-16sv:*.16sv
video/annodex:*.axv
application/annodex:*.anx
audio/3gpp2:*.3gpp2
video/3gpp2:*.3gpp2
video/x-mpeg2:*.mpv2
audio/8svx:*.8svx
audio/x-8svx:*.8svx
audio/x-mpeg:*.mpega

I'm clearly in the dark as to how the mime data pool of information gets touched via their xml files and how Debian does it.

Current content of .~/.local/share/mime

drwx------ 2 mdriftmeyer mdriftmeyer  12K Dec  4 09:09 packages
-rw-r--r-- 1 mdriftmeyer mdriftmeyer    0 Dec 22 10:10 XMLnamespaces
drwxr-xr-x 2 mdriftmeyer mdriftmeyer 4.0K Dec 22 10:10 video
-rw-r--r-- 1 mdriftmeyer mdriftmeyer 2.6K Dec 22 10:10 types
-rw-r--r-- 1 mdriftmeyer mdriftmeyer   16 Dec 22 10:10 treemagic
drwxr-xr-x 2 mdriftmeyer mdriftmeyer 4.0K Dec 22 10:10 text
-rw-r--r-- 1 mdriftmeyer mdriftmeyer    0 Dec 22 10:10 subclasses
drwxr-xr-x 2 mdriftmeyer mdriftmeyer 4.0K Dec 22 10:10 model
-rw-r--r-- 1 mdriftmeyer mdriftmeyer 2.8K Dec 22 10:10 mime.cache
-rw-r--r-- 1 mdriftmeyer mdriftmeyer   12 Dec 22 10:10 magic
drwxr-xr-x 2 mdriftmeyer mdriftmeyer 4.0K Dec 22 10:10 image
-rw-r--r-- 1 mdriftmeyer mdriftmeyer  178 Dec 22 10:10 icons
-rw-r--r-- 1 mdriftmeyer mdriftmeyer  937 Dec 22 10:10 globs2
-rw-r--r-- 1 mdriftmeyer mdriftmeyer  844 Dec 22 10:10 globs
-rw-r--r-- 1 mdriftmeyer mdriftmeyer    0 Dec 22 10:10 generic-icons
drwxr-xr-x 2 mdriftmeyer mdriftmeyer 4.0K Dec 22 10:10 audio
drwxr-xr-x 2 mdriftmeyer mdriftmeyer 4.0K Dec 22 10:10 application
-rw-r--r-- 1 mdriftmeyer mdriftmeyer    0 Dec 22 10:10 aliases

every file underneath their respective folders are 644 xml files.
Comment 30 Christoph Feck 2010-01-09 14:25:52 UTC
*** Bug 221873 has been marked as a duplicate of this bug. ***
Comment 31 Christoph Feck 2010-01-09 14:26:34 UTC
*** Bug 221874 has been marked as a duplicate of this bug. ***
Comment 32 Christoph Feck 2010-01-09 16:42:57 UTC
*** Bug 221924 has been marked as a duplicate of this bug. ***
Comment 33 Christoph Feck 2010-01-11 15:36:56 UTC
*** Bug 222224 has been marked as a duplicate of this bug. ***
Comment 34 David Faure 2010-01-21 19:16:39 UTC
Fix backported for 4.3.5.

I still don't understand why it was crashing for people with a correct umask (user-readable subdirs) though. Maybe a race condition, stuff being regenerated by update-mime-database while kbuildsycoca4 was running. Anyway, please shout if you're still getting the crash with 4.3.5 or later. Or if some mimetypes are suddenly unknown at random points in time...
Comment 35 Christoph Feck 2010-01-25 17:03:47 UTC
*** Bug 224124 has been marked as a duplicate of this bug. ***
Comment 36 Christoph Feck 2010-01-25 23:18:59 UTC
*** Bug 224251 has been marked as a duplicate of this bug. ***
Comment 37 David Faure 2010-02-24 22:42:12 UTC
*** Bug 228379 has been marked as a duplicate of this bug. ***
Comment 38 Christoph Feck 2010-03-02 03:58:15 UTC
*** Bug 229094 has been marked as a duplicate of this bug. ***
Comment 39 David Faure 2015-09-19 23:07:24 UTC
Looks fixed, it didn't happen again after 4.4.