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 Re: Bug report: The auto-props setting of svn:mime-type is impossible to avoid.
Date Tue, 06 Oct 2015 10:20:47 GMT
On 4 October 2015 at 13:32, Stefan Sperling <stsp@elego.de> wrote:
> On Sun, Oct 04, 2015 at 12:52:33PM +0200, Edward d'Auvergne wrote:
>> I would maybe suggest introducing an option for disabling the entire
>> automatic property subsystem, i.e. it combines both of these, and
>> overrides them.  This is an interesting thought experiment - devise
>> any name for such a top level automatic property override - and this
>> should convincingly demonstrate the confusion that the current setting
>> names induces.
>
> I think that would just make the situation worse by adding to
> the current mess.
>
> I agree the documentation needs to be improved. Would you have time
> to update the documentation and send patches for it?

Ok, I can look into it.  Hpwever the instructions for setting the
MAGIC environmental variable needs some discussion (see below).


>> The problem with the svn:mime-type block is that for svn clients <
>> 1.9, 'svn import' can never work.  Specifically because the libmagic
>> layer overwrites any user decision to disable automatic properties.
>
> There's another trick to disable libmagic which works with all
> client versions. I just tested it with 1.8.
>
> Set the MAGIC environment variable to a file which does not exist.
>
>   env MAGIC=/nonexistent svn import ...
>
> This effectively disabled libmagic support.

I've tried all combinations and nothing works (on my Linux system with
svn 1.8.14).  For example:

$ env MAGIC=/nonexistent svn import ...
$ MAGIC=/nonexistent svn import ...
[block]

$ env MAGIC=False svn import ...
$ MAGIC=False svn import ...
[block]

$ export MAGIC=/nonexistent
$ svn import ...
[block]

$ export MAGIC=False
$ svn import ...
[block]

$ touch empty_magic
$ MAGIC=$BASE_DIR/empty_magic svn import ...
[block]

$ env MAGIC=$BASE_DIR/empty_magic svn import ...
[block]

$ head -n 1 /usr/share/mime/magic > empty_magic
$ MAGIC=$BASE_DIR/empty_magic svn import ...
[block]

Not a single one of these combinations work - svn:mime-type is always
being set by 'svn import'.  Therefore blocking svn:mime-type in a
pre-commit hook completely kills the option of using 'svn import', and
there is no way to avoid this.  Looking more carefully at what is
happening:

$ cd $BASE_DIR
$ cp dash/Images/DashBoot_logo_Mod.png test4
$ cp dash/dash-set.xml test4
$ cd test4
$ svn add DashBoot_logo_Mod.png
$ svn add dash-set.xml
$ svn plist -R
Properties on 'DashBoot_logo_Mod.png':
  svn:mime-type
$ svn pget svn:mime-type DashBoot_logo_Mod.png
application/octet-stream

So setting MAGIC is having an effect, but Subversion is falling back,
probably via a non-magic internal code path, to the default
svn:mime-type of "application/octet-stream" for PNG and some other
files.  The MAGIC env variable prevents the XML files from not having
svn:mime-type set, but other files are still being set.  Hence 'svn
import' is blocked, and there is zero way to avoid the setting of
svn:mime-type.  Because of this behaviour, I'm willing to bet that svn
1.9 will also suffer from the inability to disable the automatic
property setting of svn:mime-type (for some reason I can't do this on
a self compiled but not installed svn trunk version, as it is using
the wrong svnlook version and setting SVNLOOK doesn't seem to help).

Regards,

Edward


P. S.  Again, as always, here are some detailed instructions to allow
for a 100% reproducibility of all these tests by anyone interested:


Set up:

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

Initialise a new svn repository:

$ cd $BASE_DIR
$ svnadmin create test4.svn
$ svn co file://$BASE_DIR/test4.svn/ test4
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 fgaddon/hooks/
$ cp -vp pre-commit fgaddon-svn-* $BASE_DIR/test4.svn/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]
$ head -n 1 /usr/share/mime/magic > empty_magic
$ export MAGIC=$BASE_DIR/empty_magic
$ MAGIC=$BASE_DIR/empty_magic svn import dash
file://$BASE_DIR/test4.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.

Test 2:

$ cd $BASE_DIR
$ cp dash/dash-set.xml test4
$ cd test4
$ svn add dash-set.xml
$ svn plist -R
Properties on 'dash-set.xml':
  svn:mime-type
$ svn pget svn:mime-type dash-set.xml
application/octet-stream
$

Mime
View raw message