[ZBX-10418] fix svn:auto-props and unify svn:mime-type, svn:eol-style properties in zabbix SVN repo Created: 2016 Feb 19  Updated: 2017 May 30  Resolved: 2016 May 06

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: None
Affects Version/s: 2.0.16, 2.2.11, 2.4.7, 3.0.0, 3.2.0alpha1
Fix Version/s: 2.0.18rc1, 2.2.13rc1, 2.4.8, 3.0.3rc1, 3.2.0alpha1

Type: Incident report Priority: Minor
Reporter: Oleksii Zagorskyi Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: consistency, mime, svn
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File LIST_sorted.txt    

 Description   

See comments below.



 Comments   
Comment by Oleksii Zagorskyi [ 2016 Feb 19 ]

History of the problem:

# svn diff svn://svn.zabbix.com -r 43573:43574
Index: .
===================================================================
--- .   (revision 43573)
+++ .   (revision 43574)

Property changes on: .
___________________________________________________________________
Added: svn:auto-props
## -0,0 +1,24 ##
+*.ac = svn:eol-style=native
+*.am = svn:eol-style=native
+*.c = svn:eol-style=native
+*.conf = svn:eol-style=native
+*.css = svn:eol-style=native; svn:mime-type=text/css
+*.exe = svn:mime-type=application/x-executable
+*.gif = svn:mime-type=image/gif
+*.h = svn:eol-style=native
+*.ico = svn:mime-type=image/x-icon
+*.jpg = svn:mime-type=image/jpeg
+*.js = svn:eol-style=native; svn:mime-type=application/javascript
+*.m4 = svn:eol-style=native
+*.php = svn:eol-style=native; svn:mime-type=application/x-httpd-php
+*.pl = svn:eol-style=native; svn:mime-type=text/x-perl
+*.png = svn:mime-type=image/png
+*.po = svn:eol-style=native; svn:mime-type=application/x-gettext
+*.rng = svn:eol-style=native
+*.sh = svn:eol-style=native; svn:executable; svn:mime-type=text/x-sh
+*.sql = svn:eol-style=native; svn:mime-type=text/x-sql
+*.svg = svn:mime-type=image/svg+xml
+*.ttf = svn:mime-type=application/x-truetype-font
+*.txt = svn:eol-style=native; svn:mime-type=text/plain
+*.wav = svn:mime-type=audio/x-wav
+*.xml = svn:eol-style=native; svn:mime-type=text/xml
# svn log svn://svn.zabbix.com -r 43574
------------------------------------------------------------------------
r43574 | asaveljevs | 2014-03-19 11:57:31 +0200 (Wed, 19 Mar 2014) | 1 line

.......... [ZBX-954] added svn:auto-props for Subversion 1.8 clients
------------------------------------------------------------------------

It's added to spesc 28 June 2014 here:
https://www.zabbix.org/mw/index.php5?title=Docs%2Fspecs%2Fdevelopment_guidelines&type=revision&diff=6915&oldid=6819

As I could figure out the change was initiated by Rich and performed to improve a "websvn" instance, although it's hard to say which exactly.

Such change caused a problem when adding new files to svn by "svn add" command, at least for 3 tile types: *.js, *.php, *.po:

# svn add 1.php
svn: E200009: Can't set 'svn:eol-style': file '/zab/svn.zabbix.com/trunk/frontends/php/1.php' has binary mime type property

the error is correct because it not possible to set svn:eol-style for files which have mime type "application/...."
http://svnbook.red-bean.com/en/1.7/svn.advanced.props.file-portability.html#svn.advanced.props.special.mime-type
So all the time the "svn:auto-props" feature didn't work for *.js, *.php, *.po files.

I discovered this problem when I had to add a new .po file to the repository.

Later it appeared to be that this caused problems for all PHP devs too, and all the time they had to use a workaround like:

# svn add --no-auto-props 1.php
# svn propset svn:eol-style native 1.php

It was decided to fix that in SVN and in the spec.

In the spec useful to note that:

the svn:auto-props property overrides the auto-props runtime configuration if it defines an auto-prop for the same pattern as the runtime configuration

Source here . And I can confirm that too, using svn client v1.8

Comment by Oleksii Zagorskyi [ 2016 Feb 19 ]

When a file being added to a svn checkout, svn tool tries to decide is this file a human readable one or not. If not - it automatically sets application/octet-stream mime type.

Copy (from zabbix v3.0) one file with each unique extension to a checkout folder of a testing svn repository:

# for i in `find -type f ! -wholename '*/.svn*' | grep -Eo "\.[A-Za-z]+$" | sort | uniq`; do find -type f -name "*$i" | sed -n 'p;q' | xargs cp -t /zab/mime/def-mime/ ; done

When add those files to svn (filtered list):

# svn add *
A  (bin)  tr_top_right.gif
A  (bin)  alarm_ok.wav
A  (bin)  zabbix_sender.dll
A  (bin)  Rackmountable_3U_server_3D_(96).png
A  (bin)  DejaVuSans.ttf
A  (bin)  zabbix_sender.exe
A  (bin)  junit-4.8.2.jar
A  (bin)  zabbix_sender.lib
A  (bin)  favicon.ico

above is list of files which detected as not text and automatically set "application/octet-stream" svn:mime-type property. Here:

# find -type f ! -wholename '*/.svn*' | xargs svn pg svn:mime-type
Rackmountable_3U_server_3D_(96).png - application/octet-stream
zabbix_sender.dll - application/octet-stream
zabbix_sender.exe - application/octet-stream
tr_top_right.gif - application/octet-stream
alarm_ok.wav - application/octet-stream
junit-4.8.2.jar - application/octet-stream
DejaVuSans.ttf - application/octet-stream
zabbix_sender.lib - application/octet-stream
favicon.ico - application/octet-stream

additional proof: http://svnbook.red-bean.com/en/1.8/svn.advanced.props.html

For all the unique files, Linux detects these mime types (note - file --mime-type command here):

# find -type f ! -wholename '*/.svn*' | xargs file --mime-type
./housekeeper.sql:                     text/plain
./zbxdbupgrade.h:                      text/plain
./icons.ai:                            application/pdf
./Rackmountable_3U_server_3D_(96).png: image/png
./setup.html:                          text/html
./zabbix_sender.dll:                   application/x-dosexec
./zabbix_sender.exe:                   application/x-dosexec
./Rack_42_with_door.svg:               image/svg+xml
./strip_inkscape_attributes.xslt:      application/xml
./wmi.cpp:                             text/x-c
./tr_top_right.gif:                    image/gif
./class.bbcode.js:                     text/html
./README.dev:                          text/plain
./sender.c:                            text/x-c
./images_oracle_start.txt:             text/plain
./blue-theme.css:                      text/plain
./data.tmpl:                           text/plain
./_fonts.scss:                         text/plain
./zabbix_sender.man:                   text/troff
./alarm_ok.wav:                        audio/x-wav
./Makefile_targets.inc:                text/x-makefile
./frontend.po:                         text/x-po
./junit-4.8.2.jar:                     application/java-archive
./bootstrap.php.template:              text/x-php
./ZabbixItemTest.java:                 text/plain
./.htaccess:                           text/plain
./png_to_xml.sh:                       text/x-shellscript
./DejaVuSans.ttf:                      application/x-font-ttf
./hostAndTemplate.xml:                 application/xml
./zabbix-server.conf:                  text/plain
./zabbix_sender.lib:                   application/x-archive
./configure.ac:                        text/x-c
./resource.rc:                         text/x-c
./api.php:                             text/x-php
./favicon.ico:                         image/x-icon
./sqlite3.init:                        text/plain
./messages.mc:                         text/plain
./sender.pl:                           text/x-perl
./zabbix.conf.php.example:             text/x-php
./ChangeLog.legend:                    text/plain
./Makefile.am:                         text/plain

When try to check what mime types are set in svn already, we can see an inconsistency - a mix of properties which were set automatically before the svn:auto-props set, and customized too.
Full sorted list is attached as LIST_sorted.txt
For example we can see that the same type files have different mime types:

application/octet-stream	/frontends/php/images/general/arrow_down.png
image/png	/frontends/php/img/apple-touch-icon-120x120-precomposed.png

Such inconsistency is not critical, it did not brake anything, but as any inconsistency it should be fixed too.

Comment by Oleksii Zagorskyi [ 2016 Feb 19 ]

If try to take into account all existing factors it's very hard to decide does it worth to customize mime-type or not, for all file types or not, etc.
An existing https://www.zabbix.org/websvn installation shows that "mime-type" really have effect, but it was decided that it will not be taken into account to make final decision, because it's possible to customize websvn behavior in internal config file.

Just to write down noticed details in short:

  • if for example php file has mime-type as "text/anything", then it returned in browser as original file for download, with "Content-Type: text/anything" header.
  • if the php file doesn't have mime-type set - it's returned in browser as HTML page with nicely colored formatted code. With a minor drawback - all tabs in sources are replaced by spaces, and no way to download orginal sources file.

So, after discussion with Sasha we ended up with next simple rules:

  • files which are automatically detected as "application/octet-stream" by svn should have customized mime types set;
  • all image file types (including svg, which in an octet-stream) should have mime type set too;
  • all rest human readable files should not have mime type set, as there no strong need to have it.

New "svn:auto-props" property of svn root should be set to:

*.ac = svn:eol-style=native
*.am = svn:eol-style=native
*.c = svn:eol-style=native
*.conf = svn:eol-style=native
*.css = svn:eol-style=native
*.dll = svn:mime-type=application/x-dosexec
*.exe = svn:mime-type=application/x-dosexec
*.jar = svn:mime-type=application/java-archive
*.lib = svn:mime-type=application/x-archive
*.gif = svn:mime-type=image/gif
*.h = svn:eol-style=native
*.ico = svn:mime-type=image/x-icon
*.jpg = svn:mime-type=image/jpeg
*.js = svn:eol-style=native
*.m4 = svn:eol-style=native
*.php = svn:eol-style=native
*.pl = svn:eol-style=native
*.png = svn:mime-type=image/png
*.rng = svn:eol-style=native
*.sh = svn:eol-style=native; svn:executable
*.sql = svn:eol-style=native
*.svg = svn:mime-type=image/svg+xml
*.ttf = svn:mime-type=application/x-font-ttf
*.txt = svn:eol-style=native
*.wav = svn:mime-type=audio/x-wav
*.xml = svn:eol-style=native

Interesting to see that Mediawiki project is using similar approach https://www.mediawiki.org/wiki/Subversion/auto-props
The spec https://www.zabbix.org/wiki/Docs/specs/development_guidelines#SVN_properties should be updated and rewritten.
All devs should be suggested to remove the customized configuration on their client side, as we hope that "svn:auto-props" will work well now.

To fix all inconsistencies in branches 2.0, 2.2, 2.4, 3.0, trunk these command should be executed for each branch:

find -type f ! -wholename '*/.svn*' | xargs svn propdel svn:mime-type >/dev/null
find -type f ! -wholename '*/.svn*' | xargs svn propget svn:mime-type   ### just to check, should return empty result

find -type f ! -wholename '*/.svn*' -a -name '*.dll'  | xargs svn propset svn:mime-type application/x-dosexec
find -type f ! -wholename '*/.svn*' -a -name '*.exe'  | xargs svn propset svn:mime-type application/x-dosexec
find -type f ! -wholename '*/.svn*' -a -name '*.jar'  | xargs svn propset svn:mime-type application/java-archive
find -type f ! -wholename '*/.svn*' -a -name '*.lib'  | xargs svn propset svn:mime-type application/x-archive
find -type f ! -wholename '*/.svn*' -a -name '*.ttf'  | xargs svn propset svn:mime-type application/x-font-ttf
find -type f ! -wholename '*/.svn*' -a -name '*.gif'  | xargs svn propset svn:mime-type image/gif
find -type f ! -wholename '*/.svn*' -a -name '*.ico'  | xargs svn propset svn:mime-type image/x-icon
find -type f ! -wholename '*/.svn*' -a -name '*.png'  | xargs svn propset svn:mime-type image/png
find -type f ! -wholename '*/.svn*' -a -name '*.svg'  | xargs svn propset svn:mime-type image/svg+xml
find -type f ! -wholename '*/.svn*' -a -name '*.wav'  | xargs svn propset svn:mime-type audio/x-wav

When apply properties to file extensions which are missing in older branches, an error may be ignored:

# find -type f ! -wholename '*/.svn*' -a -name '*.dll'  | xargs svn propset svn:mime-type application/x-dosexec
svn: E205001: Try 'svn help propset' for more information
svn: E205001: Explicit target required ('application/x-dosexec' interpreted as prop value)

When apply properties to .svg extensions, a warning may be ignored, property is still set:

svn: warning: 'image/svg+xml' is a binary mime-type but file '/zab/www-dev/svn.zabbix.com/branches/dev/ZBX-10418-20/misc/images/svg/elements/Network_adapter.svg' looks like text; diff, merge, blame, and other operations will stop working on this file
property 'svn:mime-type' set on 'misc/images/svg/elements/Network_adapter.svg'

Such changes were tested with svn client 1.8 and Tortoise SVN 1.8 on Windows too. Everything works fine.

Comment by Oleksii Zagorskyi [ 2016 Feb 19 ]

After several days I'll create dev branches to implement all the planned changes.
Please share your opinions.

Comment by Oleksii Zagorskyi [ 2016 Mar 08 ]

All possible opinions were gathered, no objections discovered, will be applied as suggested.

Comment by Oleksii Zagorskyi [ 2016 Mar 08 ]

RESOLVED in r58900 for branches 2.0, 2.2, 2.4, 3.0, trunk.
As agreed with Sasha, "svn:auto-props" property of svn root level will be set right after merging to original branches.

Comment by Aleksandrs Saveljevs [ 2016 Mar 22 ]

(1) Regarding the suggested svn:auto-props value, what was the basis for the following properties?

*.dll = svn:mime-type=application/x-dosexec
*.exe = svn:mime-type=application/x-dosexec
*.lib = svn:mime-type=application/x-archive

For instance, /etc/mime.types lists the following:

application/x-msdos-program			com exe bat dll

http://www.iana.org/assignments/media-types/application/vnd.microsoft.portable-executable suggests vnd.microsoft.portable-executable for both *.exe and *.dll.

Tomcat 8.0.26 uses application/x-msdownload for *.dll files:

    <mime-mapping>
        <extension>dll</extension>
        <mime-type>application/x-msdownload</mime-type>
    </mime-mapping>

zalex_ua Search for first entry for application/x-dosexec on this page and you will see that those 3 types are result of file --mime-type command.
As was discussed, we do not take into account the /etc/mime.types file because we don't have answer why we should take it into account and actual values from it lead to currently existing problems with PHP files for example.
file --mime-type command provides predictable and consistent mime types for any file extension.
I don't have any objections to use everything what you want after application/, but using different sources of information (IANA, Tomcat etc) just adds more complexity in deciding what and where set and the picture will be less consistent.
I still suggest to use only results of file --mime-type command.

Nothing changed, RESOLVED.

asaveljevs No objections. CLOSED.

Comment by Aleksandrs Saveljevs [ 2016 Mar 22 ]

(2) Similarly, what was the rationale behind choosing image/x-icon for *.ico over image/vnd.microsoft.icon ( see http://www.iana.org/assignments/media-types/image/vnd.microsoft.icon )?

zalex_ua Answer basically the same as for (1). A key part here is image/, which is identical.
Nothing changed, RESOLVED.

asaveljevs No objections. CLOSED.

Comment by Aleksandrs Saveljevs [ 2016 Mar 22 ]

(3) Why *.po files were removed in the suggested svn:auto-props?

zalex_ua Initially I've discovered this issue exactly because of *.po files, when I had to add one to svn for a new language. During analyzing I ended up with a set of conditions, one of them is all rest human readable files should not have mime type set, as there no strong need to have it., and you can find it above.
The .po files match this condition, and currently even "svn:eol-style" is not really set for any *.po file:

# cd 3.0
# find -type f ! -wholename '*/.svn*' -name *.po | xargs svn pl
# find -type f ! -wholename '*/.svn*' -name *.sh | xargs svn pl
Properties on 'bootstrap.sh':
  svn:eol-style
  svn:executable

That's why I've excluded it from the suggested svn:auto-props. I really don't see real needs to have it, including as a translations maintainer.

Nothing changed, RESOLVED.

asaveljevs No objections. CLOSED.

Comment by Aleksandrs Saveljevs [ 2016 Mar 22 ]

(4) svn:eol-style=native should probably be added to svn:auto-props for Java source files.

asaveljevs Additionally: *.ai, *.bat, *.cpp, *.html, *.man, *.scss, README, *.xslt.

zalex_ua the list extended from (5) and (6): *.tmpl, *.legend, *.dev, *.template

zalex_ua Following the rule I mentioned in answer above for (3), I had not a goal to fix/improve "everything possible", for example extend list of file types where we set svn:eol-style because it would even more decrease chances for this issue to be considered and committed

Ok, I've collected some stat. Extended results style 3/15 means - 3 files of 15 have svn:eol-style really set, in branch 3.0.

# find -type f ! -wholename '*/.svn*' -name *.java | xargs svn pg svn:eol-style | wc -l
19/19
# find -type f ! -wholename '*/.svn*' -name *.bat | xargs svn pg svn:eol-style | wc -l <- exists in 2.0 branch only
2/2
# find -type f ! -wholename '*/.svn*' -name *.cpp | xargs svn pg svn:eol-style | wc -l
0/1
# find -type f ! -wholename '*/.svn*' -name *.html | xargs svn pg svn:eol-style | wc -l
3/15
# find -type f ! -wholename '*/.svn*' -name *.man | xargs svn pg svn:eol-style | wc -l
0/5
# find -type f ! -wholename '*/.svn*' -name *.scss | xargs svn pg svn:eol-style | wc -l
2/6
# find -type f ! -wholename '*/.svn*' -name README | xargs svn pg svn:eol-style | wc -l
7/12
# find -type f ! -wholename '*/.svn*' -name *.tmpl | xargs svn pg svn:eol-style | wc -l
1/2
# find -type f ! -wholename '*/.svn*' -name *.legend | xargs svn pg svn:eol-style | wc -l
0/1

### my own additional findings across all files detectes as "text/":
# find -type f ! -wholename '*/.svn*' -name *.inc | xargs svn pg svn:eol-style | wc -l
3/3
# find -type f ! -wholename '*/.svn*' -name *.po | xargs svn pg svn:eol-style | wc -l
0/30
# find -type f ! -wholename '*/.svn*' -name *.template | xargs svn pg svn:eol-style | wc -l
0/1
# find -type f ! -wholename '*/.svn*' -name *.htaccess | xargs svn pg svn:eol-style | wc -l
3/4
# find -type f ! -wholename '*/.svn*' -name *.rc | xargs svn pg svn:eol-style | wc -l
1/1
# find -type f ! -wholename '*/.svn*' -name *.init | xargs svn pg svn:eol-style | wc -l
0/1
# find -type f ! -wholename '*/.svn*' -name *.mc | xargs svn pg svn:eol-style | wc -l
1/1
# find -type f ! -wholename '*/.svn*' -name *.example | xargs svn pg svn:eol-style | wc -l
1/1

I'm agree that probably it would worth to resolve svn:eol-style inconsistency too, let's go:

*.ai and *.xslt will be excluded from consideration because they are not detected as text/ by file --mime-type command, so I'd go with a rule that they should not have svn:eol-style set !
note - ai file is not text at all, in the middle.
*.dev excluded too because it's very non generic file extension and we cannot be sure that in future the extension may be used for a binary files. I'm sure the only file "misc/images/README.dev" should be remamed to something like "README-DEV"

### excluded ones, listed just for statistic:
# find -type f ! -wholename '*/.svn*' -name *.ai | xargs svn pg svn:eol-style | wc -l
0/2
# find -type f ! -wholename '*/.svn*' -name *.xslt | xargs svn pg svn:eol-style | wc -l
1/1
# find -type f ! -wholename '*/.svn*' -name *.dev | xargs svn pg svn:eol-style | wc -l
0/1

Based on the collected stat, including Aleksandrs' suggestion, a new suggested value for svn:auto-props, grouped by property (for usability) and then sorted:

*.ac = svn:eol-style=native
*.am = svn:eol-style=native
*.bat = svn:eol-style=native
*.c = svn:eol-style=native
*.conf = svn:eol-style=native
*.cpp = svn:eol-style=native
*.css = svn:eol-style=native
*.example = svn:eol-style=native
*.htaccess = svn:eol-style=native
*.html = svn:eol-style=native
*.inc = svn:eol-style=native
*.init = svn:eol-style=native
*.java = svn:eol-style=native
*.h = svn:eol-style=native
*.js = svn:eol-style=native
*.legend = svn:eol-style=native
*.m4 = svn:eol-style=native
*.man = svn:eol-style=native
*.mc = svn:eol-style=native
*.php = svn:eol-style=native
*.pl = svn:eol-style=native
*.po = svn:eol-style=native
*.rc = svn:eol-style=native
*.rng = svn:eol-style=native
*.scss = svn:eol-style=native
*.sh = svn:eol-style=native; svn:executable
*.sql = svn:eol-style=native
*.template = svn:eol-style=native
*.tmpl = svn:eol-style=native
*.txt = svn:eol-style=native
*.xml = svn:eol-style=native
README* = svn:eol-style=native
*.dll = svn:mime-type=application/x-dosexec
*.exe = svn:mime-type=application/x-dosexec
*.jar = svn:mime-type=application/java-archive
*.lib = svn:mime-type=application/x-archive
*.gif = svn:mime-type=image/gif
*.ico = svn:mime-type=image/x-icon
*.jpg = svn:mime-type=image/jpeg
*.png = svn:mime-type=image/png
*.svg = svn:mime-type=image/svg+xml
*.ttf = svn:mime-type=application/x-font-ttf
*.wav = svn:mime-type=audio/x-wav

Aleksandrs, please review and then I'll prepare a set of commands to clear/re-apply these settings to existing files.

asaveljevs Proposed changes:

  • replace *.htaccess with just .htaccess, because this is the exact file name;
  • replace *.legend with ChangeLog*, because *.legend is unlikely to be used as an extension (but also see below);
  • it might be that extensions like *.example, *.init, *.legend, *.template, *.tmpl were rather ad-hoc (i.e., were only used once or twice), so instead of adding them to svn:auto-props, it might be a good idea to just fix properties on existing files, without adding automatic properties.

zalex_ua
I've paid attention for "svn:executable" attribute too, current stat:

# find -type f ! -wholename  '*/.svn*' -a -name  '*.sh'
./misc/images/png_to_xml.sh
./misc/images/svg_to_png.sh
./misc/images/png_to_sql.sh
./misc/snmptrap/snmptrap.sh
./frontends/php/locale/add_new_language.sh
./frontends/php/locale/make_mo.sh
./frontends/php/locale/update_po.sh
./src/zabbix_java/settings.sh
./src/zabbix_java/shutdown.sh
./src/zabbix_java/startup.sh
./create/bin/export_data.sh
./bootstrap.sh

# find -type f ! -wholename  '*/.svn*' -a -name  '*.sh' | xargs svn pg svn:executable
misc/images/png_to_xml.sh - *
misc/images/svg_to_png.sh - *
misc/images/png_to_sql.sh - *
misc/snmptrap/snmptrap.sh - *
frontends/php/locale/add_new_language.sh - *
frontends/php/locale/make_mo.sh - *
frontends/php/locale/update_po.sh - *
src/zabbix_java/shutdown.sh - *
src/zabbix_java/startup.sh - *
create/bin/export_data.sh - *
bootstrap.sh - *
# find -type f ! -wholename  '*/.svn*' -a -name  '*.pl'
./misc/debug/sender.pl
./misc/snmptrap/zabbix_trap_receiver.pl
./create/bin/gen_schema.pl
./create/bin/gen_data.pl

# find -type f ! -wholename  '*/.svn*' -a -name  '*.pl' | xargs svn pg svn:executable
misc/debug/sender.pl - *
create/bin/gen_schema.pl - *
create/bin/gen_data.pl - *

We see that the attribute currently is set correctly for existing files.
Exclusions are 2 files, where it should not be set: ./src/zabbix_java/settings.sh for java gateway - it supposed to be renamed in future in ZBX-9824; and ./misc/snmptrap/zabbix_trap_receiver.pl - it's a source file snmptrapd.
An inconsistency what we have in "svn:auto-props" are the property for *.sh files, while we don't have it for *.pl files.
So the "svn:executable" has added for *.pl files to, only in "svn:auto-props".

After short discussion with Alexanders we decided to still include those *.example, *.init, *.legend, *.template, *.tmpl files to svn:auto-props, new result, including proposed changes:

*.ac = svn:eol-style=native
*.am = svn:eol-style=native
*.bat = svn:eol-style=native
*.c = svn:eol-style=native
*.conf = svn:eol-style=native
*.cpp = svn:eol-style=native
*.css = svn:eol-style=native
*.example = svn:eol-style=native
*.html = svn:eol-style=native
*.inc = svn:eol-style=native
*.init = svn:eol-style=native
*.java = svn:eol-style=native
*.h = svn:eol-style=native
*.js = svn:eol-style=native
*.m4 = svn:eol-style=native
*.man = svn:eol-style=native
*.mc = svn:eol-style=native
*.php = svn:eol-style=native
*.pl = svn:eol-style=native; svn:executable
*.po = svn:eol-style=native
*.rc = svn:eol-style=native
*.rng = svn:eol-style=native
*.scss = svn:eol-style=native
*.sh = svn:eol-style=native; svn:executable
*.sql = svn:eol-style=native
*.template = svn:eol-style=native
*.tmpl = svn:eol-style=native
*.txt = svn:eol-style=native
*.xml = svn:eol-style=native
.htaccess = svn:eol-style=native
ChangeLog* = svn:eol-style=native
README* = svn:eol-style=native
*.dll = svn:mime-type=application/x-dosexec
*.exe = svn:mime-type=application/x-dosexec
*.jar = svn:mime-type=application/java-archive
*.lib = svn:mime-type=application/x-archive
*.gif = svn:mime-type=image/gif
*.ico = svn:mime-type=image/x-icon
*.jpg = svn:mime-type=image/jpeg
*.png = svn:mime-type=image/png
*.svg = svn:mime-type=image/svg+xml
*.ttf = svn:mime-type=application/x-font-ttf
*.wav = svn:mime-type=audio/x-wav

Based on the list, following commands will use long list of file name masks.
Let's check for files which have windows style EOL:

# find -type f ! -wholename '*/.svn*' -a -name '*.ac' -o -name '*.am' -o -name '*.bat' -o -name '*.c' -o -name '*.conf' -o -name '*.cpp' -o -name '*.css' -o -name '*.example' -o -name '*.html' -o -name '*.inc' -o -name '*.init' -o -name '*.java' -o -name '*.h' -o -name '*.js' -o -name '*.m4' -o -name '*.man' -o -name '*.mc' -o -name '*.php' -o -name '*.pl' -o -name '*.po' -o -name '*.rc' -o -name '*.rng' -o -name '*.scss' -o -name '*.sh' -o -name '*.sql' -o -name '*.template' -o -name '*.tmpl' -o -name '*.txt' -o -name '*.xml' -o -name '.htaccess' -o -name 'ChangeLog*' -o -name 'README*' | xargs grep -Pl '\x0D'
./frontends/php/locale/lv/LC_MESSAGES/frontend.po
./frontends/php/locale/pt_BR/LC_MESSAGES/frontend.po
./frontends/php/locale/lt/LC_MESSAGES/frontend.po
./database/postgresql/data.sql
./database/ibm_db2/data.sql
./database/sqlite3/data.sql
./sass/setup.html
./sass/overlay-dialog_with_tables.html
./sass/adm-images.html
./sass/forms-inventory.html
./sass/forms-housekeeper.html
./sass/errors.html
./sass/clock.html
./sass/signin.html
./sass/browserwarning.html
./sass/dashboard.html
./sass/stylesheets/sass/_fonts.scss
./sass/stylesheets/sass/_mixins.scss
./sass/stylesheets/sass/_colors.scss
./sass/stylesheets/sass/dark-theme.scss
./sass/screens-edit.html
./sass/popup.html

Those 3 po files have mixed EOL style - windows and linux. (windows style appeared fir a few lines as result of export from Pootle, which includes user's comments).
To fix than here is a command:

# find -type f ! -wholename '*/.svn*' -a -name '*.po' | xargs sed -i 's/\r$//g'

Commands to apply the properties to files which do not have them:

# find -type f ! -wholename '*/.svn*' -a -name '*.ac' -o -name '*.am' -o -name '*.bat' -o -name '*.c' -o -name '*.conf' -o -name '*.cpp' -o -name '*.css' -o -name '*.example' -o -name '*.html' -o -name '*.inc' -o -name '*.init' -o -name '*.java' -o -name '*.h' -o -name '*.js' -o -name '*.m4' -o -name '*.man' -o -name '*.mc' -o -name '*.php' -o -name '*.pl' -o -name '*.po' -o -name '*.rc' -o -name '*.rng' -o -name '*.scss' -o -name '*.sh' -o -name '*.sql' -o -name '*.template' -o -name '*.tmpl' -o -name '*.txt' -o -name '*.xml' -o -name '.htaccess' -o -name 'ChangeLog*' -o -name 'README*' | xargs svn propset svn:eol-style native > /dev/null

note: output to /dev/null to see clean STDERR and do not miss any error in the long STDOUT output.

EOL style for listed files will be automatically converted during "svn commit" command.
Changes in dev branches will be applied after review, please do it.

asaveljevs Looks good.

zalex_ua RESOLVED in r59425 for all branches.

asaveljevs Looks great! CLOSED

Comment by Aleksandrs Saveljevs [ 2016 Mar 22 ]

(5) We should probably add *.tmpl files (for instance, create/src/data.tmpl and create/src/schema.tmpl).

zalex_ua moved to (4)
CLOSED

Comment by Aleksandrs Saveljevs [ 2016 Mar 22 ]

(6) ChangeLog.legend does not seem to have svn:eol-style set to "native".

asaveljevs Additionally: misc/images/README.dev, frontends/php/tests/bootstrap.php.template.

zalex_ua moved to (4)
CLOSED

Comment by Oleksii Zagorskyi [ 2016 Apr 21 ]

Fixed for all branches 2.0, 2.2, 2.4, 3.0, trunk in rev 59629
svn:auto-props property on svn root level fixed in rev 59630

Comment by Oleksii Zagorskyi [ 2016 Apr 21 ]

(7) Documentation
Updated http://zabbix.org/wiki/Docs/specs/development_guidelines
RESOLVED

asaveljevs I have removed the following recommendation, because settings in ~/.subversion/config may actually be useful for working with other repositories:

Taking that into account it's recommended to keep svn client config file unconfigured for auto properties.

zalex_ua I did agree to remove the sentence, but then I did an additional test and decided to add more details and restore the sentence. See:
If client configuration file will still have this line (because it was listed in the doc page):

*.php = svn:eol-style=native; svn:mime-type=application/x-httpd-php

then attempt to "svn add 1.php" will have the same fail as described above because svn:mime-type will be tried to be applied.
So, I've added some details and returned the sentence with more details, please review.
RESOLVED

asaveljevs Thanks for checking this! I have changed note formatting a bit for consistency. Apart from, looks good.

zalex_ua Thanks! Looks better now.
CLOSED

Generated at Wed Apr 24 16:58:41 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.