[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: Stefan Sperling <stsp_at_elego.de>
Date: Fri, 2 Oct 2015 11:33:07 +0200

On Fri, Oct 02, 2015 at 10:06:26AM +0200, Edward d'Auvergne wrote:
> Hi all,
>
> I was wondering if this should be considered a bug. At the FlightGear
> project we have a 6 GB data svn repository for aircraft (
> https://sourceforge.net/projects/flightgear/ ,
> https://sourceforge.net/p/flightgear/fgaddon/HEAD/tree/ ). A large
> quantity of the files, almost 30,000 in number, are XML text files.
>
> The problem is that modern Subversion clients appear to all be using
> libmagic to determine the file type, to then set the svn:mime-type
> property. However this is rather problematic:
>
> $ file -ib Aircraft/747-400/747-400-set.xml
> application/xml; charset=us-ascii
>
> Libmagic detects all these XML files as "application/xml". Hence they
> are treated as binary files! There are many other text files with
> extensions such as *.ac, *.nas, etc. present in the repository that in
> the future might be detected by libmagic as "application/xyz".
>
> We have looked at disabling [auto-props] both as the user in
> ~/.subversion/config and as root in /etc/subversion/config by setting:
>
> enable-auto-props = no
>
> And by commenting out the entirety of the [auto-props] section.
> However this does not prevent svn:mime-type from being set on all
> files.
>
> As this bad behaviour can be so incredibly damaging for this
> repository, I have written pre-commit repository hook script to
> specifically to block any file that enters the data repository that
> has svn:mime-type set (
> http://thread.gmane.org/gmane.games.flightgear.devel/77606/focus=77796
> ). I also block svn:executable in another script. Below I'll give a
> worked example that anyone can use and replicate this problem with.
> The problem is that Subversion clients setting svn:mime-type
> automatically, even when told not to, and the hook script catching
> this causes a lot of developer confusion and prevents the use of 'svn
> import'.
>
> I was wondering if there was anything that has been missed here? Is
> this a real bug? The svn:mime-type property is not needed and is not
> desired for any file in this repository. Any help would be
> appreciated.
>
> Cheers,
>
> Edward

Hi Edward,

the pre-commit hook script you wrote blocks commits using an
undesired client configuration, so that's a good first step.

For the second step, there are several ways of tweaking the client-side
behaviour. I hope at least one of these alternatives will help you.

 - compile SVN without libmagic support

 - write you own magic file and use the MAGIC environment variable
   to point svn at it, setting the desired mime-type for XML files

 - configure autoprops for *.xml in ~/.subversion/config to set
   the svn:mime-type property to 'text/plain'.
   Autoprops always override automatic detection with libmagic.

 - set 'enable-magic-file = no' in ~/.subversion/config
   This option exists only as of Subversion 1.9, I believe.
   Consider the following trick to view a default configuration in the
   file /tmp/svncfg/config, which lists all available options in your
   current version of svn, with comments explaining their purpose:
     svn help --config-dir /tmp/svncfg
     less /tmp/svncfg/config
Received on 2015-10-02 11:33:31 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.