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

Bug#214028: localedef, LSB 1.3 conformance, and Debian standard utilities



Package: libc6
Version: 2.3.2-8

This message is motivated by Debian's desire to pass the LSB 1.3
conformance tests.  The patch proposed below is intended to close
Debian bugs 184886, 184887, 186140, and 206210.  184887 has "serious"
severity; the rest are "wishlist".

Many Debian utilities (diff, cpio, sort, join, pr, uniq, etc.) lack
complete support for multibyte encodings.  The LSB conformance tests
apparently create locales with multibyte encodings using "localedef",
and then use these locales as part of the later tests.  POSIX and LSB
do not require that localedef must succeed when users attempt to
create multibyte locales; but if localedef succeeds, Andrew Josey has
indicated that the relevant Debian utilities must fully support the
multibyte locales that are created.

We plan to fix these utilities at some point in the hopefully
not-to-distant future.  Patches have been submitted for some of them,
but the patches are incomplete, are complicated and possibly buggy,
and in some cases are harmful to unibyte performance.

In the meantime, to conform to LSB 1.3, I propose that we modify the
"localedef" command to refuse to create user-defined locales with
multibyte encodings when invoked in a strict POSIX environment.  This
is a very simple fix that avoids the patch problems mentioned earlier.
It should not affect ordinary users (who hardly ever use localedef,
and when they do, don't use it in strict POSIX mode).  And it should
satisfy the LSB 1.3 conformance testers.

Here is a proposed patch.  I haven't tested it, unfortunately, since I
lack the correct development and test environment (I've never seen the
LSB 1.3 conformance tests).  But the basic idea is pretty
straightforward.  This patch isn't entirely satisfactory of course,
but it should get the job done for now.

2003-10-03  Paul Eggert  <eggert@twinsun.com>

	* locale/programs/localedef.c (main): Reject attempts to create
	multibyte locales when operating in strict POSIX mode.

--- glibc-2.3.2-8/glibc-2.3.2/locale/programs/localedef.c	Thu Jan  2 12:02:31 2003
+++ glibc-2.3.2-8-fix/glibc-2.3.2/locale/programs/localedef.c	Fri Oct  3 16:57:39 2003
@@ -247,6 +247,18 @@ FATAL: system does not define `_POSIX2_L
   /* Process charmap file.  */
   charmap = charmap_read (charmap_file, verbose, be_quiet, 1);
 
+  /* Some Debian utilities don't fully support multibyte encodings.
+     Pass the LSB 1.3 conformance tests by not allowing users to
+     create locales with such encodings.  This hack can be removed
+     after all Debian standard utilities have full support for
+     multibyte locales.  (However, if localedef ever adds support for
+     state-dependent character encodings, a similar hack will be
+     needed until all Debian standard utilities have full support for
+     such encodings.)  */
+  if (posix_conformance && 1 < charmap->mb_cur_max)
+    WITH_CUR_LOCALE (error (2, 0, _("\
+FATAL: multibyte character sets are not supported in strict POSIX mode")));
+
   /* Add the first entry in the locale list.  */
   memset (&global, '\0', sizeof (struct localedef_t));
   global.name = input_file ?: "/dev/stdin";
Only in glibc-2.3.2-8-fix/glibc-2.3.2/locale/programs: localedef.c~



Reply to: