[MDEV-25400] Error message including Unicode changed on MariaDB 10.5 Created: 2021-04-13  Updated: 2021-05-07  Resolved: 2021-04-19

Status: Closed
Project: MariaDB Server
Component/s: Character Sets
Affects Version/s: 10.5.9
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Jun Aruga Assignee: Sergei Golubchik
Resolution: Not a Bug Votes: 0
Labels: None
Environment:
  • Fedora 35
  • MariaDB 10.5.9, RPM package: mariadb-server-10.5.9-5.fc35.x86_64
  • mariadb-connector-c: 3.1.12, mariadb-connector-c-3.1.12-1.fc35.x86_64
  • MacOSX 10.15.7
  • MariaDB 10.5.9, Brew package "brew info mariadb" mariadb: stable 10.5.9 (bottled)
  • Ubuntu focal
  • MariaDB 10.5.9, mariadb:10.5-focal container image at https://hub.docker.com/_/mariadb .


 Description   

On the MariaDB 10.5, call the function mysql_send_query with the query "\345\306}\037" to test the error message from the MariaDB server.

523	  rv = mysql_send_query(args->mysql, args->sql_ptr, args->sql_len);
(gdb) i lo
args = 0x7fffffffd980
rv = 32767
(gdb) p *args
$1 = {mysql = 0x5555559e6060, sql = 93824997035680, sql_ptr = 0x5555559e8eb0 "\345\306}\037", 
  sql_len = 4, wrapper = 0x555555907900}

and call the function mysql_read_query_result.

 my_bool res = mysql_read_query_result(client); 

And the result is here.

(gdb) p res
$2 = 1 '\001'
(gdb) p (*client).net.last_error
$3 = "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '??}\\001F' at line 1", '\000' <repeats 355 times>

On the MariaDB 10.5 The error message is

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '??}\\001F' at line 1

But on MariaDB <= 10.4 the error message is

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '??}\u001F' at line 1

On MariaDB 10.5,

\\001F

vs

On MariaDB <= 10.4,

\u001F

Did you change something on MariaDB about the error message? Is it a specification or bug?

Here is the context. We found the issue on MariaDB Ruby binding.
https://github.com/brianmario/mysql2/issues/1152#issuecomment-818463242

Thank you.



 Comments   
Comment by Jun Aruga [ 2021-04-14 ]

I compared the result of character sets between the MariaDB servers.

Updated: I removed the comparison by the mysql client command's status. It is not really related to this issue.

I call the case showing

\\001F

as "Double backslash case", as it's hard to write the actual code on the JIRA ticket, as it was converted on JIRA.

And I call the case showing

\u001F

as "Backslash u case".

The result is what I got by the MariaDB C API and by a SQL SELECT SCHEMA_NAME, DEFAULT_CHARACTER_SET_NAME, DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA.

Double backslash case

Fedora 35 MariaDB 10.5.9 RPM package + mariadb-connector-c: 3.1.12 RPM package

As I reported, it happens on the Fedora 35 MariaDB 10.5.9 RPM package + mariadb-connector-c: 3.1.12 RPM package. Here is the result.

Client info: {:id=>100505, :version=>"10.5.5", :header_version=>"10.5.5"}
Client encoding: UTF-8
Server info: {:id=>100509, :version=>"10.5.9-MariaDB"}
{"SCHEMA_NAME"=>"information_schema", "DEFAULT_CHARACTER_SET_NAME"=>"utf8", "DEFAULT_COLLATION_NAME"=>"utf8_general_ci"}
{"SCHEMA_NAME"=>"mysql", "DEFAULT_CHARACTER_SET_NAME"=>"latin1", "DEFAULT_COLLATION_NAME"=>"latin1_swedish_ci"}
{"SCHEMA_NAME"=>"test", "DEFAULT_CHARACTER_SET_NAME"=>"latin1", "DEFAULT_COLLATION_NAME"=>"latin1_swedish_ci"}
{"SCHEMA_NAME"=>"performance_schema", "DEFAULT_CHARACTER_SET_NAME"=>"utf8", "DEFAULT_COLLATION_NAME"=>"utf8_general_ci"}

MacOSX 10.15.7, MariaDB 10.5.9, Brew package

As I reported, it happens on the MacOSX 10.15.7, MariaDB 10.5.9, Brew package. Here is the result

Client info: {:id=>100509, :version=>"10.5.9", :header_version=>"10.5.9"}
Client encoding: UTF-8
Server info: {:id=>100509, :version=>"10.5.9-MariaDB"}
{"SCHEMA_NAME"=>"information_schema", "DEFAULT_CHARACTER_SET_NAME"=>"utf8", "DEFAULT_COLLATION_NAME"=>"utf8_general_ci"}
{"SCHEMA_NAME"=>"test", "DEFAULT_CHARACTER_SET_NAME"=>"latin1", "DEFAULT_COLLATION_NAME"=>"latin1_swedish_ci"}
{"SCHEMA_NAME"=>"mysql", "DEFAULT_CHARACTER_SET_NAME"=>"utf8mb4", "DEFAULT_COLLATION_NAME"=>"utf8mb4_general_ci"}
{"SCHEMA_NAME"=>"performance_schema", "DEFAULT_CHARACTER_SET_NAME"=>"utf8", "DEFAULT_COLLATION_NAME"=>"utf8_general_ci"}

MariaDB 10.5 official container image (Ubuntu focal) mariadb:10.5-focal

I noticed this issue also happens on the MariaDB 10.5 on Ubuntu by using MariaDB official container's mariadb:10.5-focal image. : https://hub.docker.com/_/mariadb . I misunderstand it was the "backslash u" case previously.

Client info: {:id=>100505, :version=>"10.5.5", :header_version=>"10.5.5"}
Client encoding: UTF-8
Server info: {:id=>100509, :version=>"10.5.9-MariaDB-1:10.5.9+maria~focal"}
{"SCHEMA_NAME"=>"information_schema", "DEFAULT_CHARACTER_SET_NAME"=>"utf8", "DEFAULT_COLLATION_NAME"=>"utf8_general_ci"}
{"SCHEMA_NAME"=>"mysql", "DEFAULT_CHARACTER_SET_NAME"=>"utf8mb4", "DEFAULT_COLLATION_NAME"=>"utf8mb4_general_ci"}
{"SCHEMA_NAME"=>"test", "DEFAULT_CHARACTER_SET_NAME"=>"utf8mb4", "DEFAULT_COLLATION_NAME"=>"utf8mb4_general_ci"}
{"SCHEMA_NAME"=>"performance_schema", "DEFAULT_CHARACTER_SET_NAME"=>"utf8", "DEFAULT_COLLATION_NAME"=>"utf8_general_ci"}

Backslash u case

Fedora 33 MariaDB 10.4.18 RPM package + mariadb-connector-c: 3.1.12 RPM package

It happens on the MariaDB 10.4.18 on Fedora 34. Here is the result.

Client info: {:id=>100505, :version=>"10.5.5", :header_version=>"10.5.5"}
Client encoding: UTF-8
Server info: {:id=>100418, :version=>"10.4.18-MariaDB"}
{"SCHEMA_NAME"=>"information_schema", "DEFAULT_CHARACTER_SET_NAME"=>"utf8", "DEFAULT_COLLATION_NAME"=>"utf8_general_ci"}
{"SCHEMA_NAME"=>"mysql", "DEFAULT_CHARACTER_SET_NAME"=>"latin1", "DEFAULT_COLLATION_NAME"=>"latin1_swedish_ci"}
{"SCHEMA_NAME"=>"test", "DEFAULT_CHARACTER_SET_NAME"=>"latin1", "DEFAULT_COLLATION_NAME"=>"latin1_swedish_ci"}
{"SCHEMA_NAME"=>"performance_schema", "DEFAULT_CHARACTER_SET_NAME"=>"utf8", "DEFAULT_COLLATION_NAME"=>"utf8_general_ci"}

I assume this issue happens on MariaDB 10.5, and does not happen on MariaDB 10.4.
The character sets might be not related to this issue.

Comment by Sergei Golubchik [ 2021-04-19 ]

yes, intentional. Note that \u001F in gdb output is one character, your \037.
In 10.5 gdb output shows \​\001F — this is a 5-character string.

That is, before 10.5 error messages included unreadable control characters verbatim into the error message. In 10.5 they're encoded to keep the error message readable. This was MDEV-8844

Comment by Jun Aruga [ 2021-05-07 ]

Okay. Thanks for the answer!

Generated at Thu Feb 08 09:37:24 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.