]> sipb.mit.edu Git - ikiwiki.git/blob - doc/bugs/crashes_in_the_python_proxy_even_if_disabled.mdwn
Merge branch 'master' of ssh://git.ikiwiki.info
[ikiwiki.git] / doc / bugs / crashes_in_the_python_proxy_even_if_disabled.mdwn
1 [[!template  id=gitbranch branch=anarcat/dev/proxy-utf8-fail author="[[anarcat]]"]]
2
3 ikiwiki 3.20130904.1~bpo70+1
4
5 rebuilding the whole wiki:
6
7 [[!format txt """
8 anarcat@marcos:ikiwiki*$ sudo ikisite changesetup wiki.anarc.at --rebuild
9 Subroutine import redefined at /usr/share/perl5/IkiWiki/Plugin/translinks.pm line 19.
10 Subroutine getsetup redefined at /usr/share/perl5/IkiWiki/Plugin/translinks.pm line 29.
11 Subroutine pagetemplate redefined at /usr/share/perl5/IkiWiki/Plugin/translinks.pm line 38.
12 Subroutine otherlanguagesloop redefined at /usr/share/perl5/IkiWiki/Plugin/translinks.pm line 51.
13 Use of uninitialized value $body in split at /usr/share/perl5/Text/MultiMarkdown.pm line 1131.
14 uncaught exception: 'ascii' codec can't encode character u'\xe9' in position 289: ordinal not in range(128)
15 Traceback (most recent call last):
16   File "/usr/lib/ikiwiki/plugins/proxy.py", line 309, in run
17     self._in_fd, self._out_fd)
18   File "/usr/lib/ikiwiki/plugins/proxy.py", line 192, in handle_rpc
19     ret = self._dispatcher.dispatch(method, params)
20   File "/usr/lib/ikiwiki/plugins/proxy.py", line 84, in dispatch
21     return self._dispatch(method, params)
22   File "/usr/lib/python2.7/SimpleXMLRPCServer.py", line 420, in _dispatch
23     return func(*params)
24   File "/usr/lib/ikiwiki/plugins/proxy.py", line 253, in hook_proxy
25     "{0} hook `{1}' returned: [{2}]".format(type, name, ret))
26 UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 289: ordinal not in range(128)
27
28 Traceback (most recent call last):
29   File "/usr/lib/ikiwiki/plugins/rst", line 86, in <module>
30     proxy.run()
31   File "/usr/lib/ikiwiki/plugins/proxy.py", line 317, in run
32     self.error('uncaught exception: {0}\n{1}'.format(e, tb))
33   File "/usr/lib/ikiwiki/plugins/proxy.py", line 298, in error
34     self.rpc('error', msg)
35   File "/usr/lib/ikiwiki/plugins/proxy.py", line 233, in rpc
36     *args, **kwargs)
37   File "/usr/lib/ikiwiki/plugins/proxy.py", line 173, in send_rpc
38     raise GoingDown()
39 proxy.py.GoingDown
40 error: ikiwiki failed
41 """]]
42
43 \xe9 is "é" in latin1, it may be the last letter of my name. no clue how it got there. suspecting this is related to the fix in [[bugs/proxy.py_utf8_troubles]], since this was not happening before the upgrade from squeeze. --[[anarcat]]
44
45 > Ooops... turns out the plugin *was* enabled, through the `rst` plugin. After disabling it, the crash is gone, but one page isn't rendered anymore:
46
47 >     removing art/histoireinternet/index.html, no longer built by art/histoireinternet.rst
48
49 > Here is that source file: http://anarc.at/art/histoireinternet.rst - and it seems encoded properly:
50 >
51 >     $ curl -s http://anarc.at/art/histoireinternet.rst | iconv -f utf8 -t latin1 | iconv -f latin1 -t utf8 > /dev/null
52 >     $
53
54 > So I am not sure what is going on here... --[[anarcat]]
55
56 >> Python is decoding what it receives from IkiWiki using the default `ascii`
57 >> codec. To match IkiWiki's "all source text is UTF-8" assumption, the
58 >> Python proxy should explicitly decode incoming text from bytes
59 >> (`str`) to `unicode` using the `utf8` codec instead.
60 >>
61 >> Python's conservative default is "`ascii`, regardless of locale" -
62 >> this minimizes the chance of silently incorrect decoding, but
63 >> unfortunately also maximizes the chance of crashing. --[[smcv]]
64
65 > > > Right, I know that. The trick is to find the rabbit hole. :P
66 > > > 
67 > > > And I found it. With my dev/proxy-utf8-fail, this doesn't fail anymore. Yay, a [[patch]] ready for commit! --[[anarcat]]
68
69 > > > > I don't see that branch in your git repo, could you repost it please?
70 > > > > (I'm trying to review some of the pending patches.) --[[smcv]]
71
72 >>>>> Ooops.. I forgot to push the branch, it should be good now! --[[anarcat]]