The freedesktop.org shared MIME-info database spec says the following in section 2.11:
A type is a subclass of another type if any instance of the first type is also an instance of the second. For example, all
image/svg+xml
files are alsoapplication/xml
,text/plain
andapplication/octet-stream
files. Subclassing is about the format, rather than the category of the data (for example, there is no ‘generic spreadsheet’ class that all spreadsheets inherit from).Some subclass rules are implicit:
- All
text/*
types are subclasses oftext/plain
.- All streamable types (ie, everything except the
inode/*
types) are subclasses of application/octet-stream.
So far so good; this makes intuitive sense and seems sensible enough. There is
an interesting consequence of this rule when the MIME-info database is used by
desktop systems for file associations, however: An application associated with
application/octet-stream
will automatically be associated with all streamable
types as well.
This means that if you associate application/octet-stream
with your text
editor, your desktop system will also suggest you open video and audio files
with that same text editor. This behaviour can be quite surprising, especially
if the association was added automatically when a file was opened through the
“Open with…” dialog.
What is even more confusing if you don’t happen to know the subclassing rule is
the fact that ~/.config/mimeapps.list
and applications interfacing with this
file will not even list the editor as associated with any audio or video files.
You might just skip over the entry it has for application/octet-stream
, not
realizing its significance. Perhaps you even assume (understandably) that
application/octet-stream
only specifies any file of “unknown” type.
User-facing documentation on desktop systems (if it even exists) does not
discuss this behaviour.
Whilst looking into this I found an older KDE bug report with some interesting thoughts on how to explain this behaviour to the end user, but sadly as far as I have seen none of these have made it into the system setting’s file association dialog.