[MDEV-17609] mysql client sets wrong application name for Readline library Created: 2018-11-03  Updated: 2019-08-11  Resolved: 2019-08-11

Status: Closed
Project: MariaDB Server
Component/s: Server
Affects Version/s: 10.3
Fix Version/s: 10.3.18, 10.4.8

Type: Bug Priority: Major
Reporter: Aleksey Midenkov Assignee: Aleksey Midenkov
Resolution: Fixed Votes: 0
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");


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