kde4 mime-list is broken for iso file associations -- they appear as text files

Has any one noticed the before and after download of an ISO file? During the download it initially shows a cd/dvd icon representation for the ISO file.
But, upon completion of the download, it changes to a text-plain file association.

I just downloaded the openSUSE-13 1.1-KDE-Live-x86_64.iso and it appears as a plain text document.
The applications associated with it are kate, kwrite, LibreOffice Writer

When I type:

file --mime-type openSUSE-13\ 1.1-KDE-Live-x86_64.iso

The result is:

openSUSE-13 1.1-KDE-Live-x86_64.iso: application/octet-stream

In Configure Desktop–>Common Appearance and Behavior–>File Associations–>application/octet-stream is unknown.

This is a bug which KDE4 devs have marked as fixed. The problem is that I remember this working in openSUSE 13.1 and earlier releases of KDE4 i.e. KDE4.11- 4.12x - 4.13x- 4.14.1.

I’ve noticed the same thing. Very odd, indeed. I have the same thing on both my desktop and laptop, both running 13.2

I have an ISO folder where I’ve stored some iso image files for VirtualBox.
The iso files downloaded with openSUSE 13.1 where shared-mime-info v1.1 was used are okay. That is if they are on a partition running openSUSE 13.1.

I’ve submitted a Bugzilla report: http://bugzilla.opensuse.org/show_bug.cgi?id=904100
However, the freedesktop creators of shared-mime-info database say it may not be a bug from their end.
GNOME’s nautilus file manager does not have this problem.

See: https://bugs.freedesktop.org/show_bug.cgi?id=80877

So, the problem has been forwarded upstream to the KDE/dolphin devs. See: https://bugs.kde.org/show_bug.cgi?id=337035

A simple workaround is to make a file association with k3b and acetoneiso2.

Thanks for the info, and for following through with the bug report!

FIX HAS BEEN FOUND

I found a fix for the broken ISO file associations. A special thanks to margueritesu who found the patch that created this mess.
A patch that was added between 1.2 and 1.3 referring to** “x-wii-rom”** broke the ISO.

Here are the steps:

  1. Open konsole and type kdesu kwrite – then your password
  2. Navigate to /usr/share/mime/packages/freedesktop.org.xml
  3. Open freedesktop.org.xml
  4. In kwrite navigate to Edit -->Go to Line
  5. Type in: 7951
    and press <enter> 1. At the beginning of the line 7951
    type <!-- in front of <mime-type type=“application/x-wii-rom”> 1. Type in: 7972
    and press <enter> 1. At the end of line 7972 – add this → after </mime-type> →
  6. Save your changes and close kwrite

The entire “application/x-wii-rom” and “application-x-gamecube-rom” block example appears below:

 <!--  <mime-type type="application/x-wii-rom">
    <comment>Wii disc image</comment>
    <alias type="application/x-wii-iso-image"/>
    <alias type="application/x-wbfs"/>
    <alias type="application/x-wia"/>
    <generic-icon name="application-x-executable"/>
    <glob pattern="*.iso"/>
    <magic priority="50">
      <match value="0x5d1c9ea3" type="big32" offset="24"/>
      <match value="WBFS" type="string" offset="0"/>
      <match value="WII\001DISC" type="string" offset="0"/>
    </magic>
  </mime-type>
  <mime-type type="application/x-gamecube-rom">
    <comment>GameCube disc image</comment>
    <generic-icon name="application-x-executable"/>
    <alias type="application/x-gamecube-iso-image"/>
    <glob pattern="*.iso"/>
    <magic priority="50">
      <match value="0xc2339f3d" type="big32" offset="28"/>
    </magic>
  </mime-type> -->

Once the entire “Wii disc image” and “GameCube disc image” block has been commented out the ISO image files return to the correct association.

**Note: **You may have to run in konsole or xterm:

update-mime-database /usr/share/mime/

Thank you both for the work around! :slight_smile: I can confirm this works.

I would like to follow up on my title " FIX HAS BEEN FOUND ". This is not an official openSUSE fix.
This is a fix recommended by me on the openSUSE forum and margueritesu on bugs.kde.org.

A very big thank you to margueritesu. The discrepancy was found with one of the patches.
Ref: http://cgit.freedesktop.org/xdg/shared-mime-info/log

One of the Archlinuxwiki users downgraded an arch package for shared-mime-info v1.2 and it fixed the problem.

Since openSUSE did not have that package as an rpm package, I downloaded shared-mime-info v1.2 from the freedesktop.org website.
Download from: http://freedesktop.org/wiki/Software/shared-mime-info/

Used the steps below:

  1. First back up /usr/share/mime/packages/freedesktop.org.xml
  2. Download and extract the package shared-mime-info-1.2.tar.xz.to your /home directory
  3. Copy the freedesktop.org.xml file to /usr/share/mime/packages/ directory
  4. Overwrite the original freedesktop.org.xml file

This really works!

This is an alternate option for users that do not want to search for “Wii disc image” and “GameCube disc” image entry and commenting it out.
IMHO It’s still faster to comment it out.

For reference, please read: https://bugs.freedesktop.org/show_bug.cgi?id=80877#c5
And: https://bugs.kde.org/show_bug.cgi?id=337035
Ref: https://bugzilla.opensuse.org/show_bug.cgi?id=904100

Hi,

Running 13.2 with stock KDE here and i ran into that issue as well. Editing

/usr/share/mime/packages/freedesktop.org.xml

and running

update-mime-database /usr/share/mime/

after that does the job/fix completely.

Here is how i did it.

First backup any file you are editing no matter how/which editor you are using.

cp -v /usr/share/mime/packages/freedesktop.org.xml /tmp

Now you can edit that file. I use Unix command based editor **ed. ** (as root)

printf '%s
' '7951s/^/<!-- /' w .  '7972s/$/ -->/' w . | ed -s /usr/share/mime/packages/freedesktop.org.xml

Update the mime database

update-mime-database /usr/share/mime/

Just in case you did something wrong the backup is in

/tmp/freedesktop.org.xml

or just reinstall the package.

shared-mime-info

Again that is how i solve that issue and I’m not saying it is the correct/official fix :wink:

Very nice. Simple and effective. Thanks for providing an alternative.

TIP: If you delete freedesktop.org.xml rather then reinstalling the package just run:

update-mime-database /usr/share/mime/

This will recreate another copy of the same file.

The problem stills exists with KDE4. Why is GNOME’s nautius not having this problem yet dolphin and other file managers do?
Hopefully we will be able to resolve this before the next release of openSUSE in 2015.

I would encourage KDE4 users to test this on Plasma 5.

Follow Up

I have found a third option on repairing the broken association with ISO files. It has been submitted to the people maintaining the “shared-mime-info” package.

  1. Open “dolphin -super user mode”
  2. Start kate or kwrite
  3. Navigate to Edit → Go to Line and type 7200. Press the enter key.

This is the entry for x-cd-image. You will be editing lines 7200 and 7201.

The original entries appears as:

<glob pattern="*.iso"/>
<glob pattern="*.iso9660"/>

Change it to:

<glob weight="60" pattern="*.iso"/>
<glob weight="60" pattern="*.iso9660"/>

Click on Save, close your editor and dolphin.

Open konsole or xterm and log in as “su -” (without the quotes).

Copy and paste the line below and press enter.

update-mime-database /usr/share/mime/

Open dolphin and check the ISO files. You will see the correct CD icon has returned and the files are now recognized as x-cd-image files.

Hi,

here is my short cut to it.

printf '%s
' '7200,7201g/\(<glob:space:]]*\)/s//\1weight="60" /' w | ed -s /usr/share/mime/packages/freedesktop.org.xml

Here is my test run.

cp -v /usr/share/mime/packages/freedesktop.org.xml /tmp
printf '%s
' '7200,7201g/\(<glob:space:]]*\)/s//\1weight="60" /' w | ed -s /tmp/freedesktop.org.xml
diff /usr/share/mime/packages/freedesktop.org.xml /tmp/freedesktop.org.xml
7200,7201c7200,7201
<     <glob pattern="*.iso"/>
<     <glob pattern="*.iso9660"/>
---
>     <glob weight="60" pattern="*.iso"/>
>     <glob weight="60" pattern="*.iso9660"/>

:slight_smile:

Important Follow Up

A patch has been accepted by the maintainers of shared-mime-info.

See: Bump priority for ISO images glob matching](http://cgit.freedesktop.org/xdg/shared-mime-info/commit/)**

Bump priority for ISO images glob matching**

To work-around file managers that cannot use magic to differentiate mime-types. https://bugs.freedesktop.org/show_bug.cgi?id=80877

What’s changed? For the entry for x-cd-image. The original glob pattern entry is:

<glob pattern="*.iso"/>

New entry is:

<glob pattern="*.iso" weight="80"/>

This should be available in the official release later this year.

](http://cgit.freedesktop.org/xdg/shared-mime-info/commit/)

Update now available Dated Feb. 26, 2015

Download and update the patched shared-mime-info 1.4x that fixes the ISO problem. This version is compatible with openSUSE 13.2.

Click on the link below to download the new updated shared-mime-info-1.4x:http://download.opensuse.org/repositories/GNOME:/Factory/openSUSE_Factory/x86_64/shared-mime-info-1.4-57.3.x86_64.rpm

Or install the one from the 13.2 update-test repo:
http://download.opensuse.org/update/13.2-test/

As this is going to be released as official update in the next days anyway, you could probably just as well wait… :wink: