[MDEV-30062] Remove unnecessary delimiter from query for mariadb-client shortcut command Created: 2022-11-21  Updated: 2022-11-28

Status: In Review
Project: MariaDB Server
Component/s: Scripts & Clients
Affects Version/s: 10.3
Fix Version/s: 10.3

Type: Bug Priority: Major
Reporter: Anel Husakovic Assignee: Vicențiu Ciorbaru
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-12192 Shell-style alias/unalias commands fo... In Review

 Description   

When comparing the string query when processing command name and it's shortcut form, one can obtain the delimiter at the end of the string. This is not needed and we can remove it in order to expect the same format of query/string to be processed by `com_*()` functions and this is now not the case.
-Example

  • Shortcut with delimiter

    MariaDB [(none)]> \h;
     
    Breakpoint 1, com_help (buffer=0x5555555b476b <find_command(char)+297>, line=0x7fffffffd990 "\220\332\377\377\377\177") at /home/anel/GitHub/mariadb/server/src/10.3/client/mysql.cc:3145
    3145	{
    (gdb) p line
    +p line
    $2 = 0x555555a3dfc0 "\\h;"
    

  • Shortcut without delimiter

    MariaDB [(none)]> \h
     
    Breakpoint 1, com_help (buffer=0x5555555b476b <find_command(char)+297>, line=0x7fffffffd990 "\220\332\377\377\377\177") at /home/anel/GitHub/mariadb/server/src/10.3/client/mysql.cc:3145
    3145	{
    (gdb) n
    +n
    3147	  char * help_arg= strchr(line,' '), buff[32], *end;
    (gdb) p line
    +p line
    $3 = 0x555555a3e5b0 "\\h"
    

  • Verbose command

    MariaDB [(none)]> help;
     
    Breakpoint 1, com_help (buffer=0x5555559f8b98, line=0x555555a3dfc4 ";") at /home/anel/GitHub/mariadb/server/src/10.3/client/mysql.cc:3145
    3145	{
    (gdb) n
    +n
    3147	  char * help_arg= strchr(line,' '), buff[32], *end;
    (gdb) p line
    +p line
    $5 = 0x5555559f8b98 "help"
    

Why is this needed?
MDEV-12192 is parsing the key/value for alias handling, so we need to have deterministic behavior for verbose command alias as well as abbreviation \a.


Generated at Thu Feb 08 10:13:21 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.