From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "MauMau" <maumau307(at)gmail(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [bug fix] strerror() returns ??? in a UTF-8/C database with LC_MESSAGES=non-ASCII |
Date: | 2013-09-06 14:37:16 |
Message-ID: | 29000.1378478236@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
"MauMau" <maumau307(at)gmail(dot)com> writes:
> I've been suffering from PostgreSQL's problems related to character encoding
> for some time. I really wish to solve those problems, because they make
> troubleshooting difficult. I'm going to propose fixes for them, and I would
> appreciate if you could help release the official patches as soon as
> possible.
I don't find either of these patches to be a particularly good idea.
There is certainly no way we'd risk back-patching something with as
many potential side-effects as fooling with libc's textdomain.
I wonder though if we could attack the specific behavior you're
complaining of by testing to see if strerror() returned "???", and
substituting the numeric value for that, ie
* Some strerror()s return an empty string for out-of-range errno. This is
* ANSI C spec compliant, but not exactly useful.
*/
- if (str == NULL || *str == '\0')
+ if (str == NULL || *str == '\0' || strcmp(str, "???") == 0)
{
snprintf(errorstr_buf, sizeof(errorstr_buf),
/*------
This would only work if glibc always returns that exact string for a
codeset translation failure, but a look into the glibc sources should
quickly confirm that.
BTW: personally, I would say that what you're looking at is a glibc bug.
I always thought the contract of gettext was to return the ASCII version
if it fails to produce a translated version. That might not be what the
end user really wants to see, but surely returning something like "???"
is completely useless to anybody.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2013-09-06 14:42:34 | Re: [bug fix] strerror() returns ??? in a UTF-8/C database with LC_MESSAGES=non-ASCII |
Previous Message | Andres Freund | 2013-09-06 14:31:56 | Re: [RFC] Extend namespace of valid guc names |