Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: * Re: Failed tests of zsh 4.3.5 in Solaris 10 w/Sun Studio 12 CC
- X-seq: zsh-workers 24596
- From: Peter Stephenson <pws@xxxxxxx>
- To: Dagobert Michelsen <dam@xxxxxxxxxxxxx>
- Subject: Re: * Re: Failed tests of zsh 4.3.5 in Solaris 10 w/Sun Studio 12 CC
- Date: Tue, 26 Feb 2008 16:10:58 +0000
- Cc: zsh-workers@xxxxxxxxxx
- In-reply-to: <656429B3-438B-4ECF-85C4-04E38D837D1A@xxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <8AABEECB-A9A6-43EA-BED2-4BE376CBE349@xxxxxxxxxxxxx> <20080226141459.76dc362c@news01> <BD1EA7D6-C784-4ED9-9558-5B655CBC5096@xxxxxxxxxxxxx> <20080226145741.6e74fc22@news01> <656429B3-438B-4ECF-85C4-04E38D837D1A@xxxxxxxxxxxxx>
Dagobert Michelsen wrote:
> 16896: -> libiconv:libiconv_open(0xdf986e04, 0x80c1e90)
>
> ...and...
>
> thor% mdb -p 16896
> Loading modules: [ ]
> > 0xdf986e04/S
> 0xdf986e04: 646
> > 0x80c1e90/S
> 0x80c1e90: UCS-4BE
>
> Looks like there is no 646:
>
> thor% /opt/csw/bin/iconv -l | grep 646
> ANSI_X3.4-1968 ANSI_X3.4-1986 ASCII CP367 IBM367 ISO-IR-6 ISO646-US
> ISO_646.IRV:1991 US US-ASCII CSASCII
> ISO-10646-UCS-2 UCS-2 CSUNICODE
> ISO-10646-UCS-4 UCS-4 CSUCS4
> ISO-IR-14 ISO646-JP JIS_C6220-1969-RO JP CSISO14JISC6220RO
> CN GB_1988-80 ISO-IR-57 ISO646-CN CSISO57GB1988
>
> Is this an error from zsh or is this a bug in libiconv?
The first argument comes directly from what nl_langinfo(CODESET) is
returning. I've tried it on our rather old Solaris 8 system and I get
the same as you, 646---and my iconv doesn't handle that either.
I asked the nice man from Mountain View about "nl_langinfo CODESET 646"
and it seems Solaris just sort of does that if doesn't think much of the
current codeset (e.g. not installed).
So I think we just need to massage it to some reasonable default, which
probably means "US-ASCII" (I'm not sure why that's better than "ASCII",
which I thought was unique, but that's what people seem to use---POSIX
rather self-centredly suggests "POSIX" but iconv doesn't seem to support
that). I don't think 646 means anything, so I haven't made this
dependent on system. Assuming ASCII shouldn't be a problem: if the
7-bit subset isn't ASCII the shell is likely to have disappeared in a
puff of smoke by now.
I suppose trapping "" is a good thing, too, since iconv_open() doesn't
appear to have useful defaults (and there's no reason why it should
have).
As they say in US police dramas, "I'm denying your 646". Or something.
Index: Src/utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/utils.c,v
retrieving revision 1.177
diff -u -r1.177 utils.c
--- Src/utils.c 26 Feb 2008 14:50:05 -0000 1.177
+++ Src/utils.c 26 Feb 2008 16:02:07 -0000
@@ -4867,6 +4867,7 @@
} else {
# ifdef HAVE_ICONV
ICONV_CONST char *inptr = inbuf;
+ const char *codesetstr = nl_langinfo(CODESET);
inbytes = 4;
outbytes = 6;
/* store value in big endian form */
@@ -4875,6 +4876,18 @@
wval >>= 8;
}
+ /*
+ * If the code set isn't handled, we'd better
+ * assume it's US-ASCII rather than just failing
+ * hopelessly. Solaris has a weird habit of
+ * returning 646.
+ *
+ * It shouldn't ever be NULL, but while we're
+ * being paranoid...
+ */
+ if (!codessetstr || !*codsetstr ||
+ !strcmp(codesetstr, "646"))
+ codesetstr == "US-ASCII";
cd = iconv_open(nl_langinfo(CODESET), "UCS-4BE");
if (cd == (iconv_t)-1) {
zerr("cannot do charset conversion (iconv failed)");
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
Messages sorted by:
Reverse Date,
Date,
Thread,
Author