edwardvip / svnx

Automatically exported from code.google.com/p/svnx
0 stars 0 forks source link

Reports "svnserve: warning: cannot set LC_CTYPE locale'' when trying to list repository #146

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Full message is 

> svnserve: warning: cannot set LC_CTYPE locale
> svnserve: warning: environment variable LC_ALL is en_US.UTF-8
> svnserve: warning: please check that your locale name is correct

I have received that message in terminal also until set LC_ALL=C.

My system Mac OS X Lion 10.7.1.
Macports installed.

Original issue reported on code.google.com by Eugene.V...@gmail.com on 12 Sep 2011 at 2:13

GoogleCodeExporter commented 9 years ago
What does this have to do with the svnX application?
SvnX does not run `svnserve`.
Is the repository local or remote?
I.e. Where is svnserve running?  That’s probably where your problem is.
I don’t think this is an svnX issue.

Original comment by chris...@gmail.com on 12 Sep 2011 at 5:36

GoogleCodeExporter commented 9 years ago
> Is the repository local or remote?
Remote. Accessed via svn+ssh://...

I think that svnX uses subversion client installed on my system. So, if command 
'svn list REPO_URL' does not produce message in terminal then SvnX also should 
not produce.

As I written above, a have seen this message in terminal until set LC_ALL to 
'C', but this did not affect on SvnX. 

The main problem is that I see list of commits but can't browse repository, 
dispite the fact that message is warning and not error.

Maybe my system is misconfigured, I will be very grateful if you help me. 
(Google didn't help=)

Original comment by Eugene.V...@gmail.com on 12 Sep 2011 at 6:27

GoogleCodeExporter commented 9 years ago
The error message means svnserve is failing when executing setlocale(LC_ALL, 
"") and setlocale(LC_CTYPE, "").
Apparently this can happen on Linux systems with a subset of locales installed. 
 It’s unlikely to occur on OSX.

Using `set LC_ALL=C` is unlikely to affect a remotely run svnserve as env vars 
are not exported through ssh by default & `set LC_ALL…` doesn’t even affect 
the local locale.  (Execute `locale` to see it & `export LC_…=…` to set it.)
What does `locale` report on your system?  (I’m guessing that English isn’t 
your primary language.)
Can you ssh to the server & execute `locale` before & after `export LC_ALL=''`?

You haven’t said which versions of svnX or Subversion you are using or on 
what you are running the svnserve process,
so I’m going to assume 1.3.1, 1.6.x & some kind of Linux server.  It’s 
possible you have a poorly configured server or non-UTF-8 conforming 
repository.  If svnX is retrieving & displaying the repo’s log correctly then 
I don’t see why it would fail to list files from that same repo.  If you open 
svnX’s Activity window before you open the repo window you will be able to 
see which commands svnX executes & their success or failure.

I would suggest you try using the /usr/bin or recommended installation of 
Subversion with svnX first.  So as to exclude Macports.

You could try running svnX from the terminal after doing `export LC_ALL=C` or 
similar.
You could try adding 'export LC_ALL=C' or similar to your ~/.profile.
You could try adding <key>LC_ALL</key><string>C</string> to the LSEnvironment 
dict of svnX’s Info.plist.
You could try setting $SVN_SSH to something.

However, I can’t recommend setting LC_ALL=C.  I don’t see how it would fix 
this problem, but it may break other things.
I still don’t think this is an svnX issue, but an issue with your 
server/config.

Original comment by chris...@gmail.com on 13 Sep 2011 at 1:43

GoogleCodeExporter commented 9 years ago
I have removed 'export LC_ALL=C'  from my ~/.profile. This line deny typing non 
ASCII chars in terminal.

So, 

This output of the 'locale' command on my local machine
LANG="ru_RU.UTF-8"
LC_COLLATE="ru_RU.UTF-8"
LC_CTYPE="ru_RU.UTF-8"
LC_MESSAGES="ru_RU.UTF-8"
LC_MONETARY="ru_RU.UTF-8"
LC_NUMERIC="ru_RU.UTF-8"
LC_TIME="ru_RU.UTF-8"
LC_ALL=

This output of the 'locale' command on remote machine
LANG=en_CA
LC_CTYPE="en_CA"
LC_NUMERIC="en_CA"
LC_TIME="en_CA"
LC_COLLATE="en_CA"
LC_MONETARY="en_CA"
LC_MESSAGES="en_CA"
LC_PAPER="en_CA"
LC_NAME="en_CA"
LC_ADDRESS="en_CA"
LC_TELEPHONE="en_CA"
LC_MEASUREMENT="en_CA"
LC_IDENTIFICATION="en_CA"
LC_ALL=

After that I have performed experiment
In Terminal on my local machine
> /usr/bin/svn log --non-interactive --xml -rHEAD:7113 -v svn+ssh://svn_repo
Output: normal xml file without any error report

In SvnX while path to svn is '/usr/bin/' 
In 'log' window:
svnserve: warning: cannot set LC_CTYPE locale
svnserve: warning: environment variable LC_ALL is en_US.UTF-8
svnserve: warning: please check that your locale name is correct
In info window:
/usr/bin/svn log --non-interactive --xml -rHEAD:7113 -v svn+ssh://svn_repo

I have tried do the same using MacPorts svn binaries and result is also the 
same.

I have tried to install SmartSVN and it works fine.

Previously I have used svnX on Snow Leopard system and all worked good.

Original comment by Eugene.V...@gmail.com on 13 Sep 2011 at 8:12

GoogleCodeExporter commented 9 years ago
That’s strange.  So why is svnserve reporting that LC_ALL=en_US.UTF-8 & not 
en_CA?
[This still sounds like a problem at the server end.
 The calls to reset locale should not fail.
 LC_ALL="en_US.UTF-8" is a reasonable value for LC_ALL.
 LANG="en_CA" is an uncommon value & may be causing problems for svnserve.]

So are you now saying `svn log` worked in Terminal with LC_*=ru_RU.UTF-8?

Try placing the shell script:
    #!/bin/sh
    export LC_ALL=C; /usr/svn "$@"
somewhere like ~/bin/ then pointing svnX at ~/bin/.

I tried this and it correctly changed the locale from "en_US.UTF-8"
(which svnX sets for sub-tasks in order to ensure consistently parse-able 
output).

Alternatively you could add:
    <key>TaskEnvironment</key><dict><key>LC_ALL</key><string>C</string></dict>
to svnX.app/Contents/Info.plist.
(I’d forgotten that I’d added this to allow overriding the default 
environment for svnX’s sub-tasks.)

Setting LANG=en_US.UTF-8 & resetting LC_ALL instead may be better:
    <key>TaskEnvironment</key><dict><key>LANG</key><string>en_US.UTF-8</string>
            <key>LC_ALL</key><string></string></dict>

Either of the above techniques will also allow setting of other environment 
variables.
The shell script technique also allows for logging any info to a file.
But I don’t know whether any of these settings will propagate to the server.
[What does `grep Env /etc/ssh_config /etc/sshd_config` output on your Mac?]

Original comment by chris...@gmail.com on 13 Sep 2011 at 1:13

GoogleCodeExporter commented 9 years ago
>> That’s strange.  So why is svnserve reporting that LC_ALL=en_US.UTF-8 & 
not en_CA?
I do not know, otherwise I would not ask.

>> So are you now saying `svn log` worked in Terminal with LC_*=ru_RU.UTF-8?
Yes!

>> Setting LANG=en_US.UTF-8 & resetting LC_ALL instead may be better:
>> <key>TaskEnvironment</key><dict><key>LANG</key><string>en_US.UTF-8</string>
>> <key>LC_ALL</key><string></string></dict>
I did it and it helped me. No svnX works! 

>> What does `grep Env /etc/ssh_config /etc/sshd_config` output on your Mac?
/etc/ssh_config:   SendEnv LANG LC_*
/etc/sshd_config:#PermitUserEnvironment no
/etc/sshd_config:AcceptEnv LANG LC_*

So as my problem is solved and I'm happy the report may be closed. If you are 
interested to continue problem investigation I'm ready to help.

Thank you very much! You saved me a lot of time.

Original comment by Eugene.V...@gmail.com on 14 Sep 2011 at 8:23

GoogleCodeExporter commented 9 years ago
So it appears that Apple (or someone else) has changed ssh_config & sshd_config 
on (your) OSX 10.7.  [Who?]
The SendEnv/AcceptEnv keys don’t appear by default on OSX 10.5.8 or 10.6.8.
The SendEnv on your Mac along with (I assume) an AcceptEnv on your server 
propagate your LANG & LC_* settings to the server.
The server has a bad LANG setting (LANG=en_CA) & probably does not support 
LANG="ru_RU.UTF-8".
Thus setlocale(LC_ALL, "") and setlocale(LC_CTYPE, "") fail & the server 
(possibly sticking with en_CA) outputs non-UTF-8 text.
SvnX expects UTF-8 from svn.

In conclusion: The SendEnv setting in ssh_config is questionable.  But your 
server is misconfigured.
I don’t think svnX can be expected to handle this situation by default.  
(Though I still don’t know if svnX or svnserve is failing.)
SvnX always setting LANG=en_US.UTF-8 would be a bit heavy handed IMO.

> Thank you very much! You saved me a lot of time.

You are welcome.
I learnt more about the tangled web that is UNIX locale & ssh in the process 
:-).

Original comment by chris...@gmail.com on 14 Sep 2011 at 1:33

GoogleCodeExporter commented 9 years ago
FYI
if you comment "SendEnv LANG LC_*" in ssh_config on os X Lion, you won't have 
the problems anymore.

Original comment by jonathan...@gmail.com on 28 Oct 2011 at 11:05

GoogleCodeExporter commented 9 years ago
Marking as `invalid` as this is not actually an svnX problem.
However, this doesn’t mean that the solution is invalid.

Original comment by chris...@gmail.com on 1 Jan 2012 at 7:16

GoogleCodeExporter commented 9 years ago
i recently encountered this issue in an ant svn task running on mountain lion 
with svn version 1.7.6 (r1370777). the command line worked fine, but the ant 
task caused the error (svnkit, not javahl). the suggestion in Comment 8 by 
jonathan...@gmail.com fixed the issue for me. the file to edit was:

/private/etc/sshd_config

root access was required to modify the file. for instructions on enabling root 
on mac osx, see:
http://www.spy-hill.com/~myers/help/apple/EnableRoot2.html

colin

Original comment by co...@playmegaphone.com on 22 Oct 2012 at 12:56