Bug 16816 - [PATCH] Add -q option to update-mime-database
Summary: [PATCH] Add -q option to update-mime-database
Status: RESOLVED NOTOURBUG
Alias: None
Product: shared-mime-info
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium enhancement
Assignee: Shared Mime Info group
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-23 05:25 UTC by drago01
Modified: 2018-05-30 09:15 UTC (History)
7 users (show)

See Also:
i915 platform:
i915 features:


Attachments
add -q option to update-mime-database (1.07 KB, patch)
2008-07-23 05:25 UTC, drago01
Details | Splinter Review

Description drago01 2008-07-23 05:25:31 UTC
Created attachment 17837 [details] [review]
add -q option to update-mime-database

Currently  update-mime-database can be very noisy printing a lot of warnings when run. Normally this is not a problem but when run from a rpm scriptlet it shouldn't print anything unless its an error.
The packages can just redirect the output to /dev/null to avoid this but a cleaner solution is a "-q" option that can be passed to update-mime-database.

The attached patch adds it. 

Another solution would be to print warnings only when in verbose mode.
Comment 1 Bastien Nocera 2008-07-23 05:35:17 UTC
Comment on attachment 17837 [details] [review]
add -q option to update-mime-database

There's already a -V for verbose, we should use that instead.
Comment 2 drago01 2008-07-23 05:37:58 UTC
So we should not print warnings unless in verbose mode?
Some messages like "Please run as root" are warnings and they should show up by default.
Comment 3 Samuli Suominen 2009-10-21 07:09:34 UTC
Also a problem for us in Gentoo. 

While I agree that KDE shouldn't be defining these at all, 
they should only show up with some switch.

http://bugs.gentoo.org/261446
Comment 4 Peter 2010-01-09 10:04:10 UTC
I'm not sure, but why

https://bugs.launchpad.net/ubuntu/+source/shared-mime-info/+bug/289592
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=469833
http://bugs.gentoo.org/261446

mention this bug as a "fix"? It looks like kde.xml does something unusual and either this should became allowed in specification or prohibited. But in any case trying to hide the problem does not sound like a good solution. So I guess the real question here is, what do do with the following mime:

  <!-- all/ fake mime types -->
  <mime-type type="all/all">
    <comment>all files and folders</comment>
  </mime-type>

Should update-mime-database warn about them or ignore?
Comment 5 Bastien Nocera 2018-04-16 17:37:39 UTC
(In reply to Peter from comment #4)
>   <!-- all/ fake mime types -->
>   <mime-type type="all/all">
>     <comment>all files and folders</comment>
>   </mime-type>

David, why does KDE define those? Isn't this the same as the "*/*" mime-type?

Do you want to throw together a patch not to print those warnings unless "-V" is passed? Or should we add another exception for "all/*" mimetypes?
Comment 6 David Faure 2018-04-22 11:36:43 UTC
"*/*" isn't more standard than all/all :-)

"*/*" requires support for wildcards which isn't there in specs like https://specifications.freedesktop.org/mime-apps-spec/mime-apps-spec-1.0.1.html

However: all this has been removed from KDE's mimetype file long ago anyway.

commit 36ff1bf60c
Author: Michael Palimaka <kensington@gentoo.org>
Date:   Sat Mar 29 01:23:57 2014 +1100

    Remove fake MIME types.
    They cause warnings when running update-mime-database.
    REVIEW: 117135

This is in ... KDE Frameworks 5.0 already.
So the problem should only happen for people who have kdelibs4 installed, right?
Comment 7 Bastien Nocera 2018-04-22 16:03:15 UTC
(In reply to David Faure from comment #6)
> "*/*" isn't more standard than all/all :-)
> 
> "*/*" requires support for wildcards which isn't there in specs like
> https://specifications.freedesktop.org/mime-apps-spec/mime-apps-spec-1.0.1.
> html

Well, at least */* and similar were used in other RFCs:
https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

In any case:
all/all ~= application/octet-stream + inode/folder
so you wouldn't even need either of those 2 options.

> However: all this has been removed from KDE's mimetype file long ago anyway.
> 
> commit 36ff1bf60c
> Author: Michael Palimaka <kensington@gentoo.org>
> Date:   Sat Mar 29 01:23:57 2014 +1100
> 
>     Remove fake MIME types.
>     They cause warnings when running update-mime-database.
>     REVIEW: 117135
> 
> This is in ... KDE Frameworks 5.0 already.
> So the problem should only happen for people who have kdelibs4 installed,
> right?

I was pointed at a couple of other bug reports which I don't have at hand right now. I'll try to find out what the problem is. It might be an app requiring an old library...
Comment 8 Bastien Nocera 2018-04-23 10:04:42 UTC
Looking at results for the past year in Google search for:
"Unknown media type in type 'all/all'"

There are still tons of warnings because users installed one or more programs that still rely on KDE 4 libraries. I think that KDE 4 libraries should also be fixed.

This is the bug to reopen for KDE4:
https://bugs.kde.org/show_bug.cgi?id=303627

Heck, kdelibs4 is still there as well.
Comment 9 Bastien Nocera 2018-04-23 10:16:55 UTC
Because I'd rather never hear about this warning ever again.

commit fc149b7615deecf3c3af73bcc5ee98a4b716fbac
Author: Bastien Nocera <hadess@hadess.net>
Date:   Mon Apr 23 12:12:00 2018 +0200

    Look in obsolete KDE sub-dirs for clean up opportunities
    
    media_types[] is also used to list the possible directories to look into
    for clean up opportunities, when recreating shared-mime-info's cache.
    
    This will clean up files left-over by old versions of KDE.
    
    https://github.com/KDE/kcoreaddons/commit/36ff1bf60c9b12c28ed4d7566abceac10cab345e
    
    https://bugs.freedesktop.org/show_bug.cgi?id=16816

commit 553aa73de2c6a5bb221bcd9153c2425cd236c703
Author: Bastien Nocera <hadess@hadess.net>
Date:   Mon Apr 23 12:10:29 2018 +0200

    Don't warn with unknown top level type names
    
    Old broken mime-types still lie around, and just won't go away after
    years. I'd rather like never to hear about things that aren't
    shared-mime-info bugs, so drop the priority of the logs to Message.
    
    Use the "-V" to display those again.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=16816


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.