Hi Sandro,
Le 02/01/2011 16:37, Sandro Tosi a écrit :
> Well, I'm not exactly sure why this is happening (it should have not)
> but could you try to apply the attached patch to /usr/bin/reportbug
> and try to replicate the problem?
>
I tried with the patch applied, and unfortunately it doesn't prevent the crash.
The final error message now ends with:
File "/usr/bin/reportbug", line 1733, in user_interface
conftext = conftext + u'%s %s\n' % (f, confinfo[f].encode('utf-8'))
AttributeError: 'exceptions.IOError' object has no attribute 'encode'
Which actually helped me understand the problem a bit better: the origin of the
offending 0xc3 byte is actually the error string "Permission non accordée"
("access denied" message with LANG=fr_FR.utf8) that occurs since the user runing
reportbug doesn't have access to one of munin-node configuration files.
Attached is a patch that works for me. I don't know Python, so I hope it's
correct. The way the charset is guessed is copied from line 504 of
/usr/bin/reportbug.
hth,
Manuel.
PS: the patch is against a file from python-reportbug, so maybe the bug should
be moved to this package. Up to you.
--- utils.py.ori 2011-01-06 01:25:15.000000000 +0100
+++ utils.py 2011-01-06 01:29:07.000000000 +0100
@@ -42,6 +42,7 @@
import rfc822
import socket
import subprocess
+import locale
from string import ascii_letters, digits
@@ -646,7 +647,10 @@
try:
fp = file(filename)
except IOError, msg:
- confinfo[filename] = msg
+ charset = locale.nl_langinfo(locale.CODESET)
+ if charset.lower() == 'ansi_x3.4-1968':
+ charset = 'us-ascii'
+ confinfo[filename] = unicode(str(msg), encoding=charset)
continue
filemd5 = commands.getoutput('md5sum ' + commands.mkarg(filename)).split()[0]
_______________________________________________
Reportbug-maint mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/reportbug-maint