Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: 'make check' failures on Solaris 2.5 and 5.8



Vin Shelton wrote:
> Sorry to followup my own post, but I forgot to mention that the
> failures started appearing on 2003-03-14.  My 2003-03-13 build passed
> 'make check' fine, except for the expected C02cond failure.

That narrows it down to being my fault in the \u/\U change. Thanks for
reporting it.

The problem is that MB_LEN_MAX is less than 6 on Solaris so it wasn't
allocating enough memory. UTF-8 has characters up to 6 bytes in length
so this suprised me. Solaris 8 pretends to offer UTF-8 locales but I
can't get them to work. The patch below is a quick fix. MB_LEN_MAX is
defined to be 16 in recent glibc which seems high. Anyone know why or
what character sets need that? Handling of $'...' will need rethinking if
'\unnnn' can produce more than 6 bytes because $'...' is done by modifying
the string in place.

If anyone has access to any operating systems other than Linux
and Solaris 8, it would be really useful to know whether it defines
__STDC_ISO_10646__, the value of MB_LEN_MAX and, even more valuably, what
iconv conversions it allows. iconv doesn't necessarily use the same names
for character sets as nl_langinfo(CODESET). unicode can be ISO-10646,
ISO646, 646, UCS4 and other variants so I perhaps should manually convert
to UTF-8 as that has fewer names and then try converting to WCHAR_T and
then nl_langinfo(CODESET).

Oliver

Index: utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/utils.c,v
retrieving revision 1.45
diff -u -r1.45 utils.c
--- utils.c	14 Mar 2003 13:36:16 -0000	1.45
+++ utils.c	18 Mar 2003 11:33:59 -0000
@@ -3311,15 +3311,12 @@
     char *inptr, *outptr;
 #  endif
     size_t count;
-    size_t buflen = MB_LEN_MAX * (strlen(s) / 6) + (strlen(s) % 6) + 1;
-#else
-    size_t buflen = strlen(s) + 1;
 #endif
 
     if (fromwhere == 6)
 	t = buf = tmp;
     else if (fromwhere != 4)
-	t = buf = zhalloc(buflen);
+	t = buf = zhalloc(strlen(s) + 1);
     else {
 	t = buf = s;
 	s += 2;



Messages sorted by: Reverse Date, Date, Thread, Author