Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: vcs_info and locales



FranÃois Gannaz wrote:
> As I installed my zsh prompt on another computer, vcs_info stopped working for
> svn repositories, it didn't print the branch nor the revision. It was just
> because I had a french locale, and so vcs_info could not parse the output of
> "svn info". The locale had no effect on hg/git, but I didn't fully test them.
>
> So I suggest either to fix the documentation or (better) fix the code.

Yes, this could happen. Thanks for reporting. Obviously, fixing the code
is the superior solution. However, I'd like to do it universally for all
of `vcs_info' and not only for the invocation of "svn info".

[...]
> BTW, changing the command with:
> 	zstyle ':vcs_info:svn:*:-all-' command "LC_ALL=C svn"
> didn't work at all, and I don't understand why.

The reason for that is because we're using the command roughly like
this:  ${command} ...

And when sh_split_word isn't set (which it isn't by default and vcs_info
uses mostly zsh defaults), the parameter isn't split, like it would in
other bourne-like shells.

I think it would be best to leave it as it is; but I don't feel strongly
about it. If a lot be people think we should split that parameter, we
could do that (even though it might break backwards compatibility for
some people).


Anyway, could you try the following patch for the locale problem? I
think it should solve the issue once and for all.

---------- >8 ----------

From 66be07ae53e9af6e386ade123cc9a1450695c7bc Mon Sep 17 00:00:00 2001
From: Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx>
Date: Sun, 25 Apr 2010 10:20:30 +0200
Subject: PATCH: vcs_info: Set LC_ALL locally
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This is to avoid problems with output from external commands with non-C
locales as reported by FranÃois Gannaz in workers-27900.
---
 Functions/VCS_Info/vcs_info |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/Functions/VCS_Info/vcs_info b/Functions/VCS_Info/vcs_info
index a9e65e1..e9f782a 100644
--- a/Functions/VCS_Info/vcs_info
+++ b/Functions/VCS_Info/vcs_info
@@ -47,11 +47,12 @@ vcs_info () {
     local pat
     local -i found
     local -a enabled disabled dps
-    local -x usercontext vcs rrn
+    local -x usercontext vcs rrn LC_ALL
     local -ix maxexports
     local -ax msgs
     local -Ax vcs_comm
 
+    LC_ALL=C
     vcs='-init-'; rrn='-all-'
     usercontext=${1:-default}
 
-- 
1.7.0



Messages sorted by: Reverse Date, Date, Thread, Author