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

Re: Bug report: The auto-props setting of svn:mime-type is impossible to avoid.

From: Ryan Schmidt <subversion-2015_at_ryandesign.com>
Date: Sat, 3 Oct 2015 04:12:40 -0500

On Oct 3, 2015, at 3:25 AM, Edward d'Auvergne wrote:

> On 2 October 2015 at 11:33, Stefan Sperling wrote:
>
>> - configure autoprops for *.xml in ~/.subversion/config to set
>> the svn:mime-type property to 'text/plain'.
>> Autoprops always override automatic detection with libmagic.
>
> From the perspective of Subversion users, libmagic is a 3rd party. We
> cannot trust them to not change the magic file again to something that
> treats text files in svn as binary files. This FG aircraft repository
> is one of the biggest version controlled repositories in the open
> source world, by far. It has an incredible diversity of text files
> with different extensions, and we would like these to forever be
> treated as text. Due to the bad behaviour of libmagic, banning
> svn:mime-type from the FG repository is the only practical option.

So configure autoprops correctly for those various extensions.

You can even use repository-dictated configuration to make those autoprops definitions automatic for all your diverse users.

http://blogs.collab.net/subversion/the-road-to-repository-dictated-configuration-day-2-autoprops#.Vg-ZjbRobfA

On Oct 3, 2015, at 3:48 AM, Edward d'Auvergne wrote:

> The damage is to the repository backend and to the development process
> itself. Treating text files as binary has a number of significant
> consequences for development. For example:
>
> - 'svn up' can no longer perform merges (G).
> - 'svn merge' or the svnmerge.py script can no longer function to
> merge changes to the same file.
> - A one character change to a massive text file results in a diff and
> db/revs backend file the size of the whole file, and not just a few
> lines for a proper diff.
> - Changes can no longer be reviewed (
> https://sourceforge.net/p/flightgear/mailman/flightgear-fgaddon-commitlogs/
> ).
>
> This is a severe bug.

Not a bug: intended behavior for binary files. The "bug" is that Subversion, via libmagic, has decided a file is binary, when you consider it to be text.

The XML specification defines a number of correct MIME types for XML files, including some beginning with "text/xml" (intended for human-readable XML files) and "application/xml" (intended for XML files not meant for humans to read). libmagic can identify whether a file is XML, but it cannot know whether the file is meant for human consumption, so it picks on of these. The person committing the file can correct this prior to committing if it is inaccurate. Or if you don't want the property set at all, use autoprops.

> Here is an interesting sign as well:
>
> $ svn propset svn:mime-type "application/xml" dash-set.xml
> svn: warning: 'application/xml' is a binary mime-type but file
> '/flightgear/repo_testing/mimetype/test1/DaSH_svn_import/dash-set.xml'
> looks like text; diff, merge, blame, and other operations will stop
> working on this file
> property 'svn:mime-type' set on 'dash-set.xml'
> $
>
> Unfortunately 'svn add' and 'svn import' set this binary mime-type
> without warning, and when explicitly told not to.

Subversion doesn't do things without being told to do so. There are defaults for how MIME types are set on files, which you can override.

> Manually monitoring this huge beast is out of the question.

Of course you wouldn't monitor it manually; you would monitor it via a pre-commit hook script that prevents commits that don't conform to your requirements.
Received on 2015-10-03 11:13:04 CEST

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.