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 freedesktop.org.xml
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"/>
    </magic>


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
"x-hex-sgf".

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 freedesktop.org.xml at the moment).

Thanks!
-Adrian

[1]: http://www.red-bean.com/sgf/properties.html
_______________________________________________
xdg mailing list
xdg@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/xdg

Reply via email to