svn_mime_type_is_binary, libmagic and application/xml
From: Ben Reser <ben_at_reser.org>
Date: Tue, 19 Nov 2013 23:23:39 -0800
Libmagic in some cases is flagging XML files as application/xml. Currently we do not treat application/xml as text.
We have had a discussion about this in the past. The main argument against setting application/xml as text was that application/xml should be used for XML files that contain binary data and text only XML files should use text/xml.
For XML files where the degree of textualness (is that a word?) is unknown application/xml was the recommended type. Which makes application/xml the logical output for libmagic.
In the past application/xml being treated as binary wasn't a huge issue since users had to set svn:mime-type or setup auto-props. However, now libmagic is setting XML files as application/XML with no user input. As can be seen on the recent issue opened:
The past conversation on this issue can be found here:
I suggest that we do two things:
1) update our defaults for some mime types to be text
2) make which mime types are treated as text user configurable with a new "text-types" category in ~/.subversion/config. Keys would be mime-types or globs for types and values would be booleans (true if type is text). Unmatched types would behave poet built in details. Built in text types could be overridden by adding an entry and setting it to false.
Most people will expect XML to be treated as text. So this helps them. While leaving people who want a way to preserve existing behavior a way to revert. It also means we don't necessarily have to have perfect defaults.
Lastly this might also be nice to support as a server directed configuration via a svn:texts types property.
This is an archived mail posted to the Subversion Dev mailing list.