#10980 closed defect (fixed)
Loading the timeline causes a Genshi UnicodeDecodeError without trace.
Reported by: | Owned by: | Jun Omae | |
---|---|---|---|
Priority: | normal | Milestone: | 1.0.1 |
Component: | version control | Version: | 1.0-stable |
Severity: | normal | Keywords: | git |
Cc: | Branch: | ||
Release Notes: |
Fixed unicode errors with non-ascii branches and tags in git repository. |
||
API Changes: | |||
Internal Changes: |
Description
When I click the Timeline on my project I get displayed:
Genshi UnicodeDecodeError error while rendering template 'None'
I am a TRAC_ADMIN and do not get any backtrace.
The logfile isn't much useful neither;
2012-12-10 22:56:22,527 Trac[authz_policy] DEBUG: Checking BROWSER_VIEW on *:*@* 2012-12-10 22:56:22,533 Trac[authz_policy] DEBUG: Checking WIKI_VIEW on wiki:AssemblyInfo@* 2012-12-10 22:56:22,533 Trac[authz_policy] DEBUG: wiki:AssemblyInfo@* matched section wiki:*@* for user jeromepoulin 2012-12-10 22:56:22,533 Trac[authz_policy] DEBUG: Checking WIKI_VIEW on wiki:AssemblyInfo@* 2012-12-10 22:56:22,533 Trac[authz_policy] DEBUG: wiki:AssemblyInfo@* matched section wiki:*@* for user jeromepoulin 2012-12-10 22:56:22,535 Trac[authz_policy] DEBUG: Checking WIKI_CREATE on wiki:AssemblyInfo@* 2012-12-10 22:56:22,535 Trac[authz_policy] DEBUG: wiki:AssemblyInfo@* matched section wiki:*@* for user jeromepoulin 2012-12-10 22:56:22,536 Trac[authz_policy] DEBUG: Checking WIKI_CREATE on wiki:AssemblyInfo@* 2012-12-10 22:56:22,536 Trac[authz_policy] DEBUG: wiki:AssemblyInfo@* matched section wiki:*@* for user jeromepoulin 2012-12-10 22:56:22,577 Trac[main] WARNING: [2001:470:b010:1::10] HTTPInternalError: 500 Trac Error (Genshi UnicodeDecodeError error while rendering template 'None', line -1, char -1) 2012-12-10 22:56:23,163 Trac[env] INFO: Reloading environment due to configuration change 2012-12-10 22:56:23,179 Trac[env] INFO: -------------------------------- environment startup [Trac 1.0.1dev-r11480] -------------------------------- 2012-12-10 22:56:23,187 Trac[main] DEBUG: Dispatching <RequestWithSession "GET '/chrome/tracwysiwyg/wysiwyg-load.js'"> 2012-12-10 22:56:23,188 Trac[session] DEBUG: Retrieving session for ID 'jeromepoulin' 2012-12-10 22:56:23,199 Trac[loader] DEBUG: Loading datefield.filter from /usr/local/lib/python2.7/dist-packages/TracDateField-1.1.0_r12118-py2.7.egg 2012-12-10 22:56:23,208 Trac[loader] DEBUG: Loading ldapplugin.api from /var/trac/projects/cauca/plugins/LdapPlugin-0.7.0dev_r11019-py2.7.egg 2012-12-10 22:56:23,208 Trac[loader] DEBUG: Loading simplemultiproject from /var/trac/projects/cauca/plugins/SimpleMultiProject-0.0.3dev_r12068-py2.7.egg 2012-12-10 22:56:23,209 Trac[loader] DEBUG: Loading trac.about from /usr/local/lib/python2.7/dist-packages/Trac-1.0.1dev_r11480-py2.7.egg 2012-12-10 22:56:23,209 Trac[loader] DEBUG: Loading trac.admin.console from /usr/local/lib/python2.7/dist-packages/Trac-1.0.1dev_r11480-py2.7.egg 2012-12-10 22:56:23,209 Trac[loader] DEBUG: Loading trac.admin.web_ui from /usr/local/lib/python2.7/dist-packages/Trac-1.0.1dev_r11480-py2.7.egg 2012-12-10 22:56:23,209 Trac[loader] DEBUG: Loading trac.attachment from /usr/local/lib/python2.7/dist-packages/Trac-1.0.1dev_r11480-py2.7.egg 2012-12-10 22:56:23,209 Trac[loader] DEBUG: Loading trac.db.mysql from /usr/local/lib/python2.7/dist-packages/Trac-1.0.1dev_r11480-py2.7.egg 2012-12-10 22:56:23,209 Trac[loader] DEBUG: Loading trac.db.postgres from /usr/local/lib/python2.7/dist-packages/Trac-1.0.1dev_r11480-py2.7.egg 2012-12-10 22:56:23,210 Trac[loader] DEBUG: Loading trac.db.sqlite from /usr/local/lib/python2.7/dist-packages/Trac-1.0.1dev_r11480-py2.7.egg
Where can I look at to debug furthermore ?
Attachments (1)
Change History (12)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
The main problem is that I didn't get the stack trace at first, here I found that the "dispatcher" variable contain \xc3\xa9 utf-8 character from a git branch name.
I guess this should not crash but it does.
Code fragment:
Line 492 try: 493 if not env and env_error: 494 raise HTTPInternalError(env_error) 495 try: 496 dispatcher = RequestDispatcher(env) 497 dispatcher.dispatch(req) 498 except RequestDone: 499 pass 500 resp = req._response or [] 501 except HTTPException, e: 502 _send_user_error(req, env, e)
Local variables:
Name Value dispatcher <trac.web.main.RequestDispatcher object at 0x7f5a9ae99450> e UnicodeDecodeError('ascii', 'calcul_validation_coordonn\xc3\xa9', 26, 27, ... env <trac.env.Environment object at 0x7f5a9a0a6e90> env_error None req <RequestWithSession "GET '/timeline'"> resp []
comment:3 by , 12 years ago
It seems an InstallationIssue.
MySQL database must be configured with utf8 charset and utf8_bin collation. Please see MySqlDb and check the configuration.
comment:4 by , 12 years ago
This issue started as soon as someone published a GIT branch with a é in it.
The MySQL database has been setup according to the installation guide as well as Trac itself. All tables are utf8_bin.
This seems to be related to GIT or the GIT plugin, however trac.ini says git_fs_encoding = utf-8
There is also a problem in Trac as it does not display any backtrace when this error is encountered. This chunk of code is preventing a backtrace;
raise TracError(_("Genshi %(error)s error while rendering " "template %(location)s", error=e.__class__.__name__, location=location))
by , 12 years ago
Attachment: | t10980-unicode-branches-and-tags.diff added |
---|
comment:5 by , 12 years ago
Thanks for your investigation! I reproduced the original issue with unicode branches and tags. Would you please try t10980-unicode-branches-and-tags.diff?
(We should add the unit tests.)
Also, I'll look into the error while rendering later.
comment:6 by , 12 years ago
I confirm this patch fixes the problem, Thank you!
I didn't know where to look at in the code as it seems to take a bucket of data and dispatch it to multiple modules and I couldn't see the branch's name in the 'data' var.
comment:7 by , 12 years ago
Version: | 1.0dev → 1.0-stable |
---|
comment:1 indicates the user is running 1.0-stable, not 1.0dev.
comment:8 by , 12 years ago
Jun, you don't need the iter()
around the generator expressions. Parentheses are enough:
return ((self._fs_to_unicode(name), sha) for name, sha in self.rev_cache.branch_dict)
comment:9 by , 12 years ago
Component: | web frontend → version control |
---|---|
Keywords: | git added |
Milestone: | → 1.0.1 |
Release Notes: | modified (diff) |
Resolution: | → fixed |
Status: | new → closed |
Sure! I just committed the patch with your suggestions in [11482-11483]. Thanks.
comment:10 by , 12 years ago
Owner: | set to |
---|
comment:11 by , 12 years ago
Release Notes: | modified (diff) |
---|
I removed a raise to get more infos:
Trac detected an internal error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 26: ordinal not in range(128)
Most recent call last:
System Information:
Enabled Plugins: