Description

When macro names contain non-ASCII char MoinMoin will crash. e.g. <<über>>.

Such macro names almost always result from typos or unfamiliarity with wiki syntax, but shouldn't cause Moin to crash.

Steps to reproduce

  1. Write <<über>> in a page.

  2. Save.
  3. Get a 500 error.

Example

CheerXiao/bad-macro-name

Component selection

Details

MoinMoin Version

MoinMoin 1.9.7

OS and Version

CentOS 6.2

Python Version

2.7.5

Server Setup

uwsgi

Server Details

Language you are using the wiki in (set in the browser/UserPreferences)

English

Workaround

  1. Edit the page by appending action=edit

  2. Fix the macro that is causing the trouble.

Discussion

Interesting, thanks for finding that. Are you working on a fix?

CheerXiao:

I've found the guilty party:

  File "bug", line 11, in <module>

  File "/home/xiaq/src/moin1/MoinMoin/formatter/__init__.py", line 310, in macro
    return macro_obj.execute(name, args)
  File "/home/xiaq/src/moin1/MoinMoin/macro/__init__.py", line 113, in execute
    call = getattr(self, 'macro_%s' % macro_name)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 6: ordinal not in range(128)

Evidently one should 1) test whether macro_name is convertible to str before doing 'macro_%s' % macro_name, in case of UnicodeEncodeError 2) terminate macro expansion and output an error instead. But I'm not sure how to do 2).

CheerXiao:

OK, I know how to do 2) :). I'll follow how the except Exception does a bit later in the execute body.

CheerXiao:

CR: http://codereview.appspot.com/35360044

Plan


CategoryMoinMoinBugFixed

MoinMoin: MoinMoinBugs/NonAsciiInMacroName (last edited 2014-01-04 16:46:23 by ThomasWaldmann)