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

mysql client sets wrong application name for Readline library

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.3
    • Fix Version/s: 10.3.18, 10.4.8
    • Component/s: Server
    • Labels:
      None

      Description

      initialize_readline() is called with full pathname of executable which sets rl_readline_name to that value:

      Breakpoint 1, initialize_readline (name=0x7fffffffc3be "/home/midenok/src/mariadb/trunk/opt/bin/mysql") at /home/midenok/src/mariadb/trunk/src/client/mysql.cc:2673
      2673      rl_readline_name = name;
      (gdb) bt
      #0  initialize_readline (name=0x7fffffffc3be "/home/midenok/src/mariadb/trunk/opt/bin/mysql") at /home/midenok/src/mariadb/trunk/src/client/mysql.cc:2673
      #1  0x0000000000417e50 in main (argc=1, argv=0xa15250) at /home/midenok/src/mariadb/trunk/src/client/mysql.cc:1243
      

      It is expected that rl_readline_name is initialized with static name not depending on the file name at all. This is needed for setting custom hotkeys in .inputrc, like:

      $if mysql
      "\033OP": "nopager\n"
      "\033OQ": "pager most\n"
      "\033OR": "pager pt-visual-explain\n"
      "\033OS": "pager most\nshow table status;\n"
      $endif
      

      Example from GDB code:

         2023   /* Setup important stuff for command line editing.  */
         2024   rl_completion_word_break_hook = gdb_completion_word_break_characters;
         2025   rl_completion_entry_function = readline_line_completion_function;
         2026   set_rl_completer_word_break_characters (default_word_break_characters ());
         2027   rl_completer_quote_characters = get_gdb_completer_quote_characters ();
         2028   rl_completion_display_matches_hook = cli_display_match_list;
         2029   rl_readline_name = "gdb";
         2030   rl_terminal_name = getenv ("TERM");
      

        Attachments

          Activity

            People

            • Assignee:
              midenok Aleksey Midenkov
              Reporter:
              midenok Aleksey Midenkov
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: