Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-7677

my_charset_handler_filename has a wrong "ismbchar" member

    XMLWordPrintable

    Details

      Description

      In this definition in ctype-utf8.c:

      static MY_CHARSET_HANDLER my_charset_filename_handler=
      {
          NULL,               /* init */
          my_ismbchar_utf8,
          my_mbcharlen_utf8,  /* TODO: this is wrong */
          ...
      };

      using utf8 functions for "filename" looks wrong.
      It must have its own functions.
      This bug is about ismbchar() which has a simple repeatable SQL script.
      The problem with mbcharlen() is reported separately in MDEV-7819.

      Prove:

      SET NAMES utf8;
      SELECT @a:=CONVERT('aя' USING filename) AS `@a`, binary @a, reverse(@a), hex(@a), hex(reverse(@a));

      returns:

      +-----+-----------+-------------+----------+------------------+
      | @a  | binary @a | reverse(@a) | hex(@a)  | hex(reverse(@a)) |
      +-----+-----------+-------------+----------+------------------+
      | aя  | a@r1      | 1r?a        | 61407231 | 31724061         |
      +-----+-----------+-------------+----------+------------------+

      This is wrong. The expected result should be:
      'яa' for `reverse(@a)`
      '40723161' for `hex(reverse(@a))`.

        Attachments

          Activity

            People

            Assignee:
            bar Alexander Barkov
            Reporter:
            bar Alexander Barkov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration