From: Petter Reinholdtsen Date: Sun, 5 Jun 2016 06:29:30 +0000 (+0200) Subject: Generated. X-Git-Url: https://pere.pagekite.me/gitweb/homepage.git/commitdiff_plain/ca6e2f2e9925f2802157cd3f333af475b71e405b Generated. --- diff --git a/blog/A_program_should_be_able_to_open_its_own_files_on_Linux.html b/blog/A_program_should_be_able_to_open_its_own_files_on_Linux.html new file mode 100644 index 0000000000..58dfa334a0 --- /dev/null +++ b/blog/A_program_should_be_able_to_open_its_own_files_on_Linux.html @@ -0,0 +1,508 @@ + + + + + Petter Reinholdtsen: A program should be able to open its own files on Linux + + + + + + +
+

+ Petter Reinholdtsen + +

+ +
+ + +
+
A program should be able to open its own files on Linux
+
5th June 2016
+

Many years ago, when koffice was fresh and with few users, I +decided to test its presentation tool when making the slides for a +talk I was giving for NUUG on Japhar, a free Java virtual machine. I +wrote the first draft of the slides, saved the result and went to bed +the day before I would give the talk. The next day I took a plane to +the location where the meeting should take place, and on the plane I +started up koffice again to polish the talk a bit, only to discover +that kpresenter refused to load its own data file. I cursed a bit and +started making the slides again from memory, to have something to +present when I arrived. I tested that the saved files could be +loaded, and the day seemed to be rescued. I continued to polish the +slides until I suddenly discovered that the saved file could no longer +be loaded into kpresenter. In the end I had to rewrite the slides +three times, condensing the content until the talk became shorter and +shorter. After the talk I was able to pinpoint the problem – +kpresenter wrote inline images in a way itself could not understand. +Eventually that bug was fixed and kpresenter ended up being a great +program to make slides. The point I'm trying to make is that we +expect a program to be able to load its own data files, and it is +embarrassing to its developers if it can't.

+ +

Did you ever experience a program failing to load its own data +files from the desktop file browser? It is not a uncommon problem. A +while back I discovered that the screencast recorder +gtk-recordmydesktop would save an Ogg Theora video file the KDE file +browser would refuse to open. No video player claimed to understand +such file. I tracked down the cause being file --mime-type +returning the application/ogg mime type, which no video player I had +installed listed as a MIME type they would understand. I asked for +file to change its +behavour and use the MIME type video/ogg instead. I also asked +several video players to add video/ogg to their desktop files, to give +the file browser an idea what to do about Ogg Theora files. After a +while, the desktop file browsers in Debian started to handle the +output from gtk-recordmydesktop properly.

+ +

But history repeats itself. A few days ago I tested the music +system Rosegarden again, and I discovered that the KDE and xfce file +browsers did not know what to do with the Rosegarden project files +(*.rg). I've reported the +rosegarden problem to BTS and a fix is commited to git and will be +included in the next upload. To increase the chance of me remembering +how to fix the problem next time some program fail to load its files +from the file browser, here are some notes on how to fix it.

+ +

The file browsers in Debian in general operates on MIME types. +There are two sources for a given files MIME type. The output from +file --mime-type mentioned above, and the content of the +shared MIME type registry (under /usr/share/mime/). The file mime +type is mapped to programs supporting the mime type, and this +information is collected from +the +desktop files available in /usr/share/applications/. If there is +one desktop file claiming support for the MIME type of the file, it is +activated when asking to open a given file. If there are more, one +can normally select which one to use by right-clicking on the file and +selecting the wanted one using 'Open with' or similar. In general +this work well. But it depend on each program picking a good mime +type (preferably +a +MIME type registered with IANA), file and/or the shared mime +registry recognizing the file and the desktop file to list the MIME +type in its list of supported MIME types.

+ +

The /usr/share/mime/packages/rosegarden.xml entry for +the +Shared MIME database look like this:

+ +

+<?xml version="1.0" encoding="UTF-8"?>
+<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
+  <mime-type type="audio/x-rosegarden">
+    <sub-class-of type="application/x-gzip"/>
+    <comment>Rosegarden project file</comment>
+    <glob pattern="*.rg"/>
+  </mime-type>
+</mime-info>
+

+ +

This states that audio/x-rosegarden is a kind of application/x-gzip +(it is a gzipped XML file). Note, it is much better to use an +official MIME type registered with IANA than it is to make up ones own +unofficial ones like the x-rosegarden type used by rosegarden.

+ +

The desktop file of the rosegarden program failed to list +audio/x-rosegarden in its list of supported MIME types, causing the +file browsers to have no idea what to do with *.rg files:

+ +

+% grep Mime /usr/share/applications/rosegarden.desktop
+MimeType=audio/x-rosegarden-composition;audio/x-rosegarden-device;audio/x-rosegarden-project;audio/x-rosegarden-template;audio/midi;
+X-KDE-NativeMimeType=audio/x-rosegarden-composition
+%
+

+ +

The fix was to add "audio/x-rosegarden;" at the end of the +MimeType= line.

+ +

If you run into a file which fail to open the correct program when +selected from the file browser, please check out the output from +file --mime-type for the file, ensure the file ending and +MIME type is registered somewhere under /usr/share/mime/ and check +that some desktop file under /usr/share/applications/ is claiming +support for this MIME type. If not, please report a bug to have it +fixed. :)

+
+ +
Tags: debian, english.
+ + +
+ + + + + +

+ Created by Chronicle v4.6 +

+ + + diff --git a/blog/archive/2016/06/06.rss b/blog/archive/2016/06/06.rss new file mode 100644 index 0000000000..93fbcee37c --- /dev/null +++ b/blog/archive/2016/06/06.rss @@ -0,0 +1,123 @@ + + + + Petter Reinholdtsen - Entries from June 2016 + Entries from June 2016 + http://people.skolelinux.org/pere/blog/ + + + + A program should be able to open its own files on Linux + http://people.skolelinux.org/pere/blog/A_program_should_be_able_to_open_its_own_files_on_Linux.html + http://people.skolelinux.org/pere/blog/A_program_should_be_able_to_open_its_own_files_on_Linux.html + Sun, 5 Jun 2016 08:30:00 +0200 + <p>Many years ago, when koffice was fresh and with few users, I +decided to test its presentation tool when making the slides for a +talk I was giving for NUUG on Japhar, a free Java virtual machine. I +wrote the first draft of the slides, saved the result and went to bed +the day before I would give the talk. The next day I took a plane to +the location where the meeting should take place, and on the plane I +started up koffice again to polish the talk a bit, only to discover +that kpresenter refused to load its own data file. I cursed a bit and +started making the slides again from memory, to have something to +present when I arrived. I tested that the saved files could be +loaded, and the day seemed to be rescued. I continued to polish the +slides until I suddenly discovered that the saved file could no longer +be loaded into kpresenter. In the end I had to rewrite the slides +three times, condensing the content until the talk became shorter and +shorter. After the talk I was able to pinpoint the problem &ndash; +kpresenter wrote inline images in a way itself could not understand. +Eventually that bug was fixed and kpresenter ended up being a great +program to make slides. The point I'm trying to make is that we +expect a program to be able to load its own data files, and it is +embarrassing to its developers if it can't.</p> + +<p>Did you ever experience a program failing to load its own data +files from the desktop file browser? It is not a uncommon problem. A +while back I discovered that the screencast recorder +gtk-recordmydesktop would save an Ogg Theora video file the KDE file +browser would refuse to open. No video player claimed to understand +such file. I tracked down the cause being <tt>file --mime-type</tt> +returning the application/ogg mime type, which no video player I had +installed listed as a MIME type they would understand. I asked for +<a href="http://bugs.gw.com/view.php?id=382">file to change its +behavour</a> and use the MIME type video/ogg instead. I also asked +several video players to add video/ogg to their desktop files, to give +the file browser an idea what to do about Ogg Theora files. After a +while, the desktop file browsers in Debian started to handle the +output from gtk-recordmydesktop properly.</p> + +<p>But history repeats itself. A few days ago I tested the music +system Rosegarden again, and I discovered that the KDE and xfce file +browsers did not know what to do with the Rosegarden project files +(*.rg). I've reported <a href="http://bugs.debian.org/825993">the +rosegarden problem to BTS</a> and a fix is commited to git and will be +included in the next upload. To increase the chance of me remembering +how to fix the problem next time some program fail to load its files +from the file browser, here are some notes on how to fix it.</p> + +<p>The file browsers in Debian in general operates on MIME types. +There are two sources for a given files MIME type. The output from +<tt>file --mime-type</tt> mentioned above, and the content of the +shared MIME type registry (under /usr/share/mime/). The file mime +type is mapped to programs supporting the mime type, and this +information is collected from +<a href="https://www.freedesktop.org/wiki/Specifications/desktop-entry-spec/">the +desktop files</a> available in /usr/share/applications/. If there is +one desktop file claiming support for the MIME type of the file, it is +activated when asking to open a given file. If there are more, one +can normally select which one to use by right-clicking on the file and +selecting the wanted one using 'Open with' or similar. In general +this work well. But it depend on each program picking a good mime +type (preferably +<a href="http://www.iana.org/assignments/media-types/media-types.xhtml">a +MIME type registered with IANA</a>), file and/or the shared mime +registry recognizing the file and the desktop file to list the MIME +type in its list of supported MIME types.</p> + +<p>The <tt>/usr/share/mime/packages/rosegarden.xml</tt> entry for +<a href="http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec">the +Shared MIME database</a> look like this:</p> + +<p><blockquote><pre> +&lt;?xml version="1.0" encoding="UTF-8"?&gt; +&lt;mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"&gt; + &lt;mime-type type="audio/x-rosegarden"&gt; + &lt;sub-class-of type="application/x-gzip"/&gt; + &lt;comment&gt;Rosegarden project file&lt;/comment&gt; + &lt;glob pattern="*.rg"/&gt; + &lt;/mime-type&gt; +&lt;/mime-info&gt; +</pre></blockquote></p> + +<p>This states that audio/x-rosegarden is a kind of application/x-gzip +(it is a gzipped XML file). Note, it is much better to use an +official MIME type registered with IANA than it is to make up ones own +unofficial ones like the x-rosegarden type used by rosegarden.</p> + +<p>The desktop file of the rosegarden program failed to list +audio/x-rosegarden in its list of supported MIME types, causing the +file browsers to have no idea what to do with *.rg files:</p> + +<p><blockquote><pre> +% grep Mime /usr/share/applications/rosegarden.desktop +MimeType=audio/x-rosegarden-composition;audio/x-rosegarden-device;audio/x-rosegarden-project;audio/x-rosegarden-template;audio/midi; +X-KDE-NativeMimeType=audio/x-rosegarden-composition +% +</pre></blockquote></p> + +<p>The fix was to add "audio/x-rosegarden;" at the end of the +MimeType= line.</p> + +<p>If you run into a file which fail to open the correct program when +selected from the file browser, please check out the output from +<tt>file --mime-type</tt> for the file, ensure the file ending and +MIME type is registered somewhere under /usr/share/mime/ and check +that some desktop file under /usr/share/applications/ is claiming +support for this MIME type. If not, please report a bug to have it +fixed. :)</p> + + + + + diff --git a/blog/archive/2016/06/index.html b/blog/archive/2016/06/index.html new file mode 100644 index 0000000000..0a84b746dd --- /dev/null +++ b/blog/archive/2016/06/index.html @@ -0,0 +1,518 @@ + + + + + Petter Reinholdtsen: entries from June 2016 + + + + + + +
+

+ Petter Reinholdtsen + +

+ +
+ + +

Entries from June 2016.

+ +
+ +
+ 5th June 2016 +
+
+

Many years ago, when koffice was fresh and with few users, I +decided to test its presentation tool when making the slides for a +talk I was giving for NUUG on Japhar, a free Java virtual machine. I +wrote the first draft of the slides, saved the result and went to bed +the day before I would give the talk. The next day I took a plane to +the location where the meeting should take place, and on the plane I +started up koffice again to polish the talk a bit, only to discover +that kpresenter refused to load its own data file. I cursed a bit and +started making the slides again from memory, to have something to +present when I arrived. I tested that the saved files could be +loaded, and the day seemed to be rescued. I continued to polish the +slides until I suddenly discovered that the saved file could no longer +be loaded into kpresenter. In the end I had to rewrite the slides +three times, condensing the content until the talk became shorter and +shorter. After the talk I was able to pinpoint the problem – +kpresenter wrote inline images in a way itself could not understand. +Eventually that bug was fixed and kpresenter ended up being a great +program to make slides. The point I'm trying to make is that we +expect a program to be able to load its own data files, and it is +embarrassing to its developers if it can't.

+ +

Did you ever experience a program failing to load its own data +files from the desktop file browser? It is not a uncommon problem. A +while back I discovered that the screencast recorder +gtk-recordmydesktop would save an Ogg Theora video file the KDE file +browser would refuse to open. No video player claimed to understand +such file. I tracked down the cause being file --mime-type +returning the application/ogg mime type, which no video player I had +installed listed as a MIME type they would understand. I asked for +file to change its +behavour and use the MIME type video/ogg instead. I also asked +several video players to add video/ogg to their desktop files, to give +the file browser an idea what to do about Ogg Theora files. After a +while, the desktop file browsers in Debian started to handle the +output from gtk-recordmydesktop properly.

+ +

But history repeats itself. A few days ago I tested the music +system Rosegarden again, and I discovered that the KDE and xfce file +browsers did not know what to do with the Rosegarden project files +(*.rg). I've reported the +rosegarden problem to BTS and a fix is commited to git and will be +included in the next upload. To increase the chance of me remembering +how to fix the problem next time some program fail to load its files +from the file browser, here are some notes on how to fix it.

+ +

The file browsers in Debian in general operates on MIME types. +There are two sources for a given files MIME type. The output from +file --mime-type mentioned above, and the content of the +shared MIME type registry (under /usr/share/mime/). The file mime +type is mapped to programs supporting the mime type, and this +information is collected from +the +desktop files available in /usr/share/applications/. If there is +one desktop file claiming support for the MIME type of the file, it is +activated when asking to open a given file. If there are more, one +can normally select which one to use by right-clicking on the file and +selecting the wanted one using 'Open with' or similar. In general +this work well. But it depend on each program picking a good mime +type (preferably +a +MIME type registered with IANA), file and/or the shared mime +registry recognizing the file and the desktop file to list the MIME +type in its list of supported MIME types.

+ +

The /usr/share/mime/packages/rosegarden.xml entry for +the +Shared MIME database look like this:

+ +

+<?xml version="1.0" encoding="UTF-8"?>
+<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
+  <mime-type type="audio/x-rosegarden">
+    <sub-class-of type="application/x-gzip"/>
+    <comment>Rosegarden project file</comment>
+    <glob pattern="*.rg"/>
+  </mime-type>
+</mime-info>
+

+ +

This states that audio/x-rosegarden is a kind of application/x-gzip +(it is a gzipped XML file). Note, it is much better to use an +official MIME type registered with IANA than it is to make up ones own +unofficial ones like the x-rosegarden type used by rosegarden.

+ +

The desktop file of the rosegarden program failed to list +audio/x-rosegarden in its list of supported MIME types, causing the +file browsers to have no idea what to do with *.rg files:

+ +

+% grep Mime /usr/share/applications/rosegarden.desktop
+MimeType=audio/x-rosegarden-composition;audio/x-rosegarden-device;audio/x-rosegarden-project;audio/x-rosegarden-template;audio/midi;
+X-KDE-NativeMimeType=audio/x-rosegarden-composition
+%
+

+ +

The fix was to add "audio/x-rosegarden;" at the end of the +MimeType= line.

+ +

If you run into a file which fail to open the correct program when +selected from the file browser, please check out the output from +file --mime-type for the file, ensure the file ending and +MIME type is registered somewhere under /usr/share/mime/ and check +that some desktop file under /usr/share/applications/ is claiming +support for this MIME type. If not, please report a bug to have it +fixed. :)

+ +
+
+ + + Tags: debian, english. + + +
+
+
+ +

RSS Feed

+ +

+ Created by Chronicle v4.6 +

+ + +