[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#129294: gcc-2.95: cannot read translated messages



At Tue, 15 Jan 2002 09:41:22 +0900,
Tomohiro KUBOTA wrote:
> Translated messages of gcc-2.95/cpp-2.95/g++-2.95/g77-2.95 is not
> displayed well.  All non-ASCII characters are replaced with "?"
> (question mark).

This problem is resolved with the attached patch.
This patch disables setlocale(LC_MESSAGES, ...) if MULTIBYTE_CHARS
is disabled, because MULTIBYTE_CHARS kick on setlocale(LC_CTYPE, ...),
but this flag is currently off for safety reason on linux.

The patch for debian/rules.patch:

--- debian/rules.patch.vanilla	Sun Jan 20 01:24:47 2002
+++ debian/rules.patch	Sun Jan 20 01:25:57 2002
@@ -60,13 +60,13 @@
 	libstdc++-out-of-mem libstdc++-wstring \
 	libstdc++-bastring \
 	gcc-manpage cpp-dos-newlines libio-doc gcc-doc \
-	strength-red
+	strength-red gcc-message
 all_patches += bootstrap cpp-macro-doc \
 	gcc-default-arch \
 	libstdc++-out-of-mem libstdc++-wstring \
 	libstdc++-bastring \
 	gcc-manpage cpp-dos-newlines libio-doc gcc-doc \
-	strength-red
+	strength-red gcc-message
 min_patches += bootstrap cpp-macro-doc \
 	libio-doc gcc-doc
 

The new patch for debian/patches/gcc-messages.dpatch:


#! /bin/sh -e

# All lines beginning with `# DPATCH:' are a description of the patch.
# DP: avoid setlocale(LC_MESSAGES, ...) not to set LC_MESSAGES, because
# DP: some environment except for setting LANG=C fail to display libc 
# DP: message.

if [ $# -eq 3 -a "$2" = '-d' ]; then
    pdir="-d $3"
elif [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
    -patch) patch $pdir -f --no-backup-if-mismatch -p0 < $0;;
    -unpatch) patch $pdir -f --no-backup-if-mismatch -R -p0 < $0;;
    *)
	echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
	exit 1
esac
exit 0

2002-01-20  GOTO Masanori  <gotom@debian.org>

	* cccp.c: avoid setlocale(LC_MESSAGES, ...) if MULTIBYTE_CHARS is not set.
	* collect2.c: likewise.
	* cppmain.c: likewise.
	* gcc.c: likewise.
	* gcov.c: likewise.
	* protoize.c: likewise.
	* toplev.c: likewise.

--- gcc.vanilla/cccp.c	Wed Sep 19 13:32:46 2001
+++ gcc/cccp.c	Sun Jan 20 00:56:45 2002
@@ -1246,7 +1246,9 @@
 #endif
 
 #ifdef HAVE_LC_MESSAGES
+#ifdef MULTIBYTE_CHARS
   setlocale (LC_MESSAGES, "");
+#endif
 #endif
   (void) bindtextdomain (PACKAGE, localedir);
   (void) textdomain (PACKAGE);
--- gcc.vanilla/collect2.c	Fri Jan 26 04:39:42 2001
+++ gcc/collect2.c	Sun Jan 20 00:57:10 2002
@@ -1018,7 +1018,9 @@
 #endif
 
 #ifdef HAVE_LC_MESSAGES
+#ifdef MULTIBYTE_CHARS
   setlocale (LC_MESSAGES, "");
+#endif
 #endif
   (void) bindtextdomain (PACKAGE, localedir);
   (void) textdomain (PACKAGE);
--- gcc.vanilla/cppmain.c	Tue May 11 00:24:36 1999
+++ gcc/cppmain.c	Sun Jan 20 00:57:39 2002
@@ -53,7 +53,9 @@
   progname = p;
 
 #ifdef HAVE_LC_MESSAGES
+#ifdef MULTIBYTE_CHARS
   setlocale (LC_MESSAGES, "");
+#endif
 #endif
   (void) bindtextdomain (PACKAGE, localedir);
   (void) textdomain (PACKAGE);
--- gcc.vanilla/gcc.c	Wed Oct  3 13:33:43 2001
+++ gcc/gcc.c	Sun Jan 20 00:58:00 2002
@@ -4654,7 +4654,9 @@
   programname = p;
 
 #ifdef HAVE_LC_MESSAGES
+#ifdef MULTIBYTE_CHARS
   setlocale (LC_MESSAGES, "");
+#endif
 #endif
   (void) bindtextdomain (PACKAGE, localedir);
   (void) textdomain (PACKAGE);
--- gcc.vanilla/gcov.c	Sat Apr 17 04:52:19 1999
+++ gcc/gcov.c	Sun Jan 20 00:58:30 2002
@@ -227,7 +227,9 @@
      char **argv;
 {
 #ifdef HAVE_LC_MESSAGES
+#ifdef MULTIBYTE_CHARS
   setlocale (LC_MESSAGES, "");
+#endif
 #endif
   (void) bindtextdomain (PACKAGE, localedir);
   (void) textdomain (PACKAGE);
--- gcc.vanilla/protoize.c	Sat Apr 17 04:52:36 1999
+++ gcc/protoize.c	Sun Jan 20 00:56:14 2002
@@ -4559,7 +4559,9 @@
   pname = pname ? pname+1 : argv[0];
 
 #ifdef HAVE_LC_MESSAGES
+#ifdef MULTIBYTE_CHARS
   setlocale (LC_MESSAGES, "");
+#endif
 #endif
   (void) bindtextdomain (PACKAGE, localedir);
   (void) textdomain (PACKAGE);
--- gcc.vanilla/toplev.c	Sat Apr  7 13:32:43 2001
+++ gcc/toplev.c	Sun Jan 20 00:59:14 2002
@@ -4791,7 +4791,9 @@
 #endif
 
 #ifdef HAVE_LC_MESSAGES
+#ifdef MULTIBYTE_CHARS
   setlocale (LC_MESSAGES, "");
+#endif
 #endif
   (void) bindtextdomain (PACKAGE, localedir);
   (void) textdomain (PACKAGE);


The test result of this patch:

gotom@celesta:~/debian/sample/gcc/gcc-2.95-2.95.4.ds8/build-native/gcc> ./xgcc aaa
xgcc: aaa: No such file or directory
xgcc: No input files
gotom@celesta:~/debian/sample/gcc/gcc-2.95-2.95.4.ds8/build-native/gcc> setenv | grep LANG
LANG=ja_JP.eucJP

-- gotom



Reply to: