doubled entries in ksycoca?

David Faure faure at kde.org
Mon Jun 30 12:18:34 BST 2008


On Saturday 28 June 2008, Christian Ehrlicher wrote:
> David Faure schrieb:
> > On Friday 27 June 2008, Christian Ehrlicher wrote:
> >> Hi,
> >>
> >> while trying to fix ksyscocatest on windows I found a problem in my 
> >> ksycoca cache. Some entries doubled.
> >> Digging a little bit deeper I found out that the doubles are written in
> >> KBuildMimeTypeFactory::savePatternLists() --> m_fastPatternDict->save(str)
> >>
> >> I added some debug output:
> >>
> >> keyStr offset &payload
> >> "asc" 78230 0x1e7ef58
> >> "asc" 82709 0x1ea07f8
> >> "asc" 82709 0x1eb2610
> >> "asc" 127207 0x1e17c48
> > 
> > Yes, this simply means you have multiple mimetypes associated with the same pattern *.asc.
> > Same here:
> > KBuildMimeTypeFactory::savePatternLists: mimeType "application/pgp-keys" has patterns ("*.skr", "*.asc", "*.pkr")
> > KBuildMimeTypeFactory::savePatternLists: mimeType "text/plain" has patterns ("*.asc", "*.txt", "*.doc")
> > KBuildMimeTypeFactory::savePatternLists: mimeType "application/pgp-encrypted" has patterns ("*.asc", "*.gpg","*.pgp")
> > 
> > I added support for KSycocaDict being used as a multihash (multiple instances of a key), when I wrote
> > the shared-mime-info support, see KSycocaDict::findMultiString.
> > And this is indeed what KMimeTypeFactory::findFromFastPatternDict uses, to get all mimetypes matching a given extension.
> > After that, KMimeType::findByUrlHelper chooses between those mimetypes by using sniffing.
> > I still have to implement the support for the new pattern (=glob) priority concept from shared-mime-info,
> > but it's pointless to do so before more people actually have an updated shared-mime-info :)
> > 
> The problem is that it breaks the kmimetypetest in line 233:

That test is about a foo.txt file that contains a PDF. This is completely unrelated to the *.asc pattern.

> KMimeType::findByUrlHelper() looks for (mimeList.count() == 1) in line 297

Yes (and uses sniffing if there is more than one mimetype in the list).

So, do you have more than one mimetype associated with *.txt? I don't.

-Asterix- dfaure 13:17 /d/kde/build/trunk/kdelibs/kded>../bin/kbuildsycoca4.shell 2>&1 | grep -w '\.txt'
kbuildsycoca4(29270) KBuildMimeTypeFactory::savePatternLists: mimeType "text/plain" has patterns ("*.asc", "*.txt", "*.doc")

--- kbuildmimetypefactory.cpp   (revision 826270)
+++ kbuildmimetypefactory.cpp   (working copy)
@@ -300,6 +300,7 @@ KBuildMimeTypeFactory::savePatternLists(

         const KMimeType::Ptr mimeType = KMimeType::Ptr::staticCast( entry );
         const QStringList pat = mimeType->patterns();
+        kDebug() << "mimeType" << mimeType->name() << "has patterns" << pat;
         QStringList::ConstIterator patit = pat.begin();
         for ( ; patit != pat.end() ; ++patit )
         {


-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list