[Maria-developers] Fwd: some question on bundled libedit in mysql
hi all: No reply from jonathan.perkin, so post to the maillist. can some one explain to me? Thanks! ---------- Forwarded message ---------- From: xiaobing jiang <s7v7nislands@gmail.com> Date: Fri, Feb 22, 2013 at 3:52 PM Subject: some question on bundled libedit in mysql To: jonathan.perkin@oracle.com hi jonathan: after read the README in source, I have some question about libedit. in recently, we find a bug. when using bundled libedit, we can't input the chinese using GBK. after debug, I find this code may be cause the bug. protected int terminal__putc(EditLine *el, Int c) { char buf[MB_LEN_MAX +1]; ssize_t i; mbstate_t state; memset(&state, 0, sizeof(mbstate_t)); if (c == (Int)MB_FILL_CHAR) return 0; i = ct_encode_char(buf, (size_t)MB_CUR_MAX, c, &state); // this should be: ct_encode_char(buf, (size_t)MB_LEN_MAX, c, &state); if (i <= 0) return (int)i; buf[i] = '\0'; return fputs(buf, el->el_outfile); } after change the code, I can fix the bug. and I find upstream also using MB_LEN_MAX. http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libedit/terminal.c protected int terminal__putc(EditLine *el, Int c) { char buf[MB_LEN_MAX +1]; ssize_t i; if (c == (Int)MB_FILL_CHAR) return 0; i = ct_encode_char(buf, (size_t)MB_LEN_MAX, c); if (i <= 0) return (int)i; buf[i] = '\0'; return fputs(buf, el->el_outfile); } so the merge from upstream may be wrong. And this bug may be the same http://bugs.mysql.com/bug.php?id=23097 and why mysql5.6 remove the bundled readline? I think readline is used more than libedit. and when using system readline, why perfer libedit to readline ? look at cmake/readline.cmake. FIND_SYSTEM_LIBEDIT(edit) -> FIND_SYSTEM_LIBEDIT(readline) thanks! xiaobing jiang
Hi, xiaobing! On Feb 25, xiaobing jiang wrote:
and why mysql5.6 remove the bundled readline? I think readline is used more than libedit. and when using system readline, why perfer libedit to readline ? look at cmake/readline.cmake. FIND_SYSTEM_LIBEDIT(edit) -> FIND_SYSTEM_LIBEDIT(readline)
For legal reasons. readline is GPL. libedit is BSD. MySQL can be built as non-GPL binary, so it cannot be linked with GPL library in these builds. Apparently, MySQL developers didn't want to maintain different linking preferences for GPL and non-GPL builds. In MariaDB we prefer to link with readline. We never link with bundled libedit at all. Either with system readline, if it's usable, or with system libedit, or with bundled readline. Regards, Sergei
participants (2)
-
Sergei Golubchik
-
xiaobing jiang