* PATCH: Restore `LC_ALL' when setting `LANG'
[not found] ` <87boqk95we.fsf@ft.bewatermyfriend.org>
@ 2012-01-03 15:26 ` Frank Terbeck
2012-01-04 2:16 ` Vincent Lefevre
0 siblings, 1 reply; 6+ messages in thread
From: Frank Terbeck @ 2012-01-03 15:26 UTC (permalink / raw)
To: 654225; +Cc: Michael Prokop, mbj, zsh-workers
(Cc:ing Upstream)
When setting LANG, zsh sets LC_ALL and then goes on to restore all
interesting LC_* values after that. Up to now, it did not restore LC_ALL
itself, though.
That could lead to trouble when setting LC_ALL=something-utf8-ish and
after that LANG=something-non-utf8.
This was reported in Debian bugreport #654225:
<http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=654225>
A recipe to reproduce the issue is here:
<http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=654225#65>
I think the patch below fixes the issue correctly, by restoring LC_ALL
from its parameter along the way with all the other LC_* values zsh
cares about.
(FWIW, the test-suite still passes with this change.)
Regards, Frank
---
Src/params.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/Src/params.c b/Src/params.c
index 446cccc..6d98b8e 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -3780,6 +3780,9 @@ static struct localename {
#ifdef LC_TIME
{"LC_TIME", LC_TIME},
#endif
+#ifdef LC_ALL
+ {"LC_ALL", LC_ALL},
+#endif
{NULL, 0}
};
--
1.7.8.rc3.17.gf56ef1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: PATCH: Restore `LC_ALL' when setting `LANG'
2012-01-03 15:26 ` PATCH: Restore `LC_ALL' when setting `LANG' Frank Terbeck
@ 2012-01-04 2:16 ` Vincent Lefevre
2012-01-04 17:30 ` Peter Stephenson
0 siblings, 1 reply; 6+ messages in thread
From: Vincent Lefevre @ 2012-01-04 2:16 UTC (permalink / raw)
To: Frank Terbeck; +Cc: 654225, Michael Prokop, mbj, zsh-workers
On 2012-01-03 16:26:44 +0100, Frank Terbeck wrote:
> I think the patch below fixes the issue correctly, by restoring LC_ALL
> from its parameter along the way with all the other LC_* values zsh
> cares about.
I don't understand why zsh has anything to do with environment
variables to detect the charset (if I understood correctly).
Why not using nl_langinfo(CODESET)?
--
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: PATCH: Restore `LC_ALL' when setting `LANG'
2012-01-04 2:16 ` Vincent Lefevre
@ 2012-01-04 17:30 ` Peter Stephenson
2012-01-06 6:03 ` Jun T.
0 siblings, 1 reply; 6+ messages in thread
From: Peter Stephenson @ 2012-01-04 17:30 UTC (permalink / raw)
To: zsh-workers; +Cc: 654225
On 2012-01-03 16:26:44 +0100, Frank Terbeck wrote:
> I think the patch below fixes the issue correctly, by restoring LC_ALL
> from its parameter along the way with all the other LC_* values zsh
> cares about.
Looks plausible, without following through all the implications.
On Wed, 4 Jan 2012 03:16:41 +0100
Vincent Lefevre <vincent@vinc17.net> wrote:
> I don't understand why zsh has anything to do with environment
> variables to detect the charset (if I understood correctly).
> Why not using nl_langinfo(CODESET)?
Intercepting the setting of environment variables is mostly to ensure
setlocale() gets run when necessary.
--
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: PATCH: Restore `LC_ALL' when setting `LANG'
2012-01-04 17:30 ` Peter Stephenson
@ 2012-01-06 6:03 ` Jun T.
2012-01-07 20:04 ` Peter Stephenson
0 siblings, 1 reply; 6+ messages in thread
From: Jun T. @ 2012-01-06 6:03 UTC (permalink / raw)
To: zsh-workers
Instead of adding LC_ALL to lc_names[], I think it better
not calling setlocale() at all if LC_ALL is non-empty.
Index: Src/params.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/params.c,v
retrieving revision 1.175
diff -u -r1.175 params.c
--- Src/params.c 11 Aug 2011 19:32:50 -0000 1.175
+++ Src/params.c 6 Jan 2012 05:42:12 -0000
@@ -3788,6 +3788,10 @@
setlang(char *x)
{
struct localename *ln;
+ char *x2;
+
+ if ((x2 = getsparam("LC_ALL")) && *x2)
+ return;
/*
* Set the global locale to the value passed, but override
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: PATCH: Restore `LC_ALL' when setting `LANG'
2012-01-06 6:03 ` Jun T.
@ 2012-01-07 20:04 ` Peter Stephenson
2012-01-07 21:41 ` Frank Terbeck
0 siblings, 1 reply; 6+ messages in thread
From: Peter Stephenson @ 2012-01-07 20:04 UTC (permalink / raw)
To: zsh-workers
On Fri, 6 Jan 2012 15:03:54 +0900
"Jun T." <takimoto-j@kba.biglobe.ne.jp> wrote:
> Instead of adding LC_ALL to lc_names[], I think it better
> not calling setlocale() at all if LC_ALL is non-empty.
I can see that's a reasonably minimal change. As long as Frank's happy
that fixes the problem, I can apply it.
--
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: PATCH: Restore `LC_ALL' when setting `LANG'
2012-01-07 20:04 ` Peter Stephenson
@ 2012-01-07 21:41 ` Frank Terbeck
0 siblings, 0 replies; 6+ messages in thread
From: Frank Terbeck @ 2012-01-07 21:41 UTC (permalink / raw)
To: zsh-workers
Peter Stephenson wrote:
> On Fri, 6 Jan 2012 15:03:54 +0900
> "Jun T." <takimoto-j@kba.biglobe.ne.jp> wrote:
>> Instead of adding LC_ALL to lc_names[], I think it better
>> not calling setlocale() at all if LC_ALL is non-empty.
>
> I can see that's a reasonably minimal change. As long as Frank's happy
> that fixes the problem, I can apply it.
I don't know if it's the better fix, but then I'm pretty ignorant about
matters of `locale'... I can confirm that Jun's patch seems to fix the
bug as well. So I don't mind either way.
Regards, Frank
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-01-07 21:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20120102132718.GA12143@gatsby.mbjnet.dk>
[not found] ` <87fwfyb2if.fsf@ft.bewatermyfriend.org>
[not found] ` <20120102154714.GA20663@gatsby.mbjnet.dk>
[not found] ` <87wr9a9ely.fsf@ft.bewatermyfriend.org>
[not found] ` <20120103111049.GA5673@gatsby.mbjnet.dk>
[not found] ` <87sjjw98yl.fsf@ft.bewatermyfriend.org>
[not found] ` <87k458974e.fsf@ft.bewatermyfriend.org>
[not found] ` <2012-01-03T15-59-18@devnull.michael-prokop.at>
[not found] ` <87boqk95we.fsf@ft.bewatermyfriend.org>
2012-01-03 15:26 ` PATCH: Restore `LC_ALL' when setting `LANG' Frank Terbeck
2012-01-04 2:16 ` Vincent Lefevre
2012-01-04 17:30 ` Peter Stephenson
2012-01-06 6:03 ` Jun T.
2012-01-07 20:04 ` Peter Stephenson
2012-01-07 21:41 ` Frank Terbeck
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).