tags 539736 confirmed
tags 539736 patch
thanks

Hi,

Le lundi 03 août 2009 à 15:05 +0200, Jakub Wilk a écrit :
> * Sandro Tosi <mo...@debian.org>, 2009-08-03, 14:19:
> >> I think you just terminated reportbug to early. (Sorry, my original report
> >> was not precise enough.)
> >
> >yeah, better to have to complete, full transcript ;) it seemed it
> >crashed right at the beginning
> >
> >> Could you try this non-interactive version?
> >
> >sure
> Thanks for you patience. :)
> 
> >> $ yes '' | PAGER=cat reportbug reportbug -s 'żółw' -O -o /dev/null
> >
> >$ yes '' | PAGER=cat reportbug reportbug -s 'żółw' -O -o /dev/null
> [snip]
> >(I removed some info not relevant here) except for the subject a bit
> >weird, it worked fine.
> That's really awkward: my investigation shown that the bug is triggered 
> only when gtk2 module is not present (which I intentionally disabled, as 
> you may recall).
> 

You were right Jakub, having the python-gtk2 package forces reportbug to
use utf-8 as default encoding. So Morph was not able to reproduce the
bug.

> Here is complete log from my clean sid chroot:
> 
> r...@pbuilder:/# apt-get install reportbug locales-all
> [snip]
> Setting up libssl0.9.8 (0.9.8k-3) ...
> Setting up libdb4.5 (4.5.20-13) ...
> Setting up libsqlite3-0 (3.6.16-1) ...
> Setting up mime-support (3.46-1) ...
> update-alternatives: using /usr/bin/see to provide /usr/bin/view (view) in 
> auto mode.
> Setting up python2.5-minimal (2.5.4-1) ...
> Setting up python2.5 (2.5.4-1) ...
> Setting up python-minimal (2.5.4-2) ...
> Setting up python (2.5.4-2) ...
> Setting up python-support (1.0.3) ...
> Setting up python-reportbug (4.5) ...
> Setting up reportbug (4.5) ...
> Setting up locales-all (2.9-23) ...
> Processing triggers for python-support ...
> r...@pbuilder:/# su - nobody
> No directory, logging in with HOME=/
> nob...@pbuilder:/$ export LC_CTYPE=pl_PL.utf8
> nob...@pbuilder:/$ reportbug reportbug -s `printf "\xc3\xb3"` -O --template
> Warning: no reportbug configuration found.  Proceeding in novice mode.
> Detected character set: UTF-8
> Please change your locale if this is incorrect.
> 
> Using 'nobody <nob...@pbuilder.jwilk.net>' as your from address.
> Getting status for reportbug...
> Maintainer for reportbug is 'Reportbug Maintainers 
> <reportbug-ma...@lists.alioth.debian.org>'.
> Looking up dependencies of reportbug...
> 
> Traceback (most recent call last):
>    File "/usr/bin/reportbug", line 1888, in <module>
>      main()
>    File "/usr/bin/reportbug", line 905, in main
>      return iface.user_interface()
>    File "/usr/bin/reportbug", line 1820, in user_interface
>      message = u"Subject: %s\n%s" % (subject, message)
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 0: 
> ordinal not in range(128)

If you don't have the python-gtk2  package, default encoding in
reportbug is ascii. So trying to mix an utf8 string and a ascii string
(with special caracter) will raise this exception.

Here is a patch to solve this issue, converting the ascii string to utf8
before using it.
> 
-- 
Carl Chenet


>From f138100d5c279f9cbd08b3d66b946b77b87a34ef Mon Sep 17 00:00:00 2001
From: chaica <cha...@ohmytux.com>
Date: Mon, 3 Aug 2009 20:01:20 +0200
Subject: [PATCH] convert ascii subject option to unicode

---
 bin/reportbug |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/bin/reportbug b/bin/reportbug
index 68f18d0..0930939 100755
--- a/bin/reportbug
+++ b/bin/reportbug
@@ -985,12 +985,15 @@ class UI(object):
         quietly = self.options.quietly
         severity = self.options.severity
         smtphost = self.options.smtphost
-        subject = self.options.subject
         bts = self.options.bts or 'debian'
         sysinfo = debianbts.SYSTEMS[bts]
         rtype = self.options.type or sysinfo.get('type')
         attachments = self.options.attachments
         pgp_addr = self.options.keyid
+        if not self.options.subject:
+            subject = self.options.subject
+        else:
+            subject = self.options.subject.decode(charset, 'replace')
 
         if self.options.body:
             body = textwrap.fill(self.options.body)
-- 
1.6.2.3

Reply via email to