* FYI: fix Solaris problem with auto host charset
@ 2009-04-17 23:50 Tom Tromey
2009-04-18 6:38 ` Eli Zaretskii
0 siblings, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2009-04-17 23:50 UTC (permalink / raw)
To: gdb-patches
I'm checking this in.
On some versions of Solaris, nl_langinfo(CODESET) will return "646"
for the C locale. Unfortunately, this value is not then recognized by
iconv_open.
This fixes the problem by recognizing this situation and using "ASCII"
instead. I'm unaware of any other names needing this treatment.
This is a bit of a hack. But, I think such cases should be rare. (My
experience with gcj was that this was the only such case ever
reported.)
Built and regtested on x86-64 (compile farm).
Joel also tested it on an actual Solaris box showing the problem, and
reported improved test results.
Tom
2009-04-17 Tom Tromey <tromey@redhat.com>
* charset.c (_initialize_charset): Add special case for "646".
Index: charset.c
===================================================================
RCS file: /cvs/src/src/gdb/charset.c,v
retrieving revision 1.22
diff -u -r1.22 charset.c
--- charset.c 15 Apr 2009 22:20:30 -0000 1.22
+++ charset.c 17 Apr 2009 23:45:32 -0000
@@ -817,6 +817,10 @@
#ifndef PHONY_ICONV
#ifdef HAVE_LANGINFO_CODESET
auto_host_charset_name = nl_langinfo (CODESET);
+ /* Solaris will return `646' here -- but the Solaris iconv then
+ does not accept this. */
+ if (!strcmp (auto_host_charset_name, "646"))
+ auto_host_charset_name = "ASCII";
target_charset_name = auto_host_charset_name;
set_be_le_names ();
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: FYI: fix Solaris problem with auto host charset
2009-04-17 23:50 FYI: fix Solaris problem with auto host charset Tom Tromey
@ 2009-04-18 6:38 ` Eli Zaretskii
2009-04-18 17:12 ` Tom Tromey
0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2009-04-18 6:38 UTC (permalink / raw)
To: tromey; +Cc: gdb-patches
> From: Tom Tromey <tromey@redhat.com>
> Date: Fri, 17 Apr 2009 17:49:58 -0600
>
> On some versions of Solaris, nl_langinfo(CODESET) will return "646"
> for the C locale. Unfortunately, this value is not then recognized by
> iconv_open.
>
> This fixes the problem by recognizing this situation and using "ASCII"
> instead. I'm unaware of any other names needing this treatment.
Btw, why is the code assuming that nl_langinfo always returns a
meaningful result? It can potentially return an empty string.
Although this is at worst a very rare situation, perhaps we should
take it into consideration and fall back on GDB_DEFAULT_HOST_CHARSET.
Also, I don't quite get the reason why nl_langinfo is not called in
the PHONY_ICONV case. It seems we blindly assume the native charset
is Latin-1 in that case, but perhaps nl_langinfo, if it exists, will
give a better guess?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: FYI: fix Solaris problem with auto host charset
2009-04-18 6:38 ` Eli Zaretskii
@ 2009-04-18 17:12 ` Tom Tromey
2009-04-21 18:53 ` Tom Tromey
0 siblings, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2009-04-18 17:12 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
Eli> Btw, why is the code assuming that nl_langinfo always returns a
Eli> meaningful result?
Oversight.
Eli> Also, I don't quite get the reason why nl_langinfo is not called in
Eli> the PHONY_ICONV case. It seems we blindly assume the native charset
Eli> is Latin-1 in that case, but perhaps nl_langinfo, if it exists, will
Eli> give a better guess?
In the PHONY_ICONV case we have no way to convert between character
sets. I think this only affects u'' and U''; so it really a matter of
which failure you want in this situation.
If you want to change this, it is fine by me.
Tom
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: FYI: fix Solaris problem with auto host charset
2009-04-18 17:12 ` Tom Tromey
@ 2009-04-21 18:53 ` Tom Tromey
2009-04-21 19:06 ` Eli Zaretskii
0 siblings, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2009-04-21 18:53 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:
Eli> Btw, why is the code assuming that nl_langinfo always returns a
Eli> meaningful result?
Tom> Oversight.
I re-read the relevant standard text online, and as far as I can tell,
nl_langinfo will only return an empty string if the argument is invalid.
So, I don't think this is an issue for gdb.
Tom
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: FYI: fix Solaris problem with auto host charset
2009-04-21 18:53 ` Tom Tromey
@ 2009-04-21 19:06 ` Eli Zaretskii
2009-04-21 19:13 ` Tom Tromey
0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2009-04-21 19:06 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
> Cc: gdb-patches@sourceware.org
> From: Tom Tromey <tromey@redhat.com>
> Date: Tue, 21 Apr 2009 12:53:26 -0600
>
> >>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:
>
> Eli> Btw, why is the code assuming that nl_langinfo always returns a
> Eli> meaningful result?
>
> Tom> Oversight.
>
> I re-read the relevant standard text online, and as far as I can tell,
> nl_langinfo will only return an empty string if the argument is invalid.
> So, I don't think this is an issue for gdb.
I thought "invalid argument" includes arguments that are unsupported.
Doesn't it?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: FYI: fix Solaris problem with auto host charset
2009-04-21 19:06 ` Eli Zaretskii
@ 2009-04-21 19:13 ` Tom Tromey
0 siblings, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2009-04-21 19:13 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
Eli> I thought "invalid argument" includes arguments that are unsupported.
Eli> Doesn't it?
Not according to the text I read.
Tom
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-04-21 19:13 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-17 23:50 FYI: fix Solaris problem with auto host charset Tom Tromey
2009-04-18 6:38 ` Eli Zaretskii
2009-04-18 17:12 ` Tom Tromey
2009-04-21 18:53 ` Tom Tromey
2009-04-21 19:06 ` Eli Zaretskii
2009-04-21 19:13 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox