zsh-workers
 help / color / mirror / code / Atom feed
From: Frank Terbeck <ft@bewatermyfriend.org>
To: zsh-workers@zsh.org
Subject: Re: vcs_info and locales
Date: Sun, 25 Apr 2010 10:38:59 +0200	[thread overview]
Message-ID: <87aassncyk.fsf@ft.bewatermyfriend.org> (raw)
In-Reply-To: <20100424234017.776ae0ea@coriolan> (=?utf-8?Q?=22Fran=C3=A7oi?= =?utf-8?Q?s?= Gannaz"'s message of "Sat, 24 Apr 2010 23:40:17 +0200")

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@bewatermyfriend.org>
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


  reply	other threads:[~2010-04-25  8:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-24 21:40 François Gannaz
2010-04-25  8:38 ` Frank Terbeck [this message]
2010-04-25 10:36   ` François Gannaz
2010-04-25 13:19   ` Phil Pennock
2010-04-25 14:09     ` Frank Terbeck
2010-04-25 14:29       ` Frank Terbeck
2010-05-19 10:07       ` Richard Hartmann
2010-05-19 11:50         ` François Gannaz
2010-05-19 12:03           ` Richard Hartmann
2010-04-25 19:09     ` François Gannaz
2010-04-26  0:29       ` Phil Pennock
2010-04-26  6:36         ` Frank Terbeck
2010-04-26  8:56           ` François Gannaz
2010-04-26 19:07             ` Frank Terbeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87aassncyk.fsf@ft.bewatermyfriend.org \
    --to=ft@bewatermyfriend.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).