some issues with mime types

Thomas Kluyver thomas at kluyver.me.uk
Sun Jun 10 15:09:49 UTC 2018


On Sat, Jun 9, 2018, at 8:01 PM, kendell clark wrote:
> OK, I feel stupid. Apparently linux doesn't identify everything with a
> .bin extension as sega disk image, it also detects sega saturn rom
> images. However, it does still identify everything else with a .bin
> extension as sega cd disk images, even windows software. I'm not sure
> what can be done about this, it seems impossible to automagically detect
> everything possiblt that uses a .bin extension. Maybe increase the magic
> priority on sega rom types?

Looking at the shared-mime-info xml file on my computer, there are three mime types with a '*.bin' glob pattern:

- application/x-sega-cd-rom (with magic string SEGADISCSYSTEM)
- application/x-saturn-rom (with magic string SEGA SEGASATURN)
- application/octet-stream (no magic)

The last is the generic 'unknown binary' type, so is what it should be using for .bin files unless they're one of the more specific types.

If the tool you're using looks at the file contents to check magic strings, I think it's a bug in that tool if it identifies arbitrary .bin files as Sega CD images. Those files should fail the magic checks for both SEGA file types and fall back to the generic one.

Unfortunately, if it's just going by filename, there's no way for it to reliably get the right type. Making the octet-stream glob higher priority would make it find that. But in that case, tools that follow the recommended steps would never detect the Sega formats, even if they were prepared to do magic sniffing, because if one glob match has higher priority, the recommended steps skip magic sniffing.
https://specifications.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html#idm140625828606432

Thomas


More information about the xdg mailing list