On Mon, Jul 02, 2007 at 10:47:43PM +0200, Pierre Habouzit wrote:
> dAniel hAhler wrote:
> > Pierre Habouzit wrote:
> > > And reading the bug, it's due to a breakage of Ubuntu that loses
> > > locales.
> >
> > Sure. The locale setup is broken. But that is likely a temporary
> > problem and no reason for apt-listchanges to fail.
>
> Sure, but OTOH apt-listchanges is suposed to be launched at times when
> the system is fully configured and in a coherent state. perl is used in
> debconf, hence during (e.g.) the locales upgrade. It's bound to fail
> somehow wrt locales updates. apt-listchanges is called *before* anything
> happens.
Regardless of whether the locale should be configured or not, there is
no reason for apt-listchanges to fail in this scenario, and therefore it
should not crash with an uncaught exception. As far as apt-listchanges
is concerned, a broken locale should be a warning, not an error.
See also this Python enhancement request (which in reality I doubt will
actually happen in Python; I can understand Martin v. Löwis' arguments)
in which I note a scenario involving ssh SendEnv where people often end
up with unconfigured locales in practice:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1703592&group_id=5470
I've attached an updated patch that addresses your concerns about
silence and that catches the exception more precisely.
Cheers,
--
Colin Watson [EMAIL PROTECTED]
--- apt-listchanges.orig/apt-listchanges.py 2007-06-18 22:20:05.000000000 +0100
+++ apt-listchanges/apt-listchanges.py 2007-07-04 04:06:40.000000000 +0100
@@ -34,7 +34,10 @@
sys.path += ['./apt-listchanges', '/usr/share/apt-listchanges']
import apt_listchanges, DebianFiles, ALCConfig
-locale.setlocale(locale.LC_ALL, '')
+try:
+ locale.setlocale(locale.LC_ALL, '')
+except locale.Error:
+ sys.stderr.write("Can't set locale; make sure $LC_* and $LANG are correct!\n")
def _(x):
try:
return gettext.translation('apt-listchanges').lgettext(x)