Package: apt-listchanges
Version: 2.74
Severity: normal
Tags: patch

If the locale settings are broken (which can happen e.g. in the process of
upgrading), apt-listchanges fails with the following backtrace:
  Traceback (most recent call last):
    File "/usr/bin/apt-listchanges", line 37, in <module>
      locale.setlocale(locale.LC_ALL, '')
    File "locale.py", line 476, in setlocale
      return _setlocale(category, locale)
  Error: unsupported locale setting

I think it makes more sense to gracefully ignore the broken locale
setup and just continue using the C locale.

The following patch/debdiff fixes this, by enclosing the locale.setlocale call
in a try/except block.

See https://bugs.launchpad.net/ubuntu/+source/apt-listchanges/+bug/91583
for the bug reported in Ubuntu.

-- System Information:
Debian Release: lenny/sid
  APT prefers gutsy
  APT policy: (500, 'gutsy'), (500, 'feisty-updates'), 
(500, 'feisty-security'), (500, 'feisty-proposed'), 
(500, 'feisty-backports'), (500, 'feisty')
Architecture: i386 (i686)

Kernel: Linux 2.6.22-7-generic (SMP w/1 CPU core)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages apt-listchanges depends on:
ii  apt                       0.7.2ubuntu3   Advanced front-end for dpkg
ii  debconf [debconf-2.0]     1.5.13ubuntu1  Debian configuration management 
sy
ii  debianutils               2.21           Miscellaneous utilities specific 
t
ii  python                    2.5.1-1ubuntu2 An interactive high-level 
object-o
ii  python-apt                0.7.2ubuntu2   Python interface to libapt-pkg
ii  python-support            0.6.4ubuntu1   automated rebuilding support for 
p
ii  ucf                       3.001          Update Configuration File: 
preserv

Versions of packages apt-listchanges recommends:
ii  postfix [mail-transport- 2.4.3-1ubuntu1  High-performance mail transport 
ag
ii  python-glade2            2.10.4-0ubuntu3 GTK+ bindings: Glade support
ii  python-gtk2              2.10.4-0ubuntu3 Python bindings for the GTK+ 
widge

-- debconf information:
* apt-listchanges/confirm: true
* apt-listchanges/email-address: root
* apt-listchanges/which: both
* apt-listchanges/frontend: pager
* apt-listchanges/save-seen: true
diff -Nru /tmp/FFA9SJ7sh0/apt-listchanges-2.74/apt-listchanges.py /tmp/ufMIm1sVtd/apt-listchanges-2.74/apt-listchanges.py
--- /tmp/FFA9SJ7sh0/apt-listchanges-2.74/apt-listchanges.py	2007-05-11 23:45:42.000000000 +0200
+++ /tmp/ufMIm1sVtd/apt-listchanges-2.74/apt-listchanges.py	2007-07-02 00:15:32.000000000 +0200
@@ -34,7 +34,11 @@
 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:
+	pass
+	
 def _(x):
     try:
         return gettext.translation('apt-listchanges').lgettext(x)
diff -Nru /tmp/FFA9SJ7sh0/apt-listchanges-2.74/debian/changelog /tmp/ufMIm1sVtd/apt-listchanges-2.74/debian/changelog
--- /tmp/FFA9SJ7sh0/apt-listchanges-2.74/debian/changelog	2007-06-18 16:22:47.000000000 +0200
+++ /tmp/ufMIm1sVtd/apt-listchanges-2.74/debian/changelog	2007-07-02 00:28:13.000000000 +0200
@@ -1,3 +1,11 @@
+apt-listchanges (2.74-0.1) unstable; urgency=low
+
+  * Non-maintainer upload
+  * Protect setlocale call in try/except block and ignore errors,
+    which may be caused by broken or incomplete locale setup (LP: #91583).
+
+ -- dAniel hAhler <[EMAIL PROTECTED]>  Mon, 02 Jul 2007 00:27:43 +0200
+
 apt-listchanges (2.74) unstable; urgency=low
 
   * binNMUs were not shown because we tracked source packages versions, and

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to