subversion-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Edward d'Auvergne" <true.bug...@gmail.com>
Subject Bug report: The auto-props setting of svn:mime-type is impossible to avoid.
Date Fri, 02 Oct 2015 08:06:26 GMT
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



P. S.  Here is the detailed worked example:


Set up:

$ export BASE_DIR="~/flightgear/repo_testing/"
$ export BACKUP_DIR="~/flightgear/backup/"

Initialise a new svn repository:

$ cd $BASE_DIR
$ svnadmin create test1.svn
$ svn co file://$BASE_DIR/test1.svn/ test1
Checked out revision 0.

Copy scripts from FGAddon backup:

$ rsync -av svn.code.sf.net::p/flightgear/fgaddon/hooks $BACKUP_DIR
$ cd $BACKUP_DIR
$ cd hooks/
$ cp -vp pre-commit fgaddon-svn-* $BASE_DIR/test1/hooks/

Download the DaSH aircraft from
https://drive.google.com/file/d/0B-4Q5DonNb8yTi1Cd1J5Um1xMTg/view to
$BASE_DIR.

Testing 'svn import':

$ cd $BASE_DIR
$ tar xvf dash_v1.tar
dash/
dash/avlModel/
dash/dash-fdm.xml
dash/dash-set.xml
dash/Engines/
[snip]
$ svn import dash file://$BASE_DIR/test1.svn/DaSH_svn_import/ -m
"Initial import of the DaSH human powered aircraft.\n\nFor details see
the forum thread at
http://forum.flightgear.org/viewtopic.php?f=4&t=24495 ."
Adding  (bin)  dash/._thumbnail.jpg
Adding         dash/Engines
Adding         dash/Engines/dash-engine.xml
Adding         dash/Engines/dash-prop.xml
Adding         dash/Images
Adding  (bin)  dash/Images/._DashBoot_logo_Mod.png
Adding  (bin)  dash/Images/._dash-3view.png
Adding  (bin)  dash/Images/DashBoot_logo_Mod.png
Adding  (bin)  dash/Images/dash-3view.png
Adding         dash/Models
Adding  (bin)  dash/Models/._SLE_21b.ac
Adding  (bin)  dash/Models/._dash-model.xml
Adding         dash/Models/SLE_21b.ac
Adding         dash/Models/dash-model.xml
Adding         dash/avlModel
Adding  (bin)  dash/avlModel/._dae11.dat
Adding  (bin)  dash/avlModel/._dash.avl
Adding  (bin)  dash/avlModel/._plot.pdf
Adding  (bin)  dash/avlModel/._plot.ps
Adding         dash/avlModel/dae11.dat
Adding         dash/avlModel/dash.avl
Adding         dash/avlModel/dash_stability.txt
Adding  (bin)  dash/avlModel/plot.pdf
Adding         dash/avlModel/plot.ps
Adding         dash/dash-fdm.xml
Adding         dash/dash-set.xml
Adding  (bin)  dash/thumbnail.jpg
svn: E165001: Commit blocked by pre-commit hook (exit code 1) with output:

The svn:mime-type property is set on the files
['DaSH_svn_import/._thumbnail.jpg',
'DaSH_svn_import/Images/._DashBoot_logo_Mod.png', 'DaSH_svn_import/Images
/._dash-3view.png', 'DaSH_svn_import/Images/DashBoot_logo_Mod.png',
'DaSH_svn_import/Images/dash-3view.png', 'DaSH_svn_import/Models/._SLE_21b.ac',
'DaSH_svn_import/Models/._dash-model.xml',
'DaSH_svn_import/avlModel/._dae11.dat', 'DaSH_svn_import/avlModel/._dash.avl',
'DaSH_svn_import/avlModel/._plot.pdf', 'DaSH_svn_import/avlModel/._plot.ps',
'DaSH_svn_import/avlModel/plot.pdf', 'DaSH_svn_import/thumbnail.jpg'], aborting
the commit.

The current policy is that the svn:mime-type property is to be avoided in
FGAddon.  Before committing, please remove this property by typing 'svn propdel
svn:mime-type file_name' for all affected files.  Or to remove it recursively
from all files to be committed, in your aircraft directory type 'svn propdel
svn:mime-type -R'.

To avoid the svn:mime-type property being set by your subversion client, the
subversion configuration should be edited and all [auto-props] entries commented
out.  In addition the setting "enable-auto-props = yes" should be deleted from
all subversion config files (in certain svn clients, this will use libmagic to
determine the mime-type and set this for all new files).  This includes the user
configuration file at $HOME/.subversion/config or, if this is not present, the
global configuration file at /etc/subversion/config in GNU/Linux and Mac OS X or
%appdata%\subversion\config and %appdata%\roaming\subversion\config in MS
Windows.

Check what was imported:

$ cd $BASE_DIR/test1
$ svn up
$ svn log -v

Nothing went into the repository.  Try another way:

$ cd $BASE_DIR/test1
$ svn mkdir DaSH_svn_import
$ svn ci -m "Created a directory for testing a new aircraft addition
using 'svn add'."
$ cd DaSH_svn_import
$ cp -urvp
$ cp -urvp $BASE_DIR/dash/* .
‘/flightgear/repo_testing/mimetype//dash/avlModel’ -> ‘./avlModel’
‘/flightgear/repo_testing/mimetype//dash/avlModel/._dae11.dat’ ->
‘./avlModel/._dae11.dat’
‘/flightgear/repo_testing/mimetype//dash/avlModel/dae11.dat’ ->
‘./avlModel/dae11.dat’
‘/flightgear/repo_testing/mimetype//dash/avlModel/._dash.avl’ ->
‘./avlModel/._dash.avl’
‘/flightgear/repo_testing/mimetype//dash/avlModel/dash.avl’ ->
‘./avlModel/dash.avl’
‘/flightgear/repo_testing/mimetype//dash/avlModel/dash_stability.txt’
-> ‘./avlModel/dash_stability.txt’
[snip]
$ rm -f */._*
$ svn add *
$ svn pl -R
Properties on 'Images/DashBoot_logo_Mod.png':
  svn:mime-type
Properties on 'Images/dash-3view.png':
  svn:mime-type
Properties on 'avlModel/plot.pdf':
  svn:mime-type
Properties on 'thumbnail.jpg':
  svn:mime-type


These properties then have to be removed prior to committing with:

$ svn pdel -R svn:mime-type
$ svn ci -m "Import of the DaSH aircraft using 'svn add'."

Mime
View raw message