Incorrect definition of x-go-sgf MIME type

Adrian Petrescu apetresc at
Wed Sep 20 21:21:18 UTC 2017

Hello all,

I'm not sure if this is the proper avenue to report this, but: the
<mime-type> definition for application/x-go-sgf in
is subtly incorrect.

The problem is the following section:

    <magic priority="50">
        <match value="(;FF[3]" type="string" offset="0"/>
        <match value="(;FF[4]" type="string" offset="0"/>

While the [SGF spec][1] does indeed require an FF attribute on the
root node telling it which version of the spec it uses, that property
can be *anywhere* on the root node; no part of SGF cares about the
ordering of properties within a node. So a file that started with
"(;CA[UTF-8]FF[4]" would be perfectly valid SGF, and a lot of
commonly-used SGF editors output files like that. I'm not sure if the
mime-type XML schema allows for some sort of regex matching, but if it
does, then perhaps we should be looking for something like
/\(;[^)]*FF\[\d\]/ which works for any SGF that isn't going out of its
way to break this.

In fact, if we wanted to be truly precise, the MIME type "x-go-sgf"
implies that it only applies to Go SGFs (which additionally have a
GM[1] root node property), while an SGF with, say, GM[11] would be an

Is FreeDesktop willing to entertain discussion about this fairly
obscure format? If so, I'd be happy to put together a working example
that correctly matches the SGF formats in actual common use (which are
basically only x-go-sgf and x-hex-sgf, the latter of which doesn't
even exist in at the moment).



More information about the xdg mailing list