Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 05-05-2013, 10:43 AM   #1
Registered: Apr 2013
Distribution: Slackware
Posts: 81

Rep: Reputation: Disabled
xdg-mime & svgz files issue

Hi fellow Slackers,

just cann't figure out why in Slackware xdg-mime from xdg-utils does return wrong mime-type whereas the same tool in Arch Linux show the correct one. Applied on the same file, of course.
$ xdg-mime query filetype Documents/spree_objtree-scheme.svgz
application/x-gzip; charset=binary
Expected result image/svg+xml-compressed; charset=binary.

I've found there are records for 'image/svg+xml-compressed' mime-type in several files in /usr/share/mime but don't know where and how to fix this issue.
Tried after mime cache was updated with update-mime-database.
Old 05-05-2013, 05:08 PM   #2
Registered: Nov 2003
Posts: 391

Rep: Reputation: Disabled
This is happening because Slackware uses the original xdg-utils package, containing xdg-mime, where as other distributions (those based on Debian, at least) have modified the command.

The original xdg-mime, and the one in Slackware, uses the command 'file -i' (absent KDE or GNOME) to determine the filetype. This mostly looks at the contents of the file, not the filename. It does NOT use the shared MIME database at /usr/share/mime/. Therefore your compressed SVG file is recognized as a gzip compressed file (which it is, on the surface).

One of the changes Debian made to 'xdg-mime' is to have it use a command 'mimetype' (not present on Slackware) instead of 'file'. 'mimetype' works like 'file' but queries the shared MIME database, not the 'file magic' database. The shared MIME database bases its answer on the filename, not the contents. Therefore your *.svgz file is seen as compressed SVG.

In my opinion, Debian's fix just moves the errors somewhere else. For example, take a JPEG file and rename it to test.png. On Slackware, 'xdg-mime query filetype test.png' correctly identifies it as JPEG, where as the same command on Xubuntu believes it is now a PNG file.

Hope this helps explain it, if not fix it for you.
2 members found this post helpful.
Old 05-06-2013, 09:40 AM   #3
Registered: Apr 2013
Distribution: Slackware
Posts: 81

Original Poster
Rep: Reputation: Disabled
Great comprehensive answer, ljb643.

Thank you.


associations, mimetypes

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
XDG MIME type for .desktop file? akamikeym Linux - General 2 09-19-2012 09:28 AM
xdg-mime file type halj Linux - Software 0 08-17-2011 01:53 PM
a weird xdg-open issue Oxpoto Linux - Software 0 07-23-2011 03:56 AM
xdg-mime linuxsavar Programming 0 10-10-2008 07:25 AM
Strip Mime & HTML from MBOX files Andrew_OC Linux - Server 8 03-28-2007 03:18 AM > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:48 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration