Unicode patch email rejected
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 35/100
Piste de recherche
Commencez par la commande de gestion parsemail et l’appel à parse_mail dans patchwork/parser.py:1191, puis suivez Patch.save dans models.py. Reproduisez l’échec signalé avec un e-mail Unicode et examinez comment le contenu du patch est stocké dans la base de données utilisant MySQL. C’est terminé lorsque le patch est analysé et stocké sans l’OperationalError signalé.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
This patch on libc-alpha did not appear in patchwork as it crashed during parsing:
https://sourceware.org/pipermail/libc-alpha/2022-October/142506.html
Here's the backtrace at the point of the crash:
Error when parsing incoming email: OperationalError(1366, "Incorrect string value: '\\xF0\\x91\\x82\\x80 0...' for column `patchwork`.`patchwork_patch`.`content` at row 1")
Traceback (most recent call last):
File "/path/to/patchwork/lib/python3/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/path/to/patchwork/lib/python3/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 73, in execute
return self.cursor.execute(query, args)
File "/path/to/patchwork/lib/python3/lib64/python3.6/site-packages/MySQLdb/cursors.py", line 206, in execute
res = self._query(query)
File "/path/to/patchwork/lib/python3/lib64/python3.6/site-packages/MySQLdb/cursors.py", line 319, in _query
db.query(q)
File "/path/to/patchwork/lib/python3/lib64/python3.6/site-packages/MySQLdb/connections.py", line 254, in query
_mysql.connection.query(self, query)
MySQLdb._exceptions.OperationalError: (1366, "Incorrect string value: '\\xF0\\x91\\x82\\x80 0...' for column `patchwork`.`patchwork_patch`.`content` at row 1")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/path/to/patchwork/patchwork.sourceware.org/patchwork/management/commands/parsemail.py", line 60, in handle
result = parse_mail(mail, options['list_id'])
File "/path/to/patchwork/patchwork.sourceware.org/patchwork/parser.py", line 1191, in parse_mail
state=find_state(mail),
File "/path/to/patchwork/lib/python3/lib/python3.6/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/path/to/patchwork/lib/python3/lib/python3.6/site-packages/django/db/models/query.py", line 447, in create
obj.save(force_insert=True, using=self.db)
File "/path/to/patchwork/patchwork.sourceware.org/patchwork/models.py", line 554, in save
super(Patch, self).save(**kwargs)
File "/path/to/patchwork/patchwork.sourceware.org/patchwork/models.py", line 385, in save
super(EmailMixin, self).save(*args, **kwargs)
File "/path/to/patchwork/lib/python3/lib/python3.6/site-packages/django/db/models/base.py", line 754, in save
force_update=force_update, update_fields=update_fields)
File "/path/to/patchwork/lib/python3/lib/python3.6/site-packages/django/db/models/base.py", line 792, in save_base
force_update, using, update_fields,
File "/path/to/patchwork/lib/python3/lib/python3.6/site-packages/django/db/models/base.py", line 895, in _save_table
results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw)
File "/path/to/patchwork/lib/python3/lib/python3.6/site-packages/django/db/models/base.py", line 935, in _do_insert
using=using, raw=raw,
File "/path/to/patchwork/lib/python3/lib/python3.6/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/path/to/patchwork/lib/python3/lib/python3.6/site-packages/django/db/models/query.py", line 1254, in _insert
return query.get_compiler(using=using).execute_sql(returning_fields)
File "/path/to/patchwork/lib/python3/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1397, in execute_sql
cursor.execute(sql, params)
File "/path/to/patchwork/lib/python3/lib/python3.6/site-packages/django/db/backends/utils.py", line 66, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/path/to/patchwork/lib/python3/lib/python3.6/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/path/to/patchwork/lib/python3/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/path/to/patchwork/lib/python3/lib/python3.6/site-packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/path/to/patchwork/lib/python3/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/path/to/patchwork/lib/python3/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 73, in execute
return self.cursor.execute(query, args)
File "/path/to/patchwork/lib/python3/lib64/python3.6/site-packages/MySQLdb/cursors.py", line 206, in execute
res = self._query(query)
File "/path/to/patchwork/lib/python3/lib64/python3.6/site-packages/MySQLdb/cursors.py", line 319, in _query
db.query(q)
File "/path/to/patchwork/lib/python3/lib64/python3.6/site-packages/MySQLdb/connections.py", line 254, in query
_mysql.connection.query(self, query)
django.db.utils.OperationalError: (1366, "Incorrect string value: '\\xF0\\x91\\x82\\x80 0...' for column `patchwork`.`patchwork_patch`.`content` at row 1")
The backtrace was attained using the following change to the sourceware instance, maybe something like this could be useful for general purpose logging too:
PYTHONPATH="${PATCHWORK_BASE}:${PATCHWORK_BASE}/lib/python:$PYTHONPATH" \
DJANGO_SETTINGS_MODULE="$DJANGO_SETTINGS_MODULE" \
- "$PW_PYTHON" "$PATCHWORK_BASE/manage.py" parsemail "$@"
+ "$PW_PYTHON" "$PATCHWORK_BASE/manage.py" parsemail \
+ "$@" >> $PATCHWORK_BASE/patchwork-mailstat.log 2>&1
# NOTE(stephenfin): We must return 0 here. When parsemail is used as a
# delivery command from a mail server like postfix (as it is intended
- Langage dominant
- Python
- Étoiles
- 317
- Forks
- 91
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de getpatchwork/patchwork
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
getpatchwork/patchwork#668 ·
-
bug web-ui
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
getpatchwork/patchwork#546 · 2 commentaires ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 52/100
getpatchwork/patchwork#664 ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
getpatchwork/patchwork#663 ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 45/100
getpatchwork/patchwork#645 ·
Toutes les issues de getpatchwork/patchwork
Issues similaires
-
Add: hunch Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
AbdelStark/awesome-typesafe#104 ·
-
enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
DiamondLightSource/dodal#2211 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
openml/openml-python#1749 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
sipyourdrink-ltd/bernstein#6191 ·