This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: gettext.py crash on bogus preamble
Type: Stage:
Components: Demos and Tools Versions: Python 2.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: barry Nosy List: barry
Priority: normal Keywords:

Created on 2002-12-24 15:45 by barry, last changed 2022-04-10 16:06 by admin. This issue is now closed.

Messages (1)
msg13681 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2002-12-24 15:45
If a .po file has the following bogus preamble:

msgid ""
msgstr ""
"Project-Id-Version: Mailman 2.1b6\n"
"POT-Creation-Date: Wed Dec 11 07:44:15 2002\n"
"PO-Revision-Date: 2002-08-14 01:18:58+00:00\n"
"Last-Translator: Ousmane Wilane <wilane@cyg.sn>\n"
"Pascal George <george@lyon.inserm.fr>\n"
"Language-Team: fr <traduc@traduc.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-15\n"
"Content-Transfer-Encoding: quoted-printable\n"
"Generated-By: pygettext.py 1.3\n"

(notice that Last-Translator has an unexpected second line)

then the resulting .mo file will crash Python when a
translation is looked up.  I got the following exception:

Traceback (most recent call last):
  File "bin/update", line 48, in ?
    from Mailman import MailList
  File "/usr/local/mailman/Mailman/MailList.py", line
49, in ?
    from Mailman.Archiver import Archiver
  File
"/usr/local/mailman/Mailman/Archiver/__init__.py", line
17, in ?
    from Archiver import *
  File
"/usr/local/mailman/Mailman/Archiver/Archiver.py", line
36, in ?
    from Mailman.i18n import _
  File "/usr/local/mailman/Mailman/i18n.py", line 52, in ?
    set_language()
  File "/usr/local/mailman/Mailman/i18n.py", line 35,
in set_language
    language)
  File "/usr/lib/python2.1/gettext.py", line 245, in
translation
    t = _translations.setdefault(key,
class_(open(mofile, 'rb')))
  File "/usr/lib/python2.1/gettext.py", line 106, in
__init__
    self._parse(fp)
  File "/usr/lib/python2.1/gettext.py", line 180, in _parse
    k, v = item.split(':', 1)
ValueError: unpack list of wrong size
make: *** [update] Erreur 1
History
Date User Action Args
2022-04-10 16:06:03adminsetgithub: 37641
2002-12-24 15:45:38barrycreate