Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Subversion client on Linux detects my XML file as binary?

I have strange error with svn client on Linux.

I would like to add test.xml file to repository. This file is standard XML text file with only Latin characters (no BOM) and with Linux end-of-line (LF only). But my svn client fails with:

[mn@mn testy]$ cat test.xml 
<?xml version="1.0" encoding="UTF-8"?>
<Test>test</Test>
<Test>89012345678901234</Test>
[mn@mn testy]$ file test.xml
test.xml: XML document text
[mn@mn testy]$ svn add test.xml
svn: E200009: Can't set 'svn:eol-style': file '/home/mn/testy/test.xml' has binary mime type property

The same operation works on Windows environment. On both I have configuration with auto-props:

*.xml = svn:eol-style=native

On both I have svn, version 1.8.10 (r1615264).

I can workaroud it:

  1. add file on Windows
  2. add svn:mime-type=text/xml into auto-props, so it looks like:

    *.xml = svn:mime-type=text/xml;svn:eol-style=native
    
  3. svn add with --no-auto-props option and then use svn propset

  4. add empty file, then edit it

But I would like to do it by simply adding file.

Why Subversion client on Linux detect this file as binary?

like image 996
Michał Niklas Avatar asked Oct 27 '14 12:10

Michał Niklas


1 Answers

Not a real solution, but some remarks that may help:

  • Normally, mime-types are set explicitly by the user of by auto-props.
  • I have found a reference how files are marked as binary: http://svnbook.red-bean.com/en/1.7/svn.forcvs.binary-and-trans.html Perhaps this helps to understand how it works.
  • Have you checked if the file is made executable in Linux, so that Subversion thinks it is a binary file?

With Subversion 1.8 on the client, you have the so called Repository Dictated Configuration, so the following should work under all circumstances:

  1. Include at the root of your repository (/ or /trunk) the property svn:auto-props with the value *.xml = svn:mime-type=text/xml;svn:eol-style=native
  2. When you now add a new file (on Windows and Linux), and the file has the ending .xml, Subversion should add as property to the file svn:mime-type and svn:eol-style. There should be no magic involved to see if the file is binary, and to have set the mime-type to something like text/* should ensure that the file is not interpreted as a binary file.
like image 57
mliebelt Avatar answered Oct 08 '22 10:10

mliebelt