Received: from mx1.karlstorz.com (mx1.karlstorz.com [62.134.46.135]) by mx.groups.io with SMTP id smtpd.web12.34030.1605531418798304243 for ; Mon, 16 Nov 2020 04:56:59 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=SPF record not found (domain: karlstorz.com, ip: 62.134.46.135, mailfrom: holger.sebert.ext@karlstorz.com) IronPort-SDR: tDgj4j7Lk4nCI4Eov/UN2mT4vYyqe/ECspzOwcjpAkCDh8S+d03UytY8PqPOfi3/hrbek2tVao fMF9ISAWrDlBypONKG6Ny0QMBtlwhhi3mh8oNEsAJ05pyJ1TaEYGanJ0Gt5YlDI5AupA9TUf7C H0iKRvUZ8xJ5ADjRYJ0IHghKalz8K1UBgjoUIqYB6pk4wkX+UeuTCOubBCmSbpNp93xLC6fYk4 9hlUWOhoovRmBcdPGkivQdpWyXbM3wFkN/MbhtM9kFkQl/iozrhMsUIU+f254GMydtNrDbETk/ hIw= X-IronPort-AV: E=Sophos;i="5.77,482,1596492000"; d="scan'208";a="39183231" Received: from tut-ex17-pv.kstg.corp ([10.0.10.196]) by mx1.karlstorz.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 16 Nov 2020 13:56:54 +0100 Received: from TUT-EX14-PV.KSTG.corp (10.0.10.193) by TUT-EX17-PV.KSTG.corp (10.0.10.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Mon, 16 Nov 2020 13:56:53 +0100 Received: from TUT-EX14-PV.KSTG.corp ([10.0.10.193]) by TUT-EX14-PV.KSTG.corp ([10.0.10.193]) with mapi id 15.01.2106.002; Mon, 16 Nov 2020 13:56:53 +0100 From: holger.sebert.ext@karlstorz.com To: "toaster@lists.yoctoproject.org" Subject: Database erros due to UTF-8 filenames Thread-Topic: Database erros due to UTF-8 filenames Thread-Index: AQHWvBej5tbm93Zq906JGmCT2/S+Ew== Date: Mon, 16 Nov 2020 12:56:53 +0000 Message-ID: Accept-Language: de-DE, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.0.10.41] x-kse-serverinfo: TUT-EX17-PV.KSTG.corp, 9 x-kse-antivirus-interceptor-info: scan successful x-kse-antivirus-info: Clean, bases: 16.11.2020 10:25:00 x-kse-attachment-filter-triggered-rules: Clean x-kse-attachment-filter-triggered-filters: Clean x-kse-bulkmessagesfiltering-scan-result: protection disabled MIME-Version: 1.0 Content-Language: de-DE Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable Hi, I've setup Toaster and a MySQL docker container, all running on Ubuntu 16.0= 4. I am encountering the following database error, when building my Yocto proj= ect: ERROR: (1366, "Incorrect string value: '\\xC5\\x91tan\\xC3...' for column = 'path' at row 1") Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/django/db/backends/utils.py= ", line 84, in _execute return self.cursor.execute(sql, params) File "/usr/local/lib/python3.7/dist-packages/django/db/backends/mysql/ba= se.py", line 71, in execute return self.cursor.execute(query, args) File "/usr/local/lib/python3.7/dist-packages/MySQLdb/cursors.py", line 2= 06, in execute res =3D self._query(query) File "/usr/local/lib/python3.7/dist-packages/MySQLdb/cursors.py", line 3= 19, in _query db.query(q) File "/usr/local/lib/python3.7/dist-packages/MySQLdb/connections.py", li= ne 260, in query _mysql.connection.query(self, query) MySQLdb._exceptions.OperationalError: (1366, "Incorrect string value: '\\x= C5\\x91tan\\xC3...' for column 'path' at row 1") The query that raised this error looks as follows: INSERT INTO `orm_target_file` (`target_id`, `path`, `size`, `inodetype`, `permission`, `owner`, `group`, `directory_id`, `sym_target_id`) VALUES (19, '/usr/share/ca-certificates/mozilla/NetLock_Arany_=3DClass_Gold=3D_F\xc5\= x91tan\xc3\xbas\xc3\xadtv\xc3\xa1ny.crt', 1476, 1, 'rw-r--r--', 'root', 'root', NULL, NULL) The file causing this error has the following UTF-8 encoded filename: NetLock_Arany_=3DClass_Gold=3D_F=F5tan=FAs=EDtv=E1ny.crt When looking into the database I found out that the column `path` of table `orm_target_file` has the following properties: CHARACTER_SET_NAME: latin1 COLLATION_NAME: latin1_swedish_ci Apperently, the column `path` is not ready for UTF-8 strings. I can fix tha= t manually by doing the following mysql command using the `mysql` tool: ALTER TABLE orm_target_file CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; This change makes the database error disappear. I would like to fix that directly in Toasters's `orm/models.py`. I found th= e following definition in class `Target_File`: path =3D models.FilePathField() It seems like I need to pass some clever options to `FilePathField`, but wh= ich? My own research in that direction has brought up nothing useful so far. My questions are thus: * How can I parametrize `FilePathField` to properly handle UTF-8 encoded filenames in the underlying database? * How should a correspondig migration file look like in `orm/migrations`? Thanks! Best, Holger