Subject: Notification: incoming/892

From: [email-masked]
Date: Mon, 03 Jun 2002 06:31:59 -0500

FVWM Bug Tracking notification

new message incoming/892

Message summary for PR#892
	From: [email-masked]
	Subject: FvwmForm: getenv LC_CTYPE
	Date: Mon, 03 Jun 2002 06:31:58 -0500
	0 replies 	0 followups

====> ORIGINAL MESSAGE FOLLOWS <====

>From [email-masked] Mon Jun 03 06:31:59 2002
From: [email-masked]
To: [email-masked]
Subject: FvwmForm: getenv LC_CTYPE
Date: Mon, 03 Jun 2002 06:31:58 -0500

Full_Name: YAMAGUCHI Shingo
Version: snapshot 20020531, snapshot 20020602
CVS_Date: 
OS: Linux 2.4.18 (glibc 2.2.5, gcc 3.1)
X_Server: XFree86 4.2.99.1
Submission from: (NULL) (210.128.199.160)

If LC_CTYPE is undefined, FvwmForm cannot display any multibyte (I use
EUC-JP) character (If LC_CTYPE set to "ja_JP.eucJP", FvwmForm works fine).

FlocaleInit() in FvwmForm main() is this:

  FlocaleInit(LC_CTYPE, getenv("LC_CTYPE"), "", "FvwmForm");

If "LC_CTYPE" environment variable is undefined, getenv() returns NULL
pointer. And NULL pointer is sent to setlocale() in FlocaleInit(). If
setlocale() receive NULL pointer locale argument, return value is
undefined.

Instead of using getenv(), use "empty string". i.e.:

  FlocaleInit(LC_CTYPE, "", "", "FvwmForm");

This means "Use default locale which is selected from one of the
environment variables (LC_*, LANG)". This technique is used on FvwmPager
etc.

Here is 1 line patch:
----- cut here -----
diff -aurN fvwm-snap-20020602.orig/modules/FvwmForm/FvwmForm.c
fvwm-snap-20020602/modules/FvwmForm/FvwmForm.c
--- fvwm-snap-20020602.orig/modules/FvwmForm/FvwmForm.c 2002-06-03
20:02:25.000000000 +0900
+++ fvwm-snap-20020602/modules/FvwmForm/FvwmForm.c      2002-06-03
20:03:28.000000000 +0900
@@ -2398,7 +2398,7 @@
   freopen(".FvwmFormDebug","w",stderr);
 #endif
 
-  FlocaleInit(LC_CTYPE, getenv("LC_CTYPE"), "", "FvwmForm");
+  FlocaleInit(LC_CTYPE, "", "", "FvwmForm");
 
   /* From FvwmAnimate start */
   /* Save our program  name - for error events */
----- cut here -----

--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Olivier Chapuis <[email-masked]>
Date: Mon, 3 Jun 2002 16:32:34 +0200

On Mon, Jun 03, 2002 at 06:31:59AM -0500, [email-masked] wrote:
> Message-Id: <[email-masked]>

Yes, I've applied the patch. FlocaleInit was called in the
good way every where but in FvwmForm. A "miss print" :o)

Any bugs repport or comments on using fvwm with a "multibyte locale"
is really welcome because no fvwm workers use such a locale.

Thanks, Olivier

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 3 Jun 2002 18:23:10 +0200

> good way every where but in FvwmForm. A "miss print" :o)

Hm, if the arguments of FlocaleInit() are always the same, then
why not put the code handling LC_CTYPE etc. directly into that
function?  As far as I can see, it's always called like this:

  FlocaleInit(LC_CTYPE, "", "", "<module name>");

The only parameter that ever changes is the last one.  So, why
not simply strip the first three arguments and hard code them
inside the function?

Bye

Dominik ^_^  ^_^

 --
Dominik Vogt, [email-masked]
Reply-To: [email-masked]
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Olivier Chapuis <[email-masked]>
Date: Mon, 3 Jun 2002 21:24:08 +0200

>   FlocaleInit(LC_CTYPE, "", "", "<module name>");

Yes.
 
> not simply strip the first three arguments and hard code them

I've no objection. But when I rewrite the locale stuff
I thought that having this parameters may be good under
certain situation (e.g., switching between locale
or enforcing one for special reason). Now maybe we
will never use this 2 parameters in the future, but
it does not seem to me that this is a big problem.

Olivier

---

From: Dominik Vogt <[email-masked]>
Date: Tue, 4 Jun 2002 11:36:19 +0200

> it does not seem to me that this is a big problem.

An additional function preparing the parameters and calling
FlocaleInit() won't hurt.

  FunctionThatCallsFlocaleInitWithTheCorrectArgs()
  -> FlocaleInit()

Bye

Dominik ^_^  ^_^