Does svn client binary honors LANG env variable on Windows?

2018-02-10 Thread Thorsten Schöning
Hi all,

I'm using the PHP webapp WebSVN and ran into encoding problems with
file names in my Linux environment when e.g. creating downloadable
Zipr or Tars using WebSVN. I worked around those problems using a
simple shell wrapper like the following:

> #!/bin/sh
>
> export LC_CTYPE=de_DE.UTF-8
> svn $*

Other people fixed this differently by using setlocale in WebSVN
directly and forwarding that value using LANG per shell invokation:

> // Make sure that the input locale is set up correctly
> setlocale(LC_ALL, $config->getLocale());

> $cmd = $this->svnCommandString('blame', $path, $rev, $peg).' > 
> '.quote($filename);
> if ($config->getLocale() != null)
>   $cmd = "LANG=".setlocale(LC_ALL, 0)." ".$cmd;

A command line like this doesn't work on Windows, it at least needs a
different syntax. I know the needed syntax and all but am not sure if
it is even necessary to handle Windows specifically the same way.

I think this depends on if the svn binary honors the env var LANG on
Windows at all? PHP itself simply executes "cmd.exe /C '...' in the
end. So which encoding is used in this case with and without setting a
LANG variable? I have the feeling it's that of the invoked cmd.exe
process in both cases because APR handles that specially for Windows?

Thanks!

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning   E-Mail: thorsten.schoen...@am-soft.de
AM-SoFT IT-Systeme  http://www.AM-SoFT.de/

Telefon...05151-  9468- 55
Fax...05151-  9468- 88
Mobil..0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow



Re: Does svn client binary honors LANG env variable on Windows?

2018-02-10 Thread Branko Čibej
On 10.02.2018 09:59, Thorsten Schöning wrote:
> Hi all,
>
> I'm using the PHP webapp WebSVN and ran into encoding problems with
> file names in my Linux environment when e.g. creating downloadable
> Zipr or Tars using WebSVN. I worked around those problems using a
> simple shell wrapper like the following:
>
>> #!/bin/sh
>>
>> export LC_CTYPE=de_DE.UTF-8
>> svn $*
> Other people fixed this differently by using setlocale in WebSVN
> directly and forwarding that value using LANG per shell invokation:
>
>> // Make sure that the input locale is set up correctly
>> setlocale(LC_ALL, $config->getLocale());
>> $cmd = $this->svnCommandString('blame', $path, $rev, $peg).' > 
>> '.quote($filename);
>> if ($config->getLocale() != null)
>>   $cmd = "LANG=".setlocale(LC_ALL, 0)." ".$cmd;
> A command line like this doesn't work on Windows, it at least needs a
> different syntax. I know the needed syntax and all but am not sure if
> it is even necessary to handle Windows specifically the same way.
>
> I think this depends on if the svn binary honors the env var LANG on
> Windows at all? PHP itself simply executes "cmd.exe /C '...' in the
> end. So which encoding is used in this case with and without setting a
> LANG variable? I have the feeling it's that of the invoked cmd.exe
> process in both cases because APR handles that specially for Windows?

On Windows, the locale is a system-wide property and it's not defined by
environment variables. Nor does Subversion look at the environment, on
any platform; it uses the C setlocale() function to set the default
locale from the environment. On Unix, that ends up looking at
environment variables; on Windows, it uses a different mechanism.

Also, on Windows, Subversion (or rather, APR) knows that file names are
always written as Unicode, regardless of the system locale.

Since Subversion is not the tool that's creating your ZIP or TAR
packages, any encoding problems are more likely caused by the
surrounding (PHP/WebSVN) code.

-- Brane



Re: EOL problems in cvs2svn converted repository

2018-02-10 Thread Bo Berglund
On Fri, 9 Feb 2018 14:06:33 -0600, Ryan Schmidt
 wrote:

>If you want to do it after the conversion by just setting the 
>property starting now, without altering history, then check out 
>a working copy, set the properties where you want them, then check it in.

I think this is what I want to do, but preferrably in a semi-automatic
way. I.e. I would like to automatically find all instances of affected
files (via the client config auto-properties entries) and then apply
to the current working copy. So the contrib Python script
svn_apply_autoprops.py might be a choice.

And, yes, I am working on Windows with this. 

I tried the contrib py script on my Windows machine as follows:

python svn_apply_autoprops.py --config %APPDATA%\Subversion\config
D:\Engineering\Projects\Subversion\EI
Traceback (most recent call last):
  File "svn_apply_autoprops.py", line 195, in 
sys.exit(main())
  File "svn_apply_autoprops.py", line 192, in main
os.path.walk(wc_path, filter_walk, autoprop_lines)
  File "C:\Programs\Python\lib\ntpath.py", line 263, in walk
walk(name, func, arg)
  File "C:\Programs\Python\lib\ntpath.py", line 259, in walk
func(arg, top, names)
  File "svn_apply_autoprops.py", line 147, in filter_walk
status = os.spawnvp(os.P_WAIT, 'svn', command)
AttributeError: 'module' object has no attribute 'spawnvp'


Maybe it is not supposed to work on Windows?
I have Python 2.7.1 installed in my PC.
Should I instead check out the projects on Linux to make it work?


-- 
Bo Berglund
Developer in Sweden



Re: EOL problems in cvs2svn converted repository

2018-02-10 Thread Ryan Schmidt

On Feb 10, 2018, at 09:29, Bo Berglund wrote:

> I tried the contrib py script on my Windows machine as follows:
> 
> python svn_apply_autoprops.py --config %APPDATA%\Subversion\config
> D:\Engineering\Projects\Subversion\EI
> Traceback (most recent call last):
>  File "svn_apply_autoprops.py", line 195, in 
>sys.exit(main())
>  File "svn_apply_autoprops.py", line 192, in main
>os.path.walk(wc_path, filter_walk, autoprop_lines)
>  File "C:\Programs\Python\lib\ntpath.py", line 263, in walk
>walk(name, func, arg)
>  File "C:\Programs\Python\lib\ntpath.py", line 259, in walk
>func(arg, top, names)
>  File "svn_apply_autoprops.py", line 147, in filter_walk
>status = os.spawnvp(os.P_WAIT, 'svn', command)
> AttributeError: 'module' object has no attribute 'spawnvp'
> 
> 
> Maybe it is not supposed to work on Windows?
> I have Python 2.7.1 installed in my PC.
> Should I instead check out the projects on Linux to make it work?

According to a quick Google search, Python on Windows does not have spawnvp, so 
the script will not work on Windows as written.



Re: EOL problems in cvs2svn converted repository

2018-02-10 Thread Bo Berglund
On Sun, 11 Feb 2018 00:13:27 -0600, Ryan Schmidt
 wrote:

>> Maybe it is not supposed to work on Windows?
>> I have Python 2.7.1 installed in my PC.
>> Should I instead check out the projects on Linux to make it work?
>
>According to a quick Google search, Python on Windows does not have 
>spawnvp, so the script will not work on Windows as written.
>

OK,
then I will have to test on a Linux machine. The problem here is that
I need to connect VPN to the server from Linux. So I have more
research to do for that
The Linux machine I have available is an OpenVPN *server* and I have
tried to figure out how I can connect it as a Client to the remote
LAN. But it seems like once connected I cannot disconnect the client
without bringing down the server or rebooting. Very strange.
But OT here of course.


-- 
Bo Berglund
Developer in Sweden