Skip site navigation (1) Skip section navigation (2)

Ye olde "failed to initialize lc_messages" gotcha

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Ye olde "failed to initialize lc_messages" gotcha
Date: 2006-06-02 23:21:05
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
We got another report of this failure today:
which I found particularly interesting because it happened on a Fedora
machine, and I had thought Fedora impervious because it considers
glibc-common a standard component.  Seems it can happen anyway.

I did some experimentation with the problem by the expedient of
renaming /usr/share/locale and /usr/lib/locale out of the way,
and found that:

1. glibc's setlocale() does in fact fail for setlocale(LC_MESSAGES, "")
if it can't find any locale files, but only if LANG is not C
(I used LANG=en_US to provoke the failure).

2. It fails in the same way for other LC_xxx settings too, but it turns
out that LC_MESSAGES is the only one where we actually pay any attention.

What I propose we do about this is tweak locale_messages_assign() to not
fail if value == "" and source == PGC_S_DEFAULT.  Since value == "" is
really a no-op during startup anyway, there is no harm in doing this;
and by restricting it to source == PGC_S_DEFAULT, we can avoid the error
of accepting explicit attempts to set lc_messages to "".

Any objections?

			regards, tom lane

pgsql-hackers by date

Next:From: Tom LaneDate: 2006-06-02 23:38:57
Subject: Re: More thoughts about planner's cost estimates
Previous:From: Rod TaylorDate: 2006-06-02 23:05:15
Subject: Re: More thoughts about planner's cost estimates

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group