bin/76773: [PATCH] catopen(3) within tcsh(1) uses LANG instead of LC_MESSAGES

Rostislav Krasny rosti_bsd at yahoo.com
Thu Jan 27 13:00:37 PST 2005


>Number:         76773
>Category:       bin
>Synopsis:       [PATCH] catopen(3) within tcsh(1) uses LANG instead of LC_MESSAGES
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 27 21:00:36 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Rostislav Krasny
>Release:        5.3-RELEASE-p5
>Organization:
>Environment:
FreeBSD saturn 5.3-RELEASE-p5 FreeBSD 5.3-RELEASE-p5 #0: Mon Jan 17 11:50:06 IST 2005     root at saturn:/usr/obj/usr/src/sys/MYKERNEL  i386
>Description:
tcsh(1) uses the catopen(3) function to open the message catalog with localized messages. It have following prototype:

catopen(const char *name, int oflag);

and is called by tcsh(1) only in sh.func.c:

catd = catopen(catalog, MCLoadBySet);

The MCLoadBySet is defined only in sh.h:

#  ifndef MCLoadBySet
#   define MCLoadBySet 0
#  endif

===== quote from catopen(3) manual =====
If the oflag argument is set to the NL_CAT_LOCALE constant, LC_MESSAGES
locale category used to open the message catalog; using NL_CAT_LOCALE
conforms to the X/Open Portability Guide Issue 4 (``XPG4'') standard.
You can specify 0 for compatibility with X/Open Portability Guide Issue 3
(``XPG3''); when oflag is set to 0, the LANG environment variable deter-
mines the message catalog locale.
===== quote from catopen(3) manual =====
>How-To-Repeat:
1. run csh or tcsh
2. change the LANG environment variable to fr_FR.ISO8859-15 or ru_RU.KOI8-R
3. change LC_MESSAGES environment variable to C
4. run any non-existent command, for example 'gg', and see in what language you get the error message.

Just a short example:

> locale
LANG=fr_FR.ISO8859-15
LC_CTYPE="fr_FR.ISO8859-15"
LC_COLLATE="fr_FR.ISO8859-15"
LC_TIME="fr_FR.ISO8859-15"
LC_NUMERIC="fr_FR.ISO8859-15"
LC_MONETARY="fr_FR.ISO8859-15"
LC_MESSAGES=C
LC_ALL=
> gg
gg: Commande introuvable.
>Fix:
--- /usr/src/bin/csh/config.h   Sun Jul 11 05:23:38 2004
+++ config.h    Thu Jan 27 22:08:22 2005
@@ -130,6 +130,8 @@
 /* we want to use the system malloc when we install as /bin/csh */
 #define SYSMALLOC
 #define BSD_STYLE_COLORLS
+/* LC_MESSAGES locale category used to open the message catalog */
+#define MCLoadBySet NL_CAT_LOCALE
 #endif

 #if defined(__NetBSD__)

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list