From: Peter Stephenson <pws@csr.com>
To: Dagobert Michelsen <dam@blastwave.org>
Cc: zsh-workers@sunsite.dk
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 [thread overview]
Message-ID: <200802261610.m1QGAwJ3008939@news01.csr.com> (raw)
In-Reply-To: <656429B3-438B-4ECF-85C4-04E38D837D1A@blastwave.org>
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@csr.com> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
next prev parent reply other threads:[~2008-02-26 16:14 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-26 13:18 Dagobert Michelsen
2008-02-26 14:14 ` Peter Stephenson
2008-02-26 14:42 ` Dagobert Michelsen
2008-02-26 14:57 ` Peter Stephenson
2008-02-26 15:18 ` Dagobert Michelsen
2008-02-26 16:10 ` Peter Stephenson [this message]
2008-02-26 17:37 ` * " Oliver Kiddle
2008-02-27 11:29 ` Peter Stephenson
2008-02-27 16:16 ` Bart Schaefer
2008-02-29 9:53 ` Oliver Kiddle
2008-03-03 12:08 ` Peter Stephenson
2008-03-03 12:43 ` Dagobert Michelsen
2008-03-03 12:59 ` Peter Stephenson
2008-02-26 18:08 ` Peter Stephenson
2008-02-26 18:12 ` İsmail Dönmez
2008-02-26 19:19 ` Dagobert Michelsen
2008-02-26 19:47 ` Dagobert Michelsen
2008-02-26 20:42 ` Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200802261610.m1QGAwJ3008939@news01.csr.com \
--to=pws@csr.com \
--cc=dam@blastwave.org \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).