[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn_mime_type_is_binary, libmagic and application/xml

From: Johan Corveleyn <jcorvel_at_gmail.com>
Date: Wed, 20 Nov 2013 09:19:16 +0100

On Wed, Nov 20, 2013 at 8:39 AM, Stefan Sperling <stsp_at_elego.de> wrote:
> On Tue, Nov 19, 2013 at 11:23:39PM -0800, Ben Reser wrote:
>> 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.
>>
>> Thoughts?
>
> Hmm... I don't see a need to change anything.
>
> libmagic is used as a last resort. Subversion already offers several
> ways of configuring the svn:mime-type property, all of which supersede
> libmagic (svn propset/propedit, auto-props, svn:auto-props).
> So unless there is a really good reason why any of these cannot be used,
> I think we should tell our users to configure their clients appropriately.
>
> Additionally, users can use their own MAGIC files to control what
> mime-types libmagic gives to Subversion. We don't need to replicate
> this functionality in Subversion itself.
>
> libmagic uses a heuristic, so it can get things wrong. But if we start
> filtering libmagic output for the purpose of treating XML documents
> as text, we could eventually end up with a huge list of hard-coded
> exceptions for all sorts of things. Where do we stop? How can we make
> sure that everyone will be happy with a list we make up?
> The whole point of relying on libmagic is to avoid such a list.

I'm not sure, but isn't libmagic support in svn unix-only? I've never
seen it being part of a Windows build. Maybe there's a Windows
alternative, but I've never seen it in an svn build.

And even with libmagic (or something similar), it would be really nice
if one could configure in svn (client and/or server-dictated) the
mime-types which should be considered text. That would nicely separate
the detection of file type from the decision of which type is
considered text.

The glob patterns would also be very useful IMO, especially for
Windows, where file extensions are still a very common way to denote
file type, and where as I said, there seems to be no libmagic.

So I'm +1 on Ben's proposal.

IIUC, this would address issue #1002 [1] and all its duplicates.

[1] http://subversion.tigris.org/issues/show_bug.cgi?id=1002 - Need
in-repo configuration for list of mime types considered text vs binary

-- 
Johan
Received on 2013-11-20 09:20:13 CET

This is an archived mail posted to the Subversion Dev mailing list.