4917: reviewboard fails when to accept review requests with non ascii tect in description

kofemann

What version are you running?

3.0.18

What steps will reproduce the problem?

  1. Posting with rbt post -p HEAD a commit where body as some greek text

What is the expected output? What do you see instead?

I see:

$ rbt post -p HEAD                                                                                                                                (git)-[fixes] 
ERROR: Error updating review request draft: HTTP 500

Your review request still exists, but the diff is not attached.

https://rb.dcache.org/r/12894/

What operating system are you using? What browser?

The server runs in a ubuntu:18.04 container with MariaDB

Please provide any additional information below.

On the server side:

Traceback (most recent call last):

  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 112, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)

  File "/usr/local/lib/python2.7/dist-packages/django/views/decorators/cache.py", line 52, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/django/views/decorators/vary.py", line 19, in inner_func
    response = func(*args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/djblets/webapi/resources/base.py", line 244, in __call__
    request, method, view, api_format=api_format, *args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/reviewboard/webapi/base.py", line 338, in call_method_view
    request, method, view, *args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/djblets/webapi/resources/mixins/api_tokens.py", line 66, in call_method_view
    request, method, view, *args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/djblets/webapi/resources/mixins/oauth2_tokens.py", line 102, in call_method_view
    request, method, view, *args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/djblets/webapi/resources/base.py", line 369, in call_method_view
    return view(request, *args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/djblets/webapi/resources/base.py", line 485, in put
    return self.update(request, *args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/djblets/webapi/decorators.py", line 125, in _call
    return view_func(*args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/reviewboard/webapi/decorators.py", line 169, in _check
    return view_func(*args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/djblets/webapi/decorators.py", line 125, in _call
    return view_func(*args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/djblets/webapi/decorators.py", line 146, in _checklogin
    return view_func(*args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/djblets/webapi/decorators.py", line 125, in _call
    return view_func(*args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/djblets/webapi/decorators.py", line 125, in _call
    return view_func(*args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/djblets/webapi/decorators.py", line 311, in _validate
    return view_func(*args, **new_kwargs)

  File "/usr/local/lib/python2.7/dist-packages/reviewboard/webapi/resources/review_request_draft.py", line 694, in update
    obj.save(update_fields=sorted(update_fields))

  File "/usr/local/lib/python2.7/dist-packages/reviewboard/reviews/models/base_review_request_details.py", line 241, in save
    super(BaseReviewRequestDetails, self).save(**kwargs)

  File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 545, in save
    force_update=force_update, update_fields=update_fields)

  File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 573, in save_base
    updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)

  File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 635, in _save_table
    forced_update)

  File "/usr/local/lib/python2.7/dist-packages/djblets/db/fields/counter_field.py", line 470, in _model_do_update
    base_qs, using, pk_val, values, update_fields, forced_update)

  File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 679, in _do_update
    return filtered._update(values) > 0

  File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 510, in _update
    return query.get_compiler(self.db).execute_sql(None)

  File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 980, in execute_sql
    cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)

  File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 786, in execute_sql
    cursor.execute(sql, params)

  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py", line 53, in execute
    return self.cursor.execute(sql, params)

  File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 99, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)

  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py", line 53, in execute
    return self.cursor.execute(sql, params)

  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 124, in execute
    return self.cursor.execute(query, args)

  File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 250, in execute
    self.errorhandler(self, exc, value)

  File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 50, in defaulterrorhandler
    raise errorvalue

OperationalError: (1366, "Incorrect string value: '\\xCE\\xA7\\xCE\\xAF\\xCE\\xBC...' for column `reviewboard`.`reviews_reviewrequestdraft`.`description` at row 1")


<WSGIRequest
path:/api/review-requests/12894/draft/,
GET:<QueryDict: {}>,
POST:<QueryDict: {u'description': [u'Motivation:\nHistorically, the namespace was called Himera, though the intend was\nChimera (\u03a7\u03af\u03bc\u03b1\u03b9\u03c1\u03b1), the monstrous fire-breathing creature composed of\nthe parts of more than one animal (to emphasise the multi-face nature).\nThe later changes have addressed the name mix, but not everywhere.\n\nModification:\nrename xxHimeraXX classes into xxChimeraXX.\n\nResult:\ncleaner naming convention\n\nAcked-by:\nTarget: master\nRequire-book: no\nRequire-notes: no'], u'target_groups': [u'all'], u'public': [u'True'], u'summary': [u'chimera: fix mix of Himera and Chimera in favor of the later one']}>,
COOKIES:{'rbsessionid': 'p60cp3lnof2hp9bn82x3tuxkoyvlpgc9'},
META:{'CONTENT_LENGTH': '942',
 'CONTENT_TYPE': 'multipart/form-data; boundary================1694779706458786214==',
 'HTTP_ACCEPT_ENCODING': 'identity',
 'HTTP_CONNECTION': 'close',
 'HTTP_COOKIE': 'rbsessionid=p60cp3lnof2hp9bn82x3tuxkoyvlpgc9',
 'HTTP_HOST': 'rb.dcache.org',
 'HTTP_USER_AGENT': "b'RBTools/2.0'",
 'HTTP_X_FORWARDED_FOR': '131.169.254.7',
 'HTTP_X_FORWARDED_PROTO': 'https',
 'HTTP_X_REAL_IP': '131.169.254.7',
 u'LOCAL_SITE': None,
 'PATH_INFO': u'/api/review-requests/12894/draft/',
 'QUERY_STRING': '',
 'REMOTE_ADDR': '10.88.0.1',
 'REMOTE_PORT': '11402',
 'REQUEST_METHOD': 'PUT',
 'REQUEST_URI': '/api/review-requests/12894/draft/',
 'SCRIPT_NAME': u'',
 'SERVER_NAME': 'rb-pod',
 'SERVER_PORT': '8000',
 'SERVER_PROTOCOL': 'HTTP/1.0',
 u'USERNAME': u'tigran',
 u'USER_EMAIL': u'tigran.mkrtchyan@desy.de',
 'UWSGI_ROUTER': 'http',
 'uwsgi.node': 'rb-pod',
 'uwsgi.version': '2.0.15-debian',
 'wsgi.errors': <open file 'wsgi_errors', mode 'w' at 0x7f977ff47780>,
 'wsgi.file_wrapper': <built-in function uwsgi_sendfile>,
 'wsgi.input': <uwsgi._Input object at 0x7f9772ab82b0>,
 'wsgi.multiprocess': True,
 'wsgi.multithread': False,
 'wsgi.run_once': False,
 'wsgi.url_scheme': u'https',
 'wsgi.version': (1, 0)}>